split the creation of SfxStyleFamilies into a method
Change-Id: I2590180fc30d75c89e758c72246a8294b5c4b9a2
This commit is contained in:
@@ -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
|
||||
|
@@ -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: */
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user