From 4be44a7a6f2f480e55255d7cdd119f3d6577d085 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 24 May 2018 19:09:44 +0200 Subject: SOSAW080: Cleanup of SdrModel First step: Find all constructors/derivations, mark all of them. Removed two-value-constructors, adapted code as needed Reduced constructors for SdrModel/FmFormModel to a single one. Removed PathName for List creation, this is not needed and anyways all calls used the default SvtPathOptions().GetPalettePath(). This is also true for usage of IsFuzzing() that is also part of the default creation process (without path). All usages that need an extra-List were setting it after construction explicitely. Removed UseExtColorTable. This prevents a single List to be not created by default, the ColorTable which is replaced later by all callers that used this. This is not needed since the default ColorTable gets constructed just by default, no expensive stuff is triggered (e.g. loading the ColorTable). Thus now a default ColorTable is created and kept for a short moment, destructed again when a ColorTable is explicitely set. Doing so is also more safe - it avoids not creating a default-ColorTable and then not setting one (what would be urgently required). f23c24a8548d5246b77b1cc359ba89564538e81a f124468c3898c5842d37123bdeb87d79a2b19c62 Change-Id: I865de4bb23f673c6684d83c2c6390439506dc5b6 Reviewed-on: https://gerrit.libreoffice.org/55028 Tested-by: Jenkins Reviewed-by: Armin Le Grand --- basctl/source/dlged/dlgedmod.cxx | 2 +- .../drawinglayer/ViewElementListProvider.cxx | 5 +- .../controller/main/ChartController_Tools.cxx | 5 +- .../source/controller/main/DrawCommandDispatch.cxx | 3 +- chart2/source/view/main/DrawModelWrapper.cxx | 8 ++-- cui/source/tabpages/tpline.cxx | 6 ++- include/svx/fmmodel.hxx | 9 ++-- include/svx/svdmodel.hxx | 20 ++++++-- reportdesign/source/core/sdr/RptModel.cxx | 6 ++- sc/source/core/data/drwlayer.cxx | 9 ++-- sc/source/ui/drawfunc/fuconcustomshape.cxx | 3 +- sc/source/ui/view/notemark.cxx | 5 +- sc/source/ui/view/viewfun5.cxx | 10 ++-- sd/source/core/drawdoc.cxx | 4 +- sd/source/ui/func/fuconcs.cxx | 3 +- svx/source/dialog/graphctl.cxx | 2 +- svx/source/engine3d/float3d.cxx | 4 +- svx/source/form/fmmodel.cxx | 31 +++---------- svx/source/svdraw/svdmodel.cxx | 53 ++++++---------------- svx/source/toolbars/fontworkbar.cxx | 3 +- svx/source/unogallery/unogalitem.cxx | 2 +- sw/source/core/draw/drawdoc.cxx | 15 ++---- sw/source/core/frmedt/fecopy.cxx | 9 ++-- sw/source/uibase/ribbar/concustomshape.cxx | 3 +- 24 files changed, 94 insertions(+), 126 deletions(-) diff --git a/basctl/source/dlged/dlgedmod.cxx b/basctl/source/dlged/dlgedmod.cxx index 8d3580fff092..1e8d58192ef2 100644 --- a/basctl/source/dlged/dlgedmod.cxx +++ b/basctl/source/dlged/dlgedmod.cxx @@ -24,7 +24,7 @@ namespace basctl { DlgEdModel::DlgEdModel() - :SdrModel() +: SdrModel() { } diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx index 8ddfd08f3578..b7bba4a1bfb9 100644 --- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx +++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx @@ -156,7 +156,10 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co ScopedVclPtrInstance< VirtualDevice > pVDev; pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); - std::unique_ptr pModel( new SdrModel ); + + std::unique_ptr pModel( + new SdrModel()); + pModel->GetItemPool().FreezeIdRanges(); SdrPage* pPage = new SdrPage( *pModel, false ); pPage->SetSize(Size(1000,1000)); diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 59444c95d5fb..312d701c2add 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -271,7 +271,10 @@ void ChartController::executeDispatch_Paste() { xStm->Seek( 0 ); Reference< io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) ); - std::unique_ptr< SdrModel > spModel( new SdrModel() ); + + std::unique_ptr< SdrModel > spModel( + new SdrModel()); + if ( SvxDrawingLayerImport( spModel.get(), xInputStream ) ) { impl_PasteShapes( spModel.get() ); diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index b1fb795be20a..dc6f6f16bf21 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -114,8 +114,9 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj ) if ( aObjList[ i ].equalsIgnoreAsciiCase( m_aCustomShapeType ) ) { FmFormModel aModel; - SfxItemPool& rPool = aModel.GetItemPool(); + SfxItemPool& rPool(aModel.GetItemPool()); rPool.FreezeIdRanges(); + if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aModel ) ) { const SdrObject* pSourceObj = aModel.GetPage( 0 )->GetObj( 0 ); diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index ab87a0769172..e3a4dc52e9e2 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -50,10 +50,10 @@ namespace chart { DrawModelWrapper::DrawModelWrapper() - : SdrModel( SvtPathOptions().GetPalettePath(), nullptr, nullptr, false ) - , m_pChartItemPool(nullptr) - , m_xMainDrawPage(nullptr) - , m_xHiddenDrawPage(nullptr) +: SdrModel() + , m_pChartItemPool(nullptr) + , m_xMainDrawPage(nullptr) + , m_xHiddenDrawPage(nullptr) { m_pChartItemPool = ChartItemPool::CreateChartItemPool(); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 9c2249310ffc..2dd8adbd01a0 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -341,7 +341,8 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton) { ScopedVclPtrInstance< VirtualDevice > pVDev; pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); - std::unique_ptr pModel(new SdrModel); + std::unique_ptr pModel( + new SdrModel()); pModel->GetItemPool().FreezeIdRanges(); // Page SdrPage* pPage = new SdrPage( *pModel, false ); @@ -1119,7 +1120,8 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) ScopedVclPtrInstance< VirtualDevice > pVDev; pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); - std::unique_ptr pModel(new SdrModel); + std::unique_ptr pModel( + new SdrModel()); pModel->GetItemPool().FreezeIdRanges(); SdrPage* pPage = new SdrPage( *pModel, false ); pPage->SetSize(Size(1000,1000)); diff --git a/include/svx/fmmodel.hxx b/include/svx/fmmodel.hxx index 5f064bae4151..19e3fe9fba6e 100644 --- a/include/svx/fmmodel.hxx +++ b/include/svx/fmmodel.hxx @@ -47,12 +47,9 @@ private: void operator=(const FmFormModel& rSrcModel) = delete; public: - - FmFormModel(SfxItemPool* pPool=nullptr, SfxObjectShell* pPers=nullptr ); - FmFormModel(const OUString& rPath, SfxItemPool* pPool=nullptr, - SfxObjectShell* pPers=nullptr ); - FmFormModel(const OUString& rPath, SfxItemPool* pPool, SfxObjectShell* pPers, - bool bUseExtColorTable); + FmFormModel( + SfxItemPool* pPool = nullptr, + SfxObjectShell* pPers = nullptr); virtual ~FmFormModel() override; diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index cc5ad89b74dc..c0907cb233c4 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -138,6 +138,15 @@ public: SdrHintKind GetKind() const { return meHint;} }; +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// SdrModel +// DlgEdModel +// FmFormModel +// ScDrawLayer +// SdDrawDocument +// SwDrawModel +// OReportModel struct SdrModelImpl; @@ -147,7 +156,6 @@ protected: std::vector maMaPag; // master pages std::vector maPages; Link aUndoLink; // link to a NotifyUndo-Handler - OUString aTablePath; Size aMaxObjSize; // e.g. for auto-growing text Fraction aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ... MapUnit eObjUnit; // see above @@ -236,8 +244,10 @@ private: SVX_DLLPRIVATE void ImpReformatAllTextObjects(); SVX_DLLPRIVATE void ImpReformatAllEdgeObjects(); SVX_DLLPRIVATE void ImpCreateTables(); - SVX_DLLPRIVATE void ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable); + SVX_DLLPRIVATE void ImpCtor( + SfxItemPool* pPool, + ::comphelper::IEmbeddedHelper* pPers); // this is a weak reference to a possible living api wrapper for this model css::uno::Reference< css::uno::XInterface > mxUnoModel; @@ -256,9 +266,9 @@ public: // if you want to use symbol objects inherited from SdrAttrObj. // If, however, you use objects inheriting from SdrObject you are free // to chose a pool of your liking. - explicit SdrModel(); - explicit SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers); - explicit SdrModel(const OUString& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable); + explicit SdrModel( + SfxItemPool* pPool = nullptr, + ::comphelper::IEmbeddedHelper* pPers = nullptr); virtual ~SdrModel() override; void ClearModel(bool bCalledFromDestructor); diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx index e3fc872227f4..dae631f257b6 100644 --- a/reportdesign/source/core/sdr/RptModel.cxx +++ b/reportdesign/source/core/sdr/RptModel.cxx @@ -45,8 +45,10 @@ using namespace reportdesign; using namespace com::sun::star; -OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition) : - SdrModel(SvtPathOptions().GetPalettePath(),nullptr,_pReportDefinition, false) +OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition) +: SdrModel( + nullptr, + _pReportDefinition) ,m_pController(nullptr) ,m_pReportDefinition(_pReportDefinition) { diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index f6cf3f90a0ff..078e49674f09 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -241,12 +241,9 @@ static ScRange lcl_getClipRangeFromClipDoc(ScDocument* pClipDoc, SCTAB nClipTab) } ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const OUString& rName ) : - FmFormModel( !utl::ConfigManager::IsFuzzing() ? SvtPathOptions().GetPalettePath() : OUString(), - nullptr, // SfxItemPool* Pool - pGlobalDrawPersist ? - pGlobalDrawPersist : - ( pDocument ? pDocument->GetDocumentShell() : nullptr ), - true ), // bUseExtColorTable (is set below) + FmFormModel( + nullptr, + pGlobalDrawPersist ? pGlobalDrawPersist : (pDocument ? pDocument->GetDocumentShell() : nullptr)), aName( rName ), pDoc( pDocument ), bRecording( false ), diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx index 3f8552101449..d59c93379ad1 100644 --- a/sc/source/ui/drawfunc/fuconcustomshape.cxx +++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx @@ -162,8 +162,9 @@ void FuConstCustomShape::SetAttributes( SdrObject* pObj ) if ( aObjList[ i ].equalsIgnoreAsciiCase( aCustomShape ) ) { FmFormModel aFormModel; - SfxItemPool& rPool = aFormModel.GetItemPool(); + SfxItemPool& rPool(aFormModel.GetItemPool()); rPool.FreezeIdRanges(); + if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) ) { const SdrObject* pSourceObj = aFormModel.GetPage( 0 )->GetObj( 0 ); diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx index 07a719d02273..af3a404401fb 100644 --- a/sc/source/ui/view/notemark.cxx +++ b/sc/source/ui/view/notemark.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -79,9 +78,7 @@ IMPL_LINK_NOARG(ScNoteMarker, TimeHdl, Timer *, void) { if (!m_bVisible) { - SvtPathOptions aPathOpt; - OUString aPath = aPathOpt.GetPalettePath(); - m_pModel = new SdrModel(aPath, nullptr, nullptr, false); + m_pModel = new SdrModel(); m_pModel->SetScaleUnit(MapUnit::Map100thMM); SfxItemPool& rPool = m_pModel->GetItemPool(); rPool.SetDefaultMetric(MapUnit::Map100thMM); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 72604ea4dfd3..7c6f710a7859 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -508,12 +507,13 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, { MakeDrawLayer(); // before loading model, so 3D factory has been created - SvtPathOptions aPathOpt; - OUString aPath = aPathOpt.GetPalettePath(); - ScDocShellRef aDragShellRef( new ScDocShell ); aDragShellRef->DoInitNew(); - std::unique_ptr pModel(new FmFormModel( aPath, nullptr, aDragShellRef.get() )); + + std::unique_ptr pModel( + new FmFormModel( + nullptr, + aDragShellRef.get())); pModel->GetItemPool().FreezeIdRanges(); xStm->Seek(0); diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 0c152e067594..c91d842a1374 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -131,7 +131,9 @@ PresentationSettings::PresentationSettings() } SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) -: FmFormModel( !utl::ConfigManager::IsFuzzing() ? SvtPathOptions().GetPalettePath() : OUString(), nullptr, pDrDocSh ) +: FmFormModel( + nullptr, + pDrDocSh) , mpOutliner(nullptr) , mpInternalOutliner(nullptr) , mpWorkStartupTimer(nullptr) diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx index 415a58c22ccc..a8d5f929fb77 100644 --- a/sd/source/ui/func/fuconcs.cxx +++ b/sd/source/ui/func/fuconcs.cxx @@ -175,8 +175,9 @@ void FuConstructCustomShape::SetAttributes( SdrObject* pObj ) if ( aObjList[ i ].equalsIgnoreAsciiCase( aCustomShape ) ) { FmFormModel aFormModel; - SfxItemPool& rPool = aFormModel.GetItemPool(); + SfxItemPool& rPool(aFormModel.GetItemPool()); rPool.FreezeIdRanges(); + if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) ) { const SdrPage* pPage = aFormModel.GetPage( 0 ); diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 45fd6f18d107..91073760eaa3 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -128,7 +128,7 @@ void GraphCtrl::InitSdrModel() delete pModel; // Creating a Model - pModel = new SdrModel; + pModel = new SdrModel(); pModel->GetItemPool().FreezeIdRanges(); pModel->SetScaleUnit( aMap100.GetMapUnit() ); pModel->SetScaleFraction( Fraction( 1, 1 ) ); diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index 98f9fb485df3..615957ada6a4 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -2786,8 +2786,10 @@ void Svx3DWin::LBSelectColor( SvxColorListBox* pLb, const Color& rColor ) void Svx3DWin::UpdatePreview() { - if( pModel == nullptr ) + if(nullptr == pModel) + { pModel = new FmFormModel(); + } // Get Itemset SfxItemSet aSet( pModel->GetItemPool(), svl::Items{}); diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx index ef5f56e09c41..decabb6cb5e6 100644 --- a/svx/source/form/fmmodel.cxx +++ b/svx/source/form/fmmodel.cxx @@ -49,31 +49,12 @@ struct FmFormModelImplData } }; -FmFormModel::FmFormModel(SfxItemPool* pPool, SfxObjectShell* pPers) - : SdrModel(pPool, pPers) - , m_pImpl(nullptr) - , m_pObjShell(nullptr) - , m_bOpenInDesignMode(false) - , m_bAutoControlFocus(false) -{ - m_pImpl.reset( new FmFormModelImplData ); - m_pImpl->mxUndoEnv = new FmXUndoEnvironment(*this); -} - -FmFormModel::FmFormModel(const OUString& rPath, SfxItemPool* pPool, SfxObjectShell* pPers) - : SdrModel(rPath, pPool, pPers, false) - , m_pImpl(nullptr) - , m_pObjShell(nullptr) - , m_bOpenInDesignMode(false) - , m_bAutoControlFocus(false) -{ - m_pImpl.reset( new FmFormModelImplData ); - m_pImpl->mxUndoEnv = new FmXUndoEnvironment(*this); -} - -FmFormModel::FmFormModel(const OUString& rPath, SfxItemPool* pPool, SfxObjectShell* pPers, - bool bUseExtColorTable) - : SdrModel(rPath, pPool, pPers, bUseExtColorTable) +FmFormModel::FmFormModel( + SfxItemPool* pPool, + SfxObjectShell* pPers) +: SdrModel( + pPool, + pPers) , m_pImpl(nullptr) , m_pObjShell(nullptr) , m_bOpenInDesignMode(false) diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index bde671498fd1..b28b6f8c734e 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -17,22 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include - #include #include - #include #include #include - #include #include #include - #include - +#include #include #include #include @@ -43,12 +38,9 @@ #include #include #include - #include #include - #include - #include #include #include @@ -64,10 +56,8 @@ #include #include #include - #include #include - #include #include #include @@ -80,10 +70,8 @@ #include #include #include - #include #include - #include #include #include @@ -111,8 +99,9 @@ struct SdrModelImpl }; -void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbeddedHelper, - bool bUseExtColorTable) +void SdrModel::ImpCtor( + SfxItemPool* pPool, + ::comphelper::IEmbeddedHelper* _pEmbeddedHelper) { mpImpl.reset(new SdrModelImpl); mpImpl->mpUndoManager=nullptr; @@ -168,8 +157,6 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe else mnCharCompressType = CharCompressType::NONE; - bExtColorTable=bUseExtColorTable; - if ( pPool == nullptr ) { pItemPool=new SdrItemPool(nullptr); @@ -216,26 +203,13 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe ImpCreateTables(); } -SdrModel::SdrModel(): - maMaPag(), +SdrModel::SdrModel( + SfxItemPool* pPool, + ::comphelper::IEmbeddedHelper* pPers) +: maMaPag(), maPages() { - ImpCtor(nullptr, nullptr, false); -} - -SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers): - maMaPag(), - maPages() -{ - ImpCtor(pPool,pPers,false/*bUseExtColorTable*/); -} - -SdrModel::SdrModel(const OUString& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable): - maMaPag(), - maPages(), - aTablePath(rPath) -{ - ImpCtor(pPool,pPers,bUseExtColorTable); + ImpCtor(pPool,pPers); } SdrModel::~SdrModel() @@ -616,11 +590,12 @@ bool SdrModel::IsUndoEnabled() const void SdrModel::ImpCreateTables() { + // use standard path for initial construction + const OUString aTablePath(!utl::ConfigManager::IsFuzzing() ? SvtPathOptions().GetPalettePath() : ""); + for( auto i : o3tl::enumrange() ) { - if( !bExtColorTable || i != XPropertyListType::Color ) - maProperties[i] = XPropertyList::CreatePropertyList ( - i, aTablePath, ""/*TODO?*/ ); + maProperties[i] = XPropertyList::CreatePropertyList(i, aTablePath, ""/*TODO?*/ ); } } @@ -655,7 +630,7 @@ void SdrModel::ClearModel(bool bCalledFromDestructor) SdrModel* SdrModel::AllocModel() const { - SdrModel* pModel=new SdrModel; + SdrModel* pModel=new SdrModel(); pModel->SetScaleUnit(eObjUnit,aObjUnit); return pModel; } diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index 338907dc1096..cdfc32236443 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -354,8 +354,9 @@ void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem, const if ( aObjList[ i ].equalsIgnoreAsciiCase( rCustomShape ) ) { FmFormModel aFormModel; - SfxItemPool& rPool = aFormModel.GetItemPool(); + SfxItemPool& rPool(aFormModel.GetItemPool()); rPool.FreezeIdRanges(); + if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) ) { const SdrObject* pSourceObj = aFormModel.GetPage( 0 )->GetObj( 0 ); diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx index 6f1bbfecfc7f..361edc2f9a55 100644 --- a/svx/source/unogallery/unogalitem.cxx +++ b/svx/source/unogallery/unogalitem.cxx @@ -322,7 +322,7 @@ void GalleryItem::_getPropertyValues( const comphelper::PropertyMapEntry** ppEnt if( gallery::GalleryItemType::DRAWING == getType() ) { ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : nullptr ); - FmFormModel* pModel = new FmFormModel; + FmFormModel* pModel = new FmFormModel(); pModel->GetItemPool().FreezeIdRanges(); diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx index 1c1229d9e456..397faf27cb90 100644 --- a/sw/source/core/draw/drawdoc.cxx +++ b/sw/source/core/draw/drawdoc.cxx @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -41,18 +40,10 @@ using namespace com::sun::star; // Constructor - -const OUString GetPalettePath() -{ - if (utl::ConfigManager::IsFuzzing()) - return OUString(); - SvtPathOptions aPathOpt; - return aPathOpt.GetPalettePath(); -} - SwDrawModel::SwDrawModel(SwDoc *const pDoc) - : FmFormModel( ::GetPalettePath(), &pDoc->GetAttrPool(), - pDoc->GetDocShell(), true ) +: FmFormModel( + &pDoc->GetAttrPool(), + pDoc->GetDocShell()) , m_pDoc( pDoc ) { SetScaleUnit( MapUnit::MapTwip ); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 804ae7d33aac..a834f4b9cdd2 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -1308,9 +1307,11 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt ) StartAllAction(); StartUndo(); - SvtPathOptions aPathOpt; - std::unique_ptr pModel( new FmFormModel( aPathOpt.GetPalettePath(), - nullptr, GetDoc()->GetDocShell() ) ); + std::unique_ptr< FmFormModel > pModel( + new FmFormModel( + nullptr, + GetDoc()->GetDocShell())); + pModel->GetItemPool().FreezeIdRanges(); rStrm.Seek(0); diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx index adbbd07ebd2b..a9f5cc718fa8 100644 --- a/sw/source/uibase/ribbar/concustomshape.cxx +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -119,8 +119,9 @@ void ConstCustomShape::SetAttributes( SdrObject* pObj ) if ( aObjList[ i ].equalsIgnoreAsciiCase( aCustomShape ) ) { FmFormModel aFormModel; - SfxItemPool& rPool = aFormModel.GetItemPool(); + SfxItemPool& rPool(aFormModel.GetItemPool()); rPool.FreezeIdRanges(); + if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) ) { const SdrObject* pSourceObj = aFormModel.GetPage( 0 )->GetObj( 0 ); -- cgit v1.2.3