diff options
author | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-08-06 16:21:14 +0200 |
---|---|---|
committer | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-08-12 23:26:38 +0200 |
commit | 5494954b269267f6ee3bdd5ac73e7513fa69978f (patch) | |
tree | bd6569e5b82a7c771062b2e2e5f6db7666913597 /sw | |
parent | 64e13a1456c44ef3461c2941bb3be15c3eaf478e (diff) |
Refactored IDocumentLayoutAccess out of SwDoc.
Into the new class DocumentLayoutManager.
Change-Id: I02d0cfcc63633d0bdab380508b2ef563187fd269
Diffstat (limited to 'sw')
114 files changed, 1053 insertions, 796 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 29f1e6622087..abf895720e73 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -199,6 +199,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/doc/DocumentFieldsManager \ sw/source/core/doc/DocumentStatisticsManager \ sw/source/core/doc/DocumentStateManager \ + sw/source/core/doc/DocumentLayoutManager \ sw/source/core/doc/extinput \ sw/source/core/doc/fmtcol \ sw/source/core/doc/ftnidx \ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 7fd488fea2e2..cc77e3a32d21 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -23,7 +23,6 @@ #include <IInterface.hxx> #include <IDocumentMarkAccess.hxx> #include <IDocumentStylePoolAccess.hxx> -#include <IDocumentLayoutAccess.hxx> #include <IDocumentExternalData.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/XStorage.hpp> @@ -191,6 +190,7 @@ class IDocumentContentOperations; class IDocumentRedlineAccess; class IDocumentStatistics; class IDocumentState; +class IDocumentLayoutAccess; class _SetGetExpFlds; namespace sw { namespace mark { @@ -214,6 +214,7 @@ namespace sw { class DocumentFieldsManager; class DocumentStatisticsManager; class DocumentStateManager; + class DocumentLayoutManager; } namespace com { namespace sun { namespace star { @@ -252,7 +253,6 @@ void StartGrammarChecking( SwDoc &rDoc ); class SW_DLLPUBLIC SwDoc : public IInterface, public IDocumentStylePoolAccess, - public IDocumentLayoutAccess, public IDocumentExternalData { friend class ::sw::DocumentContentOperationsManager; @@ -293,6 +293,7 @@ class SW_DLLPUBLIC SwDoc : const ::boost::scoped_ptr< ::sw::DocumentContentOperationsManager > m_pDocumentContentOperationsManager; const ::boost::scoped_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager; const ::boost::scoped_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager; + const ::boost::scoped_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager; // Pointer SwFrmFmt *mpDfltFrmFmt; //< Default formats. @@ -313,8 +314,6 @@ class SW_DLLPUBLIC SwDoc : SwTOXTypes *mpTOXTypes; //< Tables/indices SwDefTOXBase_Impl * mpDefTOXBases; //< defaults of SwTOXBase's - SwViewShell *mpCurrentView; //< SwDoc should get a new member mpCurrentView - SwDBManager *mpDBManager; /**< Pointer to the DBManager for evaluation of DB-fields. */ @@ -344,8 +343,6 @@ class SW_DLLPUBLIC SwDoc : SwPagePreviewPrtData *mpPgPViewPrtData; //< Indenting / spacing for printing of page view. SwPaM *mpExtInputRing; - SwLayouter *mpLayouter; /**< ::com::sun::star::frame::Controller for complex layout formatting - like footnote/endnote in sections */ IStyleAccess *mpStyleAccess; //< handling of automatic styles SwLayoutCache *mpLayoutCache; /**< Layout cache to read and save with the document for a faster formatting */ @@ -582,19 +579,11 @@ public: ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager(); // IDocumentLayoutAccess - virtual void SetCurrentViewShell( SwViewShell* pNew ) SAL_OVERRIDE; - virtual SwLayouter* GetLayouter() SAL_OVERRIDE; - virtual const SwLayouter* GetLayouter() const SAL_OVERRIDE; - virtual void SetLayouter( SwLayouter* pNew ) SAL_OVERRIDE; - virtual SwFrmFmt* MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) SAL_OVERRIDE; - virtual void DelLayoutFmt( SwFrmFmt *pFmt ) SAL_OVERRIDE; - virtual SwFrmFmt* CopyLayoutFmt( const SwFrmFmt& rSrc, const SwFmtAnchor& rNewAnchor, bool bSetTxtFlyAtt, bool bMakeFrms ) SAL_OVERRIDE; - virtual const SwViewShell *GetCurrentViewShell() const SAL_OVERRIDE; - virtual SwViewShell *GetCurrentViewShell() SAL_OVERRIDE; //< It must be able to communicate to a SwViewShell.This is going to be removerd later. - virtual const SwRootFrm *GetCurrentLayout() const SAL_OVERRIDE; - virtual SwRootFrm *GetCurrentLayout() SAL_OVERRIDE; - virtual bool HasLayout() const SAL_OVERRIDE; - void ClearSwLayouterEntries(); + IDocumentLayoutAccess const & getIDocumentLayoutAccess() const; + IDocumentLayoutAccess & getIDocumentLayoutAccess(); + + ::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const; + ::sw::DocumentLayoutManager & GetDocumentLayoutManager(); // IDocumentTimerAccess // Our own 'IdleTimer' calls the following method @@ -1493,8 +1482,7 @@ public: /** update all modified OLE-Objects. The modification is called over the StarOne - Interface */ - void SetOLEObjModified() - { if( GetCurrentViewShell() ) maOLEModifiedTimer.Start(); } + void SetOLEObjModified(); // Uno - Interfaces const SwUnoCrsrTbl& GetUnoCrsrTbl() const { return *mpUnoCrsrTbl; } diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index ebf23173387e..0a2a2caa35ed 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -33,12 +33,14 @@ class IMapObject; class SwRect; class SwContact; class SdrObject; +namespace sw { class DocumentLayoutManager; } /// Style of a layout element. class SW_DLLPUBLIC SwFrmFmt: public SwFmt { friend class SwDoc; friend class SwPageDesc; ///< Is allowed to call protected CTor. + friend class ::sw::DocumentLayoutManager; ///< Is allowed to call protected CTor. ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface> m_wXObject; diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 15a8085f6caa..e2194e59f616 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -42,6 +42,7 @@ #include <unotools/tempfile.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include "docsh.hxx" typedef tools::SvRef<SwDocShell> SwDocShellRef; @@ -166,7 +167,7 @@ void SwMacrosTest::testFdo55289() SwDocShellRef pDocShell = new SwDocShell(pDoc, SFX_CREATE_MODE_EMBEDDED); // this needs to run with no layout to tickle the bugs in the special // cases in SwXShape re-anchoring - assert(!pDoc->GetCurrentLayout()); + assert(!pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); uno::Reference<frame::XModel> const xModel(pDocShell->GetModel()); uno::Reference<drawing::XDrawPageSupplier> const xDPS(xModel, UNO_QUERY); diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index e7d77f143ceb..dfd885c14e83 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -38,6 +38,7 @@ #include <unotxdoc.hxx> #include <docsh.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> using namespace css; @@ -296,7 +297,7 @@ private: SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTxtDoc); SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc(); - SwRootFrm* pLayout = pDoc->GetCurrentLayout(); + SwRootFrm* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); pLayout->dumpAsXml(pXmlWriter); // delete xml writer @@ -309,7 +310,7 @@ private: SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTxtDoc); SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc(); - pDoc->GetCurrentViewShell()->CalcLayout(); + pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); } protected: diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 2779e7456018..3469ed22100b 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -763,8 +763,8 @@ bool SwFmt::IsShadowTransparent() const const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return & GetDoc()->GetDocumentSettingManager(); } const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); } IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return & GetDoc()->getIDocumentDrawModelAccess(); } -const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); } -IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); } +const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return &GetDoc()->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return &GetDoc()->getIDocumentLayoutAccess(); } IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return & GetDoc()->getIDocumentTimerAccess(); } IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return &GetDoc()->getIDocumentFieldsAccess(); } IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return & GetDoc()->getIDocumentChartDataProviderAccess(); } diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index fcea4b0705b8..9a7fa97ed6b2 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -61,6 +61,7 @@ #include <comphelper/flagguard.hxx> #include <globals.hrc> #include <comcore.hrc> +#include <IDocumentLayoutAccess.hxx> #if defined(ANDROID) || defined(IOS) #include <touch/touch.h> @@ -704,7 +705,7 @@ static SwFrm* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt ) SwCntntNode* pCNd = rIdx.GetNode().GetCntntNode(); if( pCNd ) { - SwCntntFrm *pCntFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &rPt, 0, false ); + SwCntntFrm *pCntFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPt, 0, false ); pFrm = pCntFrm ? pCntFrm->GetUpper() : NULL; while( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() ) pFrm = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->AnchorFrm() diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 161b10f1081e..7eb498f1f96a 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -29,6 +29,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> #include <rootfrm.hxx> @@ -595,7 +596,7 @@ void lcl_MakeFldLst( { const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); const SwCntntFrm* pCFrm = - rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->GetCurrentLayout(), &aPt, 0, false ); + rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); if ( pCFrm != NULL && ( bInReadOnly || !pCFrm->IsProtected() ) ) { @@ -1653,7 +1654,7 @@ bool SwContentAtPos::IsInProtectSect() const const SwCntntFrm* pFrm; return pNd && ( pNd->IsInProtectSect() || - ( 0 != ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), 0, 0, false)) && + ( 0 != ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false)) && pFrm->IsProtected() )); } diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 1b3801f9a657..5a1d1fa1eed0 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -23,6 +23,7 @@ #include <cntfrm.hxx> #include <pagefrm.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <pam.hxx> #include <pamtyp.hxx> @@ -536,7 +537,7 @@ sal_uInt16 SwPaM::GetPageNum( bool bAtPoint, const Point* pLayPos ) const SwPosition* pPos = bAtPoint ? m_pPoint : m_pMark; if( 0 != ( pNd = pPos->nNode.GetNode().GetCntntNode() ) && - 0 != ( pCFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), pLayPos, pPos, false )) && + 0 != ( pCFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), pLayPos, pPos, false )) && 0 != ( pPg = pCFrm->FindPageFrm() )) return pPg->GetPhyPageNum(); return 0; @@ -577,7 +578,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const if ( pNd != NULL ) { Point aTmpPt; - pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, GetPoint(), false ); + pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, GetPoint(), false ); } // Will be set if point are inside edit-in-readonly environment @@ -610,7 +611,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const if ( pNd != NULL ) { Point aTmpPt; - pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, GetMark(), false ); + pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, GetMark(), false ); } const SwFrm* pMarkEditInReadonlyFrm = NULL; @@ -752,7 +753,7 @@ SwCntntNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, { if( ( - 0 == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout() ) ) || + 0 == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) || ( !bInReadOnly && pFrm->IsProtected() ) || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()) ) || @@ -785,7 +786,7 @@ SwCntntNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, if( (aPos.*fnMove->fnCmpOp)( *rPam.GetMark() ) ) { // only in AutoTextSection can be nodes that are hidden - if( 0 == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout() ) ) || + if( 0 == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) || ( !bInReadOnly && pFrm->IsProtected() ) || ( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow() ) ) diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 396940aba967..3f41c4032b05 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -31,6 +31,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <section.hxx> @@ -323,7 +324,7 @@ bool SwCursor::IsSelOvr( int eFlags ) const SwNode* pNd = &GetPoint()->nNode.GetNode(); if( pNd->IsCntntNode() && !dynamic_cast<SwUnoCrsr*>(this) ) { - const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ); + const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); if( pFrm && pFrm->IsValid() && 0 == pFrm->Frm().Height() && 0 != ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) ) @@ -340,7 +341,7 @@ bool SwCursor::IsSelOvr( int eFlags ) if( !pFrm ) { bGoNxt = !bGoNxt; - pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ); + pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); while ( pFrm && 0 == pFrm->Frm().Height() ) { pFrm = bGoNxt ? pFrm->GetNextCntntFrm() @@ -404,7 +405,7 @@ bool SwCursor::IsSelOvr( int eFlags ) } if( (pNd = &GetMark()->nNode.GetNode())->IsCntntNode() - && !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ) + && !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && !dynamic_cast<SwUnoCrsr*>(this) ) { DeleteMark(); @@ -693,7 +694,7 @@ bool SwCursor::IsAtValidPos( bool bPoint ) const const SwPosition* pPos = bPoint ? GetPoint() : GetMark(); const SwNode* pNd = &pPos->nNode.GetNode(); - if( pNd->IsCntntNode() && !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ) && + if( pNd->IsCntntNode() && !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && !dynamic_cast<const SwUnoCrsr*>(this) ) { return false; @@ -1571,7 +1572,7 @@ SwCursor::DoSetBidiLevelLeftRight( // for visual cursor travelling (used in bidi layout) // we first have to convert the logic to a visual position Point aPt; - pSttFrm = rTNd.getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); + pSttFrm = rTNd.getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); if( pSttFrm ) { sal_uInt8 nCrsrLevel = GetCrsrBidiLevel(); @@ -1701,7 +1702,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, if ( &rTmpNode != &rNode && rTmpNode.IsTxtNode() ) { Point aPt; - const SwCntntFrm* pEndFrm = ((SwTxtNode&)rTmpNode).getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); + const SwCntntFrm* pEndFrm = ((SwTxtNode&)rTmpNode).getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); if ( pEndFrm ) { if ( ! pEndFrm->IsRightToLeft() != ! pSttFrm->IsRightToLeft() ) @@ -1771,7 +1772,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, Point aPt; if( pPt ) aPt = *pPt; - SwCntntFrm* pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); + SwCntntFrm* pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); if( pFrm ) { @@ -1807,7 +1808,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, const SwNode* pEndNd = pTblNd->EndOfSectionNode(); GetPoint()->nNode = *pEndNd; pTblCrsr->Move( fnMoveBackward, fnGoNode ); - pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); + pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); } } @@ -1816,7 +1817,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, : pFrm->UnitDown( this, nUpDownX, bInReadOnly ) ) && CheckNodesRange( aOldPos.nNode, GetPoint()->nNode, bChkRange )) { - pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); + pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); --nCnt; } @@ -1827,7 +1828,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, if( !pTblCrsr ) { // try to position the cursor at half of the char-rect's height - pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); + pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); SwCrsrMoveState eTmpState( MV_UPDOWN ); eTmpState.bSetInReadOnly = bInReadOnly; SwRect aTmpRect; @@ -1859,7 +1860,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, bool SwCursor::LeftRightMargin( bool bLeft, bool bAPI ) { Point aPt; - SwCntntFrm * pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); + SwCntntFrm * pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); // calculate cursor bidi level if ( pFrm ) @@ -1875,7 +1876,7 @@ bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const { bool bRet = false; Point aPt; - SwCntntFrm * pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); + SwCntntFrm * pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); if( pFrm ) { SwPaM aPam( *GetPoint() ); diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 71d0c0663ac7..93329f62cab8 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -38,6 +38,7 @@ #include <cellfrm.hxx> #include <rowfrm.hxx> #include <trvltbl.hxx> +#include <IDocumentLayoutAccess.hxx> /// set cursor into next/previous cell bool SwCrsrShell::GoNextCell( bool bAppendLine ) @@ -371,7 +372,7 @@ static bool lcl_FindNextCell( SwNodeIndex& rIdx, bool bInReadOnly ) if ( !pCNd ) return false; - SwCntntFrm* pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ); + SwCntntFrm* pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); if ( 0 == pFrm || pCNd->FindTableNode() != pTblNd || (!bInReadOnly && pFrm->IsProtected() ) ) @@ -403,7 +404,7 @@ static bool lcl_FindNextCell( SwNodeIndex& rIdx, bool bInReadOnly ) return false; // check if we have found a suitable table cell: - pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ); + pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); if ( 0 != pFrm && pCNd->FindTableNode() == pTblNd && (bInReadOnly || !pFrm->IsProtected() ) ) @@ -444,7 +445,7 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly ) if ( !pCNd ) return false; - SwCntntFrm* pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ); + SwCntntFrm* pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); if( 0 == pFrm || pCNd->FindTableNode() != pTblNd || (!bInReadOnly && pFrm->IsProtected() )) @@ -465,7 +466,7 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly ) if ( !pCNd ) return false; - pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ); + pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); if( 0 != pFrm && pCNd->FindTableNode() == pTblNd && (bInReadOnly || !pFrm->IsProtected() ) ) diff --git a/sw/source/core/crsr/unocrsr.cxx b/sw/source/core/crsr/unocrsr.cxx index 88d6660eebca..49785a0e2fb3 100644 --- a/sw/source/core/crsr/unocrsr.cxx +++ b/sw/source/core/crsr/unocrsr.cxx @@ -19,6 +19,7 @@ #include <unocrsr.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <swtable.hxx> #include <docary.hxx> #include <rootfrm.hxx> @@ -211,9 +212,9 @@ void SwUnoTableCrsr::MakeBoxSels() const SwCntntNode* pCNd; bool bMakeTblCrsrs = true; if( GetPoint()->nNode.GetIndex() && GetMark()->nNode.GetIndex() && - 0 != ( pCNd = GetCntntNode() ) && pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ) && - 0 != ( pCNd = GetCntntNode(false) ) && pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ) ) - bMakeTblCrsrs = GetDoc()->GetCurrentLayout()->MakeTblCrsrs( *this ); + 0 != ( pCNd = GetCntntNode() ) && pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) && + 0 != ( pCNd = GetCntntNode(false) ) && pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) + bMakeTblCrsrs = GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->MakeTblCrsrs( *this ); if ( !bMakeTblCrsrs ) { diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index ffbd356f236f..40dcd3ea3ae0 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -24,6 +24,7 @@ #include <cntfrm.hxx> #include <doc.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <editsh.hxx> #include <fmtanchr.hxx> @@ -308,7 +309,7 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode(); if( !pNode ) return; - SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() ); + SwFrm* pFrm = pNode->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); if( pFrm ) { if( !pFrm->GetDrawObjs() ) diff --git a/sw/source/core/doc/DocumentChartDataProviderManager.cxx b/sw/source/core/doc/DocumentChartDataProviderManager.cxx index 40ae086a56c1..c243eb37b1dc 100644 --- a/sw/source/core/doc/DocumentChartDataProviderManager.cxx +++ b/sw/source/core/doc/DocumentChartDataProviderManager.cxx @@ -20,6 +20,7 @@ #include <DocumentChartDataProviderManager.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <vcl/svapp.hxx> #include <swtable.hxx> #include <unochart.hxx> @@ -66,7 +67,7 @@ void DocumentChartDataProviderManager::CreateChartInternalDataProviders( const S ++aIdx; if( 0 != ( pONd = aIdx.GetNode().GetOLENode() ) && aName == pONd->GetChartTblName() /* OLE node is chart? */ && - 0 != (pONd->getLayoutFrm( m_rSwdoc.GetCurrentLayout() )) /* chart frame is not hidden */ ) + 0 != (pONd->getLayoutFrm( m_rSwdoc.getIDocumentLayoutAccess().GetCurrentLayout() )) /* chart frame is not hidden */ ) { uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef(); if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) ) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 73e2e660dfb6..684bff798b78 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -22,6 +22,7 @@ #include <IDocumentMarkAccess.hxx> #include <DocumentRedlineManager.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <UndoManager.hxx> #include <docary.hxx> #include <textboxhelper.hxx> @@ -1857,7 +1858,7 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) (FLY_AT_CHAR == pAnchor->GetAnchorId())) && aRg.aStart <= pAPos->nNode && pAPos->nNode <= aRg.aEnd ) { - m_rSwdoc.DelLayoutFmt( pFly ); + m_rSwdoc.getIDocumentLayoutAccess().DelLayoutFmt( pFly ); --n; } } @@ -2751,7 +2752,7 @@ SwDrawFrmFmt* DocumentContentOperationsManager::InsertDrawObj( SwDrawContact* pContact = new SwDrawContact( pFmt, &rDrawObj ); // Create Frames if necessary - if( m_rSwdoc.GetCurrentViewShell() ) + if( m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell() ) { // create layout representation pFmt->MakeFrms(); @@ -3367,7 +3368,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( // Copy the format and set the new anchor if( bMakeCpy ) - aVecSwFrmFmt.push_back( pDest->CopyLayoutFmt( *(*it).GetFmt(), + aVecSwFrmFmt.push_back( pDest->getIDocumentLayoutAccess().CopyLayoutFmt( *(*it).GetFmt(), aAnchor, false, true ) ); ++it; } diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index 6198f8941c55..dd574538046c 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -24,6 +24,7 @@ #include <DocumentSettingManager.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <sfx2/printer.hxx> #include <vcl/virdev.hxx> #include <vcl/outdev.hxx> @@ -301,7 +302,7 @@ void DocumentDeviceManager::PrtDataChanged() // #i41075# OSL_ENSURE( m_rSwdoc.getIDocumentSettingAccess().get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) || 0 != getPrinter( false ), "PrtDataChanged will be called recursively!" ); - SwRootFrm* pTmpRoot = m_rSwdoc.GetCurrentLayout(); + SwRootFrm* pTmpRoot = m_rSwdoc.getIDocumentLayoutAccess().GetCurrentLayout(); boost::scoped_ptr<SwWait> pWait; bool bEndAction = false; @@ -311,7 +312,7 @@ void DocumentDeviceManager::PrtDataChanged() bool bDraw = true; if ( pTmpRoot ) { - SwViewShell *pSh = m_rSwdoc.GetCurrentViewShell(); + SwViewShell *pSh = m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell(); if( pSh && (!pSh->GetViewOptions()->getBrowseMode() || pSh->GetViewOptions()->IsPrtFormat()) ) @@ -339,7 +340,7 @@ void DocumentDeviceManager::PrtDataChanged() pSh->InitPrt( getPrinter(false) ); pSh = (SwViewShell*)pSh->GetNext(); } - while ( pSh != m_rSwdoc.GetCurrentViewShell() ); + while ( pSh != m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell() ); } } if ( bDraw && m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() ) diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx index 495fb39cd1f1..ce0155554808 100644 --- a/sw/source/core/doc/DocumentDrawModelManager.cxx +++ b/sw/source/core/doc/DocumentDrawModelManager.cxx @@ -24,6 +24,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> #include <IDocumentLinksAdministration.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docsh.hxx> #include <swtypes.hxx> #include <swhints.hxx> @@ -149,9 +150,9 @@ void DocumentDrawModelManager::InitDrawModel() mpDrawModel->SetRefDevice( pRefDev ); mpDrawModel->SetNotifyUndoActionHdl( LINK( &m_rSwdoc, SwDoc, AddDrawUndo )); - if ( m_rSwdoc.GetCurrentViewShell() ) + if ( m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell() ) { - SwViewShell* pViewSh = m_rSwdoc.GetCurrentViewShell(); + SwViewShell* pViewSh = m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell(); do { SwRootFrm* pRoot = pViewSh->GetLayout(); @@ -166,7 +167,7 @@ void DocumentDrawModelManager::InitDrawModel() pDrawPage->SetSize( pRoot->Frm().SSize() ); } pViewSh = (SwViewShell*)pViewSh->GetNext(); - }while( pViewSh != m_rSwdoc.GetCurrentViewShell() ); + }while( pViewSh != m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell() ); } } @@ -211,14 +212,14 @@ SwDrawModel* DocumentDrawModelManager::_MakeDrawModel() { OSL_ENSURE( !mpDrawModel, "_MakeDrawModel: Why?" ); InitDrawModel(); - if ( m_rSwdoc.GetCurrentViewShell() ) + if ( m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell() ) { - SwViewShell* pTmp = m_rSwdoc.GetCurrentViewShell(); + SwViewShell* pTmp = m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell(); do { pTmp->MakeDrawView(); pTmp = (SwViewShell*) pTmp->GetNext(); - } while ( pTmp != m_rSwdoc.GetCurrentViewShell() ); + } while ( pTmp != m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell() ); // Broadcast, so that the FormShell can be connected to the DrawView if( m_rSwdoc.GetDocShell() ) diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index f21461900cd0..b9b3607cf9c5 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -21,6 +21,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <dbmgr.hxx> #include <chpfld.hxx> #include <dbfld.hxx> @@ -709,7 +710,7 @@ void DocumentFieldsManager::UpdateTblFlds( SfxPoolItem* pHt ) { // is in the special section, that's expensive! Point aPt; // return the first frame of the layout - Tab.Headline!! - pFrm = rTxtNd.getLayoutFrm( m_rSwdoc.GetCurrentLayout(), &aPt ); + pFrm = rTxtNd.getLayoutFrm( m_rSwdoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aPt ); if( pFrm ) { SwPosition aPos( *pTblNd ); @@ -779,7 +780,7 @@ void DocumentFieldsManager::UpdateTblFlds( SfxPoolItem* pHt ) if( !pCNd ) pCNd = m_rSwdoc.GetNodes().GoNext( &aCNdIdx ); - if( pCNd && 0 != (pFrm = pCNd->getLayoutFrm( m_rSwdoc.GetCurrentLayout(), &aPt )) ) + if( pCNd && 0 != (pFrm = pCNd->getLayoutFrm( m_rSwdoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aPt )) ) { SwPosition aPos( *pCNd ); if( GetBodyTxtNode( m_rSwdoc, aPos, *pFrm ) ) diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx new file mode 100644 index 000000000000..e504d6e2f5e1 --- /dev/null +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -0,0 +1,518 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <DocumentLayoutManager.hxx> +#include <doc.hxx> +#include <IDocumentState.hxx> +#include <IDocumentUndoRedo.hxx> +#include <DocumentContentOperationsManager.hxx> +#include <undobj.hxx> +#include <viewsh.hxx> +#include <layouter.hxx> +#include <poolfmt.hxx> +#include <frmfmt.hxx> +#include <fmtcntnt.hxx> +#include <fmtcnct.hxx> +#include <ndole.hxx> +#include <com/sun/star/embed/EmbedStates.hpp> +#include <fmtanchr.hxx> +#include <txtflcnt.hxx> +#include <fmtflcnt.hxx> +#include <ndtxt.hxx> +#include <dcontact.hxx> +#include <unoframe.hxx> +#include <docary.hxx> +#include <dcontact.hxx> + +using namespace ::com::sun::star; + +namespace sw +{ + +DocumentLayoutManager::DocumentLayoutManager( SwDoc& i_rSwdoc ) : + m_rSwdoc( i_rSwdoc ), + mpCurrentView( 0 ), + mpLayouter( 0 ) +{ +} + +const SwViewShell *DocumentLayoutManager::GetCurrentViewShell() const +{ + return mpCurrentView; +} + +SwViewShell *DocumentLayoutManager::GetCurrentViewShell() +{ + return mpCurrentView; +} + +void DocumentLayoutManager::SetCurrentViewShell( SwViewShell* pNew ) +{ + mpCurrentView = pNew; +} + +// It must be able to communicate to a SwViewShell. This is going to be removed later. +const SwRootFrm *DocumentLayoutManager::GetCurrentLayout() const +{ + if(GetCurrentViewShell()) + return GetCurrentViewShell()->GetLayout(); + return 0; +} + +SwRootFrm *DocumentLayoutManager::GetCurrentLayout() +{ + if(GetCurrentViewShell()) + return GetCurrentViewShell()->GetLayout(); + return 0; +} + +bool DocumentLayoutManager::HasLayout() const +{ + // if there is a view, there is always a layout + return (mpCurrentView != 0); +} + +SwLayouter* DocumentLayoutManager::GetLayouter() +{ + return mpLayouter; +} + +const SwLayouter* DocumentLayoutManager::GetLayouter() const +{ + return mpLayouter; +} + +void DocumentLayoutManager::SetLayouter( SwLayouter* pNew ) +{ + mpLayouter = pNew; +} + +/** Create a new format whose settings fit to the Request by default. + + The format is put into the respective format array. + If there already is a fitting format, it is returned instead. */ +SwFrmFmt *DocumentLayoutManager::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) +{ + SwFrmFmt *pFmt = 0; + const bool bMod = m_rSwdoc.getIDocumentState().IsModified(); + bool bHeader = false; + + switch ( eRequest ) + { + case RND_STD_HEADER: + case RND_STD_HEADERL: + case RND_STD_HEADERR: + { + bHeader = true; + // no break, we continue further down + } + case RND_STD_FOOTER: + case RND_STD_FOOTERL: + case RND_STD_FOOTERR: + { + pFmt = new SwFrmFmt( m_rSwdoc.GetAttrPool(), + (bHeader ? "Right header" : "Right footer"), + m_rSwdoc.GetDfltFrmFmt() ); + + SwNodeIndex aTmpIdx( m_rSwdoc.GetNodes().GetEndOfAutotext() ); + SwStartNode* pSttNd = + m_rSwdoc.GetNodes().MakeTextSection + ( aTmpIdx, + bHeader ? SwHeaderStartNode : SwFooterStartNode, + m_rSwdoc.GetTxtCollFromPool(static_cast<sal_uInt16>( bHeader + ? ( eRequest == RND_STD_HEADERL + ? RES_POOLCOLL_HEADERL + : eRequest == RND_STD_HEADERR + ? RES_POOLCOLL_HEADERR + : RES_POOLCOLL_HEADER ) + : ( eRequest == RND_STD_FOOTERL + ? RES_POOLCOLL_FOOTERL + : eRequest == RND_STD_FOOTERR + ? RES_POOLCOLL_FOOTERR + : RES_POOLCOLL_FOOTER ) + ) ) ); + pFmt->SetFmtAttr( SwFmtCntnt( pSttNd )); + + if( pSet ) // Set a few more attributes + pFmt->SetFmtAttr( *pSet ); + + // Why set it back? Doc has changed, or not? + // In any case, wrong for the FlyFrames! + if ( !bMod ) + m_rSwdoc.getIDocumentState().ResetModified(); + } + break; + + case RND_DRAW_OBJECT: + { + pFmt = m_rSwdoc.MakeDrawFrmFmt( OUString(), m_rSwdoc.GetDfltFrmFmt() ); + if( pSet ) // Set a few more attributes + pFmt->SetFmtAttr( *pSet ); + + if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo()) + { + m_rSwdoc.GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsLayFmt(pFmt, 0, 0)); + } + } + break; + +#if OSL_DEBUG_LEVEL > 0 + case FLY_AT_PAGE: + case FLY_AT_CHAR: + case FLY_AT_FLY: + case FLY_AT_PARA: + case FLY_AS_CHAR: + OSL_FAIL( "use new interface instead: SwDoc::MakeFlySection!" ); + break; +#endif + + default: + OSL_ENSURE( false, + "LayoutFormat was requested with an invalid Request." ); + + } + return pFmt; +} + +/// Deletes the denoted format and its content. +void DocumentLayoutManager::DelLayoutFmt( SwFrmFmt *pFmt ) +{ + // A chain of frames needs to be merged, if necessary, + // so that the Frame's contents are adjusted accordingly before we destroy the Frames. + const SwFmtChain &rChain = pFmt->GetChain(); + if ( rChain.GetPrev() ) + { + SwFmtChain aChain( rChain.GetPrev()->GetChain() ); + aChain.SetNext( rChain.GetNext() ); + m_rSwdoc.SetAttr( aChain, *rChain.GetPrev() ); + } + if ( rChain.GetNext() ) + { + SwFmtChain aChain( rChain.GetNext()->GetChain() ); + aChain.SetPrev( rChain.GetPrev() ); + m_rSwdoc.SetAttr( aChain, *rChain.GetNext() ); + } + + const SwNodeIndex* pCntIdx = 0; + // The draw format doesn't own its content, it just has a pointer to it. + if (pFmt->Which() != RES_DRAWFRMFMT) + pCntIdx = pFmt->GetCntnt().GetCntntIdx(); + if (pCntIdx && !m_rSwdoc.GetIDocumentUndoRedo().DoesUndo()) + { + // Disconnect if it's an OLE object + SwOLENode* pOLENd = m_rSwdoc.GetNodes()[ pCntIdx->GetIndex()+1 ]->GetOLENode(); + if( pOLENd && pOLENd->GetOLEObj().IsOleRef() ) + { + + // TODO: the old object closed the object and cleared all references to it, but didn't remove it from the container. + // I have no idea, why, nobody could explain it - so I do my very best to mimic this behavior + //uno::Reference < util::XCloseable > xClose( pOLENd->GetOLEObj().GetOleRef(), uno::UNO_QUERY ); + //if ( xClose.is() ) + { + try + { + pOLENd->GetOLEObj().GetOleRef()->changeState( embed::EmbedStates::LOADED ); + } + catch ( uno::Exception& ) + { + } + } + + } + } + + // Destroy Frames + pFmt->DelFrms(); + + // Only FlyFrames are undoable at first + const sal_uInt16 nWh = pFmt->Which(); + if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo() && + (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh)) + { + m_rSwdoc.GetIDocumentUndoRedo().AppendUndo( new SwUndoDelLayFmt( pFmt )); + } + else + { + // #i32089# - delete at-frame anchored objects + if ( nWh == RES_FLYFRMFMT ) + { + // determine frame formats of at-frame anchored objects + const SwNodeIndex* pCntntIdx = 0; + if (pFmt->Which() != RES_DRAWFRMFMT) + pCntntIdx = pFmt->GetCntnt().GetCntntIdx(); + if (pCntntIdx) + { + const SwFrmFmts* pTbl = pFmt->GetDoc()->GetSpzFrmFmts(); + if ( pTbl ) + { + std::vector<SwFrmFmt*> aToDeleteFrmFmts; + const sal_uLong nNodeIdxOfFlyFmt( pCntntIdx->GetIndex() ); + + for ( sal_uInt16 i = 0; i < pTbl->size(); ++i ) + { + SwFrmFmt* pTmpFmt = (*pTbl)[i]; + const SwFmtAnchor &rAnch = pTmpFmt->GetAnchor(); + if ( rAnch.GetAnchorId() == FLY_AT_FLY && + rAnch.GetCntntAnchor()->nNode.GetIndex() == nNodeIdxOfFlyFmt ) + { + aToDeleteFrmFmts.push_back( pTmpFmt ); + } + } + + // delete found frame formats + while ( !aToDeleteFrmFmts.empty() ) + { + SwFrmFmt* pTmpFmt = aToDeleteFrmFmts.back(); + pFmt->GetDoc()->getIDocumentLayoutAccess().DelLayoutFmt( pTmpFmt ); + + aToDeleteFrmFmts.pop_back(); + } + } + } + } + + // Delete content + if( pCntIdx ) + { + SwNode *pNode = &pCntIdx->GetNode(); + ((SwFmtCntnt&)pFmt->GetFmtAttr( RES_CNTNT )).SetNewCntntIdx( 0 ); + m_rSwdoc.getIDocumentContentOperations().DeleteSection( pNode ); + } + + // Delete the character for FlyFrames anchored as char (if necessary) + const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); + if ((FLY_AS_CHAR == rAnchor.GetAnchorId()) && rAnchor.GetCntntAnchor()) + { + const SwPosition* pPos = rAnchor.GetCntntAnchor(); + SwTxtNode *pTxtNd = pPos->nNode.GetNode().GetTxtNode(); + + // attribute is still in text node, delete it + if ( pTxtNd ) + { + SwTxtFlyCnt* const pAttr = static_cast<SwTxtFlyCnt*>( + pTxtNd->GetTxtAttrForCharAt( pPos->nContent.GetIndex(), + RES_TXTATR_FLYCNT )); + if ( pAttr && (pAttr->GetFlyCnt().GetFrmFmt() == pFmt) ) + { + // dont delete, set pointer to 0 + const_cast<SwFmtFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFmt(); + SwIndex aIdx( pPos->nContent ); + pTxtNd->EraseText( aIdx, 1 ); + } + } + } + + m_rSwdoc.DelFrmFmt( pFmt ); + } + m_rSwdoc.getIDocumentState().SetModified(); +} + +/** Copies the stated format (pSrc) to pDest and returns pDest. + + If there's no pDest, it is created. + If the source format is located in another document, also copy correctly + in this case. + The Anchor attribute's position is always set to 0! */ +SwFrmFmt *DocumentLayoutManager::CopyLayoutFmt( + const SwFrmFmt& rSource, + const SwFmtAnchor& rNewAnchor, + bool bSetTxtFlyAtt, + bool bMakeFrms ) +{ + const bool bFly = RES_FLYFRMFMT == rSource.Which(); + const bool bDraw = RES_DRAWFRMFMT == rSource.Which(); + OSL_ENSURE( bFly || bDraw, "this method only works for fly or draw" ); + + SwDoc* pSrcDoc = (SwDoc*)rSource.GetDoc(); + + // May we copy this object? + // We may, unless it's 1) it's a control (and therfore a draw) + // 2) anchored in a header/footer + // 3) anchored (to paragraph?) + bool bMayNotCopy = false; + if( bDraw ) + { + const SwDrawContact* pDrawContact = + static_cast<const SwDrawContact*>( rSource.FindContactObj() ); + + bMayNotCopy = + ((FLY_AT_PARA == rNewAnchor.GetAnchorId()) || + (FLY_AT_FLY == rNewAnchor.GetAnchorId()) || + (FLY_AT_CHAR == rNewAnchor.GetAnchorId())) && + rNewAnchor.GetCntntAnchor() && + m_rSwdoc.IsInHeaderFooter( rNewAnchor.GetCntntAnchor()->nNode ) && + pDrawContact != NULL && + pDrawContact->GetMaster() != NULL && + CheckControlLayer( pDrawContact->GetMaster() ); + } + + // just return if we can't copy this + if( bMayNotCopy ) + return NULL; + + SwFrmFmt* pDest = m_rSwdoc.GetDfltFrmFmt(); + if( rSource.GetRegisteredIn() != pSrcDoc->GetDfltFrmFmt() ) + pDest = m_rSwdoc.CopyFrmFmt( *(SwFrmFmt*)rSource.GetRegisteredIn() ); + if( bFly ) + { + // #i11176# + // To do a correct cloning concerning the ZOrder for all objects + // it is necessary to actually create a draw object for fly frames, too. + // These are then added to the DrawingLayer (which needs to exist). + // Together with correct sorting of all drawinglayer based objects + // before cloning ZOrder transfer works correctly then. + SwFlyFrmFmt *pFormat = m_rSwdoc.MakeFlyFrmFmt( rSource.GetName(), pDest ); + pDest = pFormat; + + SwXFrame::GetOrCreateSdrObject(*pFormat); + } + else + pDest = m_rSwdoc.MakeDrawFrmFmt( OUString(), pDest ); + + // Copy all other or new attributes + pDest->CopyAttrs( rSource ); + + // Do not copy chains + pDest->ResetFmtAttr( RES_CHAIN ); + + if( bFly ) + { + // Duplicate the content. + const SwNode& rCSttNd = rSource.GetCntnt().GetCntntIdx()->GetNode(); + SwNodeRange aRg( rCSttNd, 1, *rCSttNd.EndOfSectionNode() ); + + SwNodeIndex aIdx( m_rSwdoc.GetNodes().GetEndOfAutotext() ); + SwStartNode* pSttNd = m_rSwdoc.GetNodes().MakeEmptySection( aIdx, SwFlyStartNode ); + + // Set the Anchor/CntntIndex first. + // Within the copying part, we can access the values (DrawFmt in Headers and Footers) + aIdx = *pSttNd; + SwFmtCntnt aAttr( rSource.GetCntnt() ); + aAttr.SetNewCntntIdx( &aIdx ); + pDest->SetFmtAttr( aAttr ); + pDest->SetFmtAttr( rNewAnchor ); + + if( !m_rSwdoc.IsCopyIsMove() || &m_rSwdoc != pSrcDoc ) + { + if( m_rSwdoc.IsInReading() ) + pDest->SetName( OUString() ); + else + { + // Test first if the name is already taken, if so generate a new one. + sal_Int8 nNdTyp = aRg.aStart.GetNode().GetNodeType(); + + OUString sOld( pDest->GetName() ); + pDest->SetName( OUString() ); + if( m_rSwdoc.FindFlyByName( sOld, nNdTyp ) ) // found one + switch( nNdTyp ) + { + case ND_GRFNODE: sOld = m_rSwdoc.GetUniqueGrfName(); break; + case ND_OLENODE: sOld = m_rSwdoc.GetUniqueOLEName(); break; + default: sOld = m_rSwdoc.GetUniqueFrameName(); break; + } + + pDest->SetName( sOld ); + } + } + + if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo()) + { + m_rSwdoc.GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0)); + } + + // Make sure that FlyFrames in FlyFrames are copied + aIdx = *pSttNd->EndOfSectionNode(); + + //fdo#36631 disable (scoped) any undo operations associated with the + //contact object itself. They should be managed by SwUndoInsLayFmt. + const ::sw::DrawUndoGuard drawUndoGuard(m_rSwdoc.GetIDocumentUndoRedo()); + + pSrcDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aIdx, NULL, false, true, true ); + } + else + { + OSL_ENSURE( RES_DRAWFRMFMT == rSource.Which(), "Neither Fly nor Draw." ); + // #i52780# - Note: moving object to visible layer not needed. + SwDrawContact* pSourceContact = (SwDrawContact *)rSource.FindContactObj(); + + SwDrawContact* pContact = new SwDrawContact( (SwDrawFrmFmt*)pDest, + m_rSwdoc.CloneSdrObj( *pSourceContact->GetMaster(), + m_rSwdoc.IsCopyIsMove() && &m_rSwdoc == pSrcDoc ) ); + // #i49730# - notify draw frame format that position attributes are + // already set, if the position attributes are already set at the + // source draw frame format. + if ( pDest->ISA(SwDrawFrmFmt) && + rSource.ISA(SwDrawFrmFmt) && + static_cast<const SwDrawFrmFmt&>(rSource).IsPosAttrSet() ) + { + static_cast<SwDrawFrmFmt*>(pDest)->PosAttrSet(); + } + + if( pDest->GetAnchor() == rNewAnchor ) + { + // Do *not* connect to layout, if a <MakeFrms> will not be called. + if ( bMakeFrms ) + { + pContact->ConnectToLayout( &rNewAnchor ); + } + } + else + pDest->SetFmtAttr( rNewAnchor ); + + if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo()) + { + m_rSwdoc.GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0)); + } + } + + if (bSetTxtFlyAtt && (FLY_AS_CHAR == rNewAnchor.GetAnchorId())) + { + const SwPosition* pPos = rNewAnchor.GetCntntAnchor(); + SwFmtFlyCnt aFmt( pDest ); + pPos->nNode.GetNode().GetTxtNode()->InsertItem( + aFmt, pPos->nContent.GetIndex(), 0 ); + } + + if( bMakeFrms ) + pDest->MakeFrms(); + + return pDest; +} + +//Load document from fdo#42534 under valgrind, drag the scrollbar down so full +//document layout is triggered. Close document before layout has completed, and +//SwAnchoredObject objects deleted by the deletion of layout remain referenced +//by the SwLayouter +void DocumentLayoutManager::ClearSwLayouterEntries() +{ + SwLayouter::ClearMovedFwdFrms( m_rSwdoc ); + SwLayouter::ClearObjsTmpConsiderWrapInfluence( m_rSwdoc ); + // #i65250# + SwLayouter::ClearMoveBwdLayoutInfo( m_rSwdoc ); +} + +DocumentLayoutManager::~DocumentLayoutManager() +{ + delete mpLayouter; + mpLayouter = 0L; +} + +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 4cd87255a8f1..f1cf0f3a8c02 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -23,6 +23,7 @@ #include <DocumentSettingManager.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <sfx2/objsh.hxx> #include <sfx2/linkmgr.hxx> #include <sfx2/docfile.hxx> @@ -229,7 +230,7 @@ void DocumentLinksAdministrationManager::UpdateLinks( bool bUI ) SfxMedium* pMedium = m_rSwdoc.GetDocShell()->GetMedium(); SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0; Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0; - if( m_rSwdoc.GetCurrentViewShell() && !m_rSwdoc.GetEditShell( &pVSh ) && !pVSh ) + if( m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell() && !m_rSwdoc.GetEditShell( &pVSh ) && !pVSh ) { SwViewShell aVSh( m_rSwdoc, 0, 0 ); diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 79cffb62a8f9..f192f722bf26 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -21,6 +21,7 @@ #include <doc.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <comphelper/processfactory.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svx/svdmodel.hxx> @@ -399,7 +400,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLan pDrawModel->ReformatAllTextObjects(); } - SwRootFrm* pTmpRoot = m_rDoc.GetCurrentLayout(); + SwRootFrm* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout(); if( pTmpRoot && !m_rDoc.IsInReading() ) { pTmpRoot->StartAllAction(); @@ -469,7 +470,7 @@ void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharComp pDrawModel->ReformatAllTextObjects(); } - SwRootFrm* pTmpRoot = m_rDoc.GetCurrentLayout(); + SwRootFrm* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout(); if( pTmpRoot && !m_rDoc.IsInReading() ) { pTmpRoot->StartAllAction(); diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx index 9b65443deb26..568920c974a3 100644 --- a/sw/source/core/doc/DocumentStateManager.cxx +++ b/sw/source/core/doc/DocumentStateManager.cxx @@ -20,6 +20,7 @@ #include <doc.hxx> #include <DocumentStatisticsManager.hxx> #include <IDocumentUndoRedo.hxx> +#include <DocumentLayoutManager.hxx> #include <docstat.hxx> #include <acorrect.hxx> @@ -39,7 +40,7 @@ DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) : void DocumentStateManager::SetModified() { - m_rSwdoc.ClearSwLayouterEntries(); + m_rSwdoc.GetDocumentLayoutManager().ClearSwLayouterEntries(); // give the old and new modified state to the link // Bit 0: -> old state // Bit 1: -> new state diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx index 0434eebedcff..8987fb09bbf0 100644 --- a/sw/source/core/doc/DocumentStatisticsManager.cxx +++ b/sw/source/core/doc/DocumentStatisticsManager.cxx @@ -22,6 +22,7 @@ #include <docsh.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <view.hxx> #include <ndtxt.hxx> #include <switerator.hxx> @@ -169,7 +170,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF } } - mpDocStat->nPage = m_rSwdoc.GetCurrentLayout() ? m_rSwdoc.GetCurrentLayout()->GetPageNum() : 0; + mpDocStat->nPage = m_rSwdoc.getIDocumentLayoutAccess().GetCurrentLayout() ? m_rSwdoc.getIDocumentLayoutAccess().GetCurrentLayout()->GetPageNum() : 0; mpDocStat->bModified = false; com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aStat( mpDocStat->nPage ? 8 : 7); diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index 3acbaf973a80..180b50b46d61 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -21,6 +21,7 @@ #include <doc.hxx> #include <DocumentSettingManager.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> #include <viewsh.hxx> #include <unotools/lingucfg.hxx> @@ -84,12 +85,12 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer *, pTimer ) pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" ); #endif - SwRootFrm* pTmpRoot = m_rSwdoc.GetCurrentLayout(); + SwRootFrm* pTmpRoot = m_rSwdoc.getIDocumentLayoutAccess().GetCurrentLayout(); if( pTmpRoot && !SfxProgress::GetActiveProgress( m_rSwdoc.GetDocShell() ) ) { SwViewShell *pSh, *pStartSh; - pSh = pStartSh = m_rSwdoc.GetCurrentViewShell(); + pSh = pStartSh = m_rSwdoc.getIDocumentLayoutAccess().GetCurrentViewShell(); do { if( pSh->ActionPend() ) { diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 0ce75a9093f4..7a30e1a05d9d 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -32,6 +32,7 @@ #include <DocumentFieldsManager.hxx> #include <DocumentStatisticsManager.hxx> #include <DocumentStateManager.hxx> +#include <DocumentLayoutManager.hxx> #include <UndoManager.hxx> #include <hintids.hxx> #include <tools/shl.hxx> @@ -450,6 +451,27 @@ IDocumentState & SwDoc::getIDocumentState() return *m_pDocumentStateManager; } +//IDocumentLayoutAccess +IDocumentLayoutAccess const & SwDoc::getIDocumentLayoutAccess() const +{ + return *m_pDocumentLayoutManager; +} + +IDocumentLayoutAccess & SwDoc::getIDocumentLayoutAccess() +{ + return *m_pDocumentLayoutManager; +} + +::sw::DocumentLayoutManager const & SwDoc::GetDocumentLayoutManager() const +{ + return *m_pDocumentLayoutManager; +} + +::sw::DocumentLayoutManager & SwDoc::GetDocumentLayoutManager() +{ + return *m_pDocumentLayoutManager; +} + /* Implementations the next Interface here */ /* @@ -1047,18 +1069,6 @@ sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const return nCount; } -//Load document from fdo#42534 under valgrind, drag the scrollbar down so full -//document layout is triggered. Close document before layout has completed, and -//SwAnchoredObject objects deleted by the deletion of layout remain referenced -//by the SwLayouter -void SwDoc::ClearSwLayouterEntries() -{ - SwLayouter::ClearMovedFwdFrms( *this ); - SwLayouter::ClearObjsTmpConsiderWrapInfluence( *this ); - // #i65250# - SwLayouter::ClearMoveBwdLayoutInfo( *this ); -} - static bool lcl_SpellAndGrammarAgain( const SwNodePtr& rpNd, void* pArgs ) { SwTxtNode *pTxtNode = (SwTxtNode*)rpNd->GetTxtNode(); @@ -1113,7 +1123,7 @@ static bool lcl_CheckSmartTagsAgain( const SwNodePtr& rpNd, void* ) void SwDoc::SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags ) { std::set<SwRootFrm*> aAllLayouts = GetAllLayouts(); - OSL_ENSURE( GetCurrentLayout(), "SpellAgain: Where's my RootFrm?" ); + OSL_ENSURE( getIDocumentLayoutAccess().GetCurrentLayout(), "SpellAgain: Where's my RootFrm?" ); if( bInvalid ) { std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::AllInvalidateSmartTagsOrSpelling),bSmartTags)); @@ -1128,7 +1138,7 @@ void SwDoc::SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags ) void SwDoc::InvalidateAutoCompleteFlag() { - SwRootFrm* pTmpRoot = GetCurrentLayout(); + SwRootFrm* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); if( pTmpRoot ) { std::set<SwRootFrm*> aAllLayouts = GetAllLayouts(); diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index 898809912971..5430bb6d51a6 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -18,6 +18,7 @@ */ #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <node.hxx> #include <rootfrm.hxx> #include <editsh.hxx> @@ -323,10 +324,11 @@ void SwDoc::CorrRel(const SwNodeIndex& rOldNode, SwEditShell* SwDoc::GetEditShell( SwViewShell** ppSh ) const { + SwViewShell *pCurrentView = const_cast<SwViewShell*>( getIDocumentLayoutAccess().GetCurrentViewShell() ); // Layout and OLE shells should be available - if( mpCurrentView ) + if( pCurrentView ) { - SwViewShell *pSh = mpCurrentView, *pVSh = pSh; + SwViewShell *pSh = pCurrentView, *pVSh = pSh; if( ppSh ) *ppSh = pSh; diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 7ae3f566c02e..c6eafa0c4781 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -37,6 +37,7 @@ #include <IDocumentFieldsAccess.hxx> #include <DocumentContentOperationsManager.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <rootfrm.hxx> #include <frmtool.hxx> @@ -238,7 +239,7 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, const SwFmtHeader &rFmtHead = rDescFrmFmt.GetHeader(); if ( !rFmtHead.IsActive() ) { - SwFmtHeader aHead( MakeLayoutFmt( RND_STD_HEADERL, 0 ) ); + SwFmtHeader aHead( getIDocumentLayoutAccess().MakeLayoutFmt( RND_STD_HEADERL, 0 ) ); rDescFrmFmt.SetFmtAttr( aHead ); // take over additional attributes (margins, borders ...) ::lcl_DescSetAttr( *rHead.GetHeaderFmt(), *aHead.GetHeaderFmt(), false); @@ -315,7 +316,7 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, const SwFmtFooter &rFmtFoot = rDescFrmFmt.GetFooter(); if ( !rFmtFoot.IsActive() ) { - SwFmtFooter aFoot( MakeLayoutFmt( RND_STD_FOOTER, 0 ) ); + SwFmtFooter aFoot( getIDocumentLayoutAccess().MakeLayoutFmt( RND_STD_FOOTER, 0 ) ); rDescFrmFmt.SetFmtAttr( aFoot ); // Take over additional attributes (margins, borders ...). ::lcl_DescSetAttr( *rFoot.GetFooterFmt(), *aFoot.GetFooterFmt(), false); @@ -369,7 +370,7 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) OSL_ENSURE( i < maPageDescs.size(), "PageDescs is out of range." ); SwPageDesc *pDesc = maPageDescs[i]; - SwRootFrm* pTmpRoot = GetCurrentLayout(); + SwRootFrm* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); if (GetIDocumentUndoRedo().DoesUndo()) { @@ -550,7 +551,7 @@ void SwDoc::PreDelPageDesc(SwPageDesc * pDel) SwPageDescHint aHint( maPageDescs[0] ); pDel->CallSwClientNotify( aHint ); - bool bHasLayout = HasLayout(); + bool bHasLayout = getIDocumentLayoutAccess().HasLayout(); if ( mpFtnInfo->DependsOn( pDel ) ) { mpFtnInfo->ChgPageDesc( maPageDescs[0] ); @@ -698,14 +699,14 @@ extern std::vector<SvGlobalName*> *pGlobalOLEExcludeList; void SwDoc::PrtOLENotify( bool bAll ) { SwFEShell *pShell = 0; - if ( GetCurrentViewShell() ) + if ( getIDocumentLayoutAccess().GetCurrentViewShell() ) { - SwViewShell *pSh = GetCurrentViewShell(); + SwViewShell *pSh = getIDocumentLayoutAccess().GetCurrentViewShell(); if ( !pSh->ISA(SwFEShell) ) do { pSh = (SwViewShell*)pSh->GetNext(); } while ( !pSh->ISA(SwFEShell) && - pSh != GetCurrentViewShell() ); + pSh != getIDocumentLayoutAccess().GetCurrentViewShell() ); if ( pSh->ISA(SwFEShell) ) pShell = (SwFEShell*)pSh; @@ -733,7 +734,7 @@ void SwDoc::PrtOLENotify( bool bAll ) { ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY, 0, pNodes->size(), GetDocShell()); - GetCurrentLayout()->StartAllAction(); + getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction(); for( sal_uInt16 i = 0; i < pNodes->size(); ++i ) { @@ -772,7 +773,7 @@ void SwDoc::PrtOLENotify( bool bAll ) } } delete pNodes; - GetCurrentLayout()->EndAllAction(); + getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction(); ::EndProgress( GetDocShell() ); } } @@ -790,7 +791,7 @@ IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, ) { ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY, 0, pNodes->size(), GetDocShell()); - GetCurrentLayout()->StartAllAction(); + getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction(); SwMsgPoolItem aMsgHint( RES_UPDATE_ATTR ); for( sal_uInt16 i = 0; i < pNodes->size(); ++i ) @@ -807,7 +808,7 @@ IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, ) pOLENd->ModifyNotification( &aMsgHint, &aMsgHint ); } } - GetCurrentLayout()->EndAllAction(); + getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction(); ::EndProgress( GetDocShell() ); delete pNodes; } diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index d2cd1a009631..99017251d08f 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -43,6 +43,7 @@ #include <IDocumentDeviceAccess.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docsh.hxx> #include <rootfrm.hxx> #include <poolfmt.hxx> @@ -400,7 +401,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetFmt(); if( pFrmFmt ) { - DelLayoutFmt( pFrmFmt ); + getIDocumentLayoutAccess().DelLayoutFmt( pFrmFmt ); bDelMarked = false; } } @@ -418,7 +419,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) { rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), true ); --i; - DelLayoutFmt( pFrmFmt ); + getIDocumentLayoutAccess().DelLayoutFmt( pFrmFmt ); } } } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 7de0dced3ab3..1b46038e5ee8 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -24,6 +24,7 @@ #include <UndoManager.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docsh.hxx> #include <docary.hxx> #include <doctxm.hxx> @@ -77,7 +78,7 @@ void _RestFlyInRange( _SaveFlyArr & rArr, const SwNodeIndex& rSttIdx, pFmt->GetDoc()->GetSpzFrmFmts()->push_back( pFmt ); pFmt->SetFmtAttr( aAnchor ); SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode(); - if( pCNd && pCNd->getLayoutFrm( pFmt->GetDoc()->GetCurrentLayout(), 0, 0, false ) ) + if( pCNd && pCNd->getLayoutFrm( pFmt->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false ) ) pFmt->MakeFrms(); } } @@ -211,7 +212,7 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx, i = rTbl.GetPos( pFmt ); } - pDoc->DelLayoutFmt( pFmt ); + pDoc->getIDocumentLayoutAccess().DelLayoutFmt( pFmt ); // DelLayoutFmt can also trigger the deletion of objects. if( i > rTbl.size() ) @@ -511,7 +512,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, switch( pNd->GetNodeType() ) { case ND_TEXTNODE: - if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( GetCurrentLayout() )) ) + if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( getIDocumentLayoutAccess().GetCurrentLayout() )) ) { // skip protected and hidden Cells and Flys if( pCntFrm->IsProtected() ) @@ -739,7 +740,7 @@ static bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs ) SwHyphArgs *pHyphArgs = (SwHyphArgs*)pArgs; if( pNode ) { - SwCntntFrm* pCntFrm = pNode->getLayoutFrm( pNode->GetDoc()->GetCurrentLayout() ); + SwCntntFrm* pCntFrm = pNode->getLayoutFrm( pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); if( pCntFrm && !((SwTxtFrm*)pCntFrm)->IsHiddenNow() ) { sal_uInt16 *pPageSt = pHyphArgs->GetPageSt(); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 40361c277f0f..0faa281a7c8b 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -32,6 +32,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -1012,7 +1013,7 @@ void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, sal_uInt16 nFldWhich ) // always the first! (in tab headline, header-/footer) Point aPt; - const SwCntntFrm* pFrm = rTxtNd.getLayoutFrm( rDoc.GetCurrentLayout(), &aPt, 0, false ); + const SwCntntFrm* pFrm = rTxtNd.getLayoutFrm( rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); _SetGetExpFld* pNew = NULL; bool bIsInBody = false; @@ -1077,7 +1078,7 @@ void SwDocUpdtFld::GetBodyNode( const SwSectionNode& rSectNd ) // always the first! (in tab headline, header-/footer) Point aPt; - const SwCntntFrm* pFrm = pCNd->getLayoutFrm( rDoc.GetCurrentLayout(), &aPt, 0, false ); + const SwCntntFrm* pFrm = pCNd->getLayoutFrm( rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); if( !pFrm ) break; diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 90d07f9ac7bf..6b96e962b0cc 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -33,6 +33,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <ndindex.hxx> #include <docary.hxx> #include <drawdoc.hxx> @@ -174,7 +175,7 @@ static Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, const SwFrmFmt* pFlyFmt ) { Point aRet; - if( rDoc.GetCurrentViewShell() ) + if( rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() ) switch( rAnch.GetAnchorId() ) { case FLY_AS_CHAR: @@ -192,7 +193,7 @@ static Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, { const SwPosition *pPos = rAnch.GetCntntAnchor(); const SwCntntNode* pNd = pPos->nNode.GetNode().GetCntntNode(); - const SwFrm* pOld = pNd ? pNd->getLayoutFrm( rDoc.GetCurrentLayout(), &aRet, 0, false ) : 0; + const SwFrm* pOld = pNd ? pNd->getLayoutFrm( rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aRet, 0, false ) : 0; if( pOld ) aRet = pOld->Frm().Pos(); } @@ -212,7 +213,7 @@ static Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, case FLY_AT_PAGE: { sal_uInt16 nPgNum = rAnch.GetPageNum(); - const SwPageFrm *pPage = (SwPageFrm*)rDoc.GetCurrentLayout()->Lower(); + const SwPageFrm *pPage = (SwPageFrm*)rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->Lower(); for( sal_uInt16 i = 1; (i <= nPgNum) && pPage; ++i, pPage = (const SwPageFrm*)pPage->GetNext() ) if( i == nPgNum ) @@ -683,7 +684,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, const bool _bSameOnly, const bool _bPosCorr ) { - OSL_ENSURE( GetCurrentLayout(), "No layout!" ); + OSL_ENSURE( getIDocumentLayoutAccess().GetCurrentLayout(), "No layout!" ); if ( !_rMrkList.GetMarkCount() || _rMrkList.GetMark( 0 )->GetMarkedSdrObj()->GetUpGroup() ) @@ -777,11 +778,11 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, SwPosition aPos( GetNodes() ); Point aPoint( aPt ); aPoint.setX(aPoint.getX() - 1); - GetCurrentLayout()->GetCrsrOfst( &aPos, aPoint, &aState ); + getIDocumentLayoutAccess().GetCurrentLayout()->GetCrsrOfst( &aPos, aPoint, &aState ); // consider that drawing objects can be in // header/footer. Thus, <GetFrm()> by left-top-corner pTxtFrm = aPos.nNode.GetNode(). - GetCntntNode()->getLayoutFrm( GetCurrentLayout(), &aPt, 0, false ); + GetCntntNode()->getLayoutFrm( getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); } const SwFrm *pTmp = ::FindAnchor( pTxtFrm, aPt ); pNewAnchorFrm = pTmp->FindFlyFrm(); @@ -799,7 +800,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } case FLY_AT_PAGE: { - pNewAnchorFrm = GetCurrentLayout()->Lower(); + pNewAnchorFrm = getIDocumentLayoutAccess().GetCurrentLayout()->Lower(); while ( pNewAnchorFrm && !pNewAnchorFrm->Frm().IsInside( aPt ) ) pNewAnchorFrm = pNewAnchorFrm->GetNext(); if ( !pNewAnchorFrm ) @@ -838,7 +839,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, // We need to find a TextNode, because only there we can anchor a // content-bound DrawObject. SwCrsrMoveState aState( MV_SETONLYTEXT ); - GetCurrentLayout()->GetCrsrOfst( &aPos, aPoint, &aState ); + getIDocumentLayoutAccess().GetCurrentLayout()->GetCrsrOfst( &aPos, aPoint, &aState ); } else { diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index caa93c7f5d18..5d5afa69ba45 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -40,6 +40,7 @@ #include <DocumentContentOperationsManager.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <hints.hxx> @@ -1396,7 +1397,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, bool bCopyPoolIds ) { bool bNotifyLayout = false; - SwRootFrm* pTmpRoot = GetCurrentLayout(); + SwRootFrm* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); rDstDesc.SetLandscape( rSrcDesc.GetLandscape() ); rDstDesc.SetNumType( rSrcDesc.GetNumType() ); diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 505271417b6a..de88a23d37f0 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -31,6 +31,7 @@ #include <IDocumentFieldsAccess.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <ndtxt.hxx> #include <poolfmt.hxx> #include <ftninfo.hxx> @@ -249,7 +250,7 @@ SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) : void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo) { - SwRootFrm* pTmpRoot = GetCurrentLayout(); + SwRootFrm* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); if( !(GetFtnInfo() == rInfo) ) { const SwFtnInfo &rOld = GetFtnInfo(); @@ -318,7 +319,7 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo) void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) { - SwRootFrm* pTmpRoot = GetCurrentLayout(); + SwRootFrm* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); if( !(GetEndNoteInfo() == rInfo) ) { if(GetIDocumentUndoRedo().DoesUndo()) @@ -388,7 +389,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const OUString& rNumStr, sal_uInt16 nNumber, bool bIsEndNote ) { SwFtnIdxs& rFtnArr = GetFtnIdxs(); - SwRootFrm* pTmpRoot = GetCurrentLayout(); + SwRootFrm* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End(); const sal_uLong nSttNd = pStt->nNode.GetIndex(); diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index b74340a7f6f8..422f6fd5dc75 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -35,6 +35,7 @@ #include <IDocumentRedlineAccess.hxx> #include <DocumentSettingManager.hxx> #include <DocumentContentOperationsManager.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -387,7 +388,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, aSIdx <= pAPos->nNode && pAPos->nNode < aEIdx ) { - DelLayoutFmt( pFly ); + getIDocumentLayoutAccess().DelLayoutFmt( pFly ); --n; } } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index e89f265b9569..9e319be247bc 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -68,6 +68,7 @@ #include <DocumentContentOperationsManager.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> @@ -113,399 +114,6 @@ static bool lcl_IsItemSet(const SwCntntNode & rNode, sal_uInt16 which) return bResult; } -/** Create a new format whose settings fit to the Request by default. - - The format is put into the respective format array. - If there already is a fitting format, it is returned instead. */ -SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) -{ - SwFrmFmt *pFmt = 0; - const bool bMod = getIDocumentState().IsModified(); - bool bHeader = false; - - switch ( eRequest ) - { - case RND_STD_HEADER: - case RND_STD_HEADERL: - case RND_STD_HEADERR: - { - bHeader = true; - // no break, we continue further down - } - case RND_STD_FOOTER: - case RND_STD_FOOTERL: - case RND_STD_FOOTERR: - { - pFmt = new SwFrmFmt( GetAttrPool(), - (bHeader ? "Right header" : "Right footer"), - GetDfltFrmFmt() ); - - SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() ); - SwStartNode* pSttNd = - GetNodes().MakeTextSection - ( aTmpIdx, - bHeader ? SwHeaderStartNode : SwFooterStartNode, - GetTxtCollFromPool(static_cast<sal_uInt16>( bHeader - ? ( eRequest == RND_STD_HEADERL - ? RES_POOLCOLL_HEADERL - : eRequest == RND_STD_HEADERR - ? RES_POOLCOLL_HEADERR - : RES_POOLCOLL_HEADER ) - : ( eRequest == RND_STD_FOOTERL - ? RES_POOLCOLL_FOOTERL - : eRequest == RND_STD_FOOTERR - ? RES_POOLCOLL_FOOTERR - : RES_POOLCOLL_FOOTER ) - ) ) ); - pFmt->SetFmtAttr( SwFmtCntnt( pSttNd )); - - if( pSet ) // Set a few more attributes - pFmt->SetFmtAttr( *pSet ); - - // Why set it back? Doc has changed, or not? - // In any case, wrong for the FlyFrames! - if ( !bMod ) - getIDocumentState().ResetModified(); - } - break; - - case RND_DRAW_OBJECT: - { - pFmt = MakeDrawFrmFmt( OUString(), GetDfltFrmFmt() ); - if( pSet ) // Set a few more attributes - pFmt->SetFmtAttr( *pSet ); - - if (GetIDocumentUndoRedo().DoesUndo()) - { - GetIDocumentUndoRedo().AppendUndo( - new SwUndoInsLayFmt(pFmt, 0, 0)); - } - } - break; - -#if OSL_DEBUG_LEVEL > 0 - case FLY_AT_PAGE: - case FLY_AT_CHAR: - case FLY_AT_FLY: - case FLY_AT_PARA: - case FLY_AS_CHAR: - OSL_FAIL( "use new interface instead: SwDoc::MakeFlySection!" ); - break; -#endif - - default: - OSL_ENSURE( false, - "LayoutFormat was requested with an invalid Request." ); - - } - return pFmt; -} - -/// Deletes the denoted format and its content. -void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt ) -{ - // A chain of frames needs to be merged, if necessary, - // so that the Frame's contents are adjusted accordingly before we destroy the Frames. - const SwFmtChain &rChain = pFmt->GetChain(); - if ( rChain.GetPrev() ) - { - SwFmtChain aChain( rChain.GetPrev()->GetChain() ); - aChain.SetNext( rChain.GetNext() ); - SetAttr( aChain, *rChain.GetPrev() ); - } - if ( rChain.GetNext() ) - { - SwFmtChain aChain( rChain.GetNext()->GetChain() ); - aChain.SetPrev( rChain.GetPrev() ); - SetAttr( aChain, *rChain.GetNext() ); - } - - const SwNodeIndex* pCntIdx = 0; - // The draw format doesn't own its content, it just has a pointer to it. - if (pFmt->Which() != RES_DRAWFRMFMT) - pCntIdx = pFmt->GetCntnt().GetCntntIdx(); - if (pCntIdx && !GetIDocumentUndoRedo().DoesUndo()) - { - // Disconnect if it's an OLE object - SwOLENode* pOLENd = GetNodes()[ pCntIdx->GetIndex()+1 ]->GetOLENode(); - if( pOLENd && pOLENd->GetOLEObj().IsOleRef() ) - { - - // TODO: the old object closed the object and cleared all references to it, but didn't remove it from the container. - // I have no idea, why, nobody could explain it - so I do my very best to mimic this behavior - //uno::Reference < util::XCloseable > xClose( pOLENd->GetOLEObj().GetOleRef(), uno::UNO_QUERY ); - //if ( xClose.is() ) - { - try - { - pOLENd->GetOLEObj().GetOleRef()->changeState( embed::EmbedStates::LOADED ); - } - catch ( uno::Exception& ) - { - } - } - - } - } - - // Destroy Frames - pFmt->DelFrms(); - - // Only FlyFrames are undoable at first - const sal_uInt16 nWh = pFmt->Which(); - if (GetIDocumentUndoRedo().DoesUndo() && - (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh)) - { - GetIDocumentUndoRedo().AppendUndo( new SwUndoDelLayFmt( pFmt )); - } - else - { - // #i32089# - delete at-frame anchored objects - if ( nWh == RES_FLYFRMFMT ) - { - // determine frame formats of at-frame anchored objects - const SwNodeIndex* pCntntIdx = 0; - if (pFmt->Which() != RES_DRAWFRMFMT) - pCntntIdx = pFmt->GetCntnt().GetCntntIdx(); - if (pCntntIdx) - { - const SwFrmFmts* pTbl = pFmt->GetDoc()->GetSpzFrmFmts(); - if ( pTbl ) - { - std::vector<SwFrmFmt*> aToDeleteFrmFmts; - const sal_uLong nNodeIdxOfFlyFmt( pCntntIdx->GetIndex() ); - - for ( sal_uInt16 i = 0; i < pTbl->size(); ++i ) - { - SwFrmFmt* pTmpFmt = (*pTbl)[i]; - const SwFmtAnchor &rAnch = pTmpFmt->GetAnchor(); - if ( rAnch.GetAnchorId() == FLY_AT_FLY && - rAnch.GetCntntAnchor()->nNode.GetIndex() == nNodeIdxOfFlyFmt ) - { - aToDeleteFrmFmts.push_back( pTmpFmt ); - } - } - - // delete found frame formats - while ( !aToDeleteFrmFmts.empty() ) - { - SwFrmFmt* pTmpFmt = aToDeleteFrmFmts.back(); - pFmt->GetDoc()->DelLayoutFmt( pTmpFmt ); - - aToDeleteFrmFmts.pop_back(); - } - } - } - } - - // Delete content - if( pCntIdx ) - { - SwNode *pNode = &pCntIdx->GetNode(); - ((SwFmtCntnt&)pFmt->GetFmtAttr( RES_CNTNT )).SetNewCntntIdx( 0 ); - getIDocumentContentOperations().DeleteSection( pNode ); - } - - // Delete the character for FlyFrames anchored as char (if necessary) - const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); - if ((FLY_AS_CHAR == rAnchor.GetAnchorId()) && rAnchor.GetCntntAnchor()) - { - const SwPosition* pPos = rAnchor.GetCntntAnchor(); - SwTxtNode *pTxtNd = pPos->nNode.GetNode().GetTxtNode(); - - // attribute is still in text node, delete it - if ( pTxtNd ) - { - SwTxtFlyCnt* const pAttr = static_cast<SwTxtFlyCnt*>( - pTxtNd->GetTxtAttrForCharAt( pPos->nContent.GetIndex(), - RES_TXTATR_FLYCNT )); - if ( pAttr && (pAttr->GetFlyCnt().GetFrmFmt() == pFmt) ) - { - // dont delete, set pointer to 0 - const_cast<SwFmtFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFmt(); - SwIndex aIdx( pPos->nContent ); - pTxtNd->EraseText( aIdx, 1 ); - } - } - } - - DelFrmFmt( pFmt ); - } - getIDocumentState().SetModified(); -} - -/** Copies the stated format (pSrc) to pDest and returns pDest. - - If there's no pDest, it is created. - If the source format is located in another document, also copy correctly - in this case. - The Anchor attribute's position is always set to 0! */ -SwFrmFmt *SwDoc::CopyLayoutFmt( - const SwFrmFmt& rSource, - const SwFmtAnchor& rNewAnchor, - bool bSetTxtFlyAtt, - bool bMakeFrms ) -{ - const bool bFly = RES_FLYFRMFMT == rSource.Which(); - const bool bDraw = RES_DRAWFRMFMT == rSource.Which(); - OSL_ENSURE( bFly || bDraw, "this method only works for fly or draw" ); - - SwDoc* pSrcDoc = (SwDoc*)rSource.GetDoc(); - - // May we copy this object? - // We may, unless it's 1) it's a control (and therfore a draw) - // 2) anchored in a header/footer - // 3) anchored (to paragraph?) - bool bMayNotCopy = false; - if( bDraw ) - { - const SwDrawContact* pDrawContact = - static_cast<const SwDrawContact*>( rSource.FindContactObj() ); - - bMayNotCopy = - ((FLY_AT_PARA == rNewAnchor.GetAnchorId()) || - (FLY_AT_FLY == rNewAnchor.GetAnchorId()) || - (FLY_AT_CHAR == rNewAnchor.GetAnchorId())) && - rNewAnchor.GetCntntAnchor() && - IsInHeaderFooter( rNewAnchor.GetCntntAnchor()->nNode ) && - pDrawContact != NULL && - pDrawContact->GetMaster() != NULL && - CheckControlLayer( pDrawContact->GetMaster() ); - } - - // just return if we can't copy this - if( bMayNotCopy ) - return NULL; - - SwFrmFmt* pDest = GetDfltFrmFmt(); - if( rSource.GetRegisteredIn() != pSrcDoc->GetDfltFrmFmt() ) - pDest = CopyFrmFmt( *(SwFrmFmt*)rSource.GetRegisteredIn() ); - if( bFly ) - { - // #i11176# - // To do a correct cloning concerning the ZOrder for all objects - // it is necessary to actually create a draw object for fly frames, too. - // These are then added to the DrawingLayer (which needs to exist). - // Together with correct sorting of all drawinglayer based objects - // before cloning ZOrder transfer works correctly then. - SwFlyFrmFmt *pFormat = MakeFlyFrmFmt( rSource.GetName(), pDest ); - pDest = pFormat; - - SwXFrame::GetOrCreateSdrObject(*pFormat); - } - else - pDest = MakeDrawFrmFmt( OUString(), pDest ); - - // Copy all other or new attributes - pDest->CopyAttrs( rSource ); - - // Do not copy chains - pDest->ResetFmtAttr( RES_CHAIN ); - - if( bFly ) - { - // Duplicate the content. - const SwNode& rCSttNd = rSource.GetCntnt().GetCntntIdx()->GetNode(); - SwNodeRange aRg( rCSttNd, 1, *rCSttNd.EndOfSectionNode() ); - - SwNodeIndex aIdx( GetNodes().GetEndOfAutotext() ); - SwStartNode* pSttNd = GetNodes().MakeEmptySection( aIdx, SwFlyStartNode ); - - // Set the Anchor/CntntIndex first. - // Within the copying part, we can access the values (DrawFmt in Headers and Footers) - aIdx = *pSttNd; - SwFmtCntnt aAttr( rSource.GetCntnt() ); - aAttr.SetNewCntntIdx( &aIdx ); - pDest->SetFmtAttr( aAttr ); - pDest->SetFmtAttr( rNewAnchor ); - - if( !mbCopyIsMove || this != pSrcDoc ) - { - if( mbInReading ) - pDest->SetName( OUString() ); - else - { - // Test first if the name is already taken, if so generate a new one. - sal_Int8 nNdTyp = aRg.aStart.GetNode().GetNodeType(); - - OUString sOld( pDest->GetName() ); - pDest->SetName( OUString() ); - if( FindFlyByName( sOld, nNdTyp ) ) // found one - switch( nNdTyp ) - { - case ND_GRFNODE: sOld = GetUniqueGrfName(); break; - case ND_OLENODE: sOld = GetUniqueOLEName(); break; - default: sOld = GetUniqueFrameName(); break; - } - - pDest->SetName( sOld ); - } - } - - if (GetIDocumentUndoRedo().DoesUndo()) - { - GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0)); - } - - // Make sure that FlyFrames in FlyFrames are copied - aIdx = *pSttNd->EndOfSectionNode(); - - //fdo#36631 disable (scoped) any undo operations associated with the - //contact object itself. They should be managed by SwUndoInsLayFmt. - const ::sw::DrawUndoGuard drawUndoGuard(GetIDocumentUndoRedo()); - - pSrcDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aIdx, NULL, false, true, true ); - } - else - { - OSL_ENSURE( RES_DRAWFRMFMT == rSource.Which(), "Neither Fly nor Draw." ); - // #i52780# - Note: moving object to visible layer not needed. - SwDrawContact* pSourceContact = (SwDrawContact *)rSource.FindContactObj(); - - SwDrawContact* pContact = new SwDrawContact( (SwDrawFrmFmt*)pDest, - CloneSdrObj( *pSourceContact->GetMaster(), - mbCopyIsMove && this == pSrcDoc ) ); - // #i49730# - notify draw frame format that position attributes are - // already set, if the position attributes are already set at the - // source draw frame format. - if ( pDest->ISA(SwDrawFrmFmt) && - rSource.ISA(SwDrawFrmFmt) && - static_cast<const SwDrawFrmFmt&>(rSource).IsPosAttrSet() ) - { - static_cast<SwDrawFrmFmt*>(pDest)->PosAttrSet(); - } - - if( pDest->GetAnchor() == rNewAnchor ) - { - // Do *not* connect to layout, if a <MakeFrms> will not be called. - if ( bMakeFrms ) - { - pContact->ConnectToLayout( &rNewAnchor ); - } - } - else - pDest->SetFmtAttr( rNewAnchor ); - - if (GetIDocumentUndoRedo().DoesUndo()) - { - GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0)); - } - } - - if (bSetTxtFlyAtt && (FLY_AS_CHAR == rNewAnchor.GetAnchorId())) - { - const SwPosition* pPos = rNewAnchor.GetCntntAnchor(); - SwFmtFlyCnt aFmt( pDest ); - pPos->nNode.GetNode().GetTxtNode()->InsertItem( - aFmt, pPos->nContent.GetIndex(), 0 ); - } - - if( bMakeFrms ) - pDest->MakeFrms(); - - return pDest; -} - SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveWithinDoc, bool bInsInPage ) { @@ -674,7 +282,7 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, } // Set up frames - if( GetCurrentViewShell() ) + if( getIDocumentLayoutAccess().GetCurrentViewShell() ) pFmt->MakeFrms(); // ??? if (GetIDocumentUndoRedo().DoesUndo()) @@ -938,12 +546,12 @@ SwPosFlyFrms SwDoc::GetAllFlyFmts( const SwPaM* pCmpRange, bool bDrawAlso, // If we don't have a layout we can't get page anchored FlyFrames. // Also, page anchored FlyFrames are only returned if no range is specified. - if( !GetCurrentViewShell() || pCmpRange ) + if( !getIDocumentLayoutAccess().GetCurrentViewShell() || pCmpRange ) { return aRetval; } - SwPageFrm *pPage = (SwPageFrm*)GetCurrentLayout()->GetLower(); + SwPageFrm *pPage = (SwPageFrm*)getIDocumentLayoutAccess().GetCurrentLayout()->GetLower(); while( pPage ) { if( pPage->GetSortedObjs() ) @@ -1667,7 +1275,7 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( IMPL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem*, EMPTYARG ) { SwViewShell *pSh, *pStartSh; - pSh = pStartSh = pThis->GetCurrentViewShell(); + pSh = pStartSh = pThis->getIDocumentLayoutAccess().GetCurrentViewShell(); if( pStartSh ) do { if( pSh->GetWin() ) @@ -1906,9 +1514,9 @@ bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const // Because Redlines are also attached to Start and EndNoden, // the Index must not necessarily be from a ContentNode. SwNode* pNd = &rIdx.GetNode(); - if( pNd->IsCntntNode() && mpCurrentView ) + if( pNd->IsCntntNode() && getIDocumentLayoutAccess().GetCurrentViewShell() ) { - const SwFrm *pFrm = pNd->GetCntntNode()->getLayoutFrm( GetCurrentLayout() ); + const SwFrm *pFrm = pNd->GetCntntNode()->getLayoutFrm( getIDocumentLayoutAccess().GetCurrentLayout() ); if( pFrm ) { const SwFrm *pUp = pFrm->GetUpper(); @@ -2019,61 +1627,10 @@ bool SwDoc::IsInVerticalText( const SwPosition& rPos, const Point* pPt ) const return FRMDIR_VERT_TOP_RIGHT == nDir || FRMDIR_VERT_TOP_LEFT == nDir; } -void SwDoc::SetCurrentViewShell( SwViewShell* pNew ) -{ - mpCurrentView = pNew; -} - -SwLayouter* SwDoc::GetLayouter() -{ - return mpLayouter; -} - -const SwLayouter* SwDoc::GetLayouter() const -{ - return mpLayouter; -} - -void SwDoc::SetLayouter( SwLayouter* pNew ) -{ - mpLayouter = pNew; -} - -const SwViewShell *SwDoc::GetCurrentViewShell() const -{ - return mpCurrentView; -} - -SwViewShell *SwDoc::GetCurrentViewShell() -{ - return mpCurrentView; -} - -// It must be able to communicate to a SwViewShell. This is going to be removed later. -const SwRootFrm *SwDoc::GetCurrentLayout() const -{ - if(GetCurrentViewShell()) - return GetCurrentViewShell()->GetLayout(); - return 0; -} - -SwRootFrm *SwDoc::GetCurrentLayout() -{ - if(GetCurrentViewShell()) - return GetCurrentViewShell()->GetLayout(); - return 0; -} - -bool SwDoc::HasLayout() const -{ - // if there is a view, there is always a layout - return (mpCurrentView != 0); -} - std::set<SwRootFrm*> SwDoc::GetAllLayouts() { std::set<SwRootFrm*> aAllLayouts; - SwViewShell *pStart = GetCurrentViewShell(); + SwViewShell *pStart = getIDocumentLayoutAccess().GetCurrentViewShell(); SwViewShell *pTemp = pStart; if ( pTemp ) { diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index db82e2b2e2b0..678aaed8f0f1 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -101,6 +101,7 @@ #include <DocumentFieldsManager.hxx> #include <DocumentStatisticsManager.hxx> #include <DocumentStateManager.hxx> +#include <DocumentLayoutManager.hxx> #include <unochart.hxx> #include <fldbas.hxx> @@ -217,6 +218,7 @@ SwDoc::SwDoc() m_pDocumentContentOperationsManager( new ::sw::DocumentContentOperationsManager( *this ) ), m_pDocumentFieldsManager( new ::sw::DocumentFieldsManager( *this ) ), m_pDocumentStatisticsManager( new ::sw::DocumentStatisticsManager( *this ) ), + m_pDocumentLayoutManager( new ::sw::DocumentLayoutManager( *this ) ), mpDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), mpEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, mpDfltFrmFmt ) ), mpColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, mpDfltFrmFmt ) ), @@ -232,7 +234,6 @@ SwDoc::SwDoc() mpGrfFmtCollTbl( new SwGrfFmtColls() ), mpTOXTypes( new SwTOXTypes() ), mpDefTOXBases( new SwDefTOXBase_Impl() ), - mpCurrentView( 0 ), mpGlossaryDoc( 0 ), mpOutlineRule( 0 ), mpFtnInfo( new SwFtnInfo ), @@ -247,7 +248,6 @@ SwDoc::SwDoc() mpUnoCrsrTbl( new SwUnoCrsrTbl() ), mpPgPViewPrtData( 0 ), mpExtInputRing( 0 ), - mpLayouter( 0 ), mpStyleAccess( 0 ), mpLayoutCache( 0 ), mpUnoCallBack(new SwModify(0)), @@ -256,8 +256,6 @@ SwDoc::SwDoc() mReferenceCount(0), mbGlossDoc(false), mbDtor(false), - mbCopyIsMove(false), - mbInReading(false), mbInXMLImport(false), mbUpdateTOX(false), mbInLoadAsynchron(false), @@ -445,9 +443,6 @@ SwDoc::~SwDoc() delete mpUnoCallBack, mpUnoCallBack = 0; delete mpURLStateChgd; - delete mpLayouter; - mpLayouter = 0L; - // Deactivate Undo notification from Draw if( GetDocumentDrawModelManager().GetDrawModel() ) { @@ -676,7 +671,7 @@ void SwDoc::ClearDoc() // if there are still FlyFrames dangling around, delete them too sal_uInt16 n; while ( 0 != (n = GetSpzFrmFmts()->size()) ) - DelLayoutFmt((*mpSpzFrmFmtTbl)[n-1]); + getIDocumentLayoutAccess().DelLayoutFmt((*mpSpzFrmFmtTbl)[n-1]); OSL_ENSURE( !GetDocumentDrawModelManager().GetDrawModel() || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount(), "not all DrawObjects removed from the page" ); @@ -697,7 +692,7 @@ void SwDoc::ClearDoc() // create the first one over and over again (without attributes/style etc. SwTxtNode* pFirstNd = GetNodes().MakeTxtNode( aSttIdx, mpDfltTxtFmtColl ); - if( mpCurrentView ) + if( getIDocumentLayoutAccess().GetCurrentViewShell() ) { // set the layout to the dummy pagedesc pFirstNd->SetAttr( SwFmtPageDesc( pDummyPgDsc )); @@ -750,12 +745,12 @@ void SwDoc::ClearDoc() DeleteAndDestroy(*mpGrfFmtCollTbl, 1, mpGrfFmtCollTbl->size()); DeleteAndDestroy(*mpCharFmtTbl, 1, mpCharFmtTbl->size()); - if( mpCurrentView ) + if( getIDocumentLayoutAccess().GetCurrentViewShell() ) { // search the FrameFormat of the root frm. This is not allowed to delete - mpFrmFmtTbl->erase( std::find( mpFrmFmtTbl->begin(), mpFrmFmtTbl->end(), mpCurrentView->GetLayout()->GetFmt() ) ); + mpFrmFmtTbl->erase( std::find( mpFrmFmtTbl->begin(), mpFrmFmtTbl->end(), getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFmt() ) ); DeleteAndDestroy(*mpFrmFmtTbl, 1, mpFrmFmtTbl->size()); - mpFrmFmtTbl->push_back( mpCurrentView->GetLayout()->GetFmt() ); + mpFrmFmtTbl->push_back( getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFmt() ); } else DeleteAndDestroy(*mpFrmFmtTbl, 1, mpFrmFmtTbl->size()); @@ -790,6 +785,11 @@ void SwDoc::SetPreviewPrtData( const SwPagePreviewPrtData* pNew ) getIDocumentState().SetModified(); } +void SwDoc::SetOLEObjModified() +{ + if( getIDocumentLayoutAccess().GetCurrentViewShell() ) maOLEModifiedTimer.Start(); +} + /** SwDoc: Reading and writing of the layout cache. */ void SwDoc::ReadLayoutCache( SvStream& rStream ) { @@ -978,7 +978,7 @@ void SwDoc::Paste( const SwDoc& rSource ) } else continue; - this->CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); + this->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); } } } diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 291f32e5b5e8..150a92d683ec 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -31,6 +31,7 @@ #include <DocumentContentOperationsManager.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <redline.hxx> @@ -452,7 +453,7 @@ void SwRedlineTbl::Remove( sal_uInt16 nP ) SwViewShell* pSh; if( pDoc && !pDoc->IsInDtor() && - 0 != ( pSh = pDoc->GetCurrentViewShell()) ) + 0 != ( pSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()) ) pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) ); } @@ -473,7 +474,7 @@ void SwRedlineTbl::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) SwViewShell* pSh; if( pDoc && !pDoc->IsInDtor() && - 0 != ( pSh = pDoc->GetCurrentViewShell() ) ) + 0 != ( pSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) ) pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) ); } @@ -1630,7 +1631,7 @@ void SwExtraRedlineTbl::DeleteAndDestroy( sal_uInt16 nPos, sal_uInt16 nLen ) /* SwViewShell* pSh; if( pDoc && !pDoc->IsInDtor() && - 0 != ( pSh = pDoc->GetCurrentViewShell() ) ) + 0 != ( pSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) ) pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) ); */ } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index b930830401d6..3744d8983263 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -40,6 +40,7 @@ #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <pagefrm.hxx> #include <ndtxt.hxx> #include <swtable.hxx> @@ -239,7 +240,7 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, continue; Point aPt; - const SwCntntFrm* pCFrm = pTOXSrc->getLayoutFrm( GetCurrentLayout(), &aPt, 0, false ); + const SwCntntFrm* pCFrm = pTOXSrc->getLayoutFrm( getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); if (!pCFrm) continue; @@ -1150,7 +1151,7 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl, // If selected use marks from the same chapter only if( pTOXSrc->GetNodes().IsDocNodes() && pTOXSrc->GetTxt().getLength() && pTOXSrc->GetDepends() && - pTOXSrc->getLayoutFrm( pDoc->GetCurrentLayout() ) && + pTOXSrc->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && (!IsFromChapter() || ::lcl_FindChapterNode( *pTOXSrc, 0 ) == pOwnChapterNode ) && !pTOXSrc->HasHiddenParaField() && !SwScriptInfo::IsInHiddenRange( *pTOXSrc, pTxtMark->GetStart() ) ) @@ -1208,7 +1209,7 @@ void SwTOXBaseSection::UpdateOutline( const SwTxtNode* pOwnChapterNode ) SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode(); if( pTxtNd && pTxtNd->Len() && pTxtNd->GetDepends() && sal_uInt16( pTxtNd->GetAttrOutlineLevel()) <= GetLevel() && - pTxtNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && + pTxtNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && !pTxtNd->HasHiddenParaField() && !pTxtNd->HasHiddenCharAttribute( true ) && ( !IsFromChapter() || @@ -1246,7 +1247,7 @@ void SwTOXBaseSection::UpdateTemplate( const SwTxtNode* pOwnChapterNode ) ::SetProgressState( 0, pDoc->GetDocShell() ); if (pTxtNd->GetTxt().getLength() && - pTxtNd->getLayoutFrm(pDoc->GetCurrentLayout()) && + pTxtNd->getLayoutFrm(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()) && pTxtNd->GetNodes().IsDocNodes() && ( !IsFromChapter() || pOwnChapterNode == ::lcl_FindChapterNode( *pTxtNd, 0 ) ) ) @@ -1277,7 +1278,7 @@ void SwTOXBaseSection::UpdateSequence( const SwTxtNode* pOwnChapterNode ) ::SetProgressState( 0, pDoc->GetDocShell() ); if (rTxtNode.GetTxt().getLength() && - rTxtNode.getLayoutFrm(pDoc->GetCurrentLayout()) && + rTxtNode.getLayoutFrm(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()) && rTxtNode.GetNodes().IsDocNodes() && ( !IsFromChapter() || ::lcl_FindChapterNode( rTxtNode, 0 ) == pOwnChapterNode ) ) @@ -1320,11 +1321,11 @@ void SwTOXBaseSection::UpdateAuthorities( const SwTOXInternational& rIntl ) ::SetProgressState( 0, pDoc->GetDocShell() ); if (rTxtNode.GetTxt().getLength() && - rTxtNode.getLayoutFrm(pDoc->GetCurrentLayout()) && + rTxtNode.getLayoutFrm(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()) && rTxtNode.GetNodes().IsDocNodes() ) { //#106485# the body node has to be used! - SwCntntFrm *pFrm = rTxtNode.getLayoutFrm( pDoc->GetCurrentLayout() ); + SwCntntFrm *pFrm = rTxtNode.getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); SwPosition aFldPos(rTxtNode); const SwTxtNode* pTxtNode = 0; if(pFrm && !pFrm->IsInDocBody()) @@ -1472,7 +1473,7 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, } } - if( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && ( !IsFromChapter() || + if( pCNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && ( !IsFromChapter() || ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode )) { SwTOXPara * pNew = new SwTOXPara( *pCNd, eMyType, @@ -1510,7 +1511,7 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode ) while( 0 != ( pCNd = rNds.GoNext( &aCntntIdx ) ) && aCntntIdx.GetIndex() < pTblNd->EndOfSectionIndex() ) { - if( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && (!IsFromChapter() || + if( pCNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && (!IsFromChapter() || ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode )) { SwTOXTable * pNew = new SwTOXTable( *pCNd ); @@ -1588,7 +1589,7 @@ void SwTOXBaseSection::UpdatePageNum() SwTOXSource& rTOXSource = pSortBase->aTOXSources[j]; if( rTOXSource.pNd ) { - SwCntntFrm* pFrm = rTOXSource.pNd->getLayoutFrm( pDoc->GetCurrentLayout() ); + SwCntntFrm* pFrm = rTOXSource.pNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); OSL_ENSURE( pFrm || pDoc->IsUpdateTOX(), "TOX, no Frame found"); if( !pFrm ) continue; diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx index 2d63872af828..8858cfafa5b6 100644 --- a/sw/source/core/doc/ftnidx.cxx +++ b/sw/source/core/doc/ftnidx.cxx @@ -21,6 +21,7 @@ #include <fmtftn.hxx> #include <ftninfo.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <ftnidx.hxx> #include <ndtxt.hxx> #include <ndindex.hxx> @@ -166,7 +167,7 @@ void SwFtnIdxs::UpdateAllFtn() SwUpdFtnEndNtAtEnd aNumArr; - SwRootFrm* pTmpRoot = pDoc->GetCurrentLayout(); + SwRootFrm* pTmpRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); std::set<SwRootFrm*> aAllLayouts = pDoc->GetAllLayouts(); // For normal Footnotes per-chapter and per-document numbering are treated separately. // For Endnotes we only have document-wise numbering. diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 8bc5d7c3d102..1ac952637e8f 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -28,6 +28,7 @@ #include <docary.hxx> #include "ndtxt.hxx" #include "doc.hxx" +#include <IDocumentLayoutAccess.hxx> #include "swtable.hxx" #include "rootfrm.hxx" #include "docsh.hxx" @@ -357,7 +358,7 @@ sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByVisArea( const SwDoc& rDoc ) sal_uInt16 SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc ) { // If we have a layout, we can get the width from there. - const SwRootFrm *pRootFrm = rDoc.GetCurrentLayout(); + const SwRootFrm *pRootFrm = rDoc.getIDocumentLayoutAccess().GetCurrentLayout(); if( pRootFrm ) { const SwFrm *pPageFrm = pRootFrm->GetLower(); @@ -1712,7 +1713,7 @@ void SwHTMLTableLayout::_Resize( sal_uInt16 nAbsAvail, bool bRecalc ) if( bRecalc ) AutoLayoutPass1(); - SwRootFrm *pRoot = (SwRootFrm*)GetDoc()->GetCurrentViewShell()->GetLayout(); + SwRootFrm *pRoot = (SwRootFrm*)GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout(); if ( pRoot && pRoot->IsCallbackActionEnabled() ) pRoot->StartAllAction(); @@ -1753,7 +1754,7 @@ bool SwHTMLTableLayout::Resize( sal_uInt16 nAbsAvail, bool bRecalc, // VisArea's size was potentially passed. // If we're not in a frame we need to calculate the table for the VisArea, // because switching from relative to absolute wouldn't work. - if( pDoc->GetCurrentViewShell() && pDoc->GetCurrentViewShell()->GetViewOptions()->getBrowseMode() ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->GetViewOptions()->getBrowseMode() ) { const sal_uInt16 nVisAreaWidth = GetBrowseWidthByVisArea( *pDoc ); if( nVisAreaWidth < nAbsAvail && !FindFlyFrmFmt() ) diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index d05db20cfba8..36868826609f 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -18,6 +18,7 @@ */ #include "doc.hxx" +#include <IDocumentLayoutAccess.hxx> #include <IDocumentState.hxx> #include "lineinfo.hxx" #include "charfmt.hxx" @@ -28,7 +29,7 @@ void SwDoc::SetLineNumberInfo( const SwLineNumberInfo &rNew ) { - SwRootFrm* pTmpRoot = GetCurrentLayout(); + SwRootFrm* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout(); if ( pTmpRoot && (rNew.IsCountBlankLines() != mpLineNumberInfo->IsCountBlankLines() || rNew.IsRestartEachPage() != mpLineNumberInfo->IsRestartEachPage()) ) @@ -134,7 +135,7 @@ void SwLineNumberInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew { CheckRegistration( pOld, pNew ); SwDoc *pDoc = ((SwCharFmt*)GetRegisteredIn())->GetDoc(); - SwRootFrm* pRoot = pDoc->GetCurrentLayout(); + SwRootFrm* pRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); if( pRoot ) { pRoot->StartAllAction(); diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 18c6d8790805..d2c11295b42d 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/uno/Sequence.h> #include <doc.hxx> #include <IDocumentLinksAdministration.hxx> +#include <IDocumentLayoutAccess.hxx> #include <swtypes.hxx> #include <swserv.hxx> #include <swbaslnk.hxx> @@ -302,7 +303,7 @@ SwDataChanged::SwDataChanged( SwDoc* pDc, const SwPosition& rPos ) SwDataChanged::~SwDataChanged() { // JP 09.04.96: Only if the Layout is available (thus during input) - if( pDoc->GetCurrentViewShell() ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) { const ::sfx2::SvLinkSources& rServers = pDoc->getIDocumentLinksAdministration().GetLinkManager().GetServers(); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index e6bc6ef44afe..2e28d86c1027 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -26,6 +26,7 @@ #include <DocumentContentOperationsManager.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <swtable.hxx> @@ -570,7 +571,7 @@ static void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, (FLY_AT_CHAR == pAnchor->GetAnchorId())) && aInsIdx <= pAPos->nNode && pAPos->nNode <= aEndNdIdx ) { - pDoc->DelLayoutFmt( pFly ); + pDoc->getIDocumentLayoutAccess().DelLayoutFmt( pFly ); } } diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index b7ee2ec2c677..43774cbf78cf 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -15,6 +15,7 @@ #include <fmtornt.hxx> #include <fmtfsize.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <ndtxt.hxx> #include <docsh.hxx> #include <docary.hxx> @@ -111,7 +112,7 @@ void SwTextBoxHelper::destroy(SwFrmFmt* pShape) // Delete the associated TextFrame. if (pFmt) - pShape->GetDoc()->DelLayoutFmt(pFmt); + pShape->GetDoc()->getIDocumentLayoutAccess().DelLayoutFmt(pFmt); } } diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx index a574e4ff44d8..ed3d72143502 100644 --- a/sw/source/core/doc/visiturl.cxx +++ b/sw/source/core/doc/visiturl.cxx @@ -22,6 +22,7 @@ #include <fmtinfmt.hxx> #include <txtinet.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <visiturl.hxx> #include <hints.hxx> #include <ndtxt.hxx> @@ -41,7 +42,7 @@ SwURLStateChanged::~SwURLStateChanged() void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint ) { - if( rHint.ISA( INetURLHistoryHint ) && pDoc->GetCurrentViewShell() ) + if( rHint.ISA( INetURLHistoryHint ) && pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) { // This URL has been changed: const INetURLObject* pIURL = ((INetURLHistoryHint&)rHint).GetObject(); diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index c5f460cbf9b5..db469f6a7f19 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -29,6 +29,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentLinksAdministration.hxx> +#include <IDocumentLayoutAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> #include <rootfrm.hxx> @@ -893,7 +894,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, // We could optimize this, by not removing already contained Frames and recreating them, // but by simply rewiring them bool bInsFrm = bCreateFrms && !pSectNd->GetSection().IsHidden() && - GetDoc()->GetCurrentViewShell(); + GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); SwNode2Layout *pNode2Layout = NULL; if( bInsFrm ) { @@ -1056,7 +1057,7 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx ) { // Take my succsessive or preceding ContentFrame SwNodes& rNds = GetNodes(); - if( rNds.IsDocNodes() && rNds.GetDoc()->GetCurrentViewShell() ) + if( rNds.IsDocNodes() && rNds.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) { if( GetSection().IsHidden() || IsCntntHidden() ) { @@ -1278,7 +1279,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c // Copy the Links/Server if( pNewSect->IsLinkType() ) // Add the Link - pNewSect->CreateLink( pDoc->GetCurrentViewShell() ? CREATE_CONNECT : CREATE_NONE ); + pNewSect->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? CREATE_CONNECT : CREATE_NONE ); // If we copy from the Undo as Server, enter it again if (m_pSection->IsServer() @@ -1359,7 +1360,7 @@ void SwSectionNode::NodesArrChgd() OSL_ENSURE( pDoc == GetDoc(), "Moving to different Documents?" ); if( m_pSection->IsLinkType() ) // Remove the Link - m_pSection->CreateLink( pDoc->GetCurrentViewShell() ? CREATE_CONNECT : CREATE_NONE ); + m_pSection->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? CREATE_CONNECT : CREATE_NONE ); if (m_pSection->IsServer()) pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertServer( m_pSection->GetObject() ); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index cec2a28cfeef..607b2587dec1 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -44,6 +44,7 @@ #include <IDocumentChartDataProviderAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <IDocumentState.hxx> #include <cntfrm.hxx> #include <pam.hxx> @@ -1020,7 +1021,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, cCh = 0x09; // Get the separator's position from the first Node, in order for the Boxes to be set accordingly - SwTxtFrmInfo aFInfo( (SwTxtFrm*)pTxtNd->getLayoutFrm( pTxtNd->GetDoc()->GetCurrentLayout() ) ); + SwTxtFrmInfo aFInfo( (SwTxtFrm*)pTxtNd->getLayoutFrm( pTxtNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ); if( aFInfo.IsOneLine() ) // only makes sense in this case { OUString const& rTxt(pTxtNd->GetTxt()); @@ -1971,7 +1972,7 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) if( pFmt ) { // That's the FlyFormat we're looking for - DelLayoutFmt( pFmt ); + getIDocumentLayoutAccess().DelLayoutFmt( pFmt ); return true; } } @@ -2479,7 +2480,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr, if( pShCrsr ) aPt = pShCrsr->GetPtPos(); - const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, false ); + const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); do { pTmpFrm = pTmpFrm->GetUpper(); } while ( !pTmpFrm->IsCellFrm() ); @@ -2693,7 +2694,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, if( pShCrsr ) aPt = pShCrsr->GetPtPos(); - const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, false ); + const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); do { pTmpFrm = pTmpFrm->GetUpper(); } while ( !pTmpFrm->IsCellFrm() ); diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 1805d3bafb0f..e6c94a0caf48 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -37,6 +37,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include "pam.hxx" #include "swcrsr.hxx" #include "viscrs.hxx" @@ -112,8 +113,8 @@ static void lcl_GetStartEndCell( const SwCursor& rCrsr, SwCntntNode* pPointNd = rCrsr.GetCntntNode(); SwCntntNode* pMarkNd = rCrsr.GetCntntNode(false); - SwFrm* pPointFrm = pPointNd ? pPointNd->getLayoutFrm( pPointNd->GetDoc()->GetCurrentLayout(), &aPtPos ) : 0; - SwFrm* pMarkFrm = pMarkNd ? pMarkNd->getLayoutFrm( pMarkNd->GetDoc()->GetCurrentLayout(), &aMkPos ) : 0; + SwFrm* pPointFrm = pPointNd ? pPointNd->getLayoutFrm( pPointNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPtPos ) : 0; + SwFrm* pMarkFrm = pMarkNd ? pMarkNd->getLayoutFrm( pMarkNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aMkPos ) : 0; prStart = pPointFrm ? pPointFrm->GetUpper() : 0; prEnd = pMarkFrm ? pMarkFrm->GetUpper() : 0; @@ -794,7 +795,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout(); if( pTableLayout ) { - SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->GetCurrentLayout() ); + SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm(); pTableLayout->BordersChanged( @@ -891,7 +892,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout(); if( pTableLayout ) { - SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->GetCurrentLayout() ); + SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm(); pTableLayout->BordersChanged( @@ -1162,7 +1163,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout(); if( pTableLayout ) { - SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->GetCurrentLayout() ); + SwCntntFrm* pFrm = rCursor.GetCntntNode()->getLayoutFrm( rCursor.GetCntntNode()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm(); pTableLayout->Resize( diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 0d9921bbb41a..cee18af1fd09 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -63,6 +63,7 @@ #include <DocumentSettingManager.hxx> #include <IDocumentLinksAdministration.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <switerator.hxx> #include "ndole.hxx" @@ -420,7 +421,7 @@ bool SwNode::IsProtect() const if( 0 != ( pSttNd = FindTableBoxStartNode() ) ) { SwCntntFrm* pCFrm; - if( IsCntntNode() && 0 != (pCFrm = ((SwCntntNode*)this)->getLayoutFrm( GetDoc()->GetCurrentLayout() ) )) + if( IsCntntNode() && 0 != (pCFrm = ((SwCntntNode*)this)->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) )) return pCFrm->IsProtected(); const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable(). @@ -487,7 +488,7 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay, { const SwFrm* pFrm; const SwPageFrm* pPage; - if( pNode && 0 != ( pFrm = pNode->getLayoutFrm( pNode->GetDoc()->GetCurrentLayout(), 0, 0, bCalcLay ) ) && + if( pNode && 0 != ( pFrm = pNode->getLayoutFrm( pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, bCalcLay ) ) && 0 != ( pPage = pFrm->FindPageFrm() ) ) { pPgDesc = pPage->GetPageDesc(); @@ -774,8 +775,8 @@ const SwTxtNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const const SwCntntNode* pCNd = GetCntntNode(); Point aPt( 0, 0 ); - const SwFrm* pFrm = pRet->getLayoutFrm( pRet->GetDoc()->GetCurrentLayout(), &aPt, 0, false ), - * pMyFrm = pCNd ? pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, false ) : 0; + const SwFrm* pFrm = pRet->getLayoutFrm( pRet->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ), + * pMyFrm = pCNd ? pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ) : 0; const SwPageFrm* pPgFrm = pFrm ? pFrm->FindPageFrm() : 0; if( pPgFrm && pMyFrm && pPgFrm->Frm().Top() > pMyFrm->Frm().Top() ) @@ -1859,7 +1860,7 @@ short SwCntntNode::GetTextDirection( const SwPosition& rPos, aPt = *pPt; // #i72024# - No format of the frame, because this can cause recursive layout actions - SwFrm* pFrm = getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, &rPos, false ); + SwFrm* pFrm = getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, &rPos, false ); if ( pFrm ) { @@ -1914,8 +1915,8 @@ const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return & const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return &GetDoc()->getIDocumentRedlineAccess(); } const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return GetDoc(); } const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); } -const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return GetDoc(); } -IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return GetDoc(); } +const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return &GetDoc()->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return &GetDoc()->getIDocumentLayoutAccess(); } const IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() const { return &GetDoc()->getIDocumentLinksAdministration(); } IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() { return &GetDoc()->getIDocumentLinksAdministration(); } const IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() const { return &GetDoc()->getIDocumentFieldsAccess(); } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 140f2b12c142..9806cbaec87f 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -23,6 +23,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <pam.hxx> #include <txtfld.hxx> #include <fmtfld.hxx> @@ -352,7 +353,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, if( bNewFrms ) bNewFrms = &GetDoc()->GetNodes() == (const SwNodes*)&rNds && - GetDoc()->GetCurrentViewShell(); + GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); if( bNewFrms ) { @@ -2060,7 +2061,7 @@ SwNode* SwNodes::FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx, SwNode* pFrmNd = 0; // no layout -> skip - if( GetDoc()->GetCurrentViewShell() ) + if( GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) { SwNode* pSttNd = &rFrmIdx.GetNode(); diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index fdf2d50a7966..cfb59bcbd217 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -52,6 +52,7 @@ #include <dcontact.hxx> #include <unodraw.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <doc.hxx> #include <hints.hxx> #include <txtfrm.hxx> @@ -1043,8 +1044,8 @@ void SwDrawContact::Changed( const SdrObject& rObj, // #i26791# - no event handling, if existing <SwViewShell> // is in contruction SwDoc* pDoc = GetFmt()->GetDoc(); - if ( pDoc->GetCurrentViewShell() && - pDoc->GetCurrentViewShell()->IsInConstructor() ) + if ( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && + pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor() ) { return; } @@ -1059,7 +1060,7 @@ void SwDrawContact::Changed( const SdrObject& rObj, //Put on Action, but not if presently anywhere an action runs. SwViewShell *pSh = 0, *pOrg; - SwRootFrm *pTmpRoot = pDoc->GetCurrentLayout(); + SwRootFrm *pTmpRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); if ( pTmpRoot && pTmpRoot->IsCallbackActionEnabled() ) { pDoc->GetEditShell( &pOrg ); diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index b1cef170ae1c..6653cbe4542a 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -26,6 +26,7 @@ #include <fmturl.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <shellres.hxx> #include <viewimp.hxx> #include <pagefrm.hxx> @@ -83,7 +84,7 @@ void InsertGridFrame( SdrPageGridFrameList *pLst, const SwFrm *pPg ) const SdrPageGridFrameList* SwDPage::GetGridFrameList( const SdrPageView* pPV, const Rectangle *pRect ) const { - SwViewShell *pSh = static_cast< SwDrawModel* >(GetModel())->GetDoc().GetCurrentViewShell(); + SwViewShell *pSh = static_cast< SwDrawModel* >(GetModel())->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell(); while (pSh && pSh->Imp()->GetPageView() != pPV) pSh = (SwViewShell*)pSh->GetNext(); if (pSh) diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index 299d244c8eab..19609f6543d1 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -47,6 +47,7 @@ #include "shellres.hxx" #include <IDocumentUndoRedo.hxx> #include <DocumentSettingManager.hxx> +#include <IDocumentLayoutAccess.hxx> #include <com/sun/star/embed/Aspects.hpp> @@ -924,7 +925,7 @@ void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView ) void SwDrawView::DeleteMarked() { SwDoc* pDoc = Imp().GetShell()->GetDoc(); - SwRootFrm *pTmpRoot = pDoc->GetCurrentLayout(); + SwRootFrm *pTmpRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); if ( pTmpRoot ) pTmpRoot->StartAllAction(); pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); @@ -960,7 +961,7 @@ void SwDrawView::DeleteMarked() // Only delete these now: earlier deletion would clear the mark list as well. for (std::vector<SwFrmFmt*>::iterator i = aTextBoxesToDelete.begin(); i != aTextBoxesToDelete.end(); ++i) - pDoc->DelLayoutFmt(*i); + pDoc->getIDocumentLayoutAccess().DelLayoutFmt(*i); } pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); if( pTmpRoot ) diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 3a4bb733ce64..77c388218039 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -36,6 +36,7 @@ #include <ndtxt.hxx> #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <unofldmid.h> #include <unoprnms.hxx> #include <switerator.hxx> @@ -284,7 +285,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle) const SwTxtNode& rFldTxtNode = pTxtFld->GetTxtNode(); SwPosition aFldPos(rFldTxtNode); SwDoc& rDoc = *(SwDoc*)rFldTxtNode.GetDoc(); - SwCntntFrm *pFrm = rFldTxtNode.getLayoutFrm( rDoc.GetCurrentLayout() ); + SwCntntFrm *pFrm = rFldTxtNode.getLayoutFrm( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ); const SwTxtNode* pTxtNode = 0; if(pFrm && !pFrm->IsInDocBody()) pTxtNode = GetBodyTxtNode( rDoc, aFldPos, *pFrm ); @@ -293,7 +294,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle) if(!pTxtNode) pTxtNode = &rFldTxtNode; if (!pTxtNode->GetTxt().isEmpty() && - pTxtNode->getLayoutFrm( rDoc.GetCurrentLayout() ) && + pTxtNode->getLayoutFrm( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ) && pTxtNode->GetNodes().IsDocNodes() ) { SwTOXAuthority* pNew = new SwTOXAuthority( *pTxtNode, diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 240c60a75bdd..2bead09c28ab 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -27,6 +27,7 @@ #include <cntfrm.hxx> #include <tabfrm.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <swtable.hxx> @@ -725,7 +726,7 @@ static const SwFrm* lcl_GetBoxFrm( const SwTableBox& rBox ) SwCntntNode* pCNd = aIdx.GetNodes().GoNext( &aIdx ); OSL_ENSURE( pCNd, "Box has no TextNode" ); Point aPt; // get the first frame of the layout - table headline - return pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, NULL, false ); + return pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, NULL, false ); } static sal_Int32 lcl_GetLongBoxNum( OUString& rStr ) diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index a698cab96d31..1b0d916d4a1f 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -22,6 +22,7 @@ #include <doc.hxx> #include <IDocumentLinksAdministration.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <editsh.hxx> #include <ndtxt.hxx> #include <fmtfld.hxx> @@ -302,7 +303,7 @@ void SwDDEFieldType::_RefCntChgd() { refLink->SetVisible( pDoc->getIDocumentLinksAdministration().IsVisibleLinks() ); pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertDDELink( refLink ); - if( pDoc->GetCurrentViewShell() ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) UpdateNow(); } else diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 43e5485a0010..c5013d636336 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -22,6 +22,7 @@ #include <doc.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <index.hxx> #include <ndtxt.hxx> #include <swtable.hxx> @@ -169,7 +170,7 @@ bool SwDDETable::NoDDETable() GetTabLines().begin(), GetTabLines().end() ); // move lines GetTabLines().clear(); - if( pDoc->GetCurrentViewShell() ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) ((SwDDEFieldType*)aDepend.GetRegisteredIn())->DecRefCnt(); pTblNd->SetNewTable( pNewTbl ); // replace table diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 053836bdc33b..5a2873fdf921 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -74,6 +74,7 @@ #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> @@ -742,8 +743,8 @@ OUString SwDocStatFieldType::Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const case DS_WORD: nVal = rDStat.nWord; break; case DS_CHAR: nVal = rDStat.nChar; break; case DS_PAGE: - if( pDoc->GetCurrentLayout() ) - ((SwDocStat &)rDStat).nPage = pDoc->GetCurrentLayout()->GetPageNum(); + if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) + ((SwDocStat &)rDStat).nPage = pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetPageNum(); nVal = rDStat.nPage; if( SVX_NUM_PAGEDESC == nFmt ) nFmt = (sal_uInt32)nNumberingType; @@ -2126,7 +2127,7 @@ sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst ) // Always the first! (in Tab-Headline, header/footer ) Point aPt; - const SwCntntFrm* pFrm = rTxtNd.getLayoutFrm( rTxtNd.GetDoc()->GetCurrentLayout(), &aPt, 0, false ); + const SwCntntFrm* pFrm = rTxtNd.getLayoutFrm( rTxtNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); _SetGetExpFld* pNew; @@ -2185,8 +2186,8 @@ void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld, { // determine the correct offset Point aPt; - const SwCntntFrm* pFrm = pTxtNode->getLayoutFrm( pTxtNode->GetDoc()->GetCurrentLayout(), &aPt, 0, false ); - const SwCntntFrm* pRefFrm = pRefTxtFld->GetTxtNode().getLayoutFrm( pRefTxtFld->GetTxtNode().GetDoc()->GetCurrentLayout(), &aPt, 0, false ); + const SwCntntFrm* pFrm = pTxtNode->getLayoutFrm( pTxtNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); + const SwCntntFrm* pRefFrm = pRefTxtFld->GetTxtNode().getLayoutFrm( pRefTxtFld->GetTxtNode().GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); const SwPageFrm* pPgFrm = 0; sal_uInt16 nDiff = ( pFrm && pRefFrm ) ? (pPgFrm = pFrm->FindPageFrm())->GetPhyPageNum() - diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 4741564e6609..c7f1a00caaaf 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -26,6 +26,7 @@ #include <editeng/unolingu.hxx> #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <pam.hxx> #include <cntfrm.hxx> #include <pagefrm.hxx> @@ -92,8 +93,8 @@ static void lcl_GetLayTree( const SwFrm* pFrm, std::vector<const SwFrm*>& rArr ) bool IsFrameBehind( const SwTxtNode& rMyNd, sal_Int32 nMySttPos, const SwTxtNode& rBehindNd, sal_Int32 nSttPos ) { - const SwTxtFrm *pMyFrm = (SwTxtFrm*)rMyNd.getLayoutFrm( rMyNd.GetDoc()->GetCurrentLayout(), 0, 0, false), - *pFrm = (SwTxtFrm*)rBehindNd.getLayoutFrm( rBehindNd.GetDoc()->GetCurrentLayout(), 0, 0, false); + const SwTxtFrm *pMyFrm = (SwTxtFrm*)rMyNd.getLayoutFrm( rMyNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false), + *pFrm = (SwTxtFrm*)rBehindNd.getLayoutFrm( rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false); while( pFrm && !pFrm->IsInside( nSttPos ) ) pFrm = (SwTxtFrm*)pFrm->GetFollow(); @@ -417,7 +418,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) case REF_PAGE: case REF_PAGE_PGDESC: { - const SwTxtFrm* pFrm = (SwTxtFrm*)pTxtNd->getLayoutFrm( pDoc->GetCurrentLayout(), 0, 0, false), + const SwTxtFrm* pFrm = (SwTxtFrm*)pTxtNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false), *pSave = pFrm; while( pFrm && !pFrm->IsInside( nNumStart ) ) pFrm = (SwTxtFrm*)pFrm->GetFollow(); @@ -439,7 +440,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) case REF_CHAPTER: { // a bit tricky: search any frame - const SwFrm* pFrm = pTxtNd->getLayoutFrm( pDoc->GetCurrentLayout() ); + const SwFrm* pFrm = pTxtNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); if( pFrm ) { SwChapterFieldType aFldTyp; diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index aeea08370c87..261f49236e55 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -57,6 +57,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <DocumentFieldsManager.hxx> +#include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> #include <ndtxt.hxx> #include <pam.hxx> @@ -103,7 +104,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt ) for( sal_uInt16 n = 0; n < pClpDoc->GetSpzFrmFmts()->size(); ++n ) { SwFlyFrmFmt* pFly = (SwFlyFrmFmt*)(*pClpDoc->GetSpzFrmFmts())[n]; - pClpDoc->DelLayoutFmt( pFly ); + pClpDoc->getIDocumentLayoutAccess().DelLayoutFmt( pFly ); } pClpDoc->GetDocumentFieldsManager().GCFieldTypes(); // delete the FieldTypes @@ -140,7 +141,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt ) } aAnchor.SetAnchor( &aPos ); } - pFlyFmt = pClpDoc->CopyLayoutFmt( *pFlyFmt, aAnchor, true, true ); + pFlyFmt = pClpDoc->getIDocumentLayoutAccess().CopyLayoutFmt( *pFlyFmt, aAnchor, true, true ); // assure the "RootFmt" is the first element in Spz-Array // (if necessary Flys were copied in Flys) @@ -208,7 +209,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt ) aAnchor.SetAnchor( &aPos ); } - pClpDoc->CopyLayoutFmt( *pFmt, aAnchor, true, true ); + pClpDoc->getIDocumentLayoutAccess().CopyLayoutFmt( *pFmt, aAnchor, true, true ); } } bRet = true; @@ -380,7 +381,7 @@ bool SwFEShell::CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt, pFmt = pDestDoc->getIDocumentContentOperations().InsertDrawObj( *pDestShell->GetCrsr(), *pNew, aSet ); } else - pFmt = pDestDoc->CopyLayoutFmt( *pFmt, aAnchor, true, true ); + pFmt = pDestDoc->getIDocumentLayoutAccess().CopyLayoutFmt( *pFmt, aAnchor, true, true ); // Can be 0, as Draws are not allowed in Headers/Footers if ( pFmt ) @@ -531,7 +532,7 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt, if( bRet ) { SwFrmFmt *pOldFmt = pFlyFmt; - pFlyFmt = pDestShell->GetDoc()->CopyLayoutFmt( *pFlyFmt, aAnchor, true, true ); + pFlyFmt = pDestShell->GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( *pFlyFmt, aAnchor, true, true ); if ( FLY_AS_CHAR != aAnchor.GetAnchorId() ) { @@ -545,7 +546,7 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt, const Point aPt( pDestShell->GetCrsrDocPos() ); if( bIsMove ) - GetDoc()->DelLayoutFmt( pOldFmt ); + GetDoc()->getIDocumentLayoutAccess().DelLayoutFmt( pOldFmt ); // only select if it can be shifted/copied in the same shell if( bSelectInsert ) @@ -965,7 +966,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) 0, aPt, *this, aAnchor, aPt, false ); } - SwFrmFmt * pNew = GetDoc()->CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); + SwFrmFmt * pNew = GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); if( pNew ) { @@ -1084,7 +1085,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) } else continue; - GetDoc()->CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); + GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); } } } @@ -1190,7 +1191,7 @@ bool SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1 } else continue; - rToFill.GetDoc()->CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); + rToFill.GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); } } GetDoc()->getIDocumentFieldsAccess().UnlockExpFlds(); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index d175b9963129..ce7b32d42581 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -46,6 +46,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <dview.hxx> #include <dflyobj.hxx> #include <dcontact.hxx> @@ -88,7 +89,7 @@ static bool lcl_SetNewFlyPos( const SwNode& rNode, SwFmtAnchor& rAnchor, else { const SwCntntNode *pCntNd = rNode.GetCntntNode(); - const SwCntntFrm* pCFrm = pCntNd ? pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), &rPt, 0, false ) : 0; + const SwCntntFrm* pCFrm = pCntNd ? pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPt, 0, false ) : 0; const SwPageFrm *pPg = pCFrm ? pCFrm->FindPageFrm() : 0; rAnchor.SetPageNum( pPg ? pPg->GetPhyPageNum() : 1 ); @@ -162,7 +163,7 @@ static bool lcl_FindAnchorPos( SwCrsrMoveState aState( MV_SETONLYTEXT ); SwPosition aPos( rDoc.GetNodes() ); aTmpPnt.setX(aTmpPnt.getX() - 1); // do not land in the fly! - rDoc.GetCurrentLayout()->GetCrsrOfst( &aPos, aTmpPnt, &aState ); + rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->GetCrsrOfst( &aPos, aTmpPnt, &aState ); pNewAnch = ::FindAnchor( aPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( rFrm.getRootFrm(), 0, 0, false ), aTmpPnt )->FindFlyFrm(); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 6cd068b0febb..6bbb858baa75 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -39,6 +39,8 @@ #include <IDocumentSettingAccess.hxx> #include <DocumentSettingManager.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <cmdid.h> #include <drawdoc.hxx> #include <textboxhelper.hxx> diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 2a33bfac5d19..e767b1902955 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -35,6 +35,7 @@ #include <fesh.hxx> #include <doc.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <cntfrm.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> @@ -1031,7 +1032,7 @@ static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos ) const SwCntntFrm *pFrm; if( 0 != ( pNd = rPos.nNode.GetNode().GetCntntNode() )) - pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, &rPos, false ); + pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, &rPos, false ); else pFrm = 0; diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index ca20bd0584bf..d64686fd187d 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -28,6 +28,7 @@ #include <crsrsh.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -132,7 +133,7 @@ void GetTblSelCrs( const SwTableCursor& rTblCrsr, SwSelBoxes& rBoxes ) if (rTblCrsr.IsChgd() || !rTblCrsr.GetSelectedBoxesCount()) { SwTableCursor* pTCrsr = (SwTableCursor*)&rTblCrsr; - pTCrsr->GetDoc()->GetCurrentLayout()->MakeTblCrsrs( *pTCrsr ); + pTCrsr->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->MakeTblCrsrs( *pTCrsr ); } if (rTblCrsr.GetSelectedBoxesCount()) @@ -228,10 +229,10 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes, } const SwCntntNode *pCntNd = rCrsr.GetCntntNode(); const SwLayoutFrm *pStart = pCntNd ? - pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), &aPtPos )->GetUpper() : 0; + pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPtPos )->GetUpper() : 0; pCntNd = rCrsr.GetCntntNode(false); const SwLayoutFrm *pEnd = pCntNd ? - pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), &aMkPos )->GetUpper() : 0; + pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aMkPos )->GetUpper() : 0; if( pStart && pEnd ) GetTblSel( pStart, pEnd, rBoxes, 0, eSearchType ); } @@ -431,10 +432,10 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) // #i22135# - Also the content of the table could be // invisible - e.g. in a hidden section // Robust: check, if content was found (e.g. empty table cells) - if ( !pCNd || pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ) == NULL ) + if ( !pCNd || pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) == NULL ) return false; - const SwLayoutFrm *pStart = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aNullPos )->GetUpper(); + const SwLayoutFrm *pStart = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aNullPos )->GetUpper(); OSL_ENSURE( pStart, "without frame nothing works" ); aIdx = rEndNd; @@ -443,12 +444,12 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) pCNd = aIdx.GetNodes().GoNextSection( &aIdx, false, false ); // #i22135# - Robust: check, if content was found and if it's visible - if ( !pCNd || pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout() ) == NULL ) + if ( !pCNd || pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) == NULL ) { return false; } - const SwLayoutFrm *pEnd = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aNullPos )->GetUpper(); + const SwLayoutFrm *pEnd = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aNullPos )->GetUpper(); OSL_ENSURE( pEnd, "without frame nothing works" ); bool bTblIsValid, bValidChartSel; @@ -912,10 +913,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, Point aPt( 0, 0 ); const SwCntntNode* pCntNd = rPam.GetCntntNode(); - const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), + const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt )->GetUpper(); pCntNd = rPam.GetCntntNode(false); - const SwLayoutFrm *pEnd = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), + const SwLayoutFrm *pEnd = pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt )->GetUpper(); // First, compute tables and rectangles @@ -1431,10 +1432,10 @@ sal_uInt16 CheckMergeSel( const SwPaM& rPam ) Point aPt; const SwCntntNode* pCntNd = rPam.GetCntntNode(); - const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), + const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt )->GetUpper(); pCntNd = rPam.GetCntntNode(false); - const SwLayoutFrm *pEnd = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), + const SwLayoutFrm *pEnd = pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt )->GetUpper(); GetTblSel( pStart, pEnd, aBoxes, 0 ); return CheckMergeSel( aBoxes ); @@ -1961,10 +1962,10 @@ bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv, } const SwCntntNode* pCntNd = rCrsr.GetCntntNode(); - const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), + const SwLayoutFrm *pStart = pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPtPos )->GetUpper(); pCntNd = rCrsr.GetCntntNode(false); - const SwLayoutFrm *pEnd = pCntNd->getLayoutFrm( pCntNd->GetDoc()->GetCurrentLayout(), + const SwLayoutFrm *pEnd = pCntNd->getLayoutFrm( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aMkPos )->GetUpper(); SWRECTFN( pStart->GetUpper() ) diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 5781e9eb20ab..539027c46e6f 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -35,6 +35,7 @@ #include <frmfmt.hxx> #include <doc.hxx> #include <IDocumentLinksAdministration.hxx> +#include <IDocumentLayoutAccess.hxx> #include <frmatr.hxx> #include <grfatr.hxx> #include <swtypes.hxx> @@ -215,7 +216,7 @@ bool SwGrfNode::ReRead( if( refLink.Is() ) { - if( getLayoutFrm( GetDoc()->GetCurrentLayout() ) ) + if( getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) { SwMsgPoolItem aMsgHint( RES_GRF_REREAD_AND_INCACHE ); ModifyNotification( &aMsgHint, &aMsgHint ); diff --git a/sw/source/core/inc/DocumentLayoutManager.hxx b/sw/source/core/inc/DocumentLayoutManager.hxx new file mode 100644 index 000000000000..66a1d8bb0d87 --- /dev/null +++ b/sw/source/core/inc/DocumentLayoutManager.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTLAYOUTMANAGER_HXX +#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTLAYOUTMANAGER_HXX + +#include <IDocumentLayoutAccess.hxx> +#include <boost/utility.hpp> + +class SwDoc; +class SwViewShell; +class SwLayouter; + +namespace sw { + +class DocumentLayoutManager : public IDocumentLayoutAccess, + public ::boost::noncopyable +{ + +public: + + DocumentLayoutManager( SwDoc& i_rSwdoc ); + + virtual const SwViewShell *GetCurrentViewShell() const SAL_OVERRIDE; + virtual SwViewShell *GetCurrentViewShell() SAL_OVERRIDE; //< It must be able to communicate to a SwViewShell.This is going to be removerd later. + virtual void SetCurrentViewShell( SwViewShell* pNew ) SAL_OVERRIDE; + + virtual const SwRootFrm *GetCurrentLayout() const SAL_OVERRIDE; + virtual SwRootFrm *GetCurrentLayout() SAL_OVERRIDE; + virtual bool HasLayout() const SAL_OVERRIDE; + + virtual const SwLayouter* GetLayouter() const SAL_OVERRIDE; + virtual SwLayouter* GetLayouter() SAL_OVERRIDE; + virtual void SetLayouter( SwLayouter* pNew ) SAL_OVERRIDE; + + virtual SwFrmFmt* MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) SAL_OVERRIDE; + virtual void DelLayoutFmt( SwFrmFmt *pFmt ) SAL_OVERRIDE; + virtual SwFrmFmt* CopyLayoutFmt( const SwFrmFmt& rSrc, const SwFmtAnchor& rNewAnchor, bool bSetTxtFlyAtt, bool bMakeFrms ) SAL_OVERRIDE; + + //Non Interface methods + void ClearSwLayouterEntries(); + + virtual ~DocumentLayoutManager(); + +private: + + SwDoc& m_rSwdoc; + + SwViewShell *mpCurrentView; //< SwDoc should get a new member mpCurrentView + SwLayouter *mpLayouter; /**< ::com::sun::star::frame::Controller for complex layout formatting + like footnote/endnote in sections */ +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index db19e5740840..b362180c70f6 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -47,6 +47,7 @@ #include <hfspacingitem.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentContentOperations.hxx> +#include <IDocumentLayoutAccess.hxx> #include <pagefrm.hxx> #include <rootfrm.hxx> #include <cntfrm.hxx> @@ -2468,13 +2469,13 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if( pH && pH->IsActive() && !pH->GetHeaderFmt() ) { //If he doesn't have one, I'll add one - SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_HEADER, 0 ); + SwFrmFmt *pFmt = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFmt( RND_STD_HEADER, 0 ); pH->RegisterToFormat( *pFmt ); } if( pF && pF->IsActive() && !pF->GetFooterFmt() ) { //If he doesn't have one, I'll add one - SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_FOOTER, 0 ); + SwFrmFmt *pFmt = GetDoc()->getIDocumentLayoutAccess().MakeLayoutFmt( RND_STD_FOOTER, 0 ); pF->RegisterToFormat( *pFmt ); } @@ -2691,7 +2692,7 @@ SwFlyFrmFmt::~SwFlyFrmFmt() void SwFlyFrmFmt::MakeFrms() { // is there a layout? - if( !GetDoc()->GetCurrentViewShell() ) + if( !GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) return; SwModify *pModify = 0; @@ -2752,7 +2753,7 @@ void SwFlyFrmFmt::MakeFrms() case FLY_AT_PAGE: { sal_uInt16 nPgNum = aAnchorAttr.GetPageNum(); - SwPageFrm *pPage = (SwPageFrm*)GetDoc()->GetCurrentLayout()->Lower(); + SwPageFrm *pPage = (SwPageFrm*)GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->Lower(); if( nPgNum == 0 && aAnchorAttr.GetCntntAnchor() ) { SwCntntNode *pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode(); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index db3ae50b0cfd..a5f79bdcde4f 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -42,6 +42,7 @@ #include <flyfrms.hxx> #include <DocumentSettingManager.hxx> +#include <IDocumentLayoutAccess.hxx> // Move methods @@ -865,7 +866,7 @@ bool SwTxtNode::IsCollapse() const // The paragraph is collapsed only if the NdAfter is the end of a cell bool bInTable = this->FindTableNode( ) != NULL; - SwSortedObjs* pObjs = this->getLayoutFrm( GetDoc()->GetCurrentLayout() )->GetDrawObjs( ); + SwSortedObjs* pObjs = this->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() )->GetDrawObjs( ); sal_uInt32 nObjs = ( pObjs != NULL ) ? pObjs->Count( ) : 0; return pNdBefore!=NULL && pNdAfter!=NULL && nObjs == 0 && bInTable; diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index c6c44e6c3595..cb029ae5b7ee 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -30,6 +30,7 @@ #include "switerator.hxx" #include "ftnfrm.hxx" #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> SwColumnFrm::SwColumnFrm( SwFrmFmt *pFmt, SwFrm* pSib ): SwFtnBossFrm( pFmt, pSib ) @@ -210,7 +211,7 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, // SaveCntnt would also suck up the content of the footnote container // and store it within the normal text flow. if( IsPageBodyFrm() ) - pDoc->GetCurrentLayout()->RemoveFtns( (SwPageFrm*)GetUpper(), true, false ); + pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->RemoveFtns( (SwPageFrm*)GetUpper(), true, false ); pSave = ::SaveCntnt( this ); //If columns exist, they get deleted if a column count of 0 or 1 is requested. diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index bcf92090f2a9..b744ec834a22 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -60,6 +60,7 @@ #include <vcl/svapp.hxx> #include "switerator.hxx" #include <IDocumentSettingAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <textboxhelper.hxx> #include <txtfly.hxx> @@ -1391,7 +1392,7 @@ void CalcCntnt( SwLayoutFrm *pLay, if( pSect->IsEndnAtEnd() ) { if( bCollect ) - pLay->GetFmt()->GetDoc()->GetLayouter()-> + pLay->GetFmt()->GetDoc()->getIDocumentLayoutAccess().GetLayouter()-> InsertEndnotes( pSect ); bool bLock = pSect->IsFtnLock(); pSect->SetFtnLock( true ); @@ -1646,7 +1647,7 @@ void CalcCntnt( SwLayoutFrm *pLay, { if( bCollect ) { - pLay->GetFmt()->GetDoc()->GetLayouter()->InsertEndnotes(pSect); + pLay->GetFmt()->GetDoc()->getIDocumentLayoutAccess().GetLayouter()->InsertEndnotes(pSect); pSect->CalcFtnCntnt(); } if( pSect->HasFollow() ) diff --git a/sw/source/core/layout/flypos.cxx b/sw/source/core/layout/flypos.cxx index 87f215cf9013..2857b14a276d 100644 --- a/sw/source/core/layout/flypos.cxx +++ b/sw/source/core/layout/flypos.cxx @@ -18,6 +18,7 @@ */ #include "doc.hxx" +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include "dcontact.hxx" #include "flyfrm.hxx" @@ -45,7 +46,7 @@ SwPosFlyFrm::SwPosFlyFrm( const SwNodeIndex& rIdx, const SwFrmFmt* pFmt, { pNdIdx = new SwNodeIndex( rIdx ); } - else if( pFmt->GetDoc()->GetCurrentViewShell() ) + else if( pFmt->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) { if( RES_FLYFRMFMT == pFmt->Which() ) { diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 34d10fb32605..c3c994e67b45 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -33,6 +33,7 @@ #include "docstat.hxx" #include "swevent.hxx" #include <IDocumentStatistics.hxx> +#include <IDocumentLayoutAccess.hxx> #include <sfx2/event.hxx> diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index c6f6957219b4..7a5ae59a3385 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -20,6 +20,7 @@ #include <editeng/formatbreakitem.hxx> #include <doc.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docstat.hxx> #include <docary.hxx> #include <fmtpdsc.hxx> @@ -155,7 +156,7 @@ bool SwLayCacheImpl::Read( SvStream& rStream ) */ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) { - if( rDoc.GetCurrentLayout() ) // the layout itself .. + if( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ) // the layout itself .. { SwLayCacheIoImpl aIo( rStream, true ); // We want to save the relative index, so we need the index @@ -163,7 +164,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) sal_uLong nStartOfContent = rDoc.GetNodes().GetEndOfContent(). StartOfSectionNode()->GetIndex(); // The first page.. - SwPageFrm* pPage = (SwPageFrm*)rDoc.GetCurrentLayout()->Lower(); + SwPageFrm* pPage = (SwPageFrm*)rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->Lower(); aIo.OpenRec( SW_LAYCACHE_IO_REC_PAGES ); aIo.OpenFlagRec( 0, 0 ); @@ -319,7 +320,7 @@ bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const { if( !pImpl ) return true; - const SwRootFrm *pRootFrm = rDoc.GetCurrentLayout(); + const SwRootFrm *pRootFrm = rDoc.getIDocumentLayoutAccess().GetCurrentLayout(); if( pRootFrm ) { sal_uInt16 nIndex = 0; diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx index 6dcbc8987b4e..8d88f9a60bbf 100644 --- a/sw/source/core/layout/layouter.cxx +++ b/sw/source/core/layout/layouter.cxx @@ -23,6 +23,7 @@ #include "pagefrm.hxx" #include "ftnfrm.hxx" #include "txtfrm.hxx" +#include <IDocumentLayoutAccess.hxx> #include <movedfwdfrmsbyobjpos.hxx> #include <objstmpconsiderwrapinfl.hxx> @@ -281,16 +282,16 @@ void SwLayouter::EndLoopControl() void SwLayouter::CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect ) { assert(pDoc && "No doc, no fun"); - if( !pDoc->GetLayouter() ) - pDoc->SetLayouter( new SwLayouter() ); - pDoc->GetLayouter()->_CollectEndnotes( pSect ); + if( !pDoc->getIDocumentLayoutAccess().GetLayouter() ) + pDoc->getIDocumentLayoutAccess().SetLayouter( new SwLayouter() ); + pDoc->getIDocumentLayoutAccess().GetLayouter()->_CollectEndnotes( pSect ); } bool SwLayouter::Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn ) { - if( !pDoc->GetLayouter() ) + if( !pDoc->getIDocumentLayoutAccess().GetLayouter() ) return false; - SwLayouter *pLayouter = pDoc->GetLayouter(); + SwLayouter *pLayouter = pDoc->getIDocumentLayoutAccess().GetLayouter(); if( pLayouter->pEndnoter && pLayouter->pEndnoter->GetSect() && pSect && ( pLayouter->pEndnoter->GetSect()->IsAnFollow( pSect ) || pSect->IsAnFollow( pLayouter->pEndnoter->GetSect() ) ) ) @@ -305,10 +306,10 @@ bool SwLayouter::Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn ) bool SwLayouter::StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage ) { OSL_ENSURE( pDoc, "No doc, no fun" ); - if( !pDoc->GetLayouter() ) - pDoc->SetLayouter( new SwLayouter() ); - return !pDoc->GetLayouter()->pLooping && - pDoc->GetLayouter()->StartLooping( pPage ); + if( !pDoc->getIDocumentLayoutAccess().GetLayouter() ) + pDoc->getIDocumentLayoutAccess().SetLayouter( new SwLayouter() ); + return !pDoc->getIDocumentLayoutAccess().GetLayouter()->pLooping && + pDoc->getIDocumentLayoutAccess().GetLayouter()->StartLooping( pPage ); } // #i28701# @@ -316,10 +317,10 @@ bool SwLayouter::StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage ) // of its anchored objects void SwLayouter::ClearMovedFwdFrms( const SwDoc& _rDoc ) { - if ( _rDoc.GetLayouter() && - _rDoc.GetLayouter()->mpMovedFwdFrms ) + if ( _rDoc.getIDocumentLayoutAccess().GetLayouter() && + _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms ) { - _rDoc.GetLayouter()->mpMovedFwdFrms->Clear(); + _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms->Clear(); } } @@ -327,18 +328,18 @@ void SwLayouter::InsertMovedFwdFrm( const SwDoc& _rDoc, const SwTxtFrm& _rMovedFwdFrmByObjPos, const sal_uInt32 _nToPageNum ) { - if ( !_rDoc.GetLayouter() ) + if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter() ) { - const_cast<SwDoc&>(_rDoc).SetLayouter( new SwLayouter() ); + const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().SetLayouter( new SwLayouter() ); } - if ( !_rDoc.GetLayouter()->mpMovedFwdFrms ) + if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms ) { - const_cast<SwDoc&>(_rDoc).GetLayouter()->mpMovedFwdFrms = + const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms = new SwMovedFwdFrmsByObjPos(); } - _rDoc.GetLayouter()->mpMovedFwdFrms->Insert( _rMovedFwdFrmByObjPos, + _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms->Insert( _rMovedFwdFrmByObjPos, _nToPageNum ); } @@ -349,7 +350,7 @@ void SwLayouter::RemoveMovedFwdFrm( const SwDoc& _rDoc, sal_uInt32 nDummy; if ( SwLayouter::FrmMovedFwdByObjPos( _rDoc, _rTxtFrm, nDummy ) ) { - _rDoc.GetLayouter()->mpMovedFwdFrms->Remove( _rTxtFrm ); + _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms->Remove( _rTxtFrm ); } } @@ -357,19 +358,19 @@ bool SwLayouter::FrmMovedFwdByObjPos( const SwDoc& _rDoc, const SwTxtFrm& _rTxtFrm, sal_uInt32& _ornToPageNum ) { - if ( !_rDoc.GetLayouter() ) + if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter() ) { _ornToPageNum = 0; return false; } - else if ( !_rDoc.GetLayouter()->mpMovedFwdFrms ) + else if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms ) { _ornToPageNum = 0; return false; } else { - return _rDoc.GetLayouter()->mpMovedFwdFrms-> + return _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms-> FrmMovedFwdByObjPos( _rTxtFrm, _ornToPageNum ); } } @@ -378,17 +379,17 @@ bool SwLayouter::FrmMovedFwdByObjPos( const SwDoc& _rDoc, bool SwLayouter::DoesRowContainMovedFwdFrm( const SwDoc& _rDoc, const SwRowFrm& _rRowFrm ) { - if ( !_rDoc.GetLayouter() ) + if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter() ) { return false; } - else if ( !_rDoc.GetLayouter()->mpMovedFwdFrms ) + else if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrms ) { return false; } else { - return _rDoc.GetLayouter()-> + return _rDoc.getIDocumentLayoutAccess().GetLayouter()-> mpMovedFwdFrms->DoesRowContainMovedFwdFrm( _rRowFrm ); } } @@ -396,28 +397,28 @@ bool SwLayouter::DoesRowContainMovedFwdFrm( const SwDoc& _rDoc, // #i35911# void SwLayouter::ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc ) { - if ( _rDoc.GetLayouter() && - _rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl ) + if ( _rDoc.getIDocumentLayoutAccess().GetLayouter() && + _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl ) { - _rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl->Clear(); + _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl->Clear(); } } void SwLayouter::InsertObjForTmpConsiderWrapInfluence( const SwDoc& _rDoc, SwAnchoredObject& _rAnchoredObj ) { - if ( !_rDoc.GetLayouter() ) + if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter() ) { - const_cast<SwDoc&>(_rDoc).SetLayouter( new SwLayouter() ); + const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().SetLayouter( new SwLayouter() ); } - if ( !_rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl ) + if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl ) { - const_cast<SwDoc&>(_rDoc).GetLayouter()->mpObjsTmpConsiderWrapInfl = + const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl = new SwObjsMarkedAsTmpConsiderWrapInfluence(); } - _rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl->Insert( _rAnchoredObj ); + _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl->Insert( _rAnchoredObj ); } void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTxtFrm& rTxtFrm ) @@ -425,9 +426,9 @@ void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTxtFrm& rTxtFrm ) if ( bCondition ) { const SwDoc& rDoc = *rTxtFrm.GetAttrSet()->GetDoc(); - if ( rDoc.GetLayouter() ) + if ( rDoc.getIDocumentLayoutAccess().GetLayouter() ) { - const_cast<SwDoc&>(rDoc).GetLayouter()->LoopingLouieLight( rDoc, rTxtFrm ); + const_cast<SwDoc&>(rDoc).getIDocumentLayoutAccess().GetLayouter()->LoopingLouieLight( rDoc, rTxtFrm ); } } } @@ -439,9 +440,9 @@ bool SwLayouter::MoveBwdSuppressed( const SwDoc& p_rDoc, { bool bMoveBwdSuppressed( false ); - if ( !p_rDoc.GetLayouter() ) + if ( !p_rDoc.getIDocumentLayoutAccess().GetLayouter() ) { - const_cast<SwDoc&>(p_rDoc).SetLayouter( new SwLayouter() ); + const_cast<SwDoc&>(p_rDoc).getIDocumentLayoutAccess().SetLayouter( new SwLayouter() ); } // create hash map key @@ -464,7 +465,7 @@ bool SwLayouter::MoveBwdSuppressed( const SwDoc& p_rDoc, // check for moving backward suppress threshold const sal_uInt16 cMoveBwdCountSuppressThreshold = 20; - if ( ++const_cast<SwDoc&>(p_rDoc).GetLayouter()->maMoveBwdLayoutInfo[ aMoveBwdLayoutInfo ] > + if ( ++const_cast<SwDoc&>(p_rDoc).getIDocumentLayoutAccess().GetLayouter()->maMoveBwdLayoutInfo[ aMoveBwdLayoutInfo ] > cMoveBwdCountSuppressThreshold ) { bMoveBwdSuppressed = true; @@ -475,8 +476,8 @@ bool SwLayouter::MoveBwdSuppressed( const SwDoc& p_rDoc, void SwLayouter::ClearMoveBwdLayoutInfo( const SwDoc& _rDoc ) { - if ( _rDoc.GetLayouter() ) - const_cast<SwDoc&>(_rDoc).GetLayouter()->maMoveBwdLayoutInfo.clear(); + if ( _rDoc.getIDocumentLayoutAccess().GetLayouter() ) + const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->maMoveBwdLayoutInfo.clear(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index a052114ff6cf..efb1fc9078f9 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -37,6 +37,7 @@ #include <set> #include <IDocumentSettingAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <DocumentLayoutManager.hxx> SwLayVout *SwRootFrm::pVout = 0; bool SwRootFrm::bInPaint = false; @@ -584,7 +585,7 @@ SwRootFrm::~SwRootFrm() { SwDoc *pDoc = pRegisteredInNonConst->GetDoc(); pDoc->DelFrmFmt( pRegisteredInNonConst ); - pDoc->ClearSwLayouterEntries(); + pDoc->GetDocumentLayoutManager().ClearSwLayouterEntries(); } delete pDestroy; pDestroy = 0; diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 76584b6fb24c..59922992d565 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -30,6 +30,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentContentOperations.hxx> +#include <IDocumentLayoutAccess.hxx> #include <cstdlib> #include <vector> #include <set> @@ -1406,7 +1407,7 @@ bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn _FndBox aFndBox( 0, 0 ); aFndBox.SetTableLines( rBoxes, *this ); - if( bSameHeight && pDoc->GetCurrentViewShell() ) + if( bSameHeight && pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) { SwSplitLines aRowLines; SwSplitLines aSplitLines; diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index c6729f9bff10..104cd4d2edc7 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -36,6 +36,7 @@ #include <doc.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <viewsh.hxx> #include <rootfrm.hxx> #include <docary.hxx> diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index b5c686a3d59a..c8706a411c83 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -29,6 +29,7 @@ #include <ndtxt.hxx> #include <doc.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> #include <breakit.hxx> #include <vcl/keycodes.hxx> diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index c14eb8962b70..089e080e60a1 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -19,6 +19,7 @@ #include "viewsh.hxx" #include "doc.hxx" +#include <IDocumentLayoutAccess.hxx> #include "pagefrm.hxx" #include "rootfrm.hxx" #include "ndtxt.hxx" diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx index 9c83b4abc56e..af71b04b4abb 100644 --- a/sw/source/core/tox/ToxTextGenerator.cxx +++ b/sw/source/core/tox/ToxTextGenerator.cxx @@ -23,6 +23,7 @@ #include "cntfrm.hxx" #include "fchrfmt.hxx" #include "doc.hxx" +#include <IDocumentLayoutAccess.hxx> #include "fmtinfmt.hxx" #include "ndtxt.hxx" #include "pagedesc.hxx" @@ -115,7 +116,7 @@ ToxTextGenerator::HandleChapterToken(const SwTOXSortTabBase& rBase, const SwForm } // #i53420# - const SwCntntFrm* contentFrame = contentNode->getLayoutFrm(pDoc->GetCurrentLayout()); + const SwCntntFrm* contentFrame = contentNode->getLayoutFrm(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); if (!contentFrame) { return OUString(); } @@ -203,7 +204,7 @@ ToxTextGenerator::GenerateText(SwDoc* pDoc, const std::vector<SwTOXSortTabBase*> case TOKEN_TAB_STOP: { ToxTabStopTokenHandler::HandledTabStopToken htst = - mTabStopTokenHandler->HandleTabStopToken(aToken, *pTOXNd, pDoc->GetCurrentLayout()); + mTabStopTokenHandler->HandleTabStopToken(aToken, *pTOXNd, pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); rTxt += htst.text; aTStops.Insert(htst.tabStop); break; diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 8818fe2d0b36..325b38977913 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -23,6 +23,7 @@ #include <editeng/unolingu.hxx> #include <txtfld.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <cntfrm.hxx> #include <node.hxx> @@ -157,7 +158,7 @@ SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwCntntNode* pNd, { // Then get the 'anchor' (body) position Point aPt; - const SwCntntFrm* pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aPt, 0, false ); + const SwCntntFrm* pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false ); if( pFrm ) { SwPosition aPos( *pNd ); diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx index 205259cac9ae..0250326abb9c 100644 --- a/sw/source/core/txtnode/atrflyin.cxx +++ b/sw/source/core/txtnode/atrflyin.cxx @@ -21,6 +21,7 @@ #include "cntfrm.hxx" #include "doc.hxx" #include <IDocumentUndoRedo.hxx> +#include <IDocumentLayoutAccess.hxx> #include "pam.hxx" #include "flyfrm.hxx" #include "ndtxt.hxx" @@ -127,7 +128,7 @@ void SwTxtFlyCnt::CopyFlyFmt( SwDoc* pDoc ) } } - SwFrmFmt* pNew = pDoc->CopyLayoutFmt( *pFmt, aAnchor, false, false ); + SwFrmFmt* pNew = pDoc->getIDocumentLayoutAccess().CopyLayoutFmt( *pFmt, aAnchor, false, false ); ((SwFmtFlyCnt&)GetFlyCnt()).SetFlyFmt( pNew ); } @@ -171,11 +172,11 @@ void SwTxtFlyCnt::SetAnchor( const SwTxtNode *pNode ) { // disable undo while copying attribute ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); - SwFrmFmt* pNew = pDoc->CopyLayoutFmt( *pFmt, aAnchor, false, false ); + SwFrmFmt* pNew = pDoc->getIDocumentLayoutAccess().CopyLayoutFmt( *pFmt, aAnchor, false, false ); ::sw::UndoGuard const undoGuardFmt( pFmt->GetDoc()->GetIDocumentUndoRedo()); - pFmt->GetDoc()->DelLayoutFmt( pFmt ); + pFmt->GetDoc()->getIDocumentLayoutAccess().DelLayoutFmt( pFmt ); ((SwFmtFlyCnt&)GetFlyCnt()).SetFlyFmt( pNew ); } else if( pNode->GetpSwpHints() && diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index cc2c5cd2cd55..f7c208ba0025 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -54,6 +54,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentListsAccess.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <pam.hxx> #include <fldbas.hxx> @@ -121,7 +122,7 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere, // if there is no layout or it is in a hidden section, MakeFrms is not needed const SwSectionNode* pSectNd; - if( !GetDoc()->GetCurrentViewShell() || + if( !GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() || ( 0 != (pSectNd = pNode->FindSectionNode()) && pSectNd->GetSection().IsHiddenFlag() )) return pNode; @@ -296,7 +297,7 @@ sal_Int32 SwTxtNode::Len() const static void lcl_ChangeFtnRef( SwTxtNode &rNode ) { SwpHints *pSwpHints = rNode.GetpSwpHints(); - if( pSwpHints && rNode.GetDoc()->GetCurrentViewShell() ) + if( pSwpHints && rNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) { SwTxtAttr* pHt; SwCntntFrm* pFrm = NULL; @@ -500,7 +501,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) // text node. const SwRootFrm *pRootFrm; if ( (nTxtLen != nSplitPos) || - ( (pRootFrm = pNode->GetDoc()->GetCurrentLayout()) != 0 && + ( (pRootFrm = pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()) != 0 && pRootFrm->IsAnyShellAccessible() ) ) { // dann sage den Frames noch, das am Ende etwas "geloescht" wurde diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 23b661ea7676..5dbaaf8effad 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -54,6 +54,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <fldbas.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -1120,7 +1121,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr ) // zeichengebundener Frames" in fesh.cxx, SwFEShell::DelFmt() SwFrmFmt* pFmt = pAttr->GetFlyCnt().GetFrmFmt(); if( pFmt ) // vom Undo auf 0 gesetzt ?? - pDoc->DelLayoutFmt( pFmt ); + pDoc->getIDocumentLayoutAccess().DelLayoutFmt( pFmt ); } break; diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 57706917bfc8..188639476e7f 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -37,6 +37,7 @@ #include <acmplwrd.hxx> #include <doc.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docsh.hxx> #include <txtfld.hxx> #include <fmtfld.hxx> @@ -1596,7 +1597,7 @@ bool SwTxtNode::Hyphenate( SwInterHyphInfo &rHyphInf ) if( pLinguNode != this ) { pLinguNode = this; - pLinguFrm = (SwTxtFrm*)getLayoutFrm( GetDoc()->GetCurrentLayout(), (Point*)(rHyphInf.GetCrsrPos()) ); + pLinguFrm = (SwTxtFrm*)getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), (Point*)(rHyphInf.GetCrsrPos()) ); } SwTxtFrm *pFrm = pLinguFrm; if( pFrm ) diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 41675082886e..f39252fb9ed5 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -41,6 +41,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <paratr.hxx> @@ -896,7 +897,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool ) aTmp.SetAnchor( &aPos ); // so the Layout does not get confused - if ( !pCNd || !pCNd->getLayoutFrm( pDoc->GetCurrentLayout(), 0, 0, false ) ) + if ( !pCNd || !pCNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false ) ) { m_rFmt.DelFrms(); } diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index d582d979eac2..23ac2228f692 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -35,6 +35,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IShellCursorSupplier.hxx> #include <docary.hxx> @@ -482,7 +483,7 @@ bool SwUndoFmtAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext) aNewAnchor.SetPageNum( rAnchor.GetPageNum() ); Point aDrawSavePt, aDrawOldPt; - if( pDoc->GetCurrentViewShell() ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) { if( RES_DRAWFRMFMT == pFrmFmt->Which() ) { diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 38893d497ee1..5c2d4fe7d89d 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -30,6 +30,7 @@ #include <UndoDraw.hxx> #include <rolbck.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <rootfrm.hxx> #include <swundo.hxx> @@ -324,13 +325,13 @@ void SwUndoInsLayFmt::RepeatImpl(::sw::RepeatContext & rContext) } else if (FLY_AT_PAGE == aAnchor.GetAnchorId()) { - aAnchor.SetPageNum( pDoc->GetCurrentLayout()->GetCurrPage( &rContext.GetRepeatPaM() )); + aAnchor.SetPageNum( pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetCurrPage( &rContext.GetRepeatPaM() )); } else { OSL_FAIL( "What kind of anchor is this?" ); } - SwFrmFmt* pFlyFmt = pDoc->CopyLayoutFmt( *pFrmFmt, aAnchor, true, true ); + SwFrmFmt* pFlyFmt = pDoc->getIDocumentLayoutAccess().CopyLayoutFmt( *pFrmFmt, aAnchor, true, true ); (void) pFlyFmt; } diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 50120ca553b1..ede0e46043f6 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -34,6 +34,7 @@ #include <frmfmt.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docary.hxx> #include <frame.hxx> #include <swundo.hxx> @@ -64,7 +65,7 @@ IMPL_LINK( SwDoc, AddDrawUndo, SdrUndoAction *, pUndo ) GetIDocumentUndoRedo().DoesDrawUndo()) { const SdrMarkList* pMarkList = 0; - SwViewShell* pSh = GetCurrentViewShell(); + SwViewShell* pSh = getIDocumentLayoutAccess().GetCurrentViewShell(); if( pSh && pSh->HasDrawView() ) pMarkList = &pSh->GetDrawView()->GetMarkedObjectList(); diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index f3875e07a752..06694b3639a2 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -33,6 +33,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <swundo.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -995,7 +996,7 @@ void SwUndoInsertLabel::RepeatImpl(::sw::RepeatContext & rContext) case LTYPE_OBJECT: { SwFlyFrm* pFly; - SwCntntFrm *pCnt = pCNd->getLayoutFrm( rDoc.GetCurrentLayout() ); + SwCntntFrm *pCnt = pCNd->getLayoutFrm( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ); if( pCnt && 0 != ( pFly = pCnt->FindFlyFrm() ) ) nIdx = pFly->GetFmt()->GetCntnt().GetCntntIdx()->GetIndex(); } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 6c2afc64dc44..d2fc1770cd1d 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -46,6 +46,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <fmtftn.hxx> #include <fmtpdsc.hxx> #include <charfmt.hxx> @@ -894,7 +895,7 @@ void GetCurPageStyle(SwPaM& rPaM, OUString &rString) { if (!rPaM.GetCntntNode()) return; // TODO: is there an easy way to get it for tables/sections? - const SwPageFrm* pPage = rPaM.GetCntntNode()->getLayoutFrm(rPaM.GetDoc()->GetCurrentLayout())->FindPageFrm(); + const SwPageFrm* pPage = rPaM.GetCntntNode()->getLayoutFrm(rPaM.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout())->FindPageFrm(); if(pPage) { SwStyleNameMapper::FillProgName(pPage->GetPageDesc()->GetName(), diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 09dd5cb57e10..9640704ebf12 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -34,6 +34,7 @@ #include <docary.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <fmtcntnt.hxx> #include <fmtflcnt.hxx> #include <txtatr.hxx> @@ -703,11 +704,11 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) else throw uno::RuntimeException(); } - else if ((aAnchor.GetAnchorId() != FLY_AT_PAGE) && pDoc->GetCurrentLayout()) + else if ((aAnchor.GetAnchorId() != FLY_AT_PAGE) && pDoc->getIDocumentLayoutAccess().GetCurrentLayout()) { SwCrsrMoveState aState( MV_SETONLYTEXT ); Point aTmp(convertMm100ToTwip(aMM100Pos.X), convertMm100ToTwip(aMM100Pos.Y)); - pDoc->GetCurrentLayout()->GetCrsrOfst( pPam->GetPoint(), aTmp, &aState ); + pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetCrsrOfst( pPam->GetPoint(), aTmp, &aState ); aAnchor.SetAnchor( pPam->GetPoint() ); // #i32349# - adjustment of vertical positioning @@ -1216,7 +1217,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a aValue >>= nPositionLayoutDir; pFmt->SetPositionLayoutDir( nPositionLayoutDir ); } - else if( pDoc->GetCurrentLayout()) + else if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout()) { UnoActionContext aCtx(pDoc); if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId) @@ -1310,11 +1311,11 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a //if the fly has been anchored at page then it needs to be connected //to the content position SwPaM aPam(pDoc->GetNodes().GetEndOfContent()); - if( pDoc->GetCurrentLayout() ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) { SwCrsrMoveState aState( MV_SETONLYTEXT ); Point aTmp( pObj->GetSnapRect().TopLeft() ); - pDoc->GetCurrentLayout()->GetCrsrOfst( aPam.GetPoint(), aTmp, &aState ); + pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetCrsrOfst( aPam.GetPoint(), aTmp, &aState ); } else { @@ -1331,11 +1332,11 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a (FLY_AS_CHAR != eOldAnchorId)) { SwPaM aPam(pDoc->GetNodes().GetEndOfContent()); - if( pDoc->GetCurrentLayout() ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) { SwCrsrMoveState aState( MV_SETONLYTEXT ); Point aTmp( pObj->GetSnapRect().TopLeft() ); - pDoc->GetCurrentLayout()->GetCrsrOfst( aPam.GetPoint(), aTmp, &aState ); + pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetCrsrOfst( aPam.GetPoint(), aTmp, &aState ); } else { @@ -1444,7 +1445,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a { aKeepedPosition = getPosition(); } - if( pFmt && pFmt->GetDoc()->GetCurrentViewShell() ) + if( pFmt && pFmt->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) { UnoActionContext aCtx(pFmt->GetDoc()); xPrSet->setPropertyValue(rPropertyName, aValue); @@ -2156,7 +2157,7 @@ void SwXShape::dispose(void) throw( uno::RuntimeException, std::exception ) pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx ); } else - pFmt->GetDoc()->DelLayoutFmt( pFmt ); + pFmt->GetDoc()->getIDocumentLayoutAccess().DelLayoutFmt( pFmt ); } } if(xShapeAgg.is()) diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index c5b6ef0eaaeb..694fda405394 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -43,6 +43,7 @@ #include <drawdoc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docsh.hxx> #include <editsh.hxx> #include <swcli.hxx> @@ -2604,7 +2605,7 @@ void SwXFrame::dispose(void) throw( uno::RuntimeException, std::exception ) pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx ); } else - pFmt->GetDoc()->DelLayoutFmt(pFmt); + pFmt->GetDoc()->getIDocumentLayoutAccess().DelLayoutFmt(pFmt); } } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 089e1d14bf61..548d7f67b78a 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -27,6 +27,7 @@ #include <frmfmt.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentLayoutAccess.hxx> #include <textboxhelper.hxx> #include <ndtxt.hxx> #include <ndnotxt.hxx> @@ -176,9 +177,9 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx, ? FLY_AT_CHAR : FLY_AT_PARA); const SwCntntFrm* pCFrm; const SwCntntNode* pCNd; - if( pDoc->GetCurrentViewShell() && + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && 0 != (pCNd = rIdx.GetNode().GetCntntNode()) && - 0 != (pCFrm = pCNd->getLayoutFrm( pDoc->GetCurrentLayout())) ) + 0 != (pCFrm = pCNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout())) ) { const SwSortedObjs *pObjs = pCFrm->GetDrawObjs(); if( pObjs ) @@ -240,7 +241,7 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx, UnoActionContext::UnoActionContext(SwDoc *const pDoc) : m_pDoc(pDoc) { - SwRootFrm *const pRootFrm = m_pDoc->GetCurrentLayout(); + SwRootFrm *const pRootFrm = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); if (pRootFrm) { pRootFrm->StartAllAction(); @@ -252,7 +253,7 @@ UnoActionContext::~UnoActionContext() // Doc may already have been removed here if (m_pDoc) { - SwRootFrm *const pRootFrm = m_pDoc->GetCurrentLayout(); + SwRootFrm *const pRootFrm = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); if (pRootFrm) { pRootFrm->EndAllAction(); @@ -263,7 +264,7 @@ UnoActionContext::~UnoActionContext() UnoActionRemoveContext::UnoActionRemoveContext(SwDoc *const pDoc) : m_pDoc(pDoc) { - SwRootFrm *const pRootFrm = m_pDoc->GetCurrentLayout(); + SwRootFrm *const pRootFrm = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); if (pRootFrm) { pRootFrm->UnoRemoveAllActions(); @@ -272,7 +273,7 @@ UnoActionRemoveContext::UnoActionRemoveContext(SwDoc *const pDoc) UnoActionRemoveContext::~UnoActionRemoveContext() { - SwRootFrm *const pRootFrm = m_pDoc->GetCurrentLayout(); + SwRootFrm *const pRootFrm = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); if (pRootFrm) { pRootFrm->UnoRestoreAllActions(); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index c2a8043697b7..363ad2f35b50 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -36,6 +36,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <IDocumentOutlineNodes.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <IDocumentState.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> @@ -2319,7 +2320,7 @@ uno::Reference< ::com::sun::star::accessibility::XAccessible > SwViewShell::Crea OSL_ENSURE( mpLayout, "no layout, no access" ); OSL_ENSURE( GetWin(), "no window, no access" ); - if( mpDoc->GetCurrentViewShell() && GetWin() ) + if( mpDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && GetWin() ) xAcc = Imp()->GetAccessibleMap().GetDocumentView(); return xAcc; @@ -2532,8 +2533,8 @@ const IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() const IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() { return & mpDoc->getIDocumentDrawModelAccess(); } const IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() const { return &mpDoc->getIDocumentRedlineAccess(); } IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() { return &mpDoc->getIDocumentRedlineAccess(); } -const IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() const { return mpDoc; } -IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() { return mpDoc; } +const IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() const { return &mpDoc->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() { return &mpDoc->getIDocumentLayoutAccess(); } IDocumentContentOperations* SwViewShell::getIDocumentContentOperations() { return &mpDoc->getIDocumentContentOperations(); } IDocumentStylePoolAccess* SwViewShell::getIDocumentStylePoolAccess() { return mpDoc; } const IDocumentStatistics* SwViewShell::getIDocumentStatistics() const { return &mpDoc->getIDocumentStatistics(); } diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 852904a8a922..d25b501246dc 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -22,6 +22,7 @@ #include <IDocumentUndoRedo.hxx> #include <DocumentSettingManager.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> #include <docsh.hxx> @@ -118,7 +119,7 @@ void SwViewShell::Init( const SwViewOption *pNewOpt ) // Here's the code which disables the usage of "multiple" layouts at the moment // If the problems with controls and groups objects are solved, // this code can be removed... - SwViewShell *pCurrShell = GetDoc()->GetCurrentViewShell(); + SwViewShell *pCurrShell = GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); if( pCurrShell ) mpLayout = pCurrShell->mpLayout; // end of "disable multiple layouts" @@ -355,8 +356,8 @@ SwViewShell::~SwViewShell() if ( mpDoc ) { GetLayout()->DeRegisterShell( this ); - if(mpDoc->GetCurrentViewShell()==this) - mpDoc->SetCurrentViewShell( this->GetNext()!=this ? + if(mpDoc->getIDocumentLayoutAccess().GetCurrentViewShell()==this) + mpDoc->getIDocumentLayoutAccess().SetCurrentViewShell( this->GetNext()!=this ? (SwViewShell*)this->GetNext() : NULL ); } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 381707eef279..3992d0ba84f9 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -48,6 +48,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentDeviceAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <wdocsh.hxx> #include <fesh.hxx> #include <pam.hxx> @@ -584,8 +585,8 @@ void SwViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintD // For printing a shell is needed. Either the Doc already has one, than we // create a new view, or it has none, than we create the first view. SwViewShell *pSh; - if( pDoc->GetCurrentViewShell() ) - pSh = new SwViewShell( *pDoc->GetCurrentViewShell(), 0, pOleOut,VSHELLFLAG_SHARELAYOUT ); + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) + pSh = new SwViewShell( *pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(), 0, pOleOut,VSHELLFLAG_SHARELAYOUT ); else pSh = new SwViewShell( *pDoc, 0, pOpt, pOleOut); diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 99f52a83d15d..dd5f71f20923 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -43,6 +43,7 @@ #include "frmatr.hxx" #include "pam.hxx" #include "doc.hxx" +#include <IDocumentLayoutAccess.hxx> #include "ndtxt.hxx" #include "shellio.hxx" #include "poolfmt.hxx" @@ -4995,7 +4996,7 @@ void _TblSaveStruct::MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDoc SwTableNode *pTblNd = pTCntxt->GetTableNode(); OSL_ENSURE( pTblNd, "Wo ist der Tabellen-Node" ); - if( pDoc->GetCurrentViewShell() && pTblNd ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && pTblNd ) { // Existiert schon ein Layout, dann muss an dieser Tabelle die // BoxFrames neu erzeugt werden. diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index ff3ae8326956..704a8becac0a 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -48,6 +48,7 @@ #include <IDocumentFieldsAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <ndtxt.hxx> #include <frmatr.hxx> #include <fldbas.hxx> @@ -503,7 +504,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, pFmt->SetFmtAttr(aAnchor); // So the frames will be created when inserting into // existing doc (after setting the anchor!): - if(pDoc->GetCurrentViewShell() + if(pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && (FLY_AT_PARA == pFmt->GetAnchor().GetAnchorId())) { pFmt->MakeFrms(); @@ -1706,7 +1707,7 @@ void SwFltOutDoc::EndTable() rStack.SetAttr( *pPaM->GetPoint(), 0, false ); rEndStack.SetAttr( *pPaM->GetPoint(), 0, false ); - if (GetDoc().GetCurrentViewShell()){ + if (GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell()){ SwTableNode* pTableNode = GetDoc().IsIdxInTbl( pPaM->GetPoint()->nNode); pTableNode->DelFrms(); diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 932ec15c10a8..43272db6e9ee 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -42,6 +42,7 @@ #include <IMark.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docsh.hxx> #include <ndtxt.hxx> #include <wrtww8.hxx> @@ -792,7 +793,7 @@ void DocxExport::WriteProperties( ) void DocxExport::WriteSettings() { - SwViewShell *pViewShell(pDoc->GetCurrentViewShell()); + SwViewShell *pViewShell(pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); if( !pViewShell && !m_aSettings.hasData() && !m_pAttrOutput->HasFootnotes() && !m_pAttrOutput->HasEndnotes()) return; diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 7a42f441bb6a..4de7cca2f684 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -49,6 +49,7 @@ #include <numrule.hxx> #include <lineinfo.hxx> #include <swmodule.hxx> +#include <IDocumentLayoutAccess.hxx> #include "ww8par.hxx" @@ -523,7 +524,7 @@ void RtfExport::ExportDocument_Impl() // Default TabSize Strm().WriteCharPtr(m_pAttrOutput->m_aTabStop.makeStringAndClear().getStr()).WriteCharPtr(SAL_NEWLINE_STRING); // Zoom - SwViewShell* pViewShell(pDoc->GetCurrentViewShell()); + SwViewShell* pViewShell(pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); if (pViewShell && pViewShell->GetViewOptions()->GetZoomType() == SVX_ZOOM_PERCENT) { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_VIEWSCALE); diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index c4475e6e482b..3135b2ba01b4 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -50,6 +50,7 @@ #include <numrule.hxx> #include <vcl/svapp.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentLayoutAccess.hxx> using namespace com::sun::star; using namespace nsSwGetPoolIdFromName; @@ -837,7 +838,7 @@ namespace sw } InsertedTablesManager::InsertedTablesManager(const SwDoc &rDoc) - : mbHasRoot(rDoc.GetCurrentLayout()) + : mbHasRoot(rDoc.getIDocumentLayoutAccess().GetCurrentLayout()) { } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index a6bb254d97b1..b10a2a1e6281 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -59,6 +59,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentLayoutAccess.hxx> #include <viewopt.hxx> #include <docary.hxx> #include <pam.hxx> @@ -332,7 +333,7 @@ static void WriteDop( WW8Export& rWrt ) rDop.dxaTab = (sal_uInt16)rTabStop[0].GetTabPos(); // Zoom factor - SwViewShell *pViewShell(rWrt.pDoc->GetCurrentViewShell()); + SwViewShell *pViewShell(rWrt.pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); if (pViewShell && pViewShell->GetViewOptions()->GetZoomType() == SVX_ZOOM_PERCENT) rDop.wScaleSaved = pViewShell->GetViewOptions()->GetZoom(); diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index b14ad4f8f81e..0e3a4910dc42 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -36,6 +36,7 @@ #include <fltshell.hxx> #include <pam.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <ndtxt.hxx> #include <mdiexp.hxx> #include "writerwordglue.hxx" @@ -370,7 +371,7 @@ SwFlyFrmFmt* SwWW8ImplReader::MakeGrafNotInCntnt(const WW8PicDesc& rPD, &aFlySet, &rGrfSet, NULL); // Damit die Frames bei Einfuegen in existierendes Doc erzeugt werden: - if (rDoc.GetCurrentViewShell() && + if (rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() && (FLY_AT_PARA == pFlyFmt->GetAnchor().GetAnchorId())) { pFlyFmt->MakeFrms(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 49f288c41e31..05c9eeddf78e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -74,6 +74,7 @@ #include <section.hxx> #include <docsh.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docufld.hxx> #include <swfltopt.hxx> #include <viewsh.hxx> @@ -5325,7 +5326,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) // Remove additional pictures for (sal_uInt16 i = 0; i < vecFrmFmt.size(); ++i) { - rDoc.DelLayoutFmt(vecFrmFmt[i]); + rDoc.getIDocumentLayoutAccess().DelLayoutFmt(vecFrmFmt[i]); } } } diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index b99aade790a3..a682f7dff7db 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -40,6 +40,7 @@ #include <doc.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentLayoutAccess.hxx> #include <docstat.hxx> #include <docsh.hxx> @@ -374,7 +375,7 @@ sal_uInt32 SwXMLWriter::_Write( const uno::Reference < task::XStatusIndicator >& } } - if( pDoc->GetCurrentViewShell() && pDoc->getIDocumentStatistics().GetDocStat().nPage > 1 && + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && pDoc->getIDocumentStatistics().GetDocStat().nPage > 1 && !(bOrganizerMode || bBlock || bErr) ) { try diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 1db021a0800d..af4a75f0075d 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -63,6 +63,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentLayoutAccess.hxx> #include <pausethreadstarting.hxx> @@ -437,8 +438,8 @@ void SwXMLExport::SetBodyAttributes() { // export use of soft page breaks SwDoc *pDoc = getDoc(); - if( pDoc->GetCurrentViewShell() && - pDoc->GetCurrentViewShell()->GetPageCount() > 1 ) + if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && + pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->GetPageCount() > 1 ) { bool bValue = true; OUStringBuffer sBuffer; diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index ed024890f4d6..d535ac263243 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -40,6 +40,7 @@ #include "fmtfordr.hxx" #include "doc.hxx" #include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> #include "swtable.hxx" #include "swtblfmt.hxx" #include "pam.hxx" @@ -2803,7 +2804,7 @@ void SwXMLTableContext::MakeTable() } // ??? this is always false: root frame is only created in SwViewShell::Init - if( pTableNode->GetDoc()->GetCurrentViewShell() ) + if( pTableNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) { pTableNode->DelFrms(); SwNodeIndex aIdx( *pTableNode->EndOfSectionNode(), 1 ); diff --git a/sw/source/ui/vba/vbainformationhelper.cxx b/sw/source/ui/vba/vbainformationhelper.cxx index 9af29dada418..609e4732e962 100644 --- a/sw/source/ui/vba/vbainformationhelper.cxx +++ b/sw/source/ui/vba/vbainformationhelper.cxx @@ -25,6 +25,7 @@ #include <vbahelper/vbahelper.hxx> #include <swtypes.hxx> #include <viewsh.hxx> +#include <IDocumentLayoutAccess.hxx> using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -52,7 +53,7 @@ double SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( const css sal_Int32 nCurrentPage = handleWdActiveEndPageNumber( xTVCursor ); SwDoc* pDoc = word::getDocShell( xModel )->GetDoc(); - SwViewShell* pViewSh = pDoc->GetCurrentViewShell(); + SwViewShell* pViewSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); sal_Int32 nPageHeight = pViewSh ? pViewSh->GetPageSize( nCurrentPage, false ).Height() : 0; // FIXME: handle multipul page style // it is very strange that the curros position is incorrect when open Word file. diff --git a/sw/source/ui/vba/wordvbahelper.cxx b/sw/source/ui/vba/wordvbahelper.cxx index 4c84a57a9d47..229afa1309c1 100644 --- a/sw/source/ui/vba/wordvbahelper.cxx +++ b/sw/source/ui/vba/wordvbahelper.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/view/XSelectionSupplier.hpp> #include <unotxdoc.hxx> #include <doc.hxx> +#include <IDocumentLayoutAccess.hxx> #include <view.hxx> #include <viewsh.hxx> @@ -85,7 +86,7 @@ uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException) { SwDocShell* pDocShell = getDocShell( xModel ); - SwViewShell* pViewSh = pDocShell ? pDocShell->GetDoc()->GetCurrentViewShell() : 0; + SwViewShell* pViewSh = pDocShell ? pDocShell->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() : 0; return pViewSh ? pViewSh->GetPageCount() : 0; } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 32f46d0e1e96..f3b7b9c39050 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -79,6 +79,7 @@ #include <IDocumentLinksAdministration.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentLayoutAccess.hxx> #include <IDocumentState.hxx> #include <pagedesc.hxx> #include <shellio.hxx> @@ -394,7 +395,7 @@ void SwDocShell::Execute(SfxRequest& rReq) pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) ) { SwDoc* pTmp = pDocSh->GetDoc(); - if ( pTmp->GetCurrentViewShell() ) + if ( pTmp->getIDocumentLayoutAccess().GetCurrentViewShell() ) pTmp->InvalidateAutoCompleteFlag(); } } diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index db6e4596d090..800ec2dce1dc 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -55,6 +55,7 @@ #include <cmdid.h> #include <app.hrc> #include "helpid.h" +#include <IDocumentLayoutAccess.hxx> #include <unomid.h> #include <tools/color.hxx> @@ -617,7 +618,7 @@ void SwModule::CheckSpellChanges( bool bOnlineSpelling, pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) ) { SwDoc* pTmp = pDocSh->GetDoc(); - if ( pTmp->GetCurrentViewShell() ) + if ( pTmp->getIDocumentLayoutAccess().GetCurrentViewShell() ) { pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags ); SwViewShell* pViewShell = 0; diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index c0a99ad3881d..9d892d6855ca 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -75,6 +75,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <DocumentFieldsManager.hxx> #include <IDocumentState.hxx> +#include <IDocumentLayoutAccess.hxx> #include <drawdoc.hxx> #include <wdocsh.hxx> #include <wview.hxx> @@ -194,7 +195,7 @@ void SwView::GotFocus() const if( GetWrtShellPtr() ) { SwWrtShell& rWrtShell = GetWrtShell(); - rWrtShell.GetDoc()->SetCurrentViewShell( GetWrtShellPtr() ); + rWrtShell.GetDoc()->getIDocumentLayoutAccess().SetCurrentViewShell( GetWrtShellPtr() ); rWrtShell.GetDoc()->getIDocumentSettingAccess().set( IDocumentSettingAccess::BROWSE_MODE, rWrtShell.GetViewOptions()->getBrowseMode() ); } @@ -799,9 +800,9 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) m_pWrtShell = new SwWrtShell( *((SwView*)pExistingSh)->m_pWrtShell, m_pEditWin, *this); } - else if( dynamic_cast<SwWrtShell*>( pDocSh->GetDoc()->GetCurrentViewShell() ) ) + else if( dynamic_cast<SwWrtShell*>( pDocSh->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) ) { - m_pWrtShell = new SwWrtShell( *(SwWrtShell*)pDocSh->GetDoc()->GetCurrentViewShell(), + m_pWrtShell = new SwWrtShell( *(SwWrtShell*)pDocSh->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(), m_pEditWin, *this); } else diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 6ce799c58ab9..d1606cebc69c 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -102,6 +102,7 @@ #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentLayoutAccess.hxx> #include <IDocumentState.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svl/zforlist.hxx> @@ -3131,7 +3132,7 @@ void SwXTextDocument::paintTile( VirtualDevice &rDevice, long nTileWidth, long nTileHeight ) { SwDoc* pDoc = pDocShell->GetDoc(); - SwViewShell* pViewShell = pDoc->GetCurrentViewShell(); + SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); pViewShell->PaintTile(rDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); } @@ -3139,7 +3140,7 @@ void SwXTextDocument::paintTile( VirtualDevice &rDevice, Size SwXTextDocument::getDocumentSize() { SwDoc* pDoc = pDocShell->GetDoc(); - SwViewShell* pViewShell = pDoc->GetCurrentViewShell(); + SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); return pViewShell->GetDocSize(); } |