summaryrefslogtreecommitdiff
path: root/sw/source/core/doc
diff options
context:
space:
mode:
authorValentin Kettner <vakevk+libreoffice@gmail.com>2014-08-06 16:21:14 +0200
committerValentin Kettner <vakevk+libreoffice@gmail.com>2014-08-12 23:26:38 +0200
commit5494954b269267f6ee3bdd5ac73e7513fa69978f (patch)
treebd6569e5b82a7c771062b2e2e5f6db7666913597 /sw/source/core/doc
parent64e13a1456c44ef3461c2941bb3be15c3eaf478e (diff)
Refactored IDocumentLayoutAccess out of SwDoc.
Into the new class DocumentLayoutManager. Change-Id: I02d0cfcc63633d0bdab380508b2ef563187fd269
Diffstat (limited to 'sw/source/core/doc')
-rw-r--r--sw/source/core/doc/CntntIdxStore.cxx3
-rw-r--r--sw/source/core/doc/DocumentChartDataProviderManager.cxx3
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx7
-rw-r--r--sw/source/core/doc/DocumentDeviceManager.cxx7
-rw-r--r--sw/source/core/doc/DocumentDrawModelManager.cxx13
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx5
-rw-r--r--sw/source/core/doc/DocumentLayoutManager.cxx518
-rw-r--r--sw/source/core/doc/DocumentLinksAdministrationManager.cxx3
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx5
-rw-r--r--sw/source/core/doc/DocumentStateManager.cxx3
-rw-r--r--sw/source/core/doc/DocumentStatisticsManager.cxx3
-rw-r--r--sw/source/core/doc/DocumentTimerManager.cxx5
-rw-r--r--sw/source/core/doc/doc.cxx38
-rw-r--r--sw/source/core/doc/doccorr.cxx6
-rw-r--r--sw/source/core/doc/docdesc.cxx23
-rw-r--r--sw/source/core/doc/docdraw.cxx5
-rw-r--r--sw/source/core/doc/docedt.cxx9
-rw-r--r--sw/source/core/doc/docfld.cxx5
-rw-r--r--sw/source/core/doc/docfly.cxx17
-rw-r--r--sw/source/core/doc/docfmt.cxx3
-rw-r--r--sw/source/core/doc/docftn.cxx7
-rw-r--r--sw/source/core/doc/docglbl.cxx3
-rw-r--r--sw/source/core/doc/doclay.cxx459
-rw-r--r--sw/source/core/doc/docnew.cxx26
-rw-r--r--sw/source/core/doc/docredln.cxx7
-rw-r--r--sw/source/core/doc/doctxm.cxx21
-rw-r--r--sw/source/core/doc/ftnidx.cxx3
-rw-r--r--sw/source/core/doc/htmltbl.cxx7
-rw-r--r--sw/source/core/doc/lineinfo.cxx5
-rw-r--r--sw/source/core/doc/swserv.cxx3
-rw-r--r--sw/source/core/doc/tblcpy.cxx3
-rw-r--r--sw/source/core/doc/textboxhelper.cxx3
-rw-r--r--sw/source/core/doc/visiturl.cxx3
33 files changed, 673 insertions, 558 deletions
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();