Commits

Bjoern Michaelsen  committed 4e29fbf

swbookmarkfixes01: removed layout from PageDescManager

  • Participants
  • Parent commits 2404843

Comments (0)

Files changed (4)

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

         SwUndoPageDescDelete(const SwPageDesc&, IDocumentUndoRedo*) {};
 };
 
-
-//#define _PAGEFRM_HXX
-//#include <frame.hxx>
-//class SwPageFrm : public SwFrm
-//{
-//    public:
-//        bool IsFtnPage() const
-//            { return true; };
-//};
-
-//#define _FRMFMT_HXX
-//class SwFrmFmt : public SwModify
-//{
-//   public:
-//        bool SetFmtAttr(const SfxPoolItem&) { return true; } ;
-//        bool HasFootnotePageListener() const { return true; };
-//        void DelFrms() {};
-//};
-
 #define _PAGEDESC_HXX
 #include <frmfmt.hxx>
 class SwDoc;
 
 #include <source/core/doc/PageDescManager.cxx>
 
-//void SwFrm::CheckPageDescs(SwPageFrm*, unsigned char)
-//{}
-
-//void SwRootFrm::RemoveFtns(SwPageFrm*, unsigned char, unsigned char)
-//{}
-
 
 using namespace ::boost;
 using namespace ::sw::pagedesc;

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

 #include <PageDescManager.hxx>
 
 #include <IDocumentUndoRedo.hxx>
-#include <IDocumentLayoutAccess.hxx>
 #include <IDocumentFormatAccess.hxx>
 #include <SwUndoPageDesc.hxx>
 #include <algorithm>
 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)
+PageDescManager::PageDescManager(IDocumentUndoRedo* io_pUndoRedo, IDocumentFormatAccess* io_pFormatAccess, SwAttrPool* io_pAttrPool)
+    : m_pUndoRedo(io_pUndoRedo)
     , m_pFormatAccess(io_pFormatAccess)
     , m_pAttrPool(io_pAttrPool)
     , m_pBroadcaster(new SfxBroadcaster())

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

 #include <osl/diagnose.h>
 
 class SwDoc;
-class IDocumentLayoutAccess;
 class IDocumentUndoRedo;
 class SwAttrPool;
+
 namespace sw { namespace format {
     class IDocumentFormatAccess;
 }}
 namespace sw { namespace pagedesc
 {
     class PageDescManager
-	: private ::boost::noncopyable
-	, public ::sw::pagedesc::IDocumentPageDescAccess
+    : private ::boost::noncopyable
+    , public ::sw::pagedesc::IDocumentPageDescAccess
     {
-	public:
-        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()
-		{
+    public:
+        static PageDescManager* Create(IDocumentUndoRedo* io_pUndoRedo, ::sw::format::IDocumentFormatAccess* io_pFormatAccess, SwAttrPool* io_pPool)
+            { return new PageDescManager(io_pUndoRedo, io_pFormatAccess, io_pPool); };
+        virtual difference_type GetPageDescCnt() const
+        { return m_vPageDescs.size(); };
+        virtual SwPageDesc* GetDefaultPageDesc()
+        {
             OSL_ENSURE(m_pDefaultPageDesc.get(), "<PageDescManager:GetDefaultPageDesc(..)>"
                 " - no default page description available.");
             return m_pDefaultPageDesc.get();
         }
-	    virtual const SwPageDesc* GetDefaultPageDesc() const
+        virtual const SwPageDesc* GetDefaultPageDesc() const
             { return const_cast<PageDescManager*>(this)->GetDefaultPageDesc(); }
-	    virtual SwPageDesc* GetPageDescByName(const String& rName);
-	    virtual const SwPageDesc* GetPageDescByName(const String& rName) const
+        virtual SwPageDesc* GetPageDescByName(const String& rName);
+        virtual const SwPageDesc* GetPageDescByName(const String& rName) const
             { return const_cast<PageDescManager*>(this)->GetPageDescByName(rName); }
-	    virtual SwPageDesc* GetPageDescByPoolFmtId(USHORT nId);
-	    virtual const SwPageDesc* GetPageDescByPoolFmtId(USHORT nId) const
+        virtual SwPageDesc* GetPageDescByPoolFmtId(USHORT nId);
+        virtual const SwPageDesc* GetPageDescByPoolFmtId(USHORT nId) const
             { return const_cast<PageDescManager*>(this)->GetPageDescByPoolFmtId(nId); }
-	    virtual SwPageDesc* MakePageDesc(const String &rName, const SwPageDesc* pCpy=NULL, bool bRegardLanguage=true, bool bBroadcast=false);
-	    virtual void DelPageDesc(const String& rName, bool bBroadcast=false);
-	    virtual void DelAllPageDescs(bool bBroadcast);
+        virtual SwPageDesc* MakePageDesc(const String &rName, const SwPageDesc* pCpy=NULL, bool bRegardLanguage=true, bool bBroadcast=false);
+        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();
+        // dispose removes all pagedescs including the default pagedesc
+        // it is only to be called by the document upon destruction
+        void Dispose();
 
-	private:
-	    typedef ::std::vector< ::boost::shared_ptr< SwPageDesc > > container_t;
-	    container_t m_vPageDescs;
+    private:
+        typedef ::std::vector< ::boost::shared_ptr< SwPageDesc > > container_t;
+        container_t m_vPageDescs;
         ::boost::shared_ptr< SwPageDesc > m_pDefaultPageDesc;
-        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(IDocumentLayoutAccess* io_pLayoutAccess,IDocumentUndoRedo* io_pUndoRedo, ::sw::format::IDocumentFormatAccess* io_pFormatAccess, SwAttrPool* io_pPool);
+        PageDescManager(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);
-	    container_t::iterator FindByName(const String& rName);
-	    container_t::iterator FindByPoolFmtId(USHORT nId);
-	    virtual void ForEach_Impl(IDocumentPageDescAccess::foreach_functor_type f);
+        void CopyPageDescHeaderFooter(bool bCpyHeader, const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt);
+        void DelPageDesc(container_t::iterator ppPageDesc, bool bBroadcast=false);
+        container_t::iterator FindByName(const String& rName);
+        container_t::iterator FindByPoolFmtId(USHORT nId);
+        virtual void ForEach_Impl(IDocumentPageDescAccess::foreach_functor_type f);
     };
 }}
 #endif

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

 	mpAttrPool(new SwAttrPool(this)),
     m_pMarkManager(new ::sw::mark::MarkManager(*this)),
     m_pMetaFieldManager(new ::sw::MetaFieldManager()),
-    m_pPageDescManager(::sw::pagedesc::PageDescManager::Create(getIDocumentLayoutAccess(),getIDocumentUndoRedo(),getIDocumentFormatAccess(),&GetAttrPool())),
+    m_pPageDescManager(::sw::pagedesc::PageDescManager::Create(getIDocumentUndoRedo(), getIDocumentFormatAccess(), &GetAttrPool())),
     m_pStyleOperationBroadcaster(new SfxBroadcaster()),
 	pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
 	pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),