diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-09-23 14:05:07 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-09-24 08:33:46 +0100 |
commit | c8dc73720883333a13187865cd0d69b64af6b4b5 (patch) | |
tree | c9037bb6e79fd49507f2de1cf2b22f7159572720 /cui/source/tabpages | |
parent | 7fc35af5fd3171cc9bf43d2c27660afcf407d3f6 (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/tabpages')
-rw-r--r-- | cui/source/tabpages/backgrnd.cxx | 17 | ||||
-rw-r--r-- | cui/source/tabpages/border.cxx | 6 | ||||
-rw-r--r-- | cui/source/tabpages/chardlg.cxx | 32 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 17 | ||||
-rw-r--r-- | cui/source/tabpages/tabarea.cxx | 51 | ||||
-rw-r--r-- | cui/source/tabpages/tabline.cxx | 29 | ||||
-rw-r--r-- | cui/source/tabpages/tparea.cxx | 6 | ||||
-rw-r--r-- | cui/source/tabpages/tpbitmap.cxx | 9 | ||||
-rw-r--r-- | cui/source/tabpages/tpcolor.cxx | 90 | ||||
-rw-r--r-- | cui/source/tabpages/tpgradnt.cxx | 10 | ||||
-rw-r--r-- | cui/source/tabpages/tphatch.cxx | 10 | ||||
-rw-r--r-- | cui/source/tabpages/tpline.cxx | 6 | ||||
-rw-r--r-- | cui/source/tabpages/tplnedef.cxx | 10 | ||||
-rw-r--r-- | cui/source/tabpages/tplneend.cxx | 10 | ||||
-rw-r--r-- | cui/source/tabpages/tpshadow.cxx | 6 |
15 files changed, 108 insertions, 201 deletions
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 86eb2220cf1e..8d27b17701bc 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -1133,20 +1133,16 @@ void SvxBackgroundTabPage::FillColorValueSets_Impl() { SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = NULL; - XColorList* pColorTable = NULL; + XColorListRef pColorTable = NULL; const Size aSize15x15 = Size( 15, 15 ); - bool bOwn = false; if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorTable = ( (SvxColorListItem*)pItem )->GetColorList(); - if ( !pColorTable ) - { - bOwn = true; - pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); - } + if ( !pColorTable.is() ) + pColorTable = XColorList::CreateStdColorList(); - if ( pColorTable ) + if ( pColorTable.is() ) { short i = 0; long nCount = pColorTable->Count(); @@ -1175,9 +1171,6 @@ void SvxBackgroundTabPage::FillColorValueSets_Impl() } } - if ( bOwn ) - delete pColorTable; - aBackgroundColorSet.SetColCount( 8 ); aBackgroundColorSet.SetLineCount( 13 ); aBackgroundColorSet.CalcWindowSizePixel( aSize15x15 ); diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index aa6466e4fa04..d663ffc13512 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -277,7 +277,7 @@ SvxBorderTabPage::SvxBorderTabPage( Window* pParent, // ColorBox aus der XColorList fuellen. SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = NULL; - XColorList* pColorTable = NULL; + XColorListRef pColorTable; DBG_ASSERT( pDocSh, "DocShell not found!" ); @@ -285,12 +285,12 @@ SvxBorderTabPage::SvxBorderTabPage( Window* pParent, { pItem = pDocSh->GetItem( SID_COLOR_TABLE ); if ( pItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorTable = ( (SvxColorListItem*)pItem )->GetColorList(); } DBG_ASSERT( pColorTable, "ColorTable not found!" ); - if ( pColorTable ) + if ( pColorTable.is() ) { // fuellen der Linienfarben-Box aLbLineColor.SetUpdateMode( sal_False ); diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 33309de97100..782af954b9a1 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -457,23 +457,18 @@ void SvxCharNamePage::Initialize() // fill the color box SfxObjectShell* pDocSh = SfxObjectShell::Current(); - //DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorList* pColorTable = NULL; - bool bKillTable = false; + XColorListRef pColorTable; const SfxPoolItem* pItem = NULL; if ( pDocSh ) { pItem = pDocSh->GetItem( SID_COLOR_TABLE ); if ( pItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorTable = ( (SvxColorListItem*)pItem )->GetColorList(); } - if ( !pColorTable ) - { - pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); - bKillTable = true; - } + if ( !pColorTable.is() ) + pColorTable = XColorList::CreateStdColorList(); m_pColorLB->SetUpdateMode( sal_False ); @@ -492,10 +487,6 @@ void SvxCharNamePage::Initialize() } m_pColorLB->SetUpdateMode( sal_True ); - - if ( bKillTable ) - delete pColorTable; - m_pColorLB->SetSelectHdl( LINK( this, SvxCharNamePage, ColorBoxSelectHdl_Impl ) ); Link aLink = LINK( this, SvxCharNamePage, FontModifyHdl_Impl ); @@ -1527,21 +1518,17 @@ void SvxCharEffectsPage::Initialize() // fill the color box SfxObjectShell* pDocSh = SfxObjectShell::Current(); DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorList* pColorTable = NULL; - bool bKillTable = false; + XColorListRef pColorTable; if ( pDocSh ) { pItem = pDocSh->GetItem( SID_COLOR_TABLE ); if ( pItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorTable = ( (SvxColorListItem*)pItem )->GetColorList(); } - if ( !pColorTable ) - { - pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); - bKillTable = true; - } + if ( !pColorTable.is() ) + pColorTable = XColorList::CreateStdColorList(); m_aUnderlineColorLB.SetUpdateMode( sal_False ); m_aOverlineColorLB.SetUpdateMode( sal_False ); @@ -1571,9 +1558,6 @@ void SvxCharEffectsPage::Initialize() m_aFontColorLB.SetUpdateMode( sal_True ); m_aFontColorLB.SetSelectHdl( LINK( this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl ) ); - if ( bKillTable ) - delete pColorTable; - // handler Link aLink = LINK( this, SvxCharEffectsPage, SelectHdl_Impl ); m_aUnderlineLB.SetSelectHdl( aLink ); diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 4a47004c8b11..dd5d346b95d6 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -1342,31 +1342,24 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) { SfxObjectShell* pDocSh = SfxObjectShell::Current(); DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorList* pColorTable = NULL; - bool bKillTable = false; + XColorListRef pColorTable; if ( pDocSh ) { pItem = pDocSh->GetItem( SID_COLOR_TABLE ); if ( pItem ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorTable = ( (SvxColorListItem*)pItem )->GetColorList(); } - if ( !pColorTable ) - { - pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); - bKillTable = true; - } + if ( !pColorTable.is() ) + pColorTable = XColorList::CreateStdColorList(); - aBulColLB.InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); + aBulColLB.InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); for ( long i = 0; i < pColorTable->Count(); i++ ) { XColorEntry* pEntry = pColorTable->GetColor(i); aBulColLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); } - - if ( bKillTable ) - delete pColorTable; } SfxObjectShell* pShell; diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx index 95491d5382ad..e7e4d97269ff 100644 --- a/cui/source/tabpages/tabarea.cxx +++ b/cui/source/tabpages/tabarea.cxx @@ -67,8 +67,8 @@ SvxAreaTabDialog::SvxAreaTabDialog SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_AREA ), pAttr ), mpDrawModel ( pModel ), - mpColorTab ( pModel->GetColorTable() ), - mpNewColorTab ( pModel->GetColorTable() ), + mpColorTab ( pModel->GetColorList() ), + mpNewColorTab ( pModel->GetColorList() ), mpGradientList ( pModel->GetGradientList() ), mpNewGradientList ( pModel->GetGradientList() ), mpHatchingList ( pModel->GetHatchList() ), @@ -83,8 +83,7 @@ SvxAreaTabDialog::SvxAreaTabDialog mnPageType( PT_AREA ), mnDlgType( 0 ), mnPos( 0 ), - mbAreaTP( sal_False ), - mbDeleteColorTable( sal_True ) + mbAreaTP( sal_False ) { FreeResource(); @@ -115,57 +114,44 @@ SvxAreaTabDialog::~SvxAreaTabDialog() void SvxAreaTabDialog::SavePalettes() { SfxObjectShell* pShell = SfxObjectShell::Current(); - if( mpNewColorTab != mpDrawModel->GetColorTable() ) + if( mpNewColorTab != mpDrawModel->GetColorList() ) { - if(mbDeleteColorTable) - delete mpDrawModel->GetColorTable(); - mpDrawModel->SetColorTable( mpNewColorTab ); - SvxColorTableItem aColorTableItem( mpNewColorTab, SID_COLOR_TABLE ); + mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorTab.get()) ); + SvxColorListItem aColorTableItem( mpNewColorTab, SID_COLOR_TABLE ); if ( pShell ) pShell->PutItem( aColorTableItem ); else - { mpDrawModel->GetItemPool().Put(aColorTableItem,SID_COLOR_TABLE); - } - mpColorTab = mpDrawModel->GetColorTable(); + mpColorTab = mpDrawModel->GetColorList(); } if( mpNewGradientList != mpDrawModel->GetGradientList() ) { - delete mpDrawModel->GetGradientList(); - mpDrawModel->SetGradientList( mpNewGradientList ); + mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewGradientList.get()) ); SvxGradientListItem aItem( mpNewGradientList, SID_GRADIENT_LIST ); if ( pShell ) pShell->PutItem( aItem ); else - { mpDrawModel->GetItemPool().Put(aItem,SID_GRADIENT_LIST); - } mpGradientList = mpDrawModel->GetGradientList(); } if( mpNewHatchingList != mpDrawModel->GetHatchList() ) { - delete mpDrawModel->GetHatchList(); - mpDrawModel->SetHatchList( mpNewHatchingList ); + mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewHatchingList.get()) ); SvxHatchListItem aItem( mpNewHatchingList, SID_HATCH_LIST ); if ( pShell ) pShell->PutItem( aItem ); else - { mpDrawModel->GetItemPool().Put(aItem,SID_HATCH_LIST); - } mpHatchingList = mpDrawModel->GetHatchList(); } if( mpNewBitmapList != mpDrawModel->GetBitmapList() ) { - delete mpDrawModel->GetBitmapList(); - mpDrawModel->SetBitmapList( mpNewBitmapList ); + mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewBitmapList.get()) ); SvxBitmapListItem aItem( mpNewBitmapList, SID_BITMAP_LIST ); if ( pShell ) pShell->PutItem( aItem ); else - { mpDrawModel->GetItemPool().Put(aItem,SID_BITMAP_LIST); - } mpBitmapList = mpDrawModel->GetBitmapList(); } @@ -183,9 +169,7 @@ void SvxAreaTabDialog::SavePalettes() if ( pShell ) pShell->PutItem( aItem ); else - { mpDrawModel->GetItemPool().Put(aItem); - } } if( mnBitmapListState & CT_MODIFIED ) @@ -223,7 +207,7 @@ void SvxAreaTabDialog::SavePalettes() mpColorTab->SetPath( aPath ); mpColorTab->Save(); - SvxColorTableItem aItem( mpColorTab, SID_COLOR_TABLE ); + SvxColorListItem aItem( mpColorTab, SID_COLOR_TABLE ); // ToolBoxControls werden benachrichtigt: if ( pShell ) pShell->PutItem( aItem ); @@ -263,7 +247,7 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) switch( nId ) { case RID_SVXPAGE_AREA: - ( (SvxAreaTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxAreaTabPage&) rPage ).SetColorList( mpColorTab ); ( (SvxAreaTabPage&) rPage ).SetGradientList( mpGradientList ); ( (SvxAreaTabPage&) rPage ).SetHatchingList( mpHatchingList ); ( (SvxAreaTabPage&) rPage ).SetBitmapList( mpBitmapList ); @@ -283,7 +267,7 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) case RID_SVXPAGE_SHADOW: { - ( (SvxShadowTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxShadowTabPage&) rPage ).SetColorList( mpColorTab ); ( (SvxShadowTabPage&) rPage ).SetPageType( mnPageType ); ( (SvxShadowTabPage&) rPage ).SetDlgType( mnDlgType ); ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP ); @@ -293,7 +277,7 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) break; case RID_SVXPAGE_GRADIENT: - ( (SvxGradientTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxGradientTabPage&) rPage ).SetColorList( mpColorTab ); ( (SvxGradientTabPage&) rPage ).SetGradientList( mpGradientList ); ( (SvxGradientTabPage&) rPage ).SetPageType( &mnPageType ); ( (SvxGradientTabPage&) rPage ).SetDlgType( &mnDlgType ); @@ -305,7 +289,7 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) break; case RID_SVXPAGE_HATCH: - ( (SvxHatchTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxHatchTabPage&) rPage ).SetColorList( mpColorTab ); ( (SvxHatchTabPage&) rPage ).SetHatchingList( mpHatchingList ); ( (SvxHatchTabPage&) rPage ).SetPageType( &mnPageType ); ( (SvxHatchTabPage&) rPage ).SetDlgType( &mnDlgType ); @@ -317,7 +301,7 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) break; case RID_SVXPAGE_BITMAP: - ( (SvxBitmapTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxBitmapTabPage&) rPage ).SetColorList( mpColorTab ); ( (SvxBitmapTabPage&) rPage ).SetBitmapList( mpBitmapList ); ( (SvxBitmapTabPage&) rPage ).SetPageType( &mnPageType ); ( (SvxBitmapTabPage&) rPage ).SetDlgType( &mnDlgType ); @@ -329,13 +313,12 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) break; case RID_SVXPAGE_COLOR: - ( (SvxColorTabPage&) rPage ).SetColorTable( mpColorTab ); + ( (SvxColorTabPage&) rPage ).SetColorList( mpColorTab ); ( (SvxColorTabPage&) rPage ).SetPageType( &mnPageType ); ( (SvxColorTabPage&) rPage ).SetDlgType( &mnDlgType ); ( (SvxColorTabPage&) rPage ).SetPos( &mnPos ); ( (SvxColorTabPage&) rPage ).SetAreaTP( &mbAreaTP ); ( (SvxColorTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - ( (SvxColorTabPage&) rPage ).SetDeleteColorTable( mbDeleteColorTable ); ( (SvxColorTabPage&) rPage ).Construct(); break; diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx index edd5d339a5e3..46f26b42affc 100644 --- a/cui/source/tabpages/tabline.cxx +++ b/cui/source/tabpages/tabline.cxx @@ -70,8 +70,8 @@ SvxLineTabDialog::SvxLineTabDialog pDrawModel ( pModel ), pObj ( pSdrObj ), rOutAttrs ( *pAttr ), - pColorTab ( pModel->GetColorTable() ), - mpNewColorTab ( pModel->GetColorTable() ), + pColorTab ( pModel->GetColorList() ), + mpNewColorTab ( pModel->GetColorList() ), pDashList ( pModel->GetDashList() ), pNewDashList ( pModel->GetDashList() ), pLineEndList ( pModel->GetLineEndList() ), @@ -86,8 +86,7 @@ SvxLineTabDialog::SvxLineTabDialog nPosDashLb( 0 ), nPosLineEndLb( 0 ), mnPos( 0 ), - mbAreaTP( sal_False ), - mbDeleteColorTable( sal_True ) + mbAreaTP( sal_False ) { FreeResource(); @@ -136,27 +135,23 @@ SvxLineTabDialog::~SvxLineTabDialog() void SvxLineTabDialog::SavePalettes() { SfxObjectShell* pShell = SfxObjectShell::Current(); - if( mpNewColorTab != pDrawModel->GetColorTable() ) + if( mpNewColorTab != pDrawModel->GetColorList() ) { - if(mbDeleteColorTable) - delete pDrawModel->GetColorTable(); - pDrawModel->SetColorTable( mpNewColorTab ); + pDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorTab.get()) ); if ( pShell ) - pShell->PutItem( SvxColorTableItem( mpNewColorTab, SID_COLOR_TABLE ) ); - pColorTab = pDrawModel->GetColorTable(); + pShell->PutItem( SvxColorListItem( mpNewColorTab, SID_COLOR_TABLE ) ); + pColorTab = pDrawModel->GetColorList(); } if( pNewDashList != pDrawModel->GetDashList() ) { - delete pDrawModel->GetDashList(); - pDrawModel->SetDashList( pNewDashList ); + pDrawModel->SetPropertyList( static_cast<XPropertyList *>(pNewDashList.get()) ); if ( pShell ) pShell->PutItem( SvxDashListItem( pNewDashList, SID_DASH_LIST ) ); pDashList = pDrawModel->GetDashList(); } if( pNewLineEndList != pDrawModel->GetLineEndList() ) { - delete pDrawModel->GetLineEndList(); - pDrawModel->SetLineEndList( pNewLineEndList ); + pDrawModel->SetPropertyList( static_cast<XPropertyList *>(pNewLineEndList.get()) ); if ( pShell ) pShell->PutItem( SvxLineEndListItem( pNewLineEndList, SID_LINEEND_LIST ) ); pLineEndList = pDrawModel->GetLineEndList(); @@ -193,7 +188,7 @@ void SvxLineTabDialog::SavePalettes() // ToolBoxControls werden benachrichtigt: if ( pShell ) - pShell->PutItem( SvxColorTableItem( pColorTab, SID_COLOR_TABLE ) ); + pShell->PutItem( SvxColorListItem( pColorTab, SID_COLOR_TABLE ) ); } } @@ -227,7 +222,7 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) switch( nId ) { case RID_SVXPAGE_LINE: - ( (SvxLineTabPage&) rPage ).SetColorTable( pColorTab ); + ( (SvxLineTabPage&) rPage ).SetColorList( pColorTab ); ( (SvxLineTabPage&) rPage ).SetDashList( pDashList ); ( (SvxLineTabPage&) rPage ).SetLineEndList( pLineEndList ); ( (SvxLineTabPage&) rPage ).SetDlgType( nDlgType ); @@ -266,7 +261,7 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) case RID_SVXPAGE_SHADOW: { - ( (SvxShadowTabPage&) rPage ).SetColorTable( pColorTab ); + ( (SvxShadowTabPage&) rPage ).SetColorList( pColorTab ); ( (SvxShadowTabPage&) rPage ).SetPageType( nPageType ); ( (SvxShadowTabPage&) rPage ).SetDlgType( nDlgType ); ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP ); diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index a177e92ca968..85e2ee99a105 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -805,7 +805,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) { *pbAreaTP = sal_True; - if( pColorTab ) + if( pColorTab.is() ) { sal_uInt16 _nPos = 0; // Bitmapliste @@ -2518,7 +2518,7 @@ void SvxAreaTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) { - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,sal_False); SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,sal_False); SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,sal_False); @@ -2527,7 +2527,7 @@ void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False); if (pColorTabItem) - SetColorTable(pColorTabItem->GetColorTable()); + SetColorList(pColorTabItem->GetColorList()); if (pGradientListItem) SetGradientList(pGradientListItem->GetGradientList()); if (pHatchingListItem) diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 3deed69a50f1..4d4ea337edb9 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -176,7 +176,7 @@ void SvxBitmapTabPage::ActivatePage( const SfxItemSet& ) { *pbAreaTP = sal_False; - if( pColorTab ) + if( pColorTab.is() ) { // ColorTable if( *pnColorTableState & CT_CHANGED || @@ -958,14 +958,11 @@ IMPL_LINK( SvxBitmapTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) aPathURL.removeFinalSlash(); // Tabelle speichern - XBitmapList* pBmpList = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + XBitmapListRef pBmpList = XPropertyList::CreatePropertyList( + XBITMAP_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsBitmapList(); pBmpList->SetName( aURL.getName() ); if( pBmpList->Load() ) { - // Pruefen, ob Tabelle geloescht werden darf: - if( pBitmapList != ( (SvxAreaTabDialog*) DLGWIN )->GetBitmapList() ) - delete pBitmapList; - pBitmapList = pBmpList; ( (SvxAreaTabDialog*) DLGWIN )->SetNewBitmapList( pBitmapList ); diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 89bc296c31b2..d49e86e9570a 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -80,39 +80,39 @@ SvxLoadSaveEmbed::SvxLoadSaveEmbed( Window *pParent, const ResId &rLoad, SetEmbed( GetEmbed() ); } -XPropertyList *SvxLoadSaveEmbed::GetList() +XPropertyListRef SvxLoadSaveEmbed::GetList() { SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( pTopDlg ); SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( pTopDlg ); - const XPropertyList *pList = NULL; + XColorListRef pList; if( pArea ) pList = pArea->GetNewColorTable(); if( pLine ) pList = pLine->GetNewColorTable(); - if( !pList ) { + if( !pList.is() ) { if( pArea ) - pList = pArea->GetColorTable(); + pList = pArea->GetColorList(); if( pLine ) - pList = pLine->GetColorTable(); + pList = pLine->GetColorList(); } - return const_cast<XPropertyList *>(pList); + return XPropertyListRef( static_cast< XPropertyList * >( pList.get() ) ); } void SvxLoadSaveEmbed::SetEmbed( bool bEmbed ) { - XPropertyList *pList = GetList(); - if( pList) + XPropertyListRef pList = GetList(); + if( pList.is() ) pList->SetEmbedInDocument( bEmbed ); aBoxEmbed.Check( bEmbed ); } bool SvxLoadSaveEmbed::GetEmbed() { - XPropertyList *pList = GetList(); - return pList ? pList->IsEmbedInDocument() : 0; + XPropertyListRef pList = GetList(); + return pList.is() ? pList->IsEmbedInDocument() : 0; } IMPL_LINK( SvxLoadSaveEmbed, EmbedToggleHdl_Impl, void *, EMPTYARG ) @@ -145,7 +145,7 @@ SvxColorTabPage::SvxColorTabPage aLbColor ( this, CUI_RES( LB_COLOR ) ), aTableNameFT ( this, CUI_RES( FT_TABLE_NAME ) ), - aValSetColorTable ( this, CUI_RES( CTL_COLORTABLE ) ), + aValSetColorList ( this, CUI_RES( CTL_COLORTABLE ) ), aCtlPreviewOld ( this, CUI_RES( CTL_PREVIEW_OLD ) ), aCtlPreviewNew ( this, CUI_RES( CTL_PREVIEW_NEW ) ), @@ -167,8 +167,6 @@ SvxColorTabPage::SvxColorTabPage rOutAttrs ( rInAttrs ), pColorTab( NULL ), - bDeleteColorTable ( sal_True ), - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), aXFStyleItem ( XFILL_SOLID ), aXFillColorItem ( String(), Color( COL_BLACK ) ), @@ -192,7 +190,7 @@ SvxColorTabPage::SvxColorTabPage // Handler ueberladen aLbColor.SetSelectHdl( LINK( this, SvxColorTabPage, SelectColorLBHdl_Impl ) ); - aValSetColorTable.SetSelectHdl( + aValSetColorList.SetSelectHdl( LINK( this, SvxColorTabPage, SelectValSetHdl_Impl ) ); aLbColorModel.SetSelectHdl( LINK( this, SvxColorTabPage, SelectColorModelHdl_Impl ) ); @@ -214,11 +212,11 @@ SvxColorTabPage::SvxColorTabPage aBtnSave.SetClickHdl( LINK( this, SvxColorTabPage, ClickSaveHdl_Impl ) ); // ValueSet - aValSetColorTable.SetStyle( aValSetColorTable.GetStyle() | WB_VSCROLL | WB_ITEMBORDER ); - aValSetColorTable.SetColCount( 8 ); - aValSetColorTable.SetLineCount( 13 ); - aValSetColorTable.SetExtraSpacing( 0 ); - aValSetColorTable.Show(); + aValSetColorList.SetStyle( aValSetColorList.GetStyle() | WB_VSCROLL | WB_ITEMBORDER ); + aValSetColorList.SetColCount( 8 ); + aValSetColorList.SetLineCount( 13 ); + aValSetColorList.SetExtraSpacing( 0 ); + aValSetColorList.Show(); aLbColorModel.SetAccessibleName( String( CUI_RES(STR_CUI_COLORMODEL) ) ); aBtnAdd.SetAccessibleRelationMemberOf( &aFlProp ); @@ -232,7 +230,7 @@ SvxColorTabPage::SvxColorTabPage void SvxColorTabPage::Construct() { aLbColor.Fill( pColorTab ); - FillValueSet_Impl( aValSetColorTable ); + FillValueSet_Impl( aValSetColorList ); } // ----------------------------------------------------------------------- @@ -243,12 +241,12 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& ) { *pbAreaTP = sal_False; - if( pColorTab ) + if( pColorTab.is() ) { if( *pPageType == PT_COLOR && *pPos != LISTBOX_ENTRY_NOTFOUND ) { aLbColor.SelectEntryPos( *pPos ); - aValSetColorTable.SelectItem( aLbColor.GetSelectEntryPos() + 1 ); + aValSetColorList.SelectItem( aLbColor.GetSelectEntryPos() + 1 ); aEdtName.SetText( aLbColor.GetSelectEntry() ); ChangeColorHdl_Impl( this ); @@ -433,7 +431,7 @@ void SvxColorTabPage::Reset( const SfxItemSet& rSet ) { XFillColorItem aColorItem( (const XFillColorItem&)rSet.Get( XATTR_FILLCOLOR ) ); aLbColor.SelectEntry( aColorItem.GetColorValue() ); - aValSetColorTable.SelectItem( aLbColor.GetSelectEntryPos() + 1 ); + aValSetColorList.SelectItem( aLbColor.GetSelectEntryPos() + 1 ); aEdtName.SetText( aLbColor.GetSelectEntry() ); } @@ -564,7 +562,7 @@ IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) pColorTab->Insert( pEntry, pColorTab->Count() ); aLbColor.Append( pEntry ); - aValSetColorTable.InsertItem( aValSetColorTable.GetItemCount() + 1, + aValSetColorList.InsertItem( aValSetColorList.GetItemCount() + 1, pEntry->GetColor(), pEntry->GetName() ); aLbColor.SelectEntryPos( aLbColor.GetEntryCount() - 1 ); @@ -653,8 +651,8 @@ IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) aLbColor.Modify( pEntry, nPos ); aLbColor.SelectEntryPos( nPos ); ///// - aValSetColorTable.SetItemColor( nPos + 1, pEntry->GetColor() ); - aValSetColorTable.SetItemText( nPos + 1, pEntry->GetName() ); + aValSetColorList.SetItemColor( nPos + 1, pEntry->GetColor() ); + aValSetColorList.SetItemText( nPos + 1, pEntry->GetName() ); aEdtName.SetText( aName ); aCtlPreviewOld.Invalidate(); @@ -740,8 +738,8 @@ IMPL_LINK( SvxColorTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) // Listbox und ValueSet aktualisieren aLbColor.RemoveEntry( nPos ); - aValSetColorTable.Clear(); - FillValueSet_Impl( aValSetColorTable ); + aValSetColorList.Clear(); + FillValueSet_Impl( aValSetColorList ); // Positionieren aLbColor.SelectEntryPos( nPos ); @@ -802,43 +800,23 @@ IMPL_LINK( SvxColorTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) aPathURL.removeFinalSlash(); // Tabelle speichern - XColorList* pColTab = new XColorList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); - pColTab->SetName( aURL.getName() ); // XXX - if( pColTab->Load() ) + XColorListRef pColList = XPropertyList::CreatePropertyList( + XCOLOR_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsColorList(); + pColList->SetName( aURL.getName() ); // XXX + if( pColList->Load() ) { // Pruefen, ob Tabelle geloescht werden darf: - const XColorList *pTempList = 0; SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN ); SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN ); - if( pArea ) - { - pTempList = pArea->GetColorTable(); - } - else if( pLine ) - { - pTempList = pLine->GetColorTable(); - } - if( pColorTab != pTempList ) - { - if( bDeleteColorTable ) - delete pColorTab; - else - bDeleteColorTable = sal_True; - } - - pColorTab = pColTab; + pColorTab = pColList; if( pArea ) - { pArea->SetNewColorTable( pColorTab ); - } else if( pLine ) - { pLine->SetNewColorTable( pColorTab ); - } aLbColor.Clear(); - aValSetColorTable.Clear(); + aValSetColorList.Clear(); Construct(); Reset( rOutAttrs ); @@ -973,7 +951,7 @@ IMPL_LINK( SvxColorTabPage, SelectColorLBHdl_Impl, void *, EMPTYARG ) sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - aValSetColorTable.SelectItem( nPos + 1 ); + aValSetColorList.SelectItem( nPos + 1 ); aEdtName.SetText( aLbColor.GetSelectEntry() ); rXFSet.Put( XFillColorItem( String(), @@ -993,7 +971,7 @@ IMPL_LINK( SvxColorTabPage, SelectColorLBHdl_Impl, void *, EMPTYARG ) IMPL_LINK( SvxColorTabPage, SelectValSetHdl_Impl, void *, EMPTYARG ) { - sal_uInt16 nPos = aValSetColorTable.GetSelectItemId(); + sal_uInt16 nPos = aValSetColorList.GetSelectItemId(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { aLbColor.SelectEntryPos( nPos - 1 ); diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index d762f74c70c6..b2b6c36e5610 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -182,7 +182,7 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& ) { *pbAreaTP = sal_False; - if( pColorTab ) + if( pColorTab.is() ) { // ColorTable if( *pnColorTableState & CT_CHANGED || @@ -678,16 +678,12 @@ IMPL_LINK( SvxGradientTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) aPathURL.removeFinalSlash(); // Liste speichern - XGradientList* pGrdList = new XGradientList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + XGradientListRef pGrdList = XPropertyList::CreatePropertyList( + XGRADIENT_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsGradientList(); pGrdList->SetName( aURL.getName() ); if ( pGrdList->Load() ) { - // Pruefen, ob Tabelle geloescht werden darf: - if ( pGradientList != - ( (SvxAreaTabDialog*) DLGWIN )->GetGradientList() ) - delete pGradientList; - pGradientList = pGrdList; ( (SvxAreaTabDialog*) DLGWIN )-> SetNewGradientList( pGradientList ); diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index de7365e54d20..556b5c490df7 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -180,7 +180,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) { *pbAreaTP = sal_False; - if( pColorTab ) + if( pColorTab.is() ) { // ColorTable if( *pnColorTableState & CT_CHANGED || @@ -722,15 +722,11 @@ IMPL_LINK( SvxHatchTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) aPathURL.removeSegment(); aPathURL.removeFinalSlash(); - // Liste speichern - XHatchList* pHatchList = new XHatchList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + XHatchListRef pHatchList = XPropertyList::CreatePropertyList( + XHATCH_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsHatchList(); pHatchList->SetName( aURL.getName() ); if( pHatchList->Load() ) { - // Pruefen, ob Tabelle geloescht werden darf: - if( pHatchingList != ( (SvxAreaTabDialog*) DLGWIN )->GetHatchingList() ) - delete pHatchingList; - pHatchingList = pHatchList; ( (SvxAreaTabDialog*) DLGWIN )->SetNewHatchingList( pHatchingList ); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index ac170a2994cb..e95244545b42 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -309,7 +309,7 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); if (pPageTypeItem) SetPageType(pPageTypeItem->GetValue()); - if( nDlgType == 0 && pDashList ) + if( nDlgType == 0 && pDashList.is() ) { sal_uInt16 nPos; sal_uInt16 nCount; @@ -1833,7 +1833,7 @@ void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt ) void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) { - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False); SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False); SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); @@ -1843,7 +1843,7 @@ void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False); if (pColorTabItem) - SetColorTable(pColorTabItem->GetColorTable()); + SetColorList(pColorTabItem->GetColorList()); if (pDashListItem) SetDashList(pDashListItem->GetDashList()); if (pLineEndListItem) diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index 41f7085c2934..6dfe68a6cfc3 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -199,7 +199,7 @@ void SvxLineDefTabPage::ActivatePage( const SfxItemSet& ) if( *pDlgType == 0 ) // Flaechen-Dialog { // ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!! - if( pDashList ) + if( pDashList.is() ) { if( *pPageType == 1 && *pPosDashLb != LISTBOX_ENTRY_NOTFOUND ) @@ -790,16 +790,12 @@ IMPL_LINK( SvxLineDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) aPathURL.removeSegment(); aPathURL.removeFinalSlash(); - // Liste speichern - XDashList* pDshLst = new XDashList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + XDashListRef pDshLst = XPropertyList::CreatePropertyList( + XGRADIENT_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsDashList(); pDshLst->SetName( aURL.getName() ); if( pDshLst->Load() ) { - // Pruefen, ob Tabelle geloescht werden darf: - if( pDashList != ( (SvxLineTabDialog*) DLGWIN )->GetDashList() ) - delete pDashList; - pDashList = pDshLst; ( (SvxLineTabDialog*) DLGWIN )->SetNewDashList( pDashList ); diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index 30b94a0759ad..572b0af82fd5 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -176,7 +176,7 @@ void SvxLineEndDefTabPage::ActivatePage( const SfxItemSet& ) if( *pDlgType == 0 ) // Flaechen-Dialog { // ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!! - if( pLineEndList ) + if( pLineEndList.is() ) { if( *pPosLineEndLb != LISTBOX_ENTRY_NOTFOUND ) { @@ -593,15 +593,11 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) aPathURL.removeSegment(); aPathURL.removeFinalSlash(); - // Liste speichern - XLineEndList* pLeList = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + XLineEndListRef pLeList = XPropertyList::CreatePropertyList( + XLINE_END_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsLineEndList(); pLeList->SetName( aURL.getName() ); if( pLeList->Load() ) { - // Pruefen, ob Tabelle geloescht werden darf: - if( pLineEndList != ( (SvxLineTabDialog*) DLGWIN )->GetLineEndList() ) - delete pLineEndList; - pLineEndList = pLeList; ( (SvxLineTabDialog*) DLGWIN )->SetNewLineEndList( pLineEndList ); aLbLineEnds.Clear(); diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index 086f4f4a9b74..dd5e4e7caef6 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -224,7 +224,7 @@ void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) if( nDlgType == 0 ) { - if( pColorTab ) + if( pColorTab.is() ) { // ColorTable if( *pnColorTableState & CT_CHANGED || @@ -596,13 +596,13 @@ void SvxShadowTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) void SvxShadowTabPage::PageCreated (SfxAllItemSet aSet) { - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); if (pColorTabItem) - SetColorTable(pColorTabItem->GetColorTable()); + SetColorList(pColorTabItem->GetColorList()); if (pPageTypeItem) SetPageType(pPageTypeItem->GetValue()); if (pDlgTypeItem) |