Kaydet (Commit) 0284352c authored tarafından Michael Meeks's avatar Michael Meeks

simple re-factor to share selection code

üst 8a6f36b6
......@@ -1053,6 +1053,15 @@ const SfxStyleFamilyItem *SfxCommonTemplateDialog_Impl::GetFamilyItem_Impl() con
return 0;
}
SfxStyleSheetBase *SfxCommonTemplateDialog_Impl::GetSelectedStyle() const
{
if (!IsInitialized() || !pStyleSheetPool || !HasSelectedStyle())
return NULL;
const String aTemplName( GetSelectedEntry() );
const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl();
return pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL );
}
//-------------------------------------------------------------------------
void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr)
......@@ -2002,9 +2011,7 @@ void SfxCommonTemplateDialog_Impl::EditHdl(void *)
{
sal_uInt16 nFilter = nActFilter;
String aTemplName(GetSelectedEntry());
const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
const SfxStyleFamily eFam = pItem->GetFamily();
pStyleSheetPool->Find(aTemplName,eFam,SFXSTYLEBIT_ALL); // -Wall required??
GetSelectedStyle(); // -Wall required??
Window* pTmp;
//DefModalDialogParent set for modality of the following dialogs
pTmp = Application::GetDefDialogParent();
......@@ -2028,9 +2035,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
if ( IsInitialized() && HasSelectedStyle() )
{
const String aTemplName( GetSelectedEntry() );
const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl();
SfxStyleSheetBase* pStyle =
pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL );
SfxStyleSheetBase* pStyle = GetSelectedStyle();
if ( pStyle )
{
String aMsg;
......
......@@ -50,6 +50,7 @@ class SfxStyleFamilies;
class SfxStyleFamilyItem;
class SfxTemplateItem;
class SfxBindings;
class SfxStyleSheetBase;
class SfxStyleSheetBasePool;
class SvTreeListBox ;
class StyleTreeListBox_Impl;
......@@ -208,7 +209,7 @@ protected:
void UpdateStyles_Impl(sal_uInt16 nFlags);
const SfxStyleFamilyItem* GetFamilyItem_Impl() const;
sal_Bool IsInitialized() { return nActFamily != 0xffff; }
sal_Bool IsInitialized() const { return nActFamily != 0xffff; }
void ResetFocus();
void EnableDelete();
void Initialize();
......@@ -218,7 +219,8 @@ protected:
void SetWaterCanState( const SfxBoolItem* pItem );
void SelectStyle( const String& rStyle );
sal_Bool HasSelectedStyle() const;
sal_Bool HasSelectedStyle() const;
SfxStyleSheetBase *GetSelectedStyle() const;
void FillTreeBox();
void Update_Impl();
void UpdateFamily_Impl();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment