diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-10-25 14:11:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-10-25 15:39:47 +0100 |
commit | 45a646f2fa1c8161d9fbc4509a2f0b2e826dc63f (patch) | |
tree | 6a7e38358dec141c144bd7839f684763ac036a9d /sfx2 | |
parent | a6ff21250bbc960cbcff026e8eeb72be032f56b2 (diff) |
split the creation of SfxStyleFamilies into a method
Change-Id: I2590180fc30d75c89e758c72246a8294b5c4b9a2
Diffstat (limited to 'sfx2')
-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 |
3 files changed, 18 insertions, 11 deletions
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; |