Commits

Bjoern Michaelsen  committed 0f76c22

swbookmarkfixes01: more PageDescManager testing

  • Participants
  • Parent commits 316426a

Comments (0)

Files changed (19)

File sw/inc/IDocumentFormatAccess.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef IDOCUMENTFORMATACCESS_HXX_INCLUDED
+#define IDOCUMENTFORMATACCESS_HXX_INCLUDED
+
+class SwFrmFmt;
+class SwCharFmt;
+
+namespace sw { namespace format
+{
+    class IDocumentFormatAccess
+    {
+        public:
+            virtual const SwFrmFmt* GetDfltFrmFmt() const =0;
+            virtual SwFrmFmt* GetDfltFrmFmt() =0;
+            virtual const SwFrmFmt* GetEmptyPageFmt() const =0;
+            virtual SwFrmFmt* GetEmptyPageFmt() =0;
+            virtual const SwFrmFmt* GetColumnContFmt() const =0;
+            virtual SwFrmFmt* GetColumnContFmt() =0;
+            virtual const SwCharFmt* GetDfltCharFmt() const =0;
+            virtual SwCharFmt* GetDfltCharFmt() =0;
+            virtual ~IDocumentFormatAccess() {};
+    };
+}}
+#endif

File sw/inc/IDocumentPageDescAccess.hxx

 class SwPageDesc;
 class SwFrmFmt;
 class String;
+class SfxListener;
 
 namespace sw { namespace pagedesc
 {
                 ForEach_Impl(static_cast<foreach_functor_type>(::boost::bind(&T::operator(), &f, _1)));
                 return f;
             }
+
+            // Broadcast and Listener 
+            virtual bool AddListener( SfxListener& rListener ) =0;
+            virtual bool RemoveListener( SfxListener& rListener ) =0;
+
             virtual ~IDocumentPageDescAccess() {};
         private:
             virtual void ForEach_Impl(foreach_functor_type f) =0;

File sw/inc/StyleOperationHint.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _STYLEOPERATIONHINT_HXX
+#define _STYLEOPERATIONHINT_HXX
+
+#include <svl/hint.hxx>
+#include <tools/string.hxx>
+#include <rsc/rscsfx.hxx>
+#include <sal/types.h>
+
+namespace sw { namespace style {
+
+class StyleOperationHint : public SfxHint
+{
+    public:
+        StyleOperationHint(String rName, SfxStyleFamily eFamily, sal_Int32 nOp)
+            : m_rName(rName)
+            , m_eFamily(eFamily)
+            , m_nOp(nOp)
+        {};
+        const String& GetName() const { return m_rName; };
+        SfxStyleFamily GetStyleFamily() const { return m_eFamily; };
+        sal_Int32 GetOp() const { return m_nOp; };
+    private:
+        const String m_rName;
+        const SfxStyleFamily m_eFamily;
+        const sal_Int32 m_nOp;
+};
+
+}}
+#endif

File sw/inc/SwUndoPageDesc.hxx

 {
     const SwPageDesc * pDesc; // #116530#
     SwPageDescExt aNew;
-    SwDoc * pDoc;
+    IDocumentUndoRedo* pDoc;
 
 public:
-    SwUndoPageDescCreate(const SwPageDesc * pNew, SwDoc * pDoc); // #116530#
+    SwUndoPageDescCreate(const SwPageDesc * pNew, IDocumentUndoRedo* pDoc); // #116530#
     virtual ~SwUndoPageDescCreate();
 
     virtual void Undo(SwUndoIter & rIt);
 class SwUndoPageDescDelete : public SwUndo
 {
     SwPageDescExt aOld;
-    SwDoc * pDoc;
+    IDocumentUndoRedo* pDoc;
 
 public:
-    SwUndoPageDescDelete(const SwPageDesc & aOld, SwDoc * pDoc);
+    SwUndoPageDescDelete(const SwPageDesc & aOld, IDocumentUndoRedo* pDoc);
     virtual ~SwUndoPageDescDelete();
 
     virtual void Undo(SwUndoIter & rIt);

File sw/inc/doc.hxx

 #include <IDocumentListsAccess.hxx>
 class SwList;
 // <--
+#include <IDocumentFormatAccess.hxx>
 #include <IDocumentExternalData.hxx>
 #define _SVSTDARR_STRINGSDTOR
 #include <svl/svstdarr.hxx>
 class SwRenderData;
 class SwPageFrm;
 class SwViewOption;
+class SfxBroadcaster;
 
 namespace sw {
     namespace mark {
     // --> OD 2008-03-12 #refactorlists#
     public IDocumentListsAccess,
     // <--
-    public IDocumentExternalData
+    public IDocumentExternalData,
+    public ::sw::format::IDocumentFormatAccess
 {
 
 	friend void _InitCore();
     const ::boost::scoped_ptr< ::sw::mark::MarkManager > m_pMarkManager;
     const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
     const ::boost::scoped_ptr< ::sw::pagedesc::PageDescManager > m_pPageDescManager;
+    const ::boost::scoped_ptr< SfxBroadcaster > m_pStyleOperationBroadcaster;
 
 	// -------------------------------------------------------------------
 	// die Pointer
 						FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt );
 	void CopyFmtArr( const SvPtrarr& rSourceArr, SvPtrarr& rDestArr,
 						FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt );
-    void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
-								const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt );
 	SwFmt* FindFmtByName( const SvPtrarr& rFmtArr,
 									const String& rName ) const;
 
 	/* LayoutFormate (Rahmen, DrawObjecte), mal const mal nicht */
 	const SwSpzFrmFmts* GetSpzFrmFmts() const	{ return pSpzFrmFmtTbl; }
 		  SwSpzFrmFmts* GetSpzFrmFmts() 		{ return pSpzFrmFmtTbl; }
-
-	const SwFrmFmt *GetDfltFrmFmt() const	{ return pDfltFrmFmt; }
-		  SwFrmFmt *GetDfltFrmFmt() 		{ return pDfltFrmFmt; }
-	const SwFrmFmt *GetEmptyPageFmt() const { return pEmptyPageFmt; }
-		  SwFrmFmt *GetEmptyPageFmt()		{ return pEmptyPageFmt; }
-	const SwFrmFmt *GetColumnContFmt() const{ return pColumnContFmt; }
-		  SwFrmFmt *GetColumnContFmt()		{ return pColumnContFmt; }
-	const SwCharFmt *GetDfltCharFmt() const { return pDfltCharFmt;}
-		  SwCharFmt *GetDfltCharFmt()		{ return pDfltCharFmt;}
+    // IDocumentFormatAccess
+    IDocumentFormatAccess* getIDocumentFormatAccess() { return this; }
+    const IDocumentFormatAccess* getIDocumentFormatAccess() const { return this; }
+	virtual const SwFrmFmt* GetDfltFrmFmt() const	{ return pDfltFrmFmt; }
+	virtual	SwFrmFmt* GetDfltFrmFmt() 		{ return pDfltFrmFmt; }
+	virtual const SwFrmFmt* GetEmptyPageFmt() const { return pEmptyPageFmt; }
+	virtual SwFrmFmt* GetEmptyPageFmt()		{ return pEmptyPageFmt; }
+	virtual const SwFrmFmt* GetColumnContFmt() const{ return pColumnContFmt; }
+	virtual SwFrmFmt* GetColumnContFmt()		{ return pColumnContFmt; }
+	virtual const SwCharFmt* GetDfltCharFmt() const { return pDfltCharFmt;}
+	virtual  SwCharFmt* GetDfltCharFmt()		{ return pDfltCharFmt;}
 
     // Returns the interface of the management of (auto)styles
     IStyleAccess& GetIStyleAccess() { return *pStyleAccess; }
     //fuer Reader
     virtual void ChgPageDesc(SwPageDesc* pDesc, const SwPageDesc&);
 
-    void BroadcastStyleOperation(String rName, SfxStyleFamily eFamily, USHORT nOp);
+    // this should be moved into an apporpriate interface for style access
+    SfxBroadcaster* getStyleOperationBroadcaster()
+        { return m_pStyleOperationBroadcaster.get(); }
 
 		// Methoden fuer die Verzeichnisse:
 		// - Verzeichnismarke einfuegen loeschen travel

File sw/inc/pagedesc.hxx

 
 	SW_DLLPRIVATE void ResetAllAttr( sal_Bool bLeft );
 
-	SW_DLLPRIVATE SwPageDesc(const String& rName, SwDoc* const pDoc, SvxFrameDirection aFrameDirection);
-	SW_DLLPRIVATE SwPageDesc(const String&, SwFrmFmt*, SwDoc* const);
+	SW_DLLPRIVATE SwPageDesc(const String&, SwFrmFmt*, SwAttrPool*, SvxFrameDirection);
+	SW_DLLPRIVATE SwPageDesc(const String&, SwFrmFmt*, SwAttrPool*);
 
 public:
     // copy the complete PageDesc -- even with different docs and "deep"

File sw/qa/core/PageDescManager/PageDescManagerTest.cxx

         SwClient* Next();
 };
 
-#define _DOC_HXX
-class SwUndo;
-class SwRootFrm;
-class SwFrmFmt;
-class SwDoc
+#define _SWATRSET_HXX
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+
+class IDocumentSettingAccess;
+class OutputDevice;
+class SfxBoolItem;
+class SvxAdjustItem;
+class SvxAutoKernItem;
+class SvxBlinkItem;
+class SvxBoxItem;
+class SvxBrushItem;
+class SvxCaseMapItem;
+class SvxCharHiddenItem;
+class SvxCharReliefItem;
+class SvxCharRotateItem;
+class SvxCharScaleWidthItem;
+class SvxCharSetColorItem;
+class SvxColorItem;
+class SvxContourItem;
+class SvxCrossedOutItem;
+class SvxEmphasisMarkItem;
+class SvxEscapementItem;
+class SvxFmtBreakItem;
+class SvxFmtKeepItem;
+class SvxFmtSplitItem;
+class SvxFontHeightItem;
+class SvxFontItem;
+class SvxForbiddenRuleItem;
+class SvxFrameDirectionItem;
+class SvxHangingPunctuationItem;
+class SvxHyphenZoneItem;
+class SvxKerningItem;
+class SvxLRSpaceItem;
+class SvxLanguageItem;
+class SvxLineSpacingItem;
+class SvxMacroItem;
+class SvxNoHyphenItem;
+class SvxOpaqueItem;
+class SvxOrphansItem;
+class SvxOverlineItem;
+class SvxPaperBinItem;
+class SvxParaGridItem;
+class SvxParaVertAlignItem;
+class SvxPostureItem;
+class SvxPrintItem;
+class SvxPropSizeItem;
+class SvxProtectItem;
+class SvxScriptSpaceItem;
+class SvxShadowItem;
+class SvxShadowedItem;
+class SvxTabStopItem;
+class SvxTwoLinesItem;
+class SvxULSpaceItem;
+class SvxUnderlineItem;
+class SvxWeightItem;
+class SvxWidowsItem;
+class SvxWordLineModeItem;
+class SwChannelBGrf;
+class SwChannelGGrf;
+class SwChannelRGrf;
+class SwContrastGrf;
+class SwCropGrf;
+class SwDoc;
+class SwDrawModeGrf;
+class SwFmtAnchor;
+class SwFmtChain;
+class SwFmtCntnt;
+class SwFmtCol;
+class SwFmtDrop;
+class SwFmtEditInReadonly;
+class SwFmtEndAtTxtEnd;
+class SwFmtFillOrder;
+class SwFmtFollowTextFlow;
+class SwFmtFooter;
+class SwFmtFrmSize;
+class SwFmtFtnAtTxtEnd;
+class SwFmtHeader;
+class SwFmtHoriOrient;
+class SwFmtLayoutSplit;
+class SwFmtLineNumber;
+class SwFmtNoBalancedColumns;
+class SwFmtPageDesc;
+class SwFmtRowSplit;
+class SwFmtSurround;
+class SwFmtURL;
+class SwFmtVertOrient;
+class SwFmtWrapInfluenceOnObjPos;
+class SwGammaGrf;
+class SwHeaderAndFooterEatSpacingItem;
+class SwInvertGrf;
+class SwLuminanceGrf;
+class SwMirrorGrf;
+class SwModify;
+class SwNumRuleItem;
+class SwParaConnectBorderItem;
+class SwRegisterItem;
+class SwRotationGrf;
+class SwTblBoxFormula;
+class SwTblBoxNumFormat;
+class SwTblBoxValue;
+class SwTextGridItem;
+class SwTransparencyGrf;
+class SwAttrPool {};
+class SwAttrSet : public SfxItemSet
 {
     public:
-        // Meh, these need to go ...
-        void BroadcastStyleOperation(String, SfxStyleFamily, USHORT) {};
+        SwDoc* GetDoc() const { return NULL; };
+        void GetPresentation( SfxItemPresentation, SfxMapUnit, SfxMapUnit, String) const {};
+        const SwFmtHeader& GetHeader(BOOL) const;
+        const SwFmtFooter& GetFooter(BOOL) const;
+        const SwFmtCntnt& GetCntnt(BOOL) const;
 };
 
 #define SW_UNDOBJ_HXX
 class SwRewriter {};
 
 #define _SW_UNDO_PAGE_DESC_HXX
+#include <IDocumentUndoRedo.hxx>
 class SwPageDesc;
 class SwUndoPageDescCreate : public SwUndo
 {
     public:
-        SwUndoPageDescCreate(const SwPageDesc*, SwDoc*) {};
+        SwUndoPageDescCreate(const SwPageDesc*, IDocumentUndoRedo*) {};
 };
 class SwUndoPageDescDelete : public SwUndo
 {
     public:
-        SwUndoPageDescDelete(const SwPageDesc&, SwDoc*) {};
+        SwUndoPageDescDelete(const SwPageDesc&, IDocumentUndoRedo*) {};
 };
 
 
 };
 
 #define _PAGEDESC_HXX
+class SwDoc;
 class SwPageDesc
 {
     public:
         SwPageDesc() {};
-        SwPageDesc(const String& rName, SwDoc*, SvxFrameDirection) : m_sName(rName) {};
-        SwPageDesc(const String& rName, SwFrmFmt*, SwDoc*) : m_sName(rName) {};
+        SwPageDesc(const String& rName, SwFrmFmt*, SwAttrPool*, SvxFrameDirection) : m_sName(rName) {};
+        SwPageDesc(const String& rName, SwFrmFmt*, SwAttrPool*) : m_sName(rName) {};
         SwPageDesc(const SwPageDesc& rOther) : m_sName(rOther.m_sName), m_nFmtId(rOther.m_nFmtId) {};
         String GetName() const { return m_sName; };
         void SetName(const String& rName) { m_sName = rName; };
 };
 class SwPageDescExt : public SwPageDesc {};
 
+#include <mock/FormatAccessMockBase.hxx>
+#include <mock/LayoutAccessMockBase.hxx>
 #include <mock/UndoRedoMockBase.hxx>
 namespace
 {
 void SwRootFrm::RemoveFtns(SwPageFrm*, unsigned char, unsigned char)
 {}
 
-#include <mock/LayoutAccessMockBase.hxx>
 
 using namespace ::boost;
 using namespace ::sw::pagedesc;
             void Setup();
             void AddPageDesc(const String& rName);
             scoped_ptr<IDocumentPageDescAccess> m_pPageDescAccess;
-            scoped_ptr<SwDoc> m_pDoc;
             scoped_ptr<IDocumentLayoutAccess> m_pLayoutAccess;
             scoped_ptr<UndoRedoMock> m_pUndoRedo;
+            scoped_ptr<FormatAccessMockBase> m_pFormatAccess;
+            scoped_ptr<SwAttrPool> m_pPool;
             static const String our_sName;
             static const String our_sOtherName;
             static const String our_sThirdName;
 
 void PageDescManagerTest::Setup()
 {
-    m_pDoc.reset(new SwDoc());
     m_pLayoutAccess.reset(new LayoutAccessMockBase());
     m_pUndoRedo.reset(new UndoRedoMock());
-    m_pPageDescAccess.reset(PageDescManager::Create(m_pDoc.get(), m_pLayoutAccess.get(), m_pUndoRedo.get()));
+    m_pFormatAccess.reset(new FormatAccessMockBase());
+    m_pPool.reset(new SwAttrPool());
+    m_pPageDescAccess.reset(PageDescManager::Create(m_pLayoutAccess.get(), m_pUndoRedo.get(), m_pFormatAccess.get(),  m_pPool.get()));
     CPPUNIT_ASSERT(m_pPageDescAccess.get()!=NULL);
 }
 

File sw/qa/core/inc/mock/FormatAccessMockBase.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef FORMATACCESSMOCKBASE_HXX_INCLUDED
+#define FORMATACCESSMOCKBASE_HXX_INCLUDED
+
+#include <IDocumentFormatAccess.hxx>
+
+namespace sw { namespace mock
+{
+    class FormatAccessMockBase : public ::sw::format::IDocumentFormatAccess
+    {
+        public:
+            FormatAccessMockBase() {};
+            virtual const SwFrmFmt* GetDfltFrmFmt() const { return NULL; };
+            virtual SwFrmFmt* GetDfltFrmFmt() { return NULL; };
+            virtual const SwFrmFmt* GetEmptyPageFmt() const { return NULL; };
+            virtual SwFrmFmt* GetEmptyPageFmt() { return NULL; };
+            virtual const SwFrmFmt* GetColumnContFmt() const { return NULL; };
+            virtual SwFrmFmt* GetColumnContFmt() { return NULL; };
+            virtual const SwCharFmt* GetDfltCharFmt() const { return NULL; };
+            virtual SwCharFmt* GetDfltCharFmt() { return NULL; };
+    };
+}}
+#endif

File sw/qa/core/inc/mock/LayoutAccessMockBase.hxx

  *
  ************************************************************************/
 
-#ifndef ILAYOUTACCESSMOCKBASE_HXX_INCLUDED
-#define ILAYOUTACCESSMOCKBASE_HXX_INCLUDED
+#ifndef LAYOUTACCESSMOCKBASE_HXX_INCLUDED
+#define LAYOUTACCESSMOCKBASE_HXX_INCLUDED
 
 #include <IDocumentLayoutAccess.hxx>
 

File sw/source/core/doc/PageDescManager.cxx

 
 #include <IDocumentUndoRedo.hxx>
 #include <IDocumentLayoutAccess.hxx>
+#include <IDocumentFormatAccess.hxx>
 #include <SwUndoPageDesc.hxx>
 #include <algorithm>
 #include <doc.hxx>
 #include <pagefrm.hxx>	//Fuer DelPageDesc
 #include <poolfmt.hxx>
 #include <rootfrm.hxx>	//Fuer DelPageDesc
+#include <svl/brdcst.hxx>
+#include <StyleOperationHint.hxx>
+#include <swatrset.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::sw::pagedesc;
+using namespace ::sw::format;
 using ::boost::shared_ptr;
+using ::boost::scoped_ptr;
 
+PageDescManager::PageDescManager(IDocumentLayoutAccess* io_pLayoutAccess, IDocumentUndoRedo* io_pUndoRedo, IDocumentFormatAccess* io_pFormatAccess, SwAttrPool* io_pAttrPool)
+    : m_pLayoutAccess(io_pLayoutAccess)
+    , m_pUndoRedo(io_pUndoRedo)
+    , m_pFormatAccess(io_pFormatAccess)
+    , m_pAttrPool(io_pAttrPool)
+    , m_pBroadcaster(new SfxBroadcaster())
+{}
 
 // The HTML import cannot resist changing the page descriptions, I don't
 // know why. This function is meant to check the page descriptors for invalid
         SvxFrameDirection aFrameDirection = bRegardLanguage
             ? GetDefaultFrameDirection(GetAppLanguage())
             : FRMDIR_HORI_LEFT_TOP;
-        pNew = shared_ptr<SwPageDesc>(new SwPageDesc(rName, m_pDoc, aFrameDirection));
+        pNew = shared_ptr<SwPageDesc>(new SwPageDesc(rName, m_pFormatAccess->GetDfltFrmFmt(), m_pAttrPool, aFrameDirection));
     }
 
     m_vPageDescs.push_back(pNew);
 
     if(bBroadcast)
-       m_pDoc->BroadcastStyleOperation(rName, SFX_STYLE_FAMILY_PAGE, SFX_STYLESHEET_CREATED);
+        m_pBroadcaster->Broadcast(::sw::style::StyleOperationHint(rName, SFX_STYLE_FAMILY_PAGE, SFX_STYLESHEET_CREATED));
 
     if(m_pUndoRedo->DoesUndo())
     {
-        m_pUndoRedo->AppendUndo(new SwUndoPageDescCreate(pNew.get(), m_pDoc));
+       m_pUndoRedo->AppendUndo(new SwUndoPageDescCreate(pNew.get(), m_pUndoRedo));
     }
 
     m_pUndoRedo->SetModified();
         return;
     }
 
-    if (bBroadcast) // #116530#
-        m_pDoc->BroadcastStyleOperation((pPageDesc)->GetName(),
-            SFX_STYLE_FAMILY_PAGE, SFX_STYLESHEET_ERASED);
+    if (bBroadcast)
+        m_pBroadcaster->Broadcast(::sw::style::StyleOperationHint(pPageDesc->GetName(), SFX_STYLE_FAMILY_PAGE, SFX_STYLESHEET_ERASED));
 
     if (m_pUndoRedo->DoesUndo())
-        m_pUndoRedo->AppendUndo(new SwUndoPageDescDelete(*pPageDesc, m_pDoc));
+        m_pUndoRedo->AppendUndo(new SwUndoPageDescDelete(*pPageDesc, m_pUndoRedo));
 
     pPageDesc->Dispose();
     ForEach(lcl_PageDescFollowClearer(pPageDesc, m_pLayoutAccess->GetRootFrm()));
 {
     ::std::for_each(m_vPageDescs.begin(), m_vPageDescs.end(), lcl_SharedPtrUnwrapper(f)).m_aFunctor;
 }
+
+bool PageDescManager::AddListener( SfxListener& rListener )
+    { return rListener.StartListening(*m_pBroadcaster); };
+
+bool PageDescManager::RemoveListener( SfxListener& rListener )
+    { return rListener.EndListening(*m_pBroadcaster); };

File sw/source/core/doc/PageDescManager.hxx

 #include <IDocumentPageDescAccess.hxx>
 #include <boost/utility.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
 #include <vector>
 #include <osl/diagnose.h>
 
 class SwDoc;
 class IDocumentLayoutAccess;
 class IDocumentUndoRedo;
+class SwAttrPool;
+namespace sw { namespace format {
+    class IDocumentFormatAccess;
+}}
 class SwFrmFmt;
+class SfxBroadcaster;
+class SfxListener;
 
 namespace sw { namespace pagedesc
 {
 	, public ::sw::pagedesc::IDocumentPageDescAccess
     {
 	public:
-        static PageDescManager* Create(SwDoc* io_pDoc, IDocumentLayoutAccess* io_pLayoutAccess, IDocumentUndoRedo* io_pUndoRedo) { return new PageDescManager(io_pDoc, io_pLayoutAccess, io_pUndoRedo); };
+        static PageDescManager* Create(IDocumentLayoutAccess* io_pLayoutAccess, IDocumentUndoRedo* io_pUndoRedo, ::sw::format::IDocumentFormatAccess* io_pFormatAccess, SwAttrPool* io_pPool)
+            { return new PageDescManager(io_pLayoutAccess, io_pUndoRedo, io_pFormatAccess, io_pPool); };
 	    virtual difference_type GetPageDescCnt() const
 		{ return m_vPageDescs.size(); };
 	    virtual SwPageDesc* GetDefaultPageDesc()
 	    virtual void DelPageDesc(const String& rName, bool bBroadcast=false);
 	    virtual void DelAllPageDescs(bool bBroadcast);
         virtual void CheckDefaultPageFmt();
+        virtual bool AddListener(SfxListener&);
+        virtual bool RemoveListener(SfxListener&);
 	    void Dispose();
-	    virtual ~PageDescManager() {};
 
 	private:
 	    typedef ::std::vector< ::boost::shared_ptr< SwPageDesc > > container_t;
 	    container_t m_vPageDescs;
         ::boost::shared_ptr< SwPageDesc > m_pDefaultPageDesc;
-	    SwDoc* const m_pDoc;
         IDocumentLayoutAccess* const m_pLayoutAccess;
         IDocumentUndoRedo* const m_pUndoRedo;
+        ::sw::format::IDocumentFormatAccess* const m_pFormatAccess;
+        SwAttrPool* m_pAttrPool;
+        const ::boost::scoped_ptr<SfxBroadcaster> m_pBroadcaster;
 
         // class is final
-	    PageDescManager(SwDoc* io_pDoc, IDocumentLayoutAccess* io_pLayoutAccess,IDocumentUndoRedo* io_pUndoRedo) : m_pDoc(io_pDoc), m_pLayoutAccess(io_pLayoutAccess), m_pUndoRedo(io_pUndoRedo) {};
+	    PageDescManager(IDocumentLayoutAccess* io_pLayoutAccess,IDocumentUndoRedo* io_pUndoRedo, ::sw::format::IDocumentFormatAccess* io_pFormatAccess, SwAttrPool* io_pPool);
 
 	    void CopyPageDescHeaderFooter(bool bCpyHeader, const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt);
 	    void DelPageDesc(container_t::iterator ppPageDesc, bool bBroadcast=false);

File sw/source/core/doc/docdesc.cxx

     }
 }
 
-// #116530#
-void SwDoc::BroadcastStyleOperation(String rName, SfxStyleFamily eFamily,
-                                    USHORT nOp)
-{
-    if (pDocShell)
-    {
-        SfxStyleSheetBasePool * pPool = pDocShell->GetStyleSheetPool();
-
-        if (pPool)
-        {
-            pPool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
-            SfxStyleSheetBase * pBase = pPool->Find(rName);
-
-            if (pBase != NULL)
-                pPool->Broadcast(SfxStyleSheetHint( nOp, *pBase ));
-        }
-    }
-}
-
-
 void SwDoc::PrtDataChanged()
 {
 //!!!!!!!! Bei Aenderungen hier bitte ggf. InJobSetup im Sw3io mitpflegen

File sw/source/core/doc/docfmt.cxx

 #include <istyleaccess.hxx>
 #include <SwUndoFmt.hxx>
 #include <docsh.hxx>
+#include <StyleOperationHint.hxx>
 
 using namespace ::com::sun::star::i18n;
 using namespace ::com::sun::star::lang;
     SwCharFmt * pDel = (*pCharFmtTbl)[nFmt];
 
     if (bBroadcast)
-        BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_CHAR,
-                                SFX_STYLESHEET_ERASED);
+        getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(pDel->GetName(), SFX_STYLE_FAMILY_CHAR, SFX_STYLESHEET_ERASED));
 
     if (DoesUndo())
     {
 		if ( USHRT_MAX != ( nPos = pFrmFmtTbl->GetPos( pFmt )) )
         {
             if (bBroadcast)
-                BroadcastStyleOperation(pFmt->GetName(),
-                                        SFX_STYLE_FAMILY_FRAME,
-                                        SFX_STYLESHEET_ERASED);
+                getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(pFmt->GetName(), SFX_STYLE_FAMILY_FRAME, SFX_STYLESHEET_ERASED));
 
             if (DoesUndo())
             {
 
     if (bBroadcast)
     {
-        BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
-                                SFX_STYLESHEET_CREATED);
+        getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(rFmtName, SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_CREATED));
 
         if (DoesUndo())
         {
 
     if (bBroadcast)
     {
-        BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_CHAR,
-                                SFX_STYLESHEET_CREATED);
+        getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(rFmtName, SFX_STYLE_FAMILY_CHAR, SFX_STYLESHEET_CREATED));
     }
 
 	return pFmt;
     }
 
     if (bBroadcast)
-        BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
-                                SFX_STYLESHEET_CREATED);
+        getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(rFmtName, SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_CREATED));
 
 	return pFmtColl;
 }
 	SetModified();
 
     if (bBroadcast)
-        BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
-                                SFX_STYLESHEET_CREATED);
+        getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(rFmtName, SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_CREATED));
 
 	return pFmtColl;
 }
 		return;		// default nie loeschen !!
 
     if (bBroadcast)
-        BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PARA,
-                                SFX_STYLESHEET_ERASED);
+        getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(pDel->GetName(), SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_ERASED));
 
     if (DoesUndo())
     {
     rFmt.SetName(sNewName);
 
     if (bBroadcast)
-        BroadcastStyleOperation(sNewName, eFamily, SFX_STYLESHEET_MODIFIED);
+        getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(sNewName, eFamily, SFX_STYLESHEET_MODIFIED));
 }
 
 // --> OD 2006-09-27 #i69627#

File sw/source/core/doc/docnew.cxx

 #include <MarkManager.hxx>
 #include <PageDescManager.hxx>
 #include <unochart.hxx>
+#include <svl/brdcst.hxx>
 
 #include <cmdid.h>              // fuer den dflt - Printer in SetJob
 
 	mpAttrPool(new SwAttrPool(this)),
     m_pMarkManager(new ::sw::mark::MarkManager(*this)),
     m_pMetaFieldManager(new ::sw::MetaFieldManager()),
-    m_pPageDescManager(::sw::pagedesc::PageDescManager::Create(this,getIDocumentLayoutAccess(),getIDocumentUndoRedo())),
+    m_pPageDescManager(::sw::pagedesc::PageDescManager::Create(getIDocumentLayoutAccess(),getIDocumentUndoRedo(),getIDocumentFormatAccess(),&GetAttrPool())),
+    m_pStyleOperationBroadcaster(new SfxBroadcaster()),
 	pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
 	pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),
 	pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ),

File sw/source/core/doc/docnum.cxx

 #include <frmatr.hxx>
 #include <SwStyleNameMapper.hxx>
 #include <SwNodeNum.hxx>
-// --> OD 2008-03-13 #refactorlists#
 #include <list.hxx>
 #include <listfunc.hxx>
-// <--
+#include <StyleOperationHint.hxx>
 
 #include <map>
 
         }
 
         if (bBroadcast)
-            BroadcastStyleOperation(rName, SFX_STYLE_FAMILY_PSEUDO,
-                                    SFX_STYLESHEET_ERASED);
+            getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(rName, SFX_STYLE_FAMILY_PSEUDO, SFX_STYLESHEET_ERASED));
 
         // --> OD 2008-04-02 #refactorlists#
         deleteListForListStyle( rName );
         bResult = sal_True;
 
         if (bBroadcast)
-            BroadcastStyleOperation(rOldName, SFX_STYLE_FAMILY_PSEUDO,
-                                    SFX_STYLESHEET_MODIFIED);
+            getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(rOldName, SFX_STYLE_FAMILY_PSEUDO, SFX_STYLESHEET_MODIFIED));
     }
 
     return bResult;
     }
 
     if (bBroadcast)
-        BroadcastStyleOperation(pNew->GetName(), SFX_STYLE_FAMILY_PSEUDO,
-                                SFX_STYLESHEET_CREATED);
+        getStyleOperationBroadcaster()->Broadcast(::sw::style::StyleOperationHint(pNew->GetName(), SFX_STYLE_FAMILY_PSEUDO, SFX_STYLESHEET_CREATED));
 
 	return nRet;
 }

File sw/source/core/layout/pagedesc.cxx

 #include <rootfrm.hxx>
 #include <swtable.hxx>
 
-SwPageDesc::SwPageDesc(const String& rName, SwDoc* const pDc, SvxFrameDirection aFrameDirection) :
+
+SwPageDesc::SwPageDesc( const String& rName, SwFrmFmt* pFmt, SwAttrPool* pPool) :
 	SwModify( 0 ),
 	aDescName( rName ),
-    aMaster( pDc->GetAttrPool(), rName, pDc->GetDfltFrmFmt() ),
-    aLeft( pDc->GetAttrPool(), rName, pDc->GetDfltFrmFmt() ),
+    aMaster( *pPool, rName, pFmt ),
+    aLeft( *pPool, rName, pFmt ),
+    aDepend( this, 0 ),
+    pFollow( this ),
+    nRegHeight( 0 ),
+	nRegAscent( 0 ),
+    eUse( (UseOnPage)(nsUseOnPage::PD_ALL | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE) ),
+    bLandscape( FALSE ),
+    aFtnInfo()
+{ }
+
+SwPageDesc::SwPageDesc( const String& rName, SwFrmFmt* pFmt, SwAttrPool* pPool, SvxFrameDirection aFrameDirection) :
+	SwModify( 0 ),
+	aDescName( rName ),
+    aMaster( *pPool, rName, pFmt ),
+    aLeft( *pPool, rName, pFmt ),
     aDepend( this, 0 ),
     pFollow( this ),
     nRegHeight( 0 ),
         GetLeft().SetFmtAttr(SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR));
 }
 
-SwPageDesc::SwPageDesc( const String& rName, SwFrmFmt* pFmt, SwDoc* const pDc ) :
-	SwModify( 0 ),
-	aDescName( rName ),
-    aMaster( pDc->GetAttrPool(), rName, pFmt ),
-    aLeft( pDc->GetAttrPool(), rName, pFmt ),
-    aDepend( this, 0 ),
-    pFollow( this ),
-    nRegHeight( 0 ),
-	nRegAscent( 0 ),
-    eUse( (UseOnPage)(nsUseOnPage::PD_ALL | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE) ),
-    bLandscape( FALSE ),
-    aFtnInfo()
-{
-}
-
 SwPageDesc::SwPageDesc( const SwPageDesc &rCpy ) :
 	SwModify( 0 ),
     aDescName( rCpy.GetName() ),

File sw/source/core/undo/SwUndoPageDesc.cxx

 
 // #116530#
 SwUndoPageDescCreate::SwUndoPageDescCreate(const SwPageDesc * pNew,
-                                           SwDoc * _pDoc)
-    : SwUndo(UNDO_CREATE_PAGEDESC), pDesc(pNew), aNew(*pNew, _pDoc),
+                                           IDocumentUndoRedo* _pDoc)
+    : SwUndo(UNDO_CREATE_PAGEDESC), pDesc(pNew), aNew(*pNew, (SwDoc*)_pDoc),
       pDoc(_pDoc)
 {
     ASSERT(0 != pDoc, "no document?");
     }
     // <- #116530#
 
-    pDoc->getIDocumentPageDescAccess()->DelPageDesc(aNew.GetName(), TRUE);
+    ((SwDoc*)pDoc)->getIDocumentPageDescAccess()->DelPageDesc(aNew.GetName(), TRUE);
     pDoc->DoUndo(bUndo);
 }
 
     pDoc->DoUndo(FALSE);
 
     SwPageDesc aPageDesc = aNew;
-    pDoc->getIDocumentPageDescAccess()->MakePageDesc(aNew.GetName(), &aPageDesc, FALSE, TRUE); // #116530#
+    ((SwDoc*)pDoc)->getIDocumentPageDescAccess()->MakePageDesc(aNew.GetName(), &aPageDesc, FALSE, TRUE); // #116530#
 
     pDoc->DoUndo(bUndo);
 }
 }
 
 SwUndoPageDescDelete::SwUndoPageDescDelete(const SwPageDesc & _aOld,
-                                           SwDoc * _pDoc)
-    : SwUndo(UNDO_DELETE_PAGEDESC), aOld(_aOld, _pDoc), pDoc(_pDoc)
+                                           IDocumentUndoRedo* _pDoc)
+    : SwUndo(UNDO_DELETE_PAGEDESC), aOld(_aOld, (SwDoc*)_pDoc), pDoc(_pDoc)
 {
     ASSERT(0 != pDoc, "no document?");
 }
     pDoc->DoUndo(FALSE);
 
     SwPageDesc aPageDesc = aOld;
-    pDoc->getIDocumentPageDescAccess()->MakePageDesc(aOld.GetName(), &aPageDesc, FALSE, TRUE); // #116530#
+    ((SwDoc*)pDoc)->getIDocumentPageDescAccess()->MakePageDesc(aOld.GetName(), &aPageDesc, FALSE, TRUE); // #116530#
     pDoc->DoUndo(bUndo);
 }
 
     BOOL bUndo = pDoc->DoesUndo();
 
     pDoc->DoUndo(FALSE);
-    pDoc->getIDocumentPageDescAccess()->DelPageDesc(aOld.GetName(), TRUE); // #116530#
+    ((SwDoc*)pDoc)->getIDocumentPageDescAccess()->DelPageDesc(aOld.GetName(), TRUE); // #116530#
     pDoc->DoUndo(bUndo);
 }
 

File sw/source/ui/app/docsh2.cxx

 #include <svl/zformat.hxx>
 #include <unotools/pathoptions.hxx>
 #include <svtools/transfer.hxx>
-#ifndef _SFXSIDS_HRC //autogen
 #include <sfx2/dialogs.hrc>
-#endif
 #include <sfx2/dinfdlg.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/dispatch.hxx>
 #include <svtools/sfxecode.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/docfilt.hxx>
-#ifndef _SVX_SVXIDS_HRC //autogen
 #include <svx/svxids.hrc>
-#endif
 #include <svx/drawitem.hxx>
 #include <editeng/svxacorr.hxx>
 #include <editeng/langitem.hxx>
 #include <cmdid.h>
 #include <globals.h>
 #include <helpid.h>
-#ifndef _APP_HRC
 #include <app.hrc>
-#endif
-#ifndef _POOLFMT_HRC
 #include <poolfmt.hrc>
-#endif
-#ifndef _GLOBALS_HRC
 #include <globals.hrc>
-#endif
 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
 
 #include <sfx2/fcontnr.hxx>
 
-#include "swabstdlg.hxx"
-#include "dialog.hrc"
-#include "swabstdlg.hxx"
+#include <swabstdlg.hxx>
+#include <dialog.hrc>
+#include <swabstdlg.hxx>
 
 #include <ndtxt.hxx>	//#outline level,add by zhaojianwei
+#include <StyleOperationHint.hxx>
 
 using namespace ::com::sun::star::ui::dialogs;
 using namespace ::com::sun::star::lang;
 	}
 
 	USHORT nAction = 0;
-	if( rHint.ISA(SfxSimpleHint) )
+    const ::sw::style::StyleOperationHint* pStyleOpHint = dynamic_cast<const ::sw::style::StyleOperationHint* >(&rHint);
+    if(pStyleOpHint)
+    {
+        if(mxBasePool.get())
+        {
+            mxBasePool->SetSearchMask(pStyleOpHint->GetStyleFamily(), SFXSTYLEBIT_ALL);
+            SfxStyleSheetBase* pBase = mxBasePool->Find(pStyleOpHint->GetName());
+            if(pBase)
+                mxBasePool->Broadcast(SfxStyleSheetHint(pStyleOpHint->GetOp(), *pBase));
+        }
+    }
+	else if( rHint.ISA(SfxSimpleHint) )
 	{
 		// swithc for more actions
 		switch( ((SfxSimpleHint&) rHint).GetId() )

File sw/source/ui/app/docshini.cxx

 
     delete pOLEChildList;
 }
-/* -----------------------------10.09.2001 15:59------------------------------
 
- ---------------------------------------------------------------------------*/
 void  SwDocShell::Init_Impl()
 {
     SetPool(&SW_MOD()->GetPool());
 	// wir als BroadCaster werden auch unser eigener Listener
 	// (fuer DocInfo/FileNamen/....)
 	StartListening( *this );
+	pDoc->getIDocumentPageDescAccess()->AddListener( *this );
     //position of the "Automatic" style filter for the stylist (app.src)
     SetAutoStyleFilterIndex(3);