diff options
-rw-r--r-- | include/sfx2/module.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/appl/module.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/dialog/mgetempl.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 10 |
4 files changed, 21 insertions, 11 deletions
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx index 8de3e907e882..4a20b1c5f27a 100644 --- a/include/sfx2/module.hxx +++ b/include/sfx2/module.hxx @@ -37,6 +37,7 @@ class SfxObjectFactory; class SfxModule; class SfxModule_Impl; class SfxSlotPool; +class SfxStyleFamilies; struct SfxChildWinContextFactory; struct SfxChildWinFactory; struct SfxStbCtrlFactory; @@ -84,6 +85,8 @@ public: const SfxItemSet& rSet ); virtual void Invalidate(sal_uInt16 nId = 0) override; + SfxStyleFamilies* CreateStyleFamilies(); + static SfxModule* GetActiveModule( SfxViewFrame* pFrame=nullptr ); static FieldUnit GetCurrentFieldUnit(); /** retrieves the field unit of the module belonging to the document displayed in the given frame diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index a6465c5967f2..0b64e6f3158e 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -23,6 +23,7 @@ #include <sfx2/module.hxx> #include <sfx2/app.hxx> #include <sfx2/sfxresid.hxx> +#include <sfx2/styfitem.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/tbxctrl.hxx> #include <sfx2/stbitem.hxx> @@ -291,4 +292,18 @@ FieldUnit SfxModule::GetFieldUnit() const return eUnit; } +SfxStyleFamilies* SfxModule::CreateStyleFamilies() +{ + SfxStyleFamilies *pStyleFamilies = nullptr; + ResMgr* pMgr = GetResMgr(); + if (pMgr) + { + ResId aFamId(DLG_STYLE_DESIGNER, *pMgr); + aFamId.SetRT(RSC_SFX_STYLE_FAMILIES); + if (pMgr->IsAvailable(aFamId)) + pStyleFamilies = new SfxStyleFamilies(aFamId); + } + return pStyleFamilies; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index a0a41e7d8e6d..8a5e89e18b56 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -95,9 +95,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx else m_pEditLinkStyleBtn->Enable(); - ResMgr* pResMgr = SfxApplication::GetModule_Impl()->GetResMgr(); - OSL_ENSURE( pResMgr, "No ResMgr in Module" ); - pFamilies = new SfxStyleFamilies( ResId( DLG_STYLE_DESIGNER, *pResMgr ) ); + pFamilies = SfxApplication::GetModule_Impl()->CreateStyleFamilies(); SfxStyleSheetBasePool* pPool = nullptr; SfxObjectShell* pDocShell = SfxObjectShell::Current(); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index e522d53fdb76..cb21669e2f8d 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -736,14 +736,8 @@ void SfxCommonTemplateDialog_Impl::ReadResource() SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); pCurObjShell = pViewFrame->GetObjectShell(); pModule = pCurObjShell ? pCurObjShell->GetModule() : nullptr; - ResMgr* pMgr = pModule ? pModule->GetResMgr() : nullptr; - if (pMgr) - { - ResId aFamId( DLG_STYLE_DESIGNER, *pMgr ); - aFamId.SetRT(RSC_SFX_STYLE_FAMILIES); - if (pMgr->IsAvailable(aFamId)) - pStyleFamilies = new SfxStyleFamilies( aFamId ); - } + if (pModule) + pStyleFamilies = pModule->CreateStyleFamilies(); if (!pStyleFamilies) pStyleFamilies = new SfxStyleFamilies; |