summaryrefslogtreecommitdiff
path: root/cui/source/options/treeopt.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2011-09-23 14:05:07 +0100
committerMichael Meeks <michael.meeks@novell.com>2011-09-24 08:33:46 +0100
commitc8dc73720883333a13187865cd0d69b64af6b4b5 (patch)
treec9037bb6e79fd49507f2de1cf2b22f7159572720 /cui/source/options/treeopt.cxx
parent7fc35af5fd3171cc9bf43d2c27660afcf407d3f6 (diff)
re-factor XPropertyList derivatives to use a rtl::Reference
This cleans up a lot of lifecycle nasties and cleans up some serious cut/paste code duplication issues at the same time. Cleanup the naming of ColorTable -> ColorList to match the impl. too
Diffstat (limited to 'cui/source/options/treeopt.cxx')
-rw-r--r--cui/source/options/treeopt.cxx30
1 files changed, 14 insertions, 16 deletions
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index de22b1f8cebd..76dca3bc8d7a 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -553,7 +553,6 @@ sal_Bool OfaOptionsTreeListBox::Collapse( SvLBoxEntry* pParent )
sNotLoadedError ( CUI_RES( ST_LOAD_ERROR ) ),\
pCurrentPageEntry ( NULL ),\
pColorPageItemSet ( NULL ),\
- pColorTab ( NULL ),\
nChangeType ( CT_NONE ),\
nUnknownType ( COLORPAGE_UNKNOWN ),\
nUnknownPos ( COLORPAGE_UNKNOWN ),\
@@ -591,7 +590,6 @@ OfaTreeOptionsDialog::OfaTreeOptionsDialog(
OfaTreeOptionsDialog::OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId ) :
SfxModalDialog( pParent, CUI_RES( RID_OFADLG_OPTIONS_TREE ) ),
-
INI_LIST()
{
@@ -1162,13 +1160,13 @@ IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG )
pPageInfo->m_pPage = ::CreateGeneralTabPage(
pPageInfo->m_nPageId, this, *pColorPageItemSet );
SvxColorTabPage& rColPage = *(SvxColorTabPage*)pPageInfo->m_pPage;
- const OfaPtrItem* pPtr = NULL;
+ const OfaRefItem<XColorList> *pPtr = NULL;
if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() )
- pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->
- GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
- pColorTab = pPtr ? (XColorList*)pPtr->GetValue() : &XColorList::GetStdColorTable();
+ pPtr = (const OfaRefItem<XColorList> *)SfxViewFrame::Current()->
+ GetDispatcher()->Execute( SID_GET_COLORLIST, SFX_CALLMODE_SYNCHRON );
+ pColorList = pPtr ? pPtr->GetValue() : XColorList::GetStdColorList();
- rColPage.SetColorTable( pColorTab );
+ rColPage.SetColorList( pColorList );
rColPage.SetPageType( &nUnknownType );
rColPage.SetDlgType( &nUnknownType );
rColPage.SetPos( &nUnknownPos );
@@ -2607,22 +2605,22 @@ short OfaTreeOptionsDialog::Execute()
if( RET_OK == nRet )
{
ApplyItemSets();
- if( GetColorTable() )
+ if( GetColorList().is() )
{
- GetColorTable()->Save();
+ GetColorList()->Save();
- // notify current viewframe it it uses the same color table
+ // notify current viewframe that it uses the same color table
if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() )
{
- const OfaPtrItem* pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
+ const OfaRefItem<XColorList> * pPtr = (const OfaRefItem<XColorList>*)SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GET_COLORLIST, SFX_CALLMODE_SYNCHRON );
if( pPtr )
{
- XColorList* _pColorTab = (XColorList*)pPtr->GetValue();
+ XColorListRef _pColorList = pPtr->GetValue();
- if( _pColorTab &&
- _pColorTab->GetPath() == GetColorTable()->GetPath() &&
- _pColorTab->GetName() == GetColorTable()->GetName() )
- SfxObjectShell::Current()->PutItem( SvxColorTableItem( GetColorTable(), SID_COLOR_TABLE ) );
+ if( _pColorList.is() &&
+ _pColorList->GetPath() == GetColorList()->GetPath() &&
+ _pColorList->GetName() == GetColorList()->GetName() )
+ SfxObjectShell::Current()->PutItem( SvxColorListItem( GetColorList(), SID_COLOR_TABLE ) );
}
}
}