summaryrefslogtreecommitdiff
path: root/sc/source/ui
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 /sc/source/ui
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 'sc/source/ui')
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx8
-rw-r--r--sc/source/ui/docshell/docsh2.cxx4
-rw-r--r--sc/source/ui/docshell/docsh4.cxx9
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx16
-rw-r--r--sc/source/ui/drawfunc/drawsh4.cxx10
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx10
-rw-r--r--sc/source/ui/miscdlgs/tabbgcolordlg.cxx19
-rw-r--r--sc/source/ui/optdlg/opredlin.cxx6
-rw-r--r--sc/source/ui/optdlg/tpview.cxx14
9 files changed, 38 insertions, 58 deletions
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index 5e1cbc3121e5..91e0c01c6bc6 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -83,14 +83,14 @@ ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const String& rName, sal_Bo
const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
if ( pItem )
{
- XColorList* pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
- if (pColorTable)
+ XColorListRef pColorList = ((SvxColorListItem*)pItem)->GetColorList();
+ if (pColorList.is())
{
aLbColor.SetUpdateMode( false );
- long nCount = pColorTable->Count();
+ long nCount = pColorList->Count();
for ( long n=0; n<nCount; n++ )
{
- XColorEntry* pEntry = pColorTable->GetColor(n);
+ XColorEntry* pEntry = pColorList->GetColor(n);
aLbColor.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
aLbColor.SetUpdateMode( sal_True );
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index f94bc36acffc..b3ccd3933e83 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -128,7 +128,7 @@ void ScDocShell::InitItems()
ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
if (pDrawLayer)
{
- PutItem( SvxColorTableItem ( pDrawLayer->GetColorTable(), SID_COLOR_TABLE ) );
+ PutItem( SvxColorListItem ( pDrawLayer->GetColorList(), SID_COLOR_TABLE ) );
PutItem( SvxGradientListItem( pDrawLayer->GetGradientList(), SID_GRADIENT_LIST ) );
PutItem( SvxHatchListItem ( pDrawLayer->GetHatchList(), SID_HATCH_LIST ) );
PutItem( SvxBitmapListItem ( pDrawLayer->GetBitmapList(), SID_BITMAP_LIST ) );
@@ -144,7 +144,7 @@ void ScDocShell::InitItems()
else
{
// always use global color table instead of local copy
- PutItem( SvxColorTableItem( &XColorList::GetStdColorTable(), SID_COLOR_TABLE ) );
+ PutItem( SvxColorListItem( XColorList::GetStdColorList(), SID_COLOR_TABLE ) );
}
if ( !aDocument.GetForbiddenCharacters().is() ||
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 80034f0f5f53..f8875896f4b5 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -587,12 +587,11 @@ void ScDocShell::Execute( SfxRequest& rReq )
OSL_FAIL("use ScAutoStyleHint instead of SID_AUTO_STYLE");
break;
- case SID_GET_COLORTABLE:
+ case SID_GET_COLORLIST:
{
- // passende ColorTable ist per PutItem gesetzt worden
- SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE);
- XColorList* pTable = pColItem->GetColorTable();
- rReq.SetReturnValue(OfaPtrItem(SID_GET_COLORTABLE, pTable));
+ SvxColorListItem* pColItem = (SvxColorListItem*)GetItem(SID_COLOR_TABLE);
+ XColorListRef pList = pColItem->GetColorList();
+ rReq.SetReturnValue(OfaRefItem<XColorList>(SID_GET_COLORLIST, pList));
}
break;
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 836d47201712..9eaf8bd52ca9 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -411,19 +411,9 @@ void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet Factory fail!");
- AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( pViewData->GetDialogParent(),
- &aNewAttr,
- pViewData->GetDocument()->GetDrawLayer(),
- pView);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- // #i74099# by default, the dialog deletes the current color table if a different one is loaded
- // (see SwDrawShell::ExecDrawDlg)
- const SvxColorTableItem* pColorItem =
- static_cast<const SvxColorTableItem*>( pViewData->GetSfxDocShell()->GetItem(SID_COLOR_TABLE) );
- if (pColorItem->GetColorTable() == &XColorList::GetStdColorTable())
- pDlg->DontDeleteColorTable();
+ AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog(
+ pViewData->GetDialogParent(), &aNewAttr,
+ pViewData->GetDocument()->GetDrawLayer(), pView);
if ( nTabPage != 0xffff )
pDlg->SetCurPageId( nTabPage );
diff --git a/sc/source/ui/drawfunc/drawsh4.cxx b/sc/source/ui/drawfunc/drawsh4.cxx
index 6f021d82b776..d46593e792f3 100644
--- a/sc/source/ui/drawfunc/drawsh4.cxx
+++ b/sc/source/ui/drawfunc/drawsh4.cxx
@@ -93,17 +93,15 @@ void ScDrawShell::GetFormTextState(SfxItemSet& rSet)
if ( pDocSh )
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
- XColorList* pColorTable = NULL;
+ XColorListRef pColorList;
if ( pItem )
- pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+ pColorList = ((SvxColorListItem*)pItem)->GetColorList();
pDlg->SetActive();
- if ( pColorTable )
- pDlg->SetColorTable( pColorTable );
- else
- { OSL_FAIL( "ColorList not found :-/" ); }
+ if ( pColorList.is() )
+ pDlg->SetColorList( pColorList );
}
}
SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool());
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx
index 4278cc976992..51ef34048bd9 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -276,17 +276,15 @@ void ScDrawTextObjectBar::GetFormTextState(SfxItemSet& rSet)
if ( pDocSh )
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
- XColorList* pColorTable = NULL;
+ XColorListRef pColorList;
if ( pItem )
- pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+ pColorList = ((SvxColorListItem*)pItem)->GetColorList();
pDlg->SetActive();
- if ( pColorTable )
- pDlg->SetColorTable( pColorTable );
- else
- { OSL_FAIL( "ColorList not found :-/" ); }
+ if ( pColorList.is() )
+ pDlg->SetColorList( pColorList );
}
}
SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool());
diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
index 961eef00e616..04b878560780 100644
--- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
+++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
@@ -93,8 +93,7 @@ void ScTabBgColorDlg::FillColorValueSets_Impl()
{
SfxObjectShell* pDocSh = SfxObjectShell::Current();
const SfxPoolItem* pItem = NULL;
- XColorList* pColorTable = NULL;
- ::boost::scoped_ptr<XColorList> pOwnColorTable; // locally instantiated in case the doc shell doesn't have one.
+ XColorListRef pColorList;
const Size aSize15x15 = Size( 15, 15 );
sal_uInt16 nSelectedItem = 0;
@@ -102,16 +101,14 @@ void ScTabBgColorDlg::FillColorValueSets_Impl()
OSL_ENSURE( pDocSh, "DocShell not found!" );
if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) ) )
- pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
- if ( !pColorTable )
- {
- pOwnColorTable.reset(new XColorList(SvtPathOptions().GetPalettePath()));
- pColorTable = pOwnColorTable.get();
- }
- if ( pColorTable )
+ pColorList = ( (SvxColorListItem*)pItem )->GetColorList();
+ if ( !pColorList.is() )
+ pColorList = XColorList::CreateStdColorList();
+
+ if ( pColorList.is() )
{
sal_uInt16 i = 0;
- long nCount = pColorTable->Count();
+ long nCount = pColorList->Count();
XColorEntry* pEntry = NULL;
Color aColWhite( COL_WHITE );
String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) );
@@ -120,7 +117,7 @@ void ScTabBgColorDlg::FillColorValueSets_Impl()
aTabBgColorSet.SetStyle( nBits );
for ( i = 0; i < nCount; i++ )
{
- pEntry = pColorTable->GetColor(i);
+ pEntry = pColorList->GetColor(i);
aTabBgColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() );
if (pEntry->GetColor() == aTabBgColor)
nSelectedItem = (i + 1);
diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx
index a93122bb4b55..332eb2d10dc4 100644
--- a/sc/source/ui/optdlg/opredlin.cxx
+++ b/sc/source/ui/optdlg/opredlin.cxx
@@ -169,10 +169,10 @@ void ScRedlineOptionsTabPage::Reset( const SfxItemSet& /* rSet */ )
aInsertColorLB.SetUpdateMode( false);
aRemoveColorLB.SetUpdateMode( false);
- XColorList& rColorTbl = XColorList::GetStdColorTable();
- for( sal_uInt16 i = 0; i < rColorTbl.Count(); ++i )
+ XColorListRef xColorLst = XColorList::GetStdColorList();
+ for( sal_uInt16 i = 0; i < xColorLst->Count(); ++i )
{
- XColorEntry* pEntry = rColorTbl.GetColor( i );
+ XColorEntry* pEntry = xColorLst->GetColor( i );
Color aColor = pEntry->GetColor();
String sName = pEntry->GetName();
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index 88cbb2e97070..b03d49205c40 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -337,19 +337,17 @@ void ScTpContentOptions::InitGridOpt()
// there might be another DocShell here
pDocSh = PTR_CAST(ScDocShell, pDocSh);
- XColorList* pColorTable = NULL;
-
+ XColorListRef pColorList;
if ( pDocSh )
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
-
if ( pItem )
- pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+ pColorList = ((SvxColorListItem*)pItem)->GetColorList();
}
else
- pColorTable = &XColorList::GetStdColorTable();
+ pColorList = XColorList::GetStdColorList();
- if ( !pColorTable )
+ if ( !pColorList.is() )
return;
//------------------------------------------------------
@@ -358,10 +356,10 @@ void ScTpContentOptions::InitGridOpt()
// items from ColorTable
- long nCount = pColorTable->Count();
+ long nCount = pColorList->Count();
for ( long n=0; n<nCount; n++ )
{
- XColorEntry* pEntry = pColorTable->GetColor(n);
+ XColorEntry* pEntry = pColorList->GetColor(n);
aColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}