diff options
author | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-06-01 22:21:38 +0200 |
---|---|---|
committer | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-06-03 19:12:05 +0200 |
commit | 86075a3f0f095cde29c6460d7e5dd4069ed89d00 (patch) | |
tree | bb4cc053f51e3f2bef38b44d1ce28dce3e1613e8 /sw | |
parent | 4269e3a7435b45cbbcd45d959e1e8c8e761a94a0 (diff) |
Split out IDocumentDrawModelAccess from SwDoc.
To the new class DocumentDrawModelManager.
All moved methods and members have the same in thew new class.
Change-Id: I89ad0e0c4a42885d5810e834983ea8e8e6c0a2d2
Diffstat (limited to 'sw')
57 files changed, 728 insertions, 486 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index c9fe775f57cf..d9eecf01dea4 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -186,6 +186,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/doc/DocumentDeviceManager \ sw/source/core/doc/docxforms \ sw/source/core/doc/DocumentSettingManager \ + sw/source/core/doc/DocumentDrawModelManager \ 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 7cabfd838f9d..f9f904d1fbf9 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -30,7 +30,6 @@ #include <IDocumentLineNumberAccess.hxx> #include <IDocumentStatistics.hxx> #include <IDocumentState.hxx> -#include <IDocumentDrawModelAccess.hxx> #include <IDocumentLayoutAccess.hxx> #include <IDocumentTimerAccess.hxx> #include <IDocumentChartDataProviderAccess.hxx> @@ -208,6 +207,7 @@ namespace sw { class IShellCursorSupplier; class DocumentSettingManager; class DocumentDeviceManager; + class DocumentDrawModelManager; } namespace com { namespace sun { namespace star { @@ -253,7 +253,6 @@ class SW_DLLPUBLIC SwDoc : public IDocumentLineNumberAccess, public IDocumentStatistics, public IDocumentState, - public IDocumentDrawModelAccess, public IDocumentLayoutAccess, public IDocumentTimerAccess, public IDocumentChartDataProviderAccess, @@ -287,6 +286,7 @@ class SW_DLLPUBLIC SwDoc : const ::boost::scoped_ptr< ::sw::mark::MarkManager> mpMarkManager; const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager; + const ::boost::scoped_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager; const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager; const ::boost::scoped_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager; ::boost::scoped_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess; @@ -311,7 +311,6 @@ class SW_DLLPUBLIC SwDoc : SwDefTOXBase_Impl * mpDefTOXBases; //< defaults of SwTOXBase's SwViewShell *mpCurrentView; //< SwDoc should get a new member mpCurrentView - SdrModel *mpDrawModel; //< StarView Drawing SwDocUpdtFld *mpUpdtFlds; //< Struct for updating fields SwFldTypes *mpFldTypes; @@ -405,18 +404,6 @@ private: sal_Int32 mIdleBlockCount; sal_Int8 mnLockExpFld; //< If != 0 UpdateExpFlds() has no effect! - /** Draw Model Layer IDs - * LayerIds, Heaven == above document - * Hell == below document - * Controls == at the very top - */ - SdrLayerID mnHeaven; - SdrLayerID mnHell; - SdrLayerID mnControls; - SdrLayerID mnInvisibleHeaven; - SdrLayerID mnInvisibleHell; - SdrLayerID mnInvisibleControls; - bool mbGlossDoc : 1; //< TRUE: glossary document. bool mbModified : 1; //< TRUE: document has changed. bool mbDtor : 1; /**< TRUE: is in SwDoc DTOR. @@ -466,10 +453,6 @@ private: // private methods void checkRedlining(RedlineMode_t& _rReadlineMode); - DECL_LINK( AddDrawUndo, SdrUndoAction * ); - // DrawModel - void DrawNotifyUndoHdl(); - /** Only for internal use and therefore private. Copy a range within the same or to another document. Position may not lie within range! */ @@ -521,9 +504,6 @@ private: const OUString& rFormula, std::vector<OUString>& rUsedDBNames ); - void InitDrawModel(); - void ReleaseDrawModel(); - void _CreateNumberFormatter(); bool _UnProtectTblCells( SwTable& rTbl ); @@ -782,20 +762,12 @@ public: virtual void SetLoaded(bool b) SAL_OVERRIDE; // IDocumentDrawModelAccess - virtual const SdrModel* GetDrawModel() const SAL_OVERRIDE; - virtual SdrModel* GetDrawModel() SAL_OVERRIDE; - virtual SdrLayerID GetHeavenId() const SAL_OVERRIDE; - virtual SdrLayerID GetHellId() const SAL_OVERRIDE; - virtual SdrLayerID GetControlsId() const SAL_OVERRIDE; - virtual SdrLayerID GetInvisibleHeavenId() const SAL_OVERRIDE; - virtual SdrLayerID GetInvisibleHellId() const SAL_OVERRIDE; - virtual SdrLayerID GetInvisibleControlsId() const SAL_OVERRIDE; - virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) SAL_OVERRIDE; - virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const SAL_OVERRIDE; - virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId ) SAL_OVERRIDE; - virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId ) SAL_OVERRIDE; - virtual SdrModel* _MakeDrawModel() SAL_OVERRIDE; - virtual SdrModel* GetOrCreateDrawModel() SAL_OVERRIDE; + DECL_LINK( AddDrawUndo, SdrUndoAction * ); + IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const; + IDocumentDrawModelAccess & getIDocumentDrawModelAccess(); + + ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const; + ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager(); // IDocumentLayoutAccess virtual void SetCurrentViewShell( SwViewShell* pNew ) SAL_OVERRIDE; diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx index 6c49b85aef55..e66969947ffb 100644 --- a/sw/source/core/access/accfrmobjmap.cxx +++ b/sw/source/core/access/accfrmobjmap.cxx @@ -24,6 +24,7 @@ #include <viewsh.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <frmfmt.hxx> #include <pagefrm.hxx> #include <txtfrm.hxx> @@ -38,8 +39,8 @@ using namespace sw::access; SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea, const SwFrm& rFrm, SwAccessibleMap& rAccMap ) - : nHellId( rAccMap.GetShell()->GetDoc()->GetHellId() ) - , nControlsId( rAccMap.GetShell()->GetDoc()->GetControlsId() ) + : nHellId( rAccMap.GetShell()->GetDoc()->getIDocumentDrawModelAccess().GetHellId() ) + , nControlsId( rAccMap.GetShell()->GetDoc()->getIDocumentDrawModelAccess().GetControlsId() ) { const bool bVisibleChildrenOnly = SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly(); diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 377c1255f429..599d62d22b83 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -755,8 +755,8 @@ bool SwFmt::IsShadowTransparent() const * Document Interface Access */ const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return & GetDoc()->GetDocumentSettingManager(); } -const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); } -IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); } +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(); } IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); } diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index 524b231e5ffe..392654f19502 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -22,6 +22,7 @@ #include <IDocumentDeviceAccess.hxx> #include <doc.hxx> #include <DocumentSettingManager.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <sfx2/printer.hxx> #include <vcl/virdev.hxx> #include <vcl/outdev.hxx> @@ -77,8 +78,8 @@ void DocumentDeviceManager::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDe mpPrt->SetMapMode( aMapMode ); } - if ( m_rSwdoc.GetDrawModel() && !m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) ) - m_rSwdoc.GetDrawModel()->SetRefDevice( mpPrt ); + if ( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() && !m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) ) + m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( mpPrt ); } if ( bCallPrtDataChanged && @@ -107,8 +108,8 @@ void DocumentDeviceManager::setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]* delete mpVirDev; mpVirDev = pVd; - if ( m_rSwdoc.GetDrawModel() && m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) ) - m_rSwdoc.GetDrawModel()->SetRefDevice( mpVirDev ); + if ( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() && m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) ) + m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( mpVirDev ); } } @@ -145,8 +146,8 @@ void DocumentDeviceManager::setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /* else pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); - if( m_rSwdoc.GetDrawModel() ) - m_rSwdoc.GetDrawModel()->SetRefDevice( pMyVirDev ); + if( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() ) + m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pMyVirDev ); } else { @@ -157,8 +158,8 @@ void DocumentDeviceManager::setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /* // getReferenceDevice()->getPrinter()->CreatePrinter_() // ->setPrinter()-> PrtDataChanged() SfxPrinter* pPrinter = getPrinter( true ); - if( m_rSwdoc.GetDrawModel() ) - m_rSwdoc.GetDrawModel()->SetRefDevice( pPrinter ); + if( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() ) + m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pPrinter ); } m_rSwdoc.GetDocumentSettingManager().set(IDocumentSettingAccess::USE_VIRTUAL_DEVICE, bNewVirtual ); @@ -320,10 +321,10 @@ void DocumentDeviceManager::PrtDataChanged() bEndAction = true; bDraw = false; - if( m_rSwdoc.GetDrawModel() ) + if( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() ) { - m_rSwdoc.GetDrawModel()->SetAddExtLeading( m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::ADD_EXT_LEADING) ); - m_rSwdoc.GetDrawModel()->SetRefDevice( getReferenceDevice( false ) ); + m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetAddExtLeading( m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::ADD_EXT_LEADING) ); + m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( getReferenceDevice( false ) ); } pFntCache->Flush(); @@ -339,15 +340,15 @@ void DocumentDeviceManager::PrtDataChanged() while ( pSh != m_rSwdoc.GetCurrentViewShell() ); } } - if ( bDraw && m_rSwdoc.GetDrawModel() ) + if ( bDraw && m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() ) { const bool bTmpAddExtLeading = m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::ADD_EXT_LEADING); - if ( bTmpAddExtLeading != m_rSwdoc.GetDrawModel()->IsAddExtLeading() ) - m_rSwdoc.GetDrawModel()->SetAddExtLeading( bTmpAddExtLeading ); + if ( bTmpAddExtLeading != m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->IsAddExtLeading() ) + m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetAddExtLeading( bTmpAddExtLeading ); OutputDevice* pOutDev = getReferenceDevice( false ); - if ( pOutDev != m_rSwdoc.GetDrawModel()->GetRefDevice() ) - m_rSwdoc.GetDrawModel()->SetRefDevice( pOutDev ); + if ( pOutDev != m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->GetRefDevice() ) + m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pOutDev ); } m_rSwdoc.PrtOLENotify( true ); diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx new file mode 100644 index 000000000000..09fdbd7ccd85 --- /dev/null +++ b/sw/source/core/doc/DocumentDrawModelManager.cxx @@ -0,0 +1,367 @@ +/* -*- 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 <DocumentDrawModelManager.hxx> + +#include <doc.hxx> +#include <IDocumentUndoRedo.hxx> +#include <IDocumentSettingAccess.hxx> +#include <IDocumentDeviceAccess.hxx> +#include <docsh.hxx> +#include <swtypes.hxx> +#include <swhints.hxx> +#include <viewsh.hxx> +#include <drawdoc.hxx> +#include <rootfrm.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <svx/svdmodel.hxx> +#include <svx/svdlayer.hxx> +#include <svx/svdoutl.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdpagv.hxx> +#include <svl/smplhint.hxx> +#include <tools/link.hxx> + +class SdrOutliner; +class XSpellChecker1; + +namespace sw +{ + +DocumentDrawModelManager::DocumentDrawModelManager( SwDoc& i_rSwdoc ) : m_rSwdoc(i_rSwdoc), mpDrawModel(0) {} + + +// Is also called by the Sw3 Reader, if there was an error when reading the +// drawing layer. If it is called by the Sw3 Reader the layer is rebuilt +// from scratch. +void DocumentDrawModelManager::InitDrawModel() +{ + // !! Attention: there is similar code in the Sw3 Reader (sw3imp.cxx) that + // also has to be maintained!! + if ( mpDrawModel ) + ReleaseDrawModel(); + +//UUUU +// // Setup DrawPool and EditEnginePool. Ownership is ours and only gets passed +// // to the Drawing. +// // The pools are destroyed in the ReleaseDrawModel. +// // for loading the drawing items. This must be loaded without RefCounts! +// SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() ); +// // change DefaultItems for the SdrEdgeObj distance items to TWIPS. +// if(pSdrPool) +// { +// const long nDefEdgeDist = ((500 * 72) / 127); // 1/100th mm in twips +// pSdrPool->SetPoolDefaultItem(SdrEdgeNode1HorzDistItem(nDefEdgeDist)); +// pSdrPool->SetPoolDefaultItem(SdrEdgeNode1VertDistItem(nDefEdgeDist)); +// pSdrPool->SetPoolDefaultItem(SdrEdgeNode2HorzDistItem(nDefEdgeDist)); +// pSdrPool->SetPoolDefaultItem(SdrEdgeNode2VertDistItem(nDefEdgeDist)); +// +// // #i33700# +// // Set shadow distance defaults as PoolDefaultItems. Details see bug. +// pSdrPool->SetPoolDefaultItem(SdrShadowXDistItem((300 * 72) / 127)); +// pSdrPool->SetPoolDefaultItem(SdrShadowYDistItem((300 * 72) / 127)); +// } +// SfxItemPool *pEEgPool = EditEngine::CreatePool( false ); +// pSdrPool->SetSecondaryPool( pEEgPool ); +// if ( !GetAttrPool().GetFrozenIdRanges () ) +// GetAttrPool().FreezeIdRanges(); +// else +// pSdrPool->FreezeIdRanges(); + + // set FontHeight pool defaults without changing static SdrEngineDefaults + m_rSwdoc.GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT )); + + SAL_INFO( "sw.doc", "before create DrawDocument" ); + // The document owns the SdrModel. We always have two layers and one page. + mpDrawModel = new SwDrawDocument( &m_rSwdoc ); + + mpDrawModel->EnableUndo( m_rSwdoc.GetIDocumentUndoRedo().DoesUndo() ); + + OUString sLayerNm; + sLayerNm = "Hell"; + mnHell = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); + + sLayerNm = "Heaven"; + mnHeaven = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); + + sLayerNm = "Controls"; + mnControls = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); + + // add invisible layers corresponding to the visible ones. + { + sLayerNm = "InvisibleHell"; + mnInvisibleHell = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); + + sLayerNm = "InvisibleHeaven"; + mnInvisibleHeaven = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); + + sLayerNm = "InvisibleControls"; + mnInvisibleControls = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); + } + + SdrPage* pMasterPage = mpDrawModel->AllocPage( false ); + mpDrawModel->InsertPage( pMasterPage ); + SAL_INFO( "sw.doc", "after create DrawDocument" ); + SAL_INFO( "sw.doc", "before create Spellchecker/Hyphenator" ); + SdrOutliner& rOutliner = mpDrawModel->GetDrawOutliner(); + ::com::sun::star::uno::Reference< com::sun::star::linguistic2::XSpellChecker1 > xSpell = ::GetSpellChecker(); + rOutliner.SetSpeller( xSpell ); + ::com::sun::star::uno::Reference< com::sun::star::linguistic2::XHyphenator > xHyphenator( ::GetHyphenator() ); + rOutliner.SetHyphenator( xHyphenator ); + SAL_INFO( "sw.doc", "after create Spellchecker/Hyphenator" ); + m_rSwdoc.SetCalcFieldValueHdl(&rOutliner); + m_rSwdoc.SetCalcFieldValueHdl(&mpDrawModel->GetHitTestOutliner()); + + // Set the LinkManager in the model so that linked graphics can be inserted. + // The WinWord import needs it too. + mpDrawModel->SetLinkManager( & m_rSwdoc.GetLinkManager() ); + mpDrawModel->SetAddExtLeading( m_rSwdoc.getIDocumentSettingAccess().get(IDocumentSettingAccess::ADD_EXT_LEADING) ); + + OutputDevice* pRefDev = m_rSwdoc.getIDocumentDeviceAccess().getReferenceDevice( false ); + if ( pRefDev ) + mpDrawModel->SetRefDevice( pRefDev ); + + mpDrawModel->SetNotifyUndoActionHdl( LINK( &m_rSwdoc, SwDoc, AddDrawUndo )); + if ( m_rSwdoc.GetCurrentViewShell() ) + { + SwViewShell* pViewSh = m_rSwdoc.GetCurrentViewShell(); + do + { + SwRootFrm* pRoot = pViewSh->GetLayout(); + if( pRoot && !pRoot->GetDrawPage() ) + { + // Disable "multiple layout" for the moment: + // use pMasterPage instead of a new created SdrPage + // mpDrawModel->AllocPage( FALSE ); + // mpDrawModel->InsertPage( pDrawPage ); + SdrPage* pDrawPage = pMasterPage; + pRoot->SetDrawPage( pDrawPage ); + pDrawPage->SetSize( pRoot->Frm().SSize() ); + } + pViewSh = (SwViewShell*)pViewSh->GetNext(); + }while( pViewSh != m_rSwdoc.GetCurrentViewShell() ); + } +} + + +void DocumentDrawModelManager::ReleaseDrawModel() +{ + if ( mpDrawModel ) + { + // !! Also maintain the code in the sw3io for inserting documents!! + + delete mpDrawModel; mpDrawModel = 0; +//UUUU +// SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool(); +// +// OSL_ENSURE( pSdrPool, "missing pool" ); +// SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool(); +// OSL_ENSURE( !pEEgPool->GetSecondaryPool(), "I don't accept additional pools"); +// pSdrPool->Delete(); // First have the items destroyed, +// // then destroy the chain! +// GetAttrPool().SetSecondaryPool( 0 ); // This one's a must! +// pSdrPool->SetSecondaryPool( 0 ); // That one's safer +// SfxItemPool::Free(pSdrPool); +// SfxItemPool::Free(pEEgPool); + } +} + + + + + +const SdrModel* DocumentDrawModelManager::GetDrawModel() const +{ + return mpDrawModel; +} + +SdrModel* DocumentDrawModelManager::GetDrawModel() +{ + return mpDrawModel; +} + +SdrModel* DocumentDrawModelManager::_MakeDrawModel() +{ + OSL_ENSURE( !mpDrawModel, "_MakeDrawModel: Why?" ); + InitDrawModel(); + if ( m_rSwdoc.GetCurrentViewShell() ) + { + SwViewShell* pTmp = m_rSwdoc.GetCurrentViewShell(); + do + { + pTmp->MakeDrawView(); + pTmp = (SwViewShell*) pTmp->GetNext(); + } while ( pTmp != m_rSwdoc.GetCurrentViewShell() ); + + // Broadcast, so that the FormShell can be connected to the DrawView + if( m_rSwdoc.GetDocShell() ) + { + SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED ); + m_rSwdoc.GetDocShell()->Broadcast( aHnt ); + } + } + return mpDrawModel; +} + +SdrModel* DocumentDrawModelManager::GetOrCreateDrawModel() +{ + return GetDrawModel() ? GetDrawModel() : _MakeDrawModel(); +} + +SdrLayerID DocumentDrawModelManager::GetHeavenId() const +{ + return mnHeaven; +} + +SdrLayerID DocumentDrawModelManager::GetHellId() const +{ + return mnHell; +} + +SdrLayerID DocumentDrawModelManager::GetControlsId() const +{ + return mnControls; +} + +SdrLayerID DocumentDrawModelManager::GetInvisibleHeavenId() const +{ + return mnInvisibleHeaven; +} + +SdrLayerID DocumentDrawModelManager::GetInvisibleHellId() const +{ + return mnInvisibleHell; +} + +SdrLayerID DocumentDrawModelManager::GetInvisibleControlsId() const +{ + return mnInvisibleControls; +} + +void DocumentDrawModelManager::NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) +{ + OUString sLayerNm; + sLayerNm = "InvisibleHell"; + _rSdrPageView.SetLayerVisible( sLayerNm, false ); + + sLayerNm = "InvisibleHeaven"; + _rSdrPageView.SetLayerVisible( sLayerNm, false ); + + sLayerNm = "InvisibleControls"; + _rSdrPageView.SetLayerVisible( sLayerNm, false ); +} + +bool DocumentDrawModelManager::IsVisibleLayerId( const SdrLayerID& _nLayerId ) const +{ + bool bRetVal; + + if ( _nLayerId == GetHeavenId() || + _nLayerId == GetHellId() || + _nLayerId == GetControlsId() ) + { + bRetVal = true; + } + else if ( _nLayerId == GetInvisibleHeavenId() || + _nLayerId == GetInvisibleHellId() || + _nLayerId == GetInvisibleControlsId() ) + { + bRetVal = false; + } + else + { + OSL_FAIL( "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." ); + bRetVal = false; + } + + return bRetVal; +} + +SdrLayerID DocumentDrawModelManager::GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId ) +{ + SdrLayerID nVisibleLayerId; + + if ( _nInvisibleLayerId == GetInvisibleHeavenId() ) + { + nVisibleLayerId = GetHeavenId(); + } + else if ( _nInvisibleLayerId == GetInvisibleHellId() ) + { + nVisibleLayerId = GetHellId(); + } + else if ( _nInvisibleLayerId == GetInvisibleControlsId() ) + { + nVisibleLayerId = GetControlsId(); + } + else if ( _nInvisibleLayerId == GetHeavenId() || + _nInvisibleLayerId == GetHellId() || + _nInvisibleLayerId == GetControlsId() ) + { + OSL_FAIL( "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." ); + nVisibleLayerId = _nInvisibleLayerId; + } + else + { + OSL_FAIL( "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." ); + nVisibleLayerId = _nInvisibleLayerId; + } + + return nVisibleLayerId; +} + +SdrLayerID DocumentDrawModelManager::GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId ) +{ + SdrLayerID nInvisibleLayerId; + + if ( _nVisibleLayerId == GetHeavenId() ) + { + nInvisibleLayerId = GetInvisibleHeavenId(); + } + else if ( _nVisibleLayerId == GetHellId() ) + { + nInvisibleLayerId = GetInvisibleHellId(); + } + else if ( _nVisibleLayerId == GetControlsId() ) + { + nInvisibleLayerId = GetInvisibleControlsId(); + } + else if ( _nVisibleLayerId == GetInvisibleHeavenId() || + _nVisibleLayerId == GetInvisibleHellId() || + _nVisibleLayerId == GetInvisibleControlsId() ) + { + OSL_FAIL( "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." ); + nInvisibleLayerId = _nVisibleLayerId; + } + else + { + OSL_FAIL( "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." ); + nInvisibleLayerId = _nVisibleLayerId; + } + + return nInvisibleLayerId; +} + +void DocumentDrawModelManager::DrawNotifyUndoHdl() +{ + mpDrawModel->SetNotifyUndoActionHdl( Link() ); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 4a7b08589f11..85f605b932fd 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -19,6 +19,7 @@ #include <DocumentSettingManager.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <comphelper/processfactory.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svx/svdmodel.hxx> @@ -388,7 +389,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLan } mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars ); - SdrModel *pDrawModel = m_rDoc.GetDrawModel(); + SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel(); if( pDrawModel ) { pDrawModel->SetForbiddenCharsTable( mxForbiddenCharsTable ); @@ -458,7 +459,7 @@ void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharComp { meChrCmprType = n; - SdrModel *pDrawModel = m_rDoc.GetDrawModel(); + SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel(); if( pDrawModel ) { pDrawModel->SetCharCompressType( static_cast<sal_uInt16>(n) ); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index d513e69dd9d2..e4ea756240a3 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -19,6 +19,7 @@ #include <doc.hxx> #include <DocumentSettingManager.hxx> +#include <DocumentDrawModelManager.hxx> #include <UndoManager.hxx> #include <hintids.hxx> @@ -149,6 +150,27 @@ sal_Int32 SwDoc::getReferenceCount() const return mReferenceCount; } +/* IDocumentDrawModelAccess */ +IDocumentDrawModelAccess const & SwDoc::getIDocumentDrawModelAccess() const +{ + return GetDocumentDrawModelManager(); +} + +IDocumentDrawModelAccess & SwDoc::getIDocumentDrawModelAccess() +{ + return GetDocumentDrawModelManager(); +} + +::sw::DocumentDrawModelManager const & SwDoc::GetDocumentDrawModelManager() const +{ + return *m_pDocumentDrawModelManager; +} + +::sw::DocumentDrawModelManager & SwDoc::GetDocumentDrawModelManager() +{ + return *m_pDocumentDrawModelManager; +} + /* IDocumentSettingAccess */ IDocumentSettingAccess const & SwDoc::getIDocumentSettingAccess() const { diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index bce20c118f17..f7dd6452dfe6 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -41,6 +41,7 @@ #include <IDocumentUndoRedo.hxx> #include <DocumentSettingManager.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docsh.hxx> #include <rootfrm.hxx> #include <poolfmt.hxx> @@ -510,287 +511,6 @@ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn, } } -#include <svx/sxenditm.hxx> - -// Is also called by the Sw3 Reader, if there was an error when reading the -// drawing layer. If it is called by the Sw3 Reader the layer is rebuilt -// from scratch. -void SwDoc::InitDrawModel() -{ - // !! Attention: there is similar code in the Sw3 Reader (sw3imp.cxx) that - // also has to be maintained!! - if ( mpDrawModel ) - ReleaseDrawModel(); - -//UUUU -// // Setup DrawPool and EditEnginePool. Ownership is ours and only gets passed -// // to the Drawing. -// // The pools are destroyed in the ReleaseDrawModel. -// // for loading the drawing items. This must be loaded without RefCounts! -// SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() ); -// // change DefaultItems for the SdrEdgeObj distance items to TWIPS. -// if(pSdrPool) -// { -// const long nDefEdgeDist = ((500 * 72) / 127); // 1/100th mm in twips -// pSdrPool->SetPoolDefaultItem(SdrEdgeNode1HorzDistItem(nDefEdgeDist)); -// pSdrPool->SetPoolDefaultItem(SdrEdgeNode1VertDistItem(nDefEdgeDist)); -// pSdrPool->SetPoolDefaultItem(SdrEdgeNode2HorzDistItem(nDefEdgeDist)); -// pSdrPool->SetPoolDefaultItem(SdrEdgeNode2VertDistItem(nDefEdgeDist)); -// -// // #i33700# -// // Set shadow distance defaults as PoolDefaultItems. Details see bug. -// pSdrPool->SetPoolDefaultItem(SdrShadowXDistItem((300 * 72) / 127)); -// pSdrPool->SetPoolDefaultItem(SdrShadowYDistItem((300 * 72) / 127)); -// } -// SfxItemPool *pEEgPool = EditEngine::CreatePool( false ); -// pSdrPool->SetSecondaryPool( pEEgPool ); -// if ( !GetAttrPool().GetFrozenIdRanges () ) -// GetAttrPool().FreezeIdRanges(); -// else -// pSdrPool->FreezeIdRanges(); - - // set FontHeight pool defaults without changing static SdrEngineDefaults - GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT )); - - SAL_INFO( "sw.doc", "before create DrawDocument" ); - // The document owns the SdrModel. We always have two layers and one page. - mpDrawModel = new SwDrawDocument( this ); - - mpDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() ); - - OUString sLayerNm; - sLayerNm = "Hell"; - mnHell = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); - - sLayerNm = "Heaven"; - mnHeaven = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); - - sLayerNm = "Controls"; - mnControls = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); - - // add invisible layers corresponding to the visible ones. - { - sLayerNm = "InvisibleHell"; - mnInvisibleHell = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); - - sLayerNm = "InvisibleHeaven"; - mnInvisibleHeaven = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); - - sLayerNm = "InvisibleControls"; - mnInvisibleControls = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); - } - - SdrPage* pMasterPage = mpDrawModel->AllocPage( false ); - mpDrawModel->InsertPage( pMasterPage ); - SAL_INFO( "sw.doc", "after create DrawDocument" ); - SAL_INFO( "sw.doc", "before create Spellchecker/Hyphenator" ); - SdrOutliner& rOutliner = mpDrawModel->GetDrawOutliner(); - uno::Reference< XSpellChecker1 > xSpell = ::GetSpellChecker(); - rOutliner.SetSpeller( xSpell ); - uno::Reference<XHyphenator> xHyphenator( ::GetHyphenator() ); - rOutliner.SetHyphenator( xHyphenator ); - SAL_INFO( "sw.doc", "after create Spellchecker/Hyphenator" ); - SetCalcFieldValueHdl(&rOutliner); - SetCalcFieldValueHdl(&mpDrawModel->GetHitTestOutliner()); - - // Set the LinkManager in the model so that linked graphics can be inserted. - // The WinWord import needs it too. - mpDrawModel->SetLinkManager( &GetLinkManager() ); - mpDrawModel->SetAddExtLeading( GetDocumentSettingManager().get(IDocumentSettingAccess::ADD_EXT_LEADING) ); - - OutputDevice* pRefDev = getIDocumentDeviceAccess().getReferenceDevice( false ); - if ( pRefDev ) - mpDrawModel->SetRefDevice( pRefDev ); - - mpDrawModel->SetNotifyUndoActionHdl( LINK( this, SwDoc, AddDrawUndo )); - if ( mpCurrentView ) - { - SwViewShell* pViewSh = mpCurrentView; - do - { - SwRootFrm* pRoot = pViewSh->GetLayout(); - if( pRoot && !pRoot->GetDrawPage() ) - { - // Disable "multiple layout" for the moment: - // use pMasterPage instead of a new created SdrPage - // mpDrawModel->AllocPage( FALSE ); - // mpDrawModel->InsertPage( pDrawPage ); - SdrPage* pDrawPage = pMasterPage; - pRoot->SetDrawPage( pDrawPage ); - pDrawPage->SetSize( pRoot->Frm().SSize() ); - } - pViewSh = (SwViewShell*)pViewSh->GetNext(); - }while( pViewSh != mpCurrentView ); - } -} - -/** method to notify drawing page view about the invisible layers */ -void SwDoc::NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) -{ - OUString sLayerNm; - sLayerNm = "InvisibleHell"; - _rSdrPageView.SetLayerVisible( sLayerNm, false ); - - sLayerNm = "InvisibleHeaven"; - _rSdrPageView.SetLayerVisible( sLayerNm, false ); - - sLayerNm = "InvisibleControls"; - _rSdrPageView.SetLayerVisible( sLayerNm, false ); -} - -/** method to determine, if a layer ID belongs to the visible ones. - - @note If given layer ID is unknown, method asserts and returns <false>. -*/ -bool SwDoc::IsVisibleLayerId( const SdrLayerID& _nLayerId ) const -{ - bool bRetVal; - - if ( _nLayerId == GetHeavenId() || - _nLayerId == GetHellId() || - _nLayerId == GetControlsId() ) - { - bRetVal = true; - } - else if ( _nLayerId == GetInvisibleHeavenId() || - _nLayerId == GetInvisibleHellId() || - _nLayerId == GetInvisibleControlsId() ) - { - bRetVal = false; - } - else - { - OSL_FAIL( "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." ); - bRetVal = false; - } - - return bRetVal; -} - -/** method to determine, if the corresponding visible layer ID for a invisible one. - - @note If given layer ID is a visible one, method returns given layer ID. - @note If given layer ID is unknown, method returns given layer ID. -*/ -SdrLayerID SwDoc::GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId ) -{ - SdrLayerID nVisibleLayerId; - - if ( _nInvisibleLayerId == GetInvisibleHeavenId() ) - { - nVisibleLayerId = GetHeavenId(); - } - else if ( _nInvisibleLayerId == GetInvisibleHellId() ) - { - nVisibleLayerId = GetHellId(); - } - else if ( _nInvisibleLayerId == GetInvisibleControlsId() ) - { - nVisibleLayerId = GetControlsId(); - } - else if ( _nInvisibleLayerId == GetHeavenId() || - _nInvisibleLayerId == GetHellId() || - _nInvisibleLayerId == GetControlsId() ) - { - OSL_FAIL( "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." ); - nVisibleLayerId = _nInvisibleLayerId; - } - else - { - OSL_FAIL( "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." ); - nVisibleLayerId = _nInvisibleLayerId; - } - - return nVisibleLayerId; -} - -/** method to determine, if the corresponding invisible layer ID for a visible one. - - @note If given layer ID is a invisible one, method returns given layer ID. - @note If given layer ID is unknown, method returns given layer ID. -*/ -SdrLayerID SwDoc::GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId ) -{ - SdrLayerID nInvisibleLayerId; - - if ( _nVisibleLayerId == GetHeavenId() ) - { - nInvisibleLayerId = GetInvisibleHeavenId(); - } - else if ( _nVisibleLayerId == GetHellId() ) - { - nInvisibleLayerId = GetInvisibleHellId(); - } - else if ( _nVisibleLayerId == GetControlsId() ) - { - nInvisibleLayerId = GetInvisibleControlsId(); - } - else if ( _nVisibleLayerId == GetInvisibleHeavenId() || - _nVisibleLayerId == GetInvisibleHellId() || - _nVisibleLayerId == GetInvisibleControlsId() ) - { - OSL_FAIL( "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." ); - nInvisibleLayerId = _nVisibleLayerId; - } - else - { - OSL_FAIL( "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." ); - nInvisibleLayerId = _nVisibleLayerId; - } - - return nInvisibleLayerId; -} - -void SwDoc::ReleaseDrawModel() -{ - if ( mpDrawModel ) - { - // !! Also maintain the code in the sw3io for inserting documents!! - - delete mpDrawModel; mpDrawModel = 0; -//UUUU -// SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool(); -// -// OSL_ENSURE( pSdrPool, "missing pool" ); -// SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool(); -// OSL_ENSURE( !pEEgPool->GetSecondaryPool(), "I don't accept additional pools"); -// pSdrPool->Delete(); // First have the items destroyed, -// // then destroy the chain! -// GetAttrPool().SetSecondaryPool( 0 ); // This one's a must! -// pSdrPool->SetSecondaryPool( 0 ); // That one's safer -// SfxItemPool::Free(pSdrPool); -// SfxItemPool::Free(pEEgPool); - } -} - -SdrModel* SwDoc::_MakeDrawModel() -{ - OSL_ENSURE( !mpDrawModel, "_MakeDrawModel: Why?" ); - InitDrawModel(); - if ( mpCurrentView ) - { - SwViewShell* pTmp = mpCurrentView; - do - { - pTmp->MakeDrawView(); - pTmp = (SwViewShell*) pTmp->GetNext(); - } while ( pTmp != mpCurrentView ); - - // Broadcast, so that the FormShell can be connected to the DrawView - if( GetDocShell() ) - { - SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED ); - GetDocShell()->Broadcast( aHnt ); - } - } - return mpDrawModel; -} - -void SwDoc::DrawNotifyUndoHdl() -{ - mpDrawModel->SetNotifyUndoActionHdl( Link() ); -} - /// In the Outliner, set a link to the method for field display in edit objects. void SwDoc::SetCalcFieldValueHdl(Outliner* pOutliner) { @@ -870,18 +590,6 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo) return(0); } -/* TFFDI: The functions formerly declared 'inline' - */ -const SdrModel* SwDoc::GetDrawModel() const { return mpDrawModel; } -SdrModel* SwDoc::GetDrawModel() { return mpDrawModel; } -SdrLayerID SwDoc::GetHeavenId() const { return mnHeaven; } -SdrLayerID SwDoc::GetHellId() const { return mnHell; } -SdrLayerID SwDoc::GetControlsId() const { return mnControls; } -SdrLayerID SwDoc::GetInvisibleHeavenId() const { return mnInvisibleHeaven; } -SdrLayerID SwDoc::GetInvisibleHellId() const { return mnInvisibleHell; } -SdrLayerID SwDoc::GetInvisibleControlsId() const { return mnInvisibleControls; } -SdrModel* SwDoc::GetOrCreateDrawModel() { return GetDrawModel() ? GetDrawModel() : _MakeDrawModel(); } - // #i62875# namespace docfunc { @@ -889,10 +597,10 @@ namespace docfunc { bool bExistsDrawObjs( false ); - if ( p_rDoc.GetDrawModel() && - p_rDoc.GetDrawModel()->GetPage( 0 ) ) + if ( p_rDoc.getIDocumentDrawModelAccess().GetDrawModel() && + p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ) ) { - const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) ); + const SdrPage& rSdrPage( *(p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) ); SdrObjListIter aIter( rSdrPage, IM_FLAT ); while( aIter.IsMore() ) @@ -914,10 +622,10 @@ namespace docfunc { bool bAllDrawObjsOnPage( true ); - if ( p_rDoc.GetDrawModel() && - p_rDoc.GetDrawModel()->GetPage( 0 ) ) + if ( p_rDoc.getIDocumentDrawModelAccess().GetDrawModel() && + p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ) ) { - const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) ); + const SdrPage& rSdrPage( *(p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) ); SdrObjListIter aIter( rSdrPage, IM_FLAT ); while( aIter.IsMore() ) diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index f610ccea2797..8418a998c520 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -32,6 +32,7 @@ #include <ndgrf.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <ndindex.hxx> #include <docary.hxx> #include <fmtcntnt.hxx> @@ -445,7 +446,7 @@ lcl_SetFlyFrmAttr(SwDoc & rDoc, void SwDoc::CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet) { - SdrModel* pDrawModel = GetOrCreateDrawModel(); + SdrModel* pDrawModel = getIDocumentDrawModelAccess().GetOrCreateDrawModel(); SfxItemIter aIter(rSet); for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem()) diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index b925f861f4ff..942ac1273931 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -63,6 +63,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <DocumentSettingManager.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> @@ -500,11 +501,11 @@ SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveWithinDoc, bool bInsInPage ) { // #i52858# - method name changed - SdrPage *pPg = GetOrCreateDrawModel()->GetPage( 0 ); + SdrPage *pPg = getIDocumentDrawModelAccess().GetOrCreateDrawModel()->GetPage( 0 ); if( !pPg ) { - pPg = GetDrawModel()->AllocPage( false ); - GetDrawModel()->InsertPage( pPg ); + pPg = getIDocumentDrawModelAccess().GetDrawModel()->AllocPage( false ); + getIDocumentDrawModelAccess().GetDrawModel()->InsertPage( pPg ); } SdrObject *pObj = rObj.Clone(); @@ -531,9 +532,9 @@ SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveWithinDoc, !pObj->ISA(SwVirtFlyDrawObj) && !IS_TYPE(SdrObject,pObj) ) { - if ( IsVisibleLayerId( nLayerIdForClone ) ) + if ( getIDocumentDrawModelAccess().IsVisibleLayerId( nLayerIdForClone ) ) { - nLayerIdForClone = GetInvisibleLayerIdByVisibleOne( nLayerIdForClone ); + nLayerIdForClone = getIDocumentDrawModelAccess().GetInvisibleLayerIdByVisibleOne( nLayerIdForClone ); } } pObj->SetLayer( nLayerIdForClone ); @@ -1556,8 +1557,8 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, // Send the frame to the back, if needed. // Consider the 'invisible' hell layer. - if ( rDoc.GetHellId() != nLayerId && - rDoc.GetInvisibleHellId() != nLayerId ) + if ( rDoc.getIDocumentDrawModelAccess().GetHellId() != nLayerId && + rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId() != nLayerId ) { SvxOpaqueItem aOpaque( RES_OPAQUE ); aOpaque.SetValue( true ); @@ -1624,14 +1625,14 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, pNewSet->ClearItem(); pNewSet->Put( SwFmtSurround( SURROUND_NONE ) ); - if (nLayerId == rDoc.GetHellId()) + if (nLayerId == rDoc.getIDocumentDrawModelAccess().GetHellId()) { // Consider drawing objects in the 'invisible' hell layer - rSdrObj.SetLayer( rDoc.GetHeavenId() ); + rSdrObj.SetLayer( rDoc.getIDocumentDrawModelAccess().GetHeavenId() ); } - else if (nLayerId == rDoc.GetInvisibleHellId()) + else if (nLayerId == rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId()) { - rSdrObj.SetLayer( rDoc.GetInvisibleHeavenId() ); + rSdrObj.SetLayer( rDoc.getIDocumentDrawModelAccess().GetInvisibleHeavenId() ); } pNewSet->Put( SvxLRSpaceItem( RES_LR_SPACE ) ); pNewSet->Put( SvxULSpaceItem( RES_UL_SPACE ) ); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index ea387a8f67cc..61441b4739fa 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -20,7 +20,6 @@ #include <config_features.h> #include <doc.hxx> -#include <DocumentSettingManager.hxx> #include <dcontact.hxx> #include <com/sun/star/document/PrinterIndependentLayout.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> @@ -89,6 +88,8 @@ #include <MarkManager.hxx> #include <UndoManager.hxx> #include <DocumentDeviceManager.hxx> +#include <DocumentSettingManager.hxx> +#include <DocumentDrawModelManager.hxx> #include <unochart.hxx> #include <fldbas.hxx> @@ -187,8 +188,9 @@ SwDoc::SwDoc() mpAttrPool(new SwAttrPool(this)), mpMarkManager(new ::sw::mark::MarkManager(*this)), m_pMetaFieldManager(new ::sw::MetaFieldManager()), + m_pDocumentDrawModelManager( new ::sw::DocumentDrawModelManager( *this ) ), m_pUndoManager(new ::sw::UndoManager( - boost::shared_ptr<SwNodes>(new SwNodes(this)), *this, *this, *this)), + boost::shared_ptr<SwNodes>(new SwNodes(this)), *m_pDocumentDrawModelManager, *this, *this)), m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)), m_pDeviceAccess( new ::sw::DocumentDeviceManager( *this ) ), mpDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), @@ -207,7 +209,6 @@ SwDoc::SwDoc() mpTOXTypes( new SwTOXTypes() ), mpDefTOXBases( new SwDefTOXBase_Impl() ), mpCurrentView( 0 ), - mpDrawModel( 0 ), mpUpdtFlds( new SwDocUpdtFld( this ) ), mpFldTypes( new SwFldTypes() ), mpGlossaryDoc( 0 ), @@ -456,9 +457,9 @@ SwDoc::~SwDoc() mpLayouter = 0L; // Deactivate Undo notification from Draw - if( mpDrawModel ) + if( GetDocumentDrawModelManager().GetDrawModel() ) { - DrawNotifyUndoHdl(); + GetDocumentDrawModelManager().DrawNotifyUndoHdl(); ClrContourCache(); } @@ -593,7 +594,7 @@ SwDoc::~SwDoc() // Only now destroy the Model, the drawing objects - which are also // contained in the Undo - need to remove their attributes from the // Model. Also, DrawContacts could exist before this. - ReleaseDrawModel(); + GetDocumentDrawModelManager().ReleaseDrawModel(); // Destroy DrawModel before the LinkManager, because it's always set // in the DrawModel. DELETEZ( mpLinkMgr ); @@ -658,11 +659,11 @@ void SwDoc::SetDocShell( SwDocShell* pDSh ) } mpLinkMgr->SetPersist( mpDocShell ); - if( mpDrawModel ) + if( GetDocumentDrawModelManager().GetDrawModel() ) { - ((SwDrawDocument*)mpDrawModel)->SetObjectShell( mpDocShell ); - mpDrawModel->SetPersist( mpDocShell ); - OSL_ENSURE( mpDrawModel->GetPersist() == GetPersist(), + ((SwDrawDocument*)GetDocumentDrawModelManager().GetDrawModel())->SetObjectShell( mpDocShell ); + GetDocumentDrawModelManager().GetDrawModel()->SetPersist( mpDocShell ); + OSL_ENSURE( GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist(), "draw model's persist is out of sync" ); } } @@ -689,9 +690,9 @@ void SwDoc::ClearDoc() ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); // Deactivate Undo notification from Draw - if( mpDrawModel ) + if( GetDocumentDrawModelManager().GetDrawModel() ) { - DrawNotifyUndoHdl(); + GetDocumentDrawModelManager().DrawNotifyUndoHdl(); ClrContourCache(); } @@ -699,7 +700,7 @@ void SwDoc::ClearDoc() sal_uInt16 n; while ( 0 != (n = GetSpzFrmFmts()->size()) ) DelLayoutFmt((*mpSpzFrmFmtTbl)[n-1]); - OSL_ENSURE( !mpDrawModel || !mpDrawModel->GetPage(0)->GetObjCount(), + OSL_ENSURE( !GetDocumentDrawModelManager().GetDrawModel() || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount(), "not all DrawObjects removed from the page" ); mpRedlineTbl->DeleteAndDestroyAll(); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 48d933938ecf..5cb751e91a83 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1918,7 +1918,7 @@ const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return & const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return GetDoc(); } const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return GetDoc(); } const IDocumentLineNumberAccess* SwNode::getIDocumentLineNumberAccess() const { return GetDoc(); } -const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return GetDoc(); } +const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); } const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return GetDoc(); } IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return GetDoc(); } const IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() const { return GetDoc(); } diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 5283af3d00ca..fde49d708f1d 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -8,6 +8,7 @@ */ #include "doc.hxx" +#include <IDocumentDrawModelAccess.hxx> #include "ndtxt.hxx" #include "MarkManager.hxx" #include "docary.hxx" @@ -189,7 +190,7 @@ void SwDoc::dumpAsXml( xmlTextWriterPtr w ) mpNumRuleTbl->dumpAsXml( writer ); mpRedlineTbl->dumpAsXml( writer ); mpExtraRedlineTbl->dumpAsXml( writer ); - lcl_dumpSdrModel( writer, mpDrawModel ); + lcl_dumpSdrModel( writer, getIDocumentDrawModelAccess().GetDrawModel() ); writer.endElement(); } diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx index 7f6236dbae17..8090dfe770e5 100644 --- a/sw/source/core/draw/drawdoc.cxx +++ b/sw/source/core/draw/drawdoc.cxx @@ -37,6 +37,7 @@ #include <hintids.hxx> #include <com/sun/star/embed/ElementModes.hpp> #include <DocumentSettingManager.hxx> +#include <IDocumentDrawModelAccess.hxx> using namespace com::sun::star; @@ -147,7 +148,7 @@ uno::Reference<embed::XStorage> SwDrawDocument::GetDocumentStorage() const SdrLayerID SwDrawDocument::GetControlExportLayerId( const SdrObject & ) const { //for versions < 5.0, there was only Hell and Heaven - return (SdrLayerID)pDoc->GetHeavenId(); + return (SdrLayerID)pDoc->getIDocumentDrawModelAccess().GetHeavenId(); } uno::Reference< uno::XInterface > SwDrawDocument::createUnoModel() diff --git a/sw/source/core/fields/textapi.cxx b/sw/source/core/fields/textapi.cxx index 719c341dab2d..c9a38206a615 100644 --- a/sw/source/core/fields/textapi.cxx +++ b/sw/source/core/fields/textapi.cxx @@ -19,6 +19,7 @@ #include <textapi.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docsh.hxx> #include <editeng/eeitem.hxx> #include <editeng/editeng.hxx> @@ -123,7 +124,7 @@ SvxTextForwarder* SwTextAPIEditSource::GetTextForwarder() if( !pImpl->mpOutliner ) { //init draw model first - pImpl->mpDoc->GetOrCreateDrawModel(); + pImpl->mpDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); pImpl->mpOutliner = new Outliner( pImpl->mpPool, OUTLINERMODE_TEXTOBJECT ); pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner ); } @@ -141,7 +142,7 @@ void SwTextAPIEditSource::SetText( OutlinerParaObject& rText ) if( !pImpl->mpOutliner ) { //init draw model first - pImpl->mpDoc->GetOrCreateDrawModel(); + pImpl->mpDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); pImpl->mpOutliner = new Outliner( pImpl->mpPool, OUTLINERMODE_TEXTOBJECT ); pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner ); } @@ -157,7 +158,7 @@ void SwTextAPIEditSource::SetString( const OUString& rText ) if( !pImpl->mpOutliner ) { //init draw model first - pImpl->mpDoc->GetOrCreateDrawModel(); + pImpl->mpDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); pImpl->mpOutliner = new Outliner( pImpl->mpPool, OUTLINERMODE_TEXTOBJECT ); pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner ); } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index f24866689a04..9aaab2aa8729 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -54,6 +54,7 @@ #include <fesh.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <rootfrm.hxx> #include <ndtxt.hxx> #include <pam.hxx> @@ -1393,9 +1394,9 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt ) pNewObj->NbcMove(Size(aVec.getX(), aVec.getY())); if( pNewObj->ISA( SdrUnoObj ) ) - pNewObj->SetLayer( GetDoc()->GetControlsId() ); + pNewObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetControlsId() ); else if( pOldObj->ISA( SdrUnoObj ) ) - pNewObj->SetLayer( GetDoc()->GetHeavenId() ); + pNewObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetHeavenId() ); else pNewObj->SetLayer( pOldObj->GetLayer() ); @@ -1524,11 +1525,11 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt ) SdrObject *pObj = pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); if( pObj->ISA( SdrUnoObj ) ) { - pObj->SetLayer( GetDoc()->GetControlsId() ); + pObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetControlsId() ); bDesignMode = true; } else - pObj->SetLayer( GetDoc()->GetHeavenId() ); + pObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetHeavenId() ); const Rectangle &rSnap = pObj->GetSnapRect(); const Size aDiff( rSnap.GetWidth()/2, rSnap.GetHeight()/2 ); pView->MoveMarkedObj( aDiff ); diff --git a/sw/source/core/inc/DocumentDrawModelManager.hxx b/sw/source/core/inc/DocumentDrawModelManager.hxx new file mode 100644 index 000000000000..596ee831b8e5 --- /dev/null +++ b/sw/source/core/inc/DocumentDrawModelManager.hxx @@ -0,0 +1,92 @@ +/* -*- 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_DOCUMENTDRAWMODELMANAGER_HXX +#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTDRAWMODELMANAGER_HXX + +#include <sal/types.h> +#include <IDocumentDrawModelAccess.hxx> +#include <boost/utility.hpp> +#include <svx/svdtypes.hxx> + +class SdrModel; +class SdrPageView; +class SwDoc; + +namespace sw +{ + +class DocumentDrawModelManager : public IDocumentDrawModelAccess, + public ::boost::noncopyable +{ +public: + + DocumentDrawModelManager( SwDoc& i_rSwdoc ); + + void InitDrawModel(); + void ReleaseDrawModel(); + void DrawNotifyUndoHdl(); + + //IDocumentDrawModelAccess + virtual const SdrModel* GetDrawModel() const SAL_OVERRIDE; + virtual SdrModel* GetDrawModel() SAL_OVERRIDE; + virtual SdrModel* _MakeDrawModel() SAL_OVERRIDE; + virtual SdrModel* GetOrCreateDrawModel() SAL_OVERRIDE; + virtual SdrLayerID GetHeavenId() const SAL_OVERRIDE; + virtual SdrLayerID GetHellId() const SAL_OVERRIDE; + virtual SdrLayerID GetControlsId() const SAL_OVERRIDE; + virtual SdrLayerID GetInvisibleHeavenId() const SAL_OVERRIDE; + virtual SdrLayerID GetInvisibleHellId() const SAL_OVERRIDE; + virtual SdrLayerID GetInvisibleControlsId() const SAL_OVERRIDE; + + virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) SAL_OVERRIDE; + + virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const SAL_OVERRIDE; + + virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId ) SAL_OVERRIDE; + + virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId ) SAL_OVERRIDE; + + virtual ~DocumentDrawModelManager() {} + +private: + + SwDoc& m_rSwdoc; + + + SdrModel* mpDrawModel; + + /** Draw Model Layer IDs + * LayerIds, Heaven == above document + * Hell == below document + * Controls == at the very top + */ + SdrLayerID mnHeaven; + SdrLayerID mnHell; + SdrLayerID mnControls; + SdrLayerID mnInvisibleHeaven; + SdrLayerID mnInvisibleHell; + SdrLayerID mnInvisibleControls; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index cd45f5667b5b..a97fa82b86ee 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -21,6 +21,7 @@ #include <fmtornt.hxx> #include <doc.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <fmtsrnd.hxx> #include <dcontact.hxx> #include <editeng/ulspitem.hxx> @@ -783,7 +784,7 @@ SwTxtFrm* SwAnchoredObject::FindAnchorCharFrm() */ bool SwAnchoredObject::IsFormatPossible() const { - return GetFrmFmt().GetDoc()->IsVisibleLayerId( GetDrawObj()->GetLayer() ); + return GetFrmFmt().GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetDrawObj()->GetLayer() ); } // --> #i3317# diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 28671eaf821a..7a7441e25d67 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -50,6 +50,7 @@ #include <fmtfollowtextflow.hxx> #include <switerator.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> bool SwFlowFrm::m_bMoveBwdJump = false; @@ -1047,7 +1048,7 @@ bool SwFlowFrm::IsPrevObjMove() const // OD 2004-01-20 #110582# - do not consider hidden objects // #i26945# - do not consider object, which // doesn't follow the text flow. - if ( pObj->GetFrmFmt().GetDoc()->IsVisibleLayerId( + if ( pObj->GetFrmFmt().GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( pObj->GetDrawObj()->GetLayer() ) && pObj->GetFrmFmt().GetFollowTextFlow().GetValue() ) { diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index f4082f1520ed..513efae5144c 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -23,6 +23,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include "frmtool.hxx" #include "dflyobj.hxx" #include "hints.hxx" @@ -302,7 +303,7 @@ bool SwOszControl::ChkOsz() |*/ void SwFlyAtCntFrm::MakeAll() { - if ( !GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) ) + if ( !GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) ) { return; } @@ -473,7 +474,7 @@ void SwFlyAtCntFrm::MakeAll() !bConsiderWrapInfluenceDueToOverlapPrevCol && // #i40444# !bConsiderWrapInfluenceDueToMovedFwdAnchor && - GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) ); + GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) ); // #i3317# - instead of attribute change apply // temporarly the 'straightforward positioning process'. diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 422e7d72e497..3f0bc43764c1 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -25,6 +25,7 @@ #include "flyfrms.hxx" #include <dflyobj.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> SwFlyInCntFrm::SwFlyInCntFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : SwFlyFrm( pFmt, pSib, pAnch ) @@ -199,7 +200,7 @@ void SwFlyInCntFrm::RegistFlys() void SwFlyInCntFrm::MakeAll() { // OD 2004-01-19 #110582# - if ( !GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) ) + if ( !GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) ) { return; } diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 15a694ba44d6..d5487dd12072 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -39,6 +39,7 @@ #include <sortedobjs.hxx> #include <viewimp.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> using namespace ::com::sun::star; @@ -95,7 +96,7 @@ void SwFlyFreeFrm::NotifyBackground( SwPageFrm *pPageFrm, void SwFlyFreeFrm::MakeAll() { - if ( !GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) ) + if ( !GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) ) { return; } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 663affda36e9..78e8c850cea1 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -45,6 +45,7 @@ #include "flyfrm.hxx" #include "doc.hxx" #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include "fesh.hxx" #include "dview.hxx" #include "dflyobj.hxx" @@ -1327,7 +1328,7 @@ void SwRootFrm::RemoveSuperfluous() // #i28701# SwAnchoredObject* pAnchoredObj = rObjs[i]; // OD 2004-01-19 #110582# - do not consider hidden objects - if ( pPage->GetFmt()->GetDoc()->IsVisibleLayerId( + if ( pPage->GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) && !pAnchoredObj->GetAnchorFrm()->FindFooterOrHeader() ) { diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 3133080cf44e..a8dbaa8a10ef 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -70,6 +70,7 @@ #include <svx/sdr/contact/viewcontact.hxx> #include <DocumentSettingManager.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <ndole.hxx> #include <svx/charthelper.hxx> @@ -3331,7 +3332,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c { // OD 29.08.2002 #102450# - add 3rd parameter // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. - pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(), + pSh->Imp()->PaintLayer( pSh->GetDoc()->getIDocumentDrawModelAccess().GetHeavenId(), pPrintData, pPage->Frm(), &aPageBackgrdColor, @@ -6665,7 +6666,7 @@ void SwLayoutFrm::RefreshLaySubsidiary( const SwPageFrm *pPage, for ( sal_uInt32 i = 0; i < rObjs.Count(); ++i ) { const SwAnchoredObject* pAnchoredObj = rObjs[i]; - if ( pPage->GetFmt()->GetDoc()->IsVisibleLayerId( + if ( pPage->GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) && pAnchoredObj->ISA(SwFlyFrm) ) { @@ -6755,7 +6756,7 @@ static void lcl_RefreshLine( const SwLayoutFrm *pLay, // OD 2004-02-12 #110582#-2 - do *not* consider fly frame, which // belongs to a invisible layer if ( pFly->IsBackgroundTransparent() || - !pFly->GetFmt()->GetDoc()->IsVisibleLayerId( pObj->GetLayer() ) ) + !pFly->GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( pObj->GetLayer() ) ) { aIter.Next(); continue; diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 4959028337bf..9f6c49848b4f 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -35,6 +35,7 @@ #include <editsh.hxx> #include <unobaseclass.hxx> #include <limits> +#include <IDocumentDrawModelAccess.hxx> using namespace ::com::sun::star; diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index e716b35b5ecc..c454ac933777 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -33,6 +33,7 @@ #include <ftnidx.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <IShellCursorSupplier.hxx> #include <docary.hxx> #include <swundo.hxx> @@ -552,7 +553,7 @@ bool SwUndoFmtAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext) if( pCont->GetAnchorFrm() && !pObj->IsInserted() ) { OSL_ENSURE( pDoc->GetDrawModel(), "RestoreFlyAnchor without DrawModel" ); - pDoc->GetDrawModel()->GetPage( 0 )->InsertObject( pObj ); + pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )->InsertObject( pObj ); } pObj->SetRelativePos( aDrawSavePt ); diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index 46cebe996184..fbb75a958d7f 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -31,6 +31,7 @@ #include <frmfmt.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <swundo.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -948,11 +949,11 @@ void SwUndoInsertLabel::RedoImpl(::sw::UndoRedoContext & rContext) if( LTYPE_DRAW == eType ) { pSdrObj->SetLayer( nLayerId ); - if( pSdrObj->GetLayer() == rDoc.GetHellId() ) - pSdrObj->SetLayer( rDoc.GetHeavenId() ); + if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetHellId() ) + pSdrObj->SetLayer( rDoc.getIDocumentDrawModelAccess().GetHeavenId() ); // OD 02.07.2003 #108784# - else if( pSdrObj->GetLayer() == rDoc.GetInvisibleHellId() ) - pSdrObj->SetLayer( rDoc.GetInvisibleHeavenId() ); + else if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId() ) + pSdrObj->SetLayer( rDoc.getIDocumentDrawModelAccess().GetInvisibleHeavenId() ); } } } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 526382620ecf..19d24f593bee 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -32,6 +32,7 @@ #include <doc.hxx> #include <docary.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <fmtcntnt.hxx> #include <fmtflcnt.hxx> #include <txtatr.hxx> @@ -513,7 +514,7 @@ sal_Int32 SwXDrawPage::getCount(void) throw( uno::RuntimeException, std::excepti SolarMutexGuard aGuard; if(!pDoc) throw uno::RuntimeException(); - if(!pDoc->GetDrawModel()) + if(!pDoc->getIDocumentDrawModelAccess().GetDrawModel()) return 0; else { @@ -535,7 +536,7 @@ uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex) SolarMutexGuard aGuard; if(!pDoc) throw uno::RuntimeException(); - if(!pDoc->GetDrawModel()) + if(!pDoc->getIDocumentDrawModelAccess().GetDrawModel()) throw lang::IndexOutOfBoundsException(); ((SwXDrawPage*)this)->GetSvxPage(); @@ -556,7 +557,7 @@ sal_Bool SwXDrawPage::hasElements(void) throw( uno::RuntimeException, std::excep SolarMutexGuard aGuard; if(!pDoc) throw uno::RuntimeException(); - if(!pDoc->GetDrawModel()) + if(!pDoc->getIDocumentDrawModelAccess().GetDrawModel()) return sal_False; else return ((SwXDrawPage*)this)->GetSvxPage()->hasElements(); @@ -674,9 +675,9 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) // #108784# - set layer of new drawing object to corresponding // invisible layer. if(FmFormInventor != pObj->GetObjInventor()) - pObj->SetLayer( bOpaque ? pDoc->GetInvisibleHeavenId() : pDoc->GetInvisibleHellId() ); + pObj->SetLayer( bOpaque ? pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId() ); else - pObj->SetLayer(pDoc->GetInvisibleControlsId()); + pObj->SetLayer(pDoc->getIDocumentDrawModelAccess().GetInvisibleControlsId()); SwPaM* pPam = new SwPaM(pDoc->GetNodes().GetEndOfContent()); SwUnoInternalPaM* pInternalPam = 0; @@ -825,7 +826,7 @@ SwFmDrawPage* SwXDrawPage::GetSvxPage() { SolarMutexGuard aGuard; // #i52858# - SdrModel* pModel = pDoc->GetOrCreateDrawModel(); + SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); SdrPage* pPage = pModel->GetPage( 0 ); { @@ -1115,16 +1116,16 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a SdrObject* pObj = pSvxShape->GetSdrObject(); // set layer of new drawing // object to corresponding invisible layer. - bool bIsVisible = pDoc->IsVisibleLayerId( pObj->GetLayer() ); + bool bIsVisible = pDoc->getIDocumentDrawModelAccess().IsVisibleLayerId( pObj->GetLayer() ); if(FmFormInventor != pObj->GetObjInventor()) { pObj->SetLayer( *(sal_Bool*)aValue.getValue() - ? ( bIsVisible ? pDoc->GetHeavenId() : pDoc->GetInvisibleHeavenId() ) - : ( bIsVisible ? pDoc->GetHellId() : pDoc->GetInvisibleHellId() )); + ? ( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetHeavenId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() ) + : ( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetHellId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId() )); } else { - pObj->SetLayer( bIsVisible ? pDoc->GetControlsId() : pDoc->GetInvisibleControlsId()); + pObj->SetLayer( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetControlsId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleControlsId()); } } @@ -1481,8 +1482,8 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName) SdrObject* pObj = pSvxShape->GetSdrObject(); // consider invisible layers sal_Bool bOpaque = - ( pObj->GetLayer() != pFmt->GetDoc()->GetHellId() && - pObj->GetLayer() != pFmt->GetDoc()->GetInvisibleHellId() ); + ( pObj->GetLayer() != pFmt->GetDoc()->getIDocumentDrawModelAccess().GetHellId() && + pObj->GetLayer() != pFmt->GetDoc()->getIDocumentDrawModelAccess().GetInvisibleHellId() ); aRet.setValue(&bOpaque, ::getBooleanCppuType()); } } @@ -2787,12 +2788,12 @@ void SwXGroupShape::add( const uno::Reference< XShape >& xShape ) throw (uno::Ru if( FmFormInventor != pObj->GetObjInventor()) { pObj->SetLayer( pSwShape->pImpl->GetOpaque() - ? pDoc->GetInvisibleHeavenId() - : pDoc->GetInvisibleHellId() ); + ? pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() + : pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId() ); } else { - pObj->SetLayer(pDoc->GetInvisibleControlsId()); + pObj->SetLayer(pDoc->getIDocumentDrawModelAccess().GetInvisibleControlsId()); } } } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 9803ef12d2c6..f1117540f05c 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -43,6 +43,7 @@ #include <hints.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docsh.hxx> #include <editsh.hxx> #include <swcli.hxx> @@ -1294,7 +1295,7 @@ SdrObject *SwXFrame::GetOrCreateSdrObject(SwFlyFrmFmt &rFmt) { SwDoc *pDoc = rFmt.GetDoc(); // #i52858# - method name changed - SdrModel *pDrawModel = pDoc->GetOrCreateDrawModel(); + SdrModel *pDrawModel = pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); SwFlyDrawContact* pContactObject = new SwFlyDrawContact( &rFmt, pDrawModel ); pObject = pContactObject->GetMaster(); @@ -1302,9 +1303,8 @@ SdrObject *SwXFrame::GetOrCreateSdrObject(SwFlyFrmFmt &rFmt) const :: SwFmtSurround& rSurround = rFmt.GetSurround(); pObject->SetLayer( ( SURROUND_THROUGHT == rSurround.GetSurround() && - !rFmt.GetOpaque().GetValue() ) ? pDoc->GetHellId() - : pDoc->GetHeavenId() ); - + !rFmt.GetOpaque().GetValue() ) ? pDoc->getIDocumentDrawModelAccess().GetHellId() + : pDoc->getIDocumentDrawModelAccess().GetHeavenId() ); pDrawModel->GetPage(0)->InsertObject( pObject ); } @@ -1681,8 +1681,13 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: if( nZOrder >= 0 && std::find(aTextBoxes.begin(), aTextBoxes.end(), pFmt) == aTextBoxes.end()) { SdrObject* pObject = +<<<<<<< HEAD GetOrCreateSdrObject( (SwFlyFrmFmt&)*pFmt ); SdrModel *pDrawModel = pDoc->GetDrawModel(); +======= + GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt ); + SdrModel *pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); +>>>>>>> Split out IDocumentDrawModelAccess from SwDoc. pDrawModel->GetPage(0)-> SetObjectOrdNum(pObject->GetOrdNum(), nZOrder); } @@ -3029,8 +3034,13 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, m_sName); } } +<<<<<<< HEAD if( pFmt && pDoc->GetDrawModel() ) GetOrCreateSdrObject(*pFmt); +======= + if( pFmt && pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) + GetOrCreateSdrObject( pFmt ); +>>>>>>> Split out IDocumentDrawModelAccess from SwDoc. const ::uno::Any* pOrder; if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) ) setPropertyValue(UNO_NAME_Z_ORDER, *pOrder); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index c14a4368f979..766a8ac8d587 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -32,6 +32,7 @@ #include <fesh.hxx> #include <doc.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> @@ -2514,8 +2515,8 @@ const IDocumentDeviceAccess* SwViewShell::getIDocumentDeviceAccess() const { ret IDocumentDeviceAccess* SwViewShell::getIDocumentDeviceAccess() { return &mpDoc->getIDocumentDeviceAccess(); } const IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() const { return mpDoc->getIDocumentMarkAccess(); } IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() { return mpDoc->getIDocumentMarkAccess(); } -const IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() const { return mpDoc; } -IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() { return mpDoc; } +const IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() const { return & mpDoc->getIDocumentDrawModelAccess(); } +IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() { return & mpDoc->getIDocumentDrawModelAccess(); } const IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() const { return mpDoc; } IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() { return mpDoc; } const IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() const { return mpDoc; } diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx index ef0fb9bbc229..a3670faa4a98 100644 --- a/sw/source/filter/html/htmldrawreader.cxx +++ b/sw/source/filter/html/htmldrawreader.cxx @@ -44,6 +44,7 @@ #include <fmtsrnd.hxx> #include "ndtxt.hxx" #include "doc.hxx" +#include <IDocumentDrawModelAccess.hxx> #include "dcontact.hxx" #include "poolfmt.hxx" #include "swcss1.hxx" @@ -79,7 +80,7 @@ void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj, // always on top of text. // but in invisible layer. <ConnectToLayout> will move the object // to the visible layer. - pNewDrawObj->SetLayer( pDoc->GetInvisibleHeavenId() ); + pNewDrawObj->SetLayer( pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() ); SfxItemSet aFrmSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); @@ -358,7 +359,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) // Ein DrawTxtobj anlegen // #i52858# - method name changed - SdrModel* pModel = pDoc->GetOrCreateDrawModel(); + SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); SdrPage* pPg = pModel->GetPage( 0 ); pMarquee = SdrObjFactory::MakeNewObject( SdrInventor, diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 91eec2d00d42..c2876a79c70e 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -54,6 +54,7 @@ #include <viewsh.hxx> #include "pam.hxx" #include "doc.hxx" +#include <IDocumentDrawModelAccess.hxx> #include "ndtxt.hxx" #include "flypos.hxx" #include "wrthtml.hxx" @@ -349,7 +350,7 @@ void SwHTMLWriter::OutHiddenForms() // Ohne DrawModel kann es auch keine Controls geben. Dann darf man // auch nicht per UNO auf das Dok zugreifen, weil sonst ein DrawModel // angelegt wird. - if( !pDoc->GetDrawModel() ) + if( !pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) return; SwDocShell *pDocSh = pDoc->GetDocShell(); diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 064e652ff497..c389d759b48e 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -45,6 +45,8 @@ #include <comphelper/seqstream.hxx> +#include <IDocumentDrawModelAccess.hxx> + using namespace com::sun::star; using namespace oox; @@ -317,7 +319,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS if (pObj != NULL) { // SdrObjects know their layer, consider that instead of the frame format. - bOpaque = pObj->GetLayer() != pFrmFmt->GetDoc()->GetHellId() && pObj->GetLayer() != pFrmFmt->GetDoc()->GetInvisibleHellId(); + bOpaque = pObj->GetLayer() != pFrmFmt->GetDoc()->getIDocumentDrawModelAccess().GetHellId() && pObj->GetLayer() != pFrmFmt->GetDoc()->getIDocumentDrawModelAccess().GetInvisibleHellId(); lclMovePositionWithRotation(aPos, rSize, pObj->GetRotateAngle()); } @@ -653,7 +655,7 @@ void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrmFmt& rFr bool bSwapInPage = false; if (!(sdrObj)->GetPage()) { - if (SdrModel* pModel = m_pImpl->m_rExport.pDoc->GetDrawModel()) + if (SdrModel* pModel = m_pImpl->m_rExport.pDoc->getIDocumentDrawModelAccess().GetDrawModel()) { if (SdrPage* pPage = pModel->GetPage(0)) { diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9a29d9fa6f69..834996e2ef92 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -95,12 +95,14 @@ #include <ndole.hxx> #include <lineinfo.hxx> #include <rtf.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <vcl/cvtgrf.hxx> #include <oox/mathml/export.hxx> #include <com/sun/star/i18n/ScriptType.hpp> + using ::editeng::SvxBorderLine; using namespace nsSwDocInfoSubType; @@ -1713,7 +1715,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const sw::Frame& rFrame, const Poin bool bSwapInPage = false; if (!pSdrObj->GetPage()) { - if (SdrModel* pModel = m_rExport.pDoc->GetDrawModel()) + if (SdrModel* pModel = m_rExport.pDoc->getIDocumentDrawModelAccess().GetDrawModel()) { if (SdrPage* pPage = pModel->GetPage(0)) { diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index fe138639dfbf..0935461eb2e1 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -49,6 +49,7 @@ #include <unotools/streamwrap.hxx> #include <numrule.hxx> #include <vcl/svapp.hxx> +#include <IDocumentDrawModelAccess.hxx> using namespace com::sun::star; using namespace nsSwGetPoolIdFromName; @@ -395,9 +396,9 @@ namespace sw // #i38889# - by default put objects into the invisible layers. SetLayer::SetLayer(const SwDoc &rDoc) - : mnHeavenLayer(rDoc.GetInvisibleHeavenId()), - mnHellLayer(rDoc.GetInvisibleHellId()), - mnFormLayer(rDoc.GetInvisibleControlsId()) + : mnHeavenLayer(rDoc.getIDocumentDrawModelAccess().GetInvisibleHeavenId()), + mnHellLayer(rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId()), + mnFormLayer(rDoc.getIDocumentDrawModelAccess().GetInvisibleControlsId()) { } diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index c0fe4b176190..c31159ab2901 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -63,6 +63,7 @@ #include <ndindex.hxx> #include <doc.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docary.hxx> #include <pam.hxx> #include <swrect.hxx> @@ -857,8 +858,8 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const OSL_ENSURE(!this, "Unsupported surround type for export"); break; } - if (pObj && (pObj->GetLayer() == rWrt.pDoc->GetHellId() || - pObj->GetLayer() == rWrt.pDoc->GetInvisibleHellId())) + if (pObj && (pObj->GetLayer() == rWrt.pDoc->getIDocumentDrawModelAccess().GetHellId() || + pObj->GetLayer() == rWrt.pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId())) { nFlags |= 0x4000; } @@ -1000,7 +1001,7 @@ sal_uInt32 WW8Export::GetSdrOrdNum( const SwFrmFmt& rFmt ) const SwFrmFmt* pFmt = (SwFrmFmt*)&rFmt; nOrdNum = pDoc->GetSpzFrmFmts()->GetPos( pFmt ); - const SdrModel* pModel = pDoc->GetDrawModel(); + const SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); if( pModel ) nOrdNum += pModel->GetPage( 0 )->GetObjCount(); } @@ -2160,7 +2161,7 @@ sal_Int32 SwEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt, MSO_SPT eShapeType void SwBasicEscherEx::Init() { MapUnit eMap = MAP_TWIP; - if (SdrModel *pModel = rWrt.pDoc->GetDrawModel()) + if (SdrModel *pModel = rWrt.pDoc->getIDocumentDrawModelAccess().GetDrawModel()) { // PPT arbeitet nur mit Einheiten zu 576DPI // WW hingegen verwendet twips, dh. 1440DPI. @@ -2176,7 +2177,7 @@ void SwBasicEscherEx::Init() mnEmuMul = aFact.GetNumerator(); mnEmuDiv = aFact.GetDenominator(); - SetHellLayerId(rWrt.pDoc->GetHellId()); + SetHellLayerId(rWrt.pDoc->getIDocumentDrawModelAccess().GetHellId()); } sal_Int32 SwBasicEscherEx::ToFract16(sal_Int32 nVal, sal_uInt32 nMax) const @@ -2202,7 +2203,7 @@ sal_Int32 SwBasicEscherEx::ToFract16(sal_Int32 nVal, sal_uInt32 nMax) const SdrLayerID SwBasicEscherEx::GetInvisibleHellId() const { - return rWrt.pDoc->GetInvisibleHellId(); + return rWrt.pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId(); } void SwBasicEscherEx::WritePictures() @@ -2294,7 +2295,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) bool bSwapInPage = false; if (!pSdrObj->GetPage()) { - if (SdrModel* pModel = rWrt.pDoc->GetDrawModel()) + if (SdrModel* pModel = rWrt.pDoc->getIDocumentDrawModelAccess().GetDrawModel()) { if (SdrPage *pPage = pModel->GetPage(0)) { @@ -3026,7 +3027,7 @@ void SwEscherEx::WriteOCXControl( const SwFrmFmt& rFmt, sal_uInt32 nShapeId ) { OpenContainer( ESCHER_SpContainer ); - SdrModel *pModel = rWrt.pDoc->GetDrawModel(); + SdrModel *pModel = rWrt.pDoc->getIDocumentDrawModelAccess().GetDrawModel(); OutputDevice *pDevice = Application::GetDefaultDevice(); OSL_ENSURE(pModel && pDevice, "no model or device"); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 6c79c5eded19..d110c90af36b 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -59,6 +59,7 @@ #include <frmatr.hxx> #include <doc.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <viewopt.hxx> #include <docary.hxx> #include <pam.hxx> @@ -3063,8 +3064,8 @@ void MSWordExportBase::ExportDocument( bool bWriteAll ) CollectOutlineBookmarks(*pDoc); // make unique OrdNums (Z-Order) for all drawing-/fly Objects - if ( pDoc->GetDrawModel() ) - pDoc->GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums(); + if ( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) + pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums(); ExportDocument_Impl(); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index e03811fa7d53..ca60186d53d4 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -65,6 +65,7 @@ #include <fmtanchr.hxx> #include <pam.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docary.hxx> #include <ndgrf.hxx> #include <ndtxt.hxx> @@ -3038,8 +3039,8 @@ void SwWW8ImplReader::GrafikCtor() // Fuer SVDraw und VCControls und Escher { if (!pDrawModel) { - rDoc.GetOrCreateDrawModel(); // #i52858# - method name changed - pDrawModel = rDoc.GetDrawModel(); + rDoc.getIDocumentDrawModelAccess().GetOrCreateDrawModel(); // #i52858# - method name changed + pDrawModel = rDoc.getIDocumentDrawModelAccess().GetDrawModel(); OSL_ENSURE(pDrawModel, "Kann DrawModel nicht anlegen"); pDrawPg = pDrawModel->GetPage(0); diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index aab22939c5df..193e767fcc51 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -50,6 +50,7 @@ #include <fltini.hxx> #include <doc.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docary.hxx> #include <docsh.hxx> #include <unotextrange.hxx> @@ -445,10 +446,10 @@ static void lcl_AdjustOutlineStylesForOOo( SwDoc& _rDoc ) static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SwDoc& _rDoc ) { - if ( _rDoc.GetDrawModel() && - _rDoc.GetDrawModel()->GetPage( 0 ) ) + if ( _rDoc.getIDocumentDrawModelAccess().GetDrawModel() && + _rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ) ) { - const SdrPage& rSdrPage( *(_rDoc.GetDrawModel()->GetPage( 0 )) ); + const SdrPage& rSdrPage( *(_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) ); // iterate recursive with group objects over all shapes on the draw page SdrObjListIter aIter( rSdrPage ); diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 66ce6d821726..bf4812c23812 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -59,6 +59,7 @@ #include <vcl/svapp.hxx> #include <osl/mutex.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <pausethreadstarting.hxx> @@ -228,7 +229,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 ) { //Auf die Korrektheit der OrdNums sind wir schon angewiesen. - SdrModel* pModel = pDoc->GetDrawModel(); + SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); if( pModel ) pModel->GetPage( 0 )->RecalcObjOrdNums(); } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 3dd3c4ce0722..c2a5e90920a5 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -36,6 +36,7 @@ #include <doc.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <unofreg.hxx> #include <TextCursorHelper.hxx> #include <unotext.hxx> @@ -667,10 +668,10 @@ void SwXMLImport::startDocument() } // We need a draw model to be able to set the z order - pDoc->GetOrCreateDrawModel(); // #i52858# - method name changed + pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); // #i52858# - method name changed // SJ: #i49801# locking the modell to disable repaints - SdrModel* pDrawModel = pDoc->GetDrawModel(); + SdrModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); if ( pDrawModel ) pDrawModel->setLock(true); @@ -870,7 +871,7 @@ void SwXMLImport::endDocument( void ) pDoc->PrtOLENotify( true ); } - SdrModel* pDrawModel = pDoc->GetDrawModel(); + SdrModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); if ( pDrawModel ) pDrawModel->setLock(false); } diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index e367b358f288..faed2f2de98a 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -39,6 +39,7 @@ #include "TextCursorHelper.hxx" #include "unoframe.hxx" #include "doc.hxx" +#include <IDocumentDrawModelAccess.hxx> #include "unocoll.hxx" #include <fmtfsize.hxx> #include <fmtanchr.hxx> @@ -357,7 +358,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE ); xPropSet = pXFrame; - if( pDoc->GetDrawModel() ) + if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) SwXFrame::GetOrCreateSdrObject(* static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order if( !rTblName.isEmpty() ) @@ -595,8 +596,13 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink( SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE ); xPropSet = pXFrame; +<<<<<<< HEAD if( pDoc->GetDrawModel() ) SwXFrame::GetOrCreateSdrObject(* +======= + if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) + SwXFrame::GetOrCreateSdrObject( +>>>>>>> Split out IDocumentDrawModelAccess from SwDoc. static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order } } @@ -652,8 +658,13 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertApplet( NULL); SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE ); xPropSet = pXFrame; +<<<<<<< HEAD if( pDoc->GetDrawModel() ) SwXFrame::GetOrCreateSdrObject(* +======= + if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) + SwXFrame::GetOrCreateSdrObject( +>>>>>>> Split out IDocumentDrawModelAccess from SwDoc. static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order return xPropSet; @@ -725,8 +736,13 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertPlugin( NULL); SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE ); xPropSet = pXFrame; +<<<<<<< HEAD if( pDoc->GetDrawModel() ) SwXFrame::GetOrCreateSdrObject(* +======= + if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) + SwXFrame::GetOrCreateSdrObject( +>>>>>>> Split out IDocumentDrawModelAccess from SwDoc. static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order } } @@ -876,8 +892,13 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra NULL); SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE ); xPropSet = pXFrame; +<<<<<<< HEAD if( pDoc->GetDrawModel() ) SwXFrame::GetOrCreateSdrObject(* +======= + if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) + SwXFrame::GetOrCreateSdrObject( +>>>>>>> Split out IDocumentDrawModelAccess from SwDoc. static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order } } diff --git a/sw/source/uibase/app/docshdrw.cxx b/sw/source/uibase/app/docshdrw.cxx index 90070c96518b..03882285cac3 100644 --- a/sw/source/uibase/app/docshdrw.cxx +++ b/sw/source/uibase/app/docshdrw.cxx @@ -27,13 +27,14 @@ #include <docsh.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> using namespace ::com::sun::star; // Load Document void SwDocShell::InitDraw() { - SdrModel *pDrDoc = pDoc->GetDrawModel(); + SdrModel *pDrDoc = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); if( pDrDoc ) { // create Lists and Tables DocShell's ItemSet diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index a073a5def9dc..8cb9c2aab831 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -40,6 +40,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <cmdid.h> #include <swstyle.h> #include <app.hrc> @@ -1150,7 +1151,7 @@ SfxItemSet& SwDocStyleSheet::GetItemSet() //UUUU create needed items for XPropertyList entries from the DrawModel so that // the Area TabPage can access them - const SdrModel* pDrawModel = rDoc.GetDrawModel(); + const SdrModel* pDrawModel = rDoc.getIDocumentDrawModelAccess().GetDrawModel(); aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE)); aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST)); diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index aa323037d0c1..c3fcc36c9635 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -38,6 +38,7 @@ #include <unotools/lingucfg.hxx> #include <doc.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docsh.hxx> #include <docary.hxx> #include <frmfmt.hxx> @@ -767,7 +768,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh) { bool bHasSpellError = false; { - SdrOutliner aTmpOutliner(pDoc->GetDrawModel()-> + SdrOutliner aTmpOutliner(pDoc->getIDocumentDrawModelAccess().GetDrawModel()-> GetDrawOutliner().GetEmptyItemSet().GetPool(), OUTLINERMODE_TEXTOBJECT ); aTmpOutliner.SetRefDevice( pDoc->getIDocumentDeviceAccess().getPrinter( false ) ); diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 7cee393f2097..572f51a47ed1 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -81,6 +81,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <pagedesc.hxx> #include <IMark.hxx> #include <docary.hxx> @@ -522,7 +523,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor ) case SOT_FORMATSTR_ID_DRAWING: { SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); - bOK = SetObject( pDoc->GetDrawModel(), + bOK = SetObject( pDoc->getIDocumentDrawModelAccess().GetDrawModel(), SWTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor ); } break; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index bf7f537a8b06..c84e91f8e402 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -75,6 +75,7 @@ #include <view.hxx> #include <wrtsh.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <fldbas.hxx> #include <swmodule.hxx> #include <docsh.hxx> @@ -485,7 +486,7 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) SdrObject* pSelectableObj = rSh.GetObjAt(rLPt); // Don't update pointer if this is a background image only. - if (pSelectableObj->GetLayer() != rSh.GetDoc()->GetHellId()) + if (pSelectableObj->GetLayer() != rSh.GetDoc()->getIDocumentDrawModelAccess().GetHellId()) eStyle = bMovable ? POINTER_MOVE : POINTER_ARROW; m_aActHitType = SDRHIT_OBJECT; } @@ -2678,7 +2679,7 @@ static bool lcl_urlOverBackground(SwWrtShell& rSh, const Point& rDocPos) SwContentAtPos aSwContentAtPos(SwContentAtPos::SW_INETATTR); SdrObject* pSelectableObj = rSh.GetObjAt(rDocPos); - return rSh.GetContentAtPos(rDocPos, aSwContentAtPos) && pSelectableObj->GetLayer() == rSh.GetDoc()->GetHellId(); + return rSh.GetContentAtPos(rDocPos, aSwContentAtPos) && pSelectableObj->GetLayer() == rSh.GetDoc()->getIDocumentDrawModelAccess().GetHellId(); } #if !HAVE_FEATURE_DESKTOP diff --git a/sw/source/uibase/lingu/sdrhhcwrap.cxx b/sw/source/uibase/lingu/sdrhhcwrap.cxx index b3e7da92f99f..fe7bec39757f 100644 --- a/sw/source/uibase/lingu/sdrhhcwrap.cxx +++ b/sw/source/uibase/lingu/sdrhhcwrap.cxx @@ -40,6 +40,7 @@ #include <dcontact.hxx> #include <doc.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docary.hxx> #include <edtwin.hxx> @@ -50,7 +51,7 @@ SdrHHCWrapper::SdrHHCWrapper( SwView* pVw, const Font* pTargetFnt, sal_Int32 nConvOptions, bool bInteractive ) : - SdrOutliner(pVw->GetDocShell()->GetDoc()->GetDrawModel()-> + SdrOutliner(pVw->GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()-> GetDrawOutliner().GetEmptyItemSet().GetPool(), OUTLINERMODE_TEXTOBJECT ), pView( pVw ), diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 472e1399e38f..a420e800e4e8 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -45,6 +45,7 @@ #include <doc.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <fmturl.hxx> #include <fmtclds.hxx> #include <fmtcnct.hxx> @@ -443,7 +444,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) //UUUU create needed items for XPropertyList entries from the DrawModel so that // the Area TabPage can access them - const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel(); + const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); aSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE)); aSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST)); diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 3e5822a4421f..23cc9bcf0fb9 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -67,6 +67,7 @@ #include <svx/extedit.hxx> #include <svx/graphichelper.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <doc.hxx> #include <docsh.hxx> @@ -238,7 +239,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) //UUUU create needed items for XPropertyList entries from the DrawModel so that // the Area TabPage can access them - const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel(); + const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); aSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE)); aSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST)); diff --git a/sw/source/uibase/shells/grfshex.cxx b/sw/source/uibase/shells/grfshex.cxx index 60988bac1736..dd763f0e4fce 100644 --- a/sw/source/uibase/shells/grfshex.cxx +++ b/sw/source/uibase/shells/grfshex.cxx @@ -29,6 +29,7 @@ #include <vcl/graphicfilter.hxx> #include <sfx2/htmlmode.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <docsh.hxx> #include <frmfmt.hxx> #include <frmmgr.hxx> @@ -137,7 +138,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq ) SdrMediaObj* pObj = new SdrMediaObj( Rectangle( aPos, aSize ) ); - pObj->SetModel(rSh.GetDoc()->GetDrawModel()); // set before setURL + pObj->SetModel(rSh.GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()); // set before setURL pObj->setURL( realURL, "" ); rSh.EnterStdMode(); rSh.SwFEShell::InsertDrawObj( *pObj, aPos ); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index eebfc4396b5d..7ab26cf1cb82 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -72,6 +72,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <drawdoc.hxx> #include <wdocsh.hxx> #include <wview.hxx> @@ -1633,7 +1634,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) if( !bReadonly ) { SwDrawDocument * pDrawDoc = 0; - if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (GetDocShell()->GetDoc()->GetDrawModel() ) ) ) + if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel() ) ) ) { if( !pDrawDoc->GetOpenInDesignMode() ) break;// don't touch the design mode diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 2976b7db8d38..854e65355a50 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -80,6 +80,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <wrtsh.hxx> #include <viewopt.hxx> #include <basesh.hxx> diff --git a/sw/source/uibase/uno/unodefaults.cxx b/sw/source/uibase/uno/unodefaults.cxx index 1959f742947c..3529b2f7e146 100644 --- a/sw/source/uibase/uno/unodefaults.cxx +++ b/sw/source/uibase/uno/unodefaults.cxx @@ -21,9 +21,10 @@ #include <svx/svdmodel.hxx> #include <svx/unoprov.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> SwSvxUnoDrawPool::SwSvxUnoDrawPool( SwDoc* pDoc ) throw() : - SvxUnoDrawPool(pDoc->GetDrawModel(), SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER), + SvxUnoDrawPool(pDoc->getIDocumentDrawModelAccess().GetDrawModel(), SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER), m_pDoc(pDoc) { } @@ -42,7 +43,7 @@ SfxItemPool* SwSvxUnoDrawPool::getModelPool( bool /*bReadOnly*/ ) throw() //SdrModel* pModel = m_pDoc->MakeDrawModel(); //return &pModel->GetItemPool(); // #i52858# - method name changed - m_pDoc->GetOrCreateDrawModel(); + m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); return &(m_pDoc->GetAttrPool()); } return 0; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index ac09758b2672..73d687a815aa 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -96,6 +96,7 @@ #include <doc.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svl/zforlist.hxx> #include <drawdoc.hxx> @@ -1920,7 +1921,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& SwDrawDocument * pDrawDoc; bool bAuto = *(sal_Bool*) aValue.getValue(); - if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * >( pDocShell->GetDoc()->GetDrawModel() ) ) ) + if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * >( pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel() ) ) ) pDrawDoc->SetAutoControlFocus( bAuto ); else if (bAuto) { @@ -1930,7 +1931,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& // SdrModel and we are leaving the default at false, // we don't need to make an SdrModel and can do nothing // #i52858# - method name changed - pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetOrCreateDrawModel() ); + pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); pDrawDoc->SetAutoControlFocus ( bAuto ); } } @@ -1940,7 +1941,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& SwDrawDocument * pDrawDoc; bool bMode = *(sal_Bool*)aValue.getValue(); - if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) ) + if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel() ) ) ) pDrawDoc->SetOpenInDesignMode( bMode ); else if (!bMode) { @@ -1951,7 +1952,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& // we don't need to make an SdrModel and can do // nothing // #i52858# - method name changed - pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetOrCreateDrawModel() ); + pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); pDrawDoc->SetOpenInDesignMode ( bMode ); } } @@ -2090,7 +2091,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) { SwDrawDocument * pDrawDoc; bool bAuto; - if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) ) + if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel() ) ) ) bAuto = pDrawDoc->GetAutoControlFocus(); else bAuto = false; @@ -2101,7 +2102,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) { SwDrawDocument * pDrawDoc; bool bMode; - if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) ) + if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel() ) ) ) bMode = pDrawDoc->GetOpenInDesignMode(); else bMode = true; @@ -3860,32 +3861,32 @@ Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(short nWhich) // assure that Draw model is created, if it doesn't exist. case SW_CREATE_DASH_TABLE : if(!xDashTable.is()) - xDashTable = SvxUnoDashTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); + xDashTable = SvxUnoDashTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xDashTable; break; case SW_CREATE_GRADIENT_TABLE : if(!xGradientTable.is()) - xGradientTable = SvxUnoGradientTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); + xGradientTable = SvxUnoGradientTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xGradientTable; break; case SW_CREATE_HATCH_TABLE : if(!xHatchTable.is()) - xHatchTable = SvxUnoHatchTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); + xHatchTable = SvxUnoHatchTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xHatchTable; break; case SW_CREATE_BITMAP_TABLE : if(!xBitmapTable.is()) - xBitmapTable = SvxUnoBitmapTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); + xBitmapTable = SvxUnoBitmapTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xBitmapTable; break; case SW_CREATE_TRANSGRADIENT_TABLE: if(!xTransGradientTable.is()) - xTransGradientTable = SvxUnoTransGradientTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); + xTransGradientTable = SvxUnoTransGradientTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xTransGradientTable; break; case SW_CREATE_MARKER_TABLE : if(!xMarkerTable.is()) - xMarkerTable = SvxUnoMarkerTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); + xMarkerTable = SvxUnoMarkerTable_createInstance( m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); xRet = xMarkerTable; break; case SW_CREATE_DRAW_DEFAULTS: diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 2e2e2a139ac6..5791659c4a34 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -46,6 +46,7 @@ #include <navicfg.hxx> #include <edtwin.hxx> #include <doc.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <unotools.hxx> #include <crsskip.hxx> #include <cmdid.h> @@ -872,7 +873,7 @@ OUString SwContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const SdrView* pDrawView = pActiveShell->GetDrawView(); if (pDrawView) { - SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel(); + SdrModel* pDrawModel = pActiveShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); SdrPage* pPage = pDrawModel->GetPage(0); const sal_uInt32 nCount = pPage->GetObjCount(); for( sal_uInt32 i=0; i< nCount; i++ ) @@ -965,7 +966,7 @@ OUString SwContentTree::GetEntryLongDescription( SvTreeListEntry* pEntry ) const SdrView* pDrawView = pActiveShell->GetDrawView(); if (pDrawView) { - SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel(); + SdrModel* pDrawModel = pActiveShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); SdrPage* pPage = pDrawModel->GetPage(0); sal_uInt32 nCount = pPage->GetObjCount(); for( sal_uInt32 i=0; i< nCount; i++ ) @@ -1409,7 +1410,7 @@ SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt) SdrView* pDrawView = pActiveShell->GetDrawView(); if (pDrawView) { - SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel(); + SdrModel* pDrawModel = pActiveShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); SdrPage* pPage = pDrawModel->GetPage(0); sal_uInt32 nCount = pPage->GetObjCount(); @@ -2678,7 +2679,7 @@ void SwContentTree::KeyInput(const KeyEvent& rEvent) { pDrawView->SdrEndTextEdit();//Change from "EndTextEdit" to "SdrEndTextEdit" for acc migration - SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel(); + SdrModel* pDrawModel = pActiveShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); SdrPage* pPage = pDrawModel->GetPage(0); sal_uInt32 nCount = pPage->GetObjCount(); bool hasObjectMarked = false; |