summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-04-28 10:57:18 +0000
committerArmin Le Grand <alg@apache.org>2013-04-28 10:57:18 +0000
commit5e5dca13097c4d23f4efce9296163ff47e26872e (patch)
tree59f7d3ffc8cfc9bb3e4a06f0d2928d6b4fc649e4 /sc
parenteb15aa364708f091c4c59a66f9c3f43e35dafd31 (diff)
i122120 Cleanup of XPropertyList and derivates to RefCounted instances, more cleanups
Notes
Notes: prefer: c8dc73720883333a13187865cd0d69b64af6b4b5
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/source/core/data/documen2.cxx3
-rw-r--r--sc/source/core/data/documen3.cxx2
-rw-r--r--sc/source/core/data/documen9.cxx15
-rw-r--r--sc/source/core/data/drwlayer.cxx11
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx8
-rw-r--r--sc/source/ui/docshell/docsh2.cxx12
-rw-r--r--sc/source/ui/docshell/docsh4.cxx7
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx2
-rw-r--r--sc/source/ui/drawfunc/drawsh4.cxx8
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx8
-rw-r--r--sc/source/ui/miscdlgs/makefile.mk3
-rw-r--r--sc/source/ui/miscdlgs/tabbgcolordlg.cxx17
-rw-r--r--sc/source/ui/optdlg/opredlin.cxx6
-rw-r--r--sc/source/ui/optdlg/tpview.cxx12
15 files changed, 55 insertions, 65 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a5ebb4fdc4aa..3a5b0189eac2 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -76,6 +76,7 @@ class SvxSearchItem;
class SvxShadowItem;
class Window;
class XColorList;
+typedef ::boost::shared_ptr< XColorList > XColorListSharedPtr;
class List;
class ScAutoFormatData;
@@ -261,7 +262,7 @@ private:
SfxPrinter* pPrinter;
VirtualDevice* pVirtualDevice_100th_mm;
ScDrawLayer* pDrawLayer; // SdrModel
- XColorList* pColorTable;
+ XColorListSharedPtr maColorTable;
ScConditionalFormatList* pCondFormList; // bedingte Formate
ScValidationDataList* pValidationList; // Gueltigkeit
SvNumberFormatterIndexTable* pFormatExchangeList; // zum Umsetzen von Zahlenformaten
@@ -460,7 +461,7 @@ public:
void GetDocStat( ScDocStat& rDocStat );
SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL );
- XColorList* GetColorTable();
+ XColorListSharedPtr GetColorTable();
SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager() const;
@@ -1858,7 +1859,6 @@ private: // CLOOK-Impl-Methoden
void ImplDeleteOptions();
void DeleteDrawLayer();
- void DeleteColorTable();
SC_DLLPUBLIC sal_Bool DrawGetPrintArea( ScRange& rRange, sal_Bool bSetHor, sal_Bool bSetVer ) const;
void DrawMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
void DrawCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index cd479332264c..173186022b44 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -130,7 +130,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
pPrinter( NULL ),
pVirtualDevice_100th_mm( NULL ),
pDrawLayer( NULL ),
- pColorTable( NULL ),
+ maColorTable(),
pCondFormList( NULL ),
pValidationList( NULL ),
pFormatExchangeList( NULL ),
@@ -457,7 +457,6 @@ ScDocument::~ScDocument()
xPoolHelper->SourceDocumentGone();
xPoolHelper.unbind();
- DeleteColorTable();
delete pScriptTypeData;
delete pOtherObjects;
delete pRecursionHelper;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 6cacf90436ca..1795f9b38481 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1296,7 +1296,7 @@ sal_Bool ScDocument::CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR
return sal_False;
}
-sal_Bool ScDocument::HasAutoFilter( SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab )
+sal_Bool ScDocument::HasAutoFilter( SCCOL /*nCurCol*/, SCROW /*nCurRow*/, SCTAB nCurTab )
{
//ScDBData* pDBData = GetDBAtCursor( nCurCol, nCurRow, nCurTab );
ScDBData* pDBData = GetDBAtTable(nCurTab, SC_DB_OLD_FILTER);
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 9d3737ff7b02..9c788ea43739 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -89,19 +89,19 @@ void ScDocument::EndDrawUndo()
delete pDrawLayer->GetCalcUndo();
}
-XColorList* ScDocument::GetColorTable()
+XColorListSharedPtr ScDocument::GetColorTable()
{
if (pDrawLayer)
- return pDrawLayer->GetColorTable();
+ return pDrawLayer->GetColorTableFromSdrModel();
else
{
- if (!pColorTable)
+ if (!maColorTable.get())
{
SvtPathOptions aPathOpt;
- pColorTable = new XColorList( aPathOpt.GetPalettePath() );
+ maColorTable = XPropertyListFactory::CreateSharedXColorList(aPathOpt.GetPalettePath());
}
- return pColorTable;
+ return maColorTable;
}
}
@@ -257,11 +257,6 @@ void ScDocument::DeleteDrawLayer()
delete pDrawLayer;
}
-void ScDocument::DeleteColorTable()
-{
- delete pColorTable;
-}
-
sal_Bool ScDocument::DrawGetPrintArea( ScRange& rRange, sal_Bool bSetHor, sal_Bool bSetVer ) const
{
return pDrawLayer->GetPrintArea( rRange, bSetHor, bSetVer );
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index c901d87c1980..8a0a5fb8cea3 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -206,8 +206,7 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const String& rName ) :
NULL, // SfxItemPool* Pool
pGlobalDrawPersist ?
pGlobalDrawPersist :
- ( pDocument ? pDocument->GetDocumentShell() : NULL ),
- sal_True ), // bUseExtColorTable (is set below)
+ ( pDocument ? pDocument->GetDocumentShell() : NULL )),
aName( rName ),
pDoc( pDocument ),
pUndoGroup( NULL ),
@@ -224,12 +223,12 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const String& rName ) :
SetObjectShell( pObjSh );
// set color table
- SvxColorTableItem* pColItem = (SvxColorTableItem*) pObjSh->GetItem( SID_COLOR_TABLE );
- XColorList* pXCol = pColItem ? pColItem->GetColorTable() : XColorList::GetStdColorList();
- SetColorTable( pXCol );
+ const SvxColorTableItem* pColItem = static_cast< const SvxColorTableItem* >(pObjSh->GetItem( SID_COLOR_TABLE ));
+ XColorListSharedPtr aXCol = pColItem ? pColItem->GetColorTable() : XColorList::GetStdColorList();
+ SetColorTableAtSdrModel( aXCol );
}
else
- SetColorTable( XColorList::GetStdColorList() );
+ SetColorTableAtSdrModel( XColorList::GetStdColorList() );
SetSwapGraphics(sal_True);
// SetSwapAsynchron(sal_True); // an der View
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index e047188812a2..2cbeb47e4b84 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -78,14 +78,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)
+ XColorListSharedPtr aColorTable = static_cast< const SvxColorTableItem* >(pItem)->GetColorTable();
+ if (aColorTable.get())
{
aLbColor.SetUpdateMode( sal_False );
- long nCount = pColorTable->Count();
+ long nCount = aColorTable->Count();
for ( long n=0; n<nCount; n++ )
{
- XColorEntry* pEntry = pColorTable->GetColor(n);
+ XColorEntry* pEntry = aColorTable->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 1fae841765de..eacb059a274d 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -152,12 +152,12 @@ void ScDocShell::InitItems()
ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
if (pDrawLayer)
{
- PutItem( SvxColorTableItem ( pDrawLayer->GetColorTable(), SID_COLOR_TABLE ) );
- PutItem( SvxGradientListItem( pDrawLayer->GetGradientList(), SID_GRADIENT_LIST ) );
- PutItem( SvxHatchListItem ( pDrawLayer->GetHatchList(), SID_HATCH_LIST ) );
- PutItem( SvxBitmapListItem ( pDrawLayer->GetBitmapList(), SID_BITMAP_LIST ) );
- PutItem( SvxDashListItem ( pDrawLayer->GetDashList(), SID_DASH_LIST ) );
- PutItem( SvxLineEndListItem ( pDrawLayer->GetLineEndList(), SID_LINEEND_LIST ) );
+ PutItem( SvxColorTableItem ( pDrawLayer->GetColorTableFromSdrModel(), SID_COLOR_TABLE ) );
+ PutItem( SvxGradientListItem( pDrawLayer->GetGradientListFromSdrModel(), SID_GRADIENT_LIST ) );
+ PutItem( SvxHatchListItem ( pDrawLayer->GetHatchListFromSdrModel(), SID_HATCH_LIST ) );
+ PutItem( SvxBitmapListItem ( pDrawLayer->GetBitmapListFromSdrModel(), SID_BITMAP_LIST ) );
+ PutItem( SvxDashListItem ( pDrawLayer->GetDashListFromSdrModel(), SID_DASH_LIST ) );
+ PutItem( SvxLineEndListItem ( pDrawLayer->GetLineEndListFromSdrModel(), SID_LINEEND_LIST ) );
// andere Anpassungen nach dem Anlegen des DrawLayers
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 2c796bebc4ee..84acf0082e05 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -565,9 +565,10 @@ void ScDocShell::Execute( SfxRequest& rReq )
case SID_GET_COLORTABLE:
{
// 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));
+ const SvxColorTableItem* pColItem = static_cast< const SvxColorTableItem* >(GetItem(SID_COLOR_TABLE));
+ XColorListSharedPtr aTable = pColItem->GetColorTable();
+
+ rReq.SetReturnValue(SvxColorTableItem(aTable, SID_GET_COLORTABLE));
}
break;
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 312a0e629737..440624e1f6ee 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -466,8 +466,6 @@ void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
// (see SwDrawShell::ExecDrawDlg)
const SvxColorTableItem* pColorItem =
static_cast<const SvxColorTableItem*>( pViewData->GetSfxDocShell()->GetItem(SID_COLOR_TABLE) );
- if (pColorItem->GetColorTable() == XColorList::GetStdColorList())
- pDlg->DontDeleteColorTable();
if ( nTabPage != 0xffff )
pDlg->SetCurPageId( nTabPage );
diff --git a/sc/source/ui/drawfunc/drawsh4.cxx b/sc/source/ui/drawfunc/drawsh4.cxx
index 100ff0764f3b..6af1d64dbb21 100644
--- a/sc/source/ui/drawfunc/drawsh4.cxx
+++ b/sc/source/ui/drawfunc/drawsh4.cxx
@@ -93,15 +93,15 @@ void ScDrawShell::GetFormTextState(SfxItemSet& rSet)
if ( pDocSh )
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
- XColorList* pColorTable = NULL;
+ XColorListSharedPtr aColorTable;
if ( pItem )
- pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+ aColorTable = static_cast< const SvxColorTableItem* >(pItem)->GetColorTable();
pDlg->SetActive();
- if ( pColorTable )
- pDlg->SetColorTable( pColorTable );
+ if ( aColorTable.get() )
+ pDlg->SetColorTable( aColorTable );
else
{ DBG_ERROR( "ColorList not found :-/" ); }
}
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx
index a4de3bfa9339..df501968e817 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -256,15 +256,15 @@ void ScDrawTextObjectBar::GetFormTextState(SfxItemSet& rSet)
if ( pDocSh )
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
- XColorList* pColorTable = NULL;
+ XColorListSharedPtr aColorTable;
if ( pItem )
- pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+ aColorTable = static_cast< const SvxColorTableItem* >(pItem)->GetColorTable();
pDlg->SetActive();
- if ( pColorTable )
- pDlg->SetColorTable( pColorTable );
+ if ( aColorTable )
+ pDlg->SetColorTable( aColorTable );
else
{ DBG_ERROR( "ColorList not found :-/" ); }
}
diff --git a/sc/source/ui/miscdlgs/makefile.mk b/sc/source/ui/miscdlgs/makefile.mk
index 681d476b7f55..d277e9494ef7 100644
--- a/sc/source/ui/miscdlgs/makefile.mk
+++ b/sc/source/ui/miscdlgs/makefile.mk
@@ -42,7 +42,6 @@ SLOFILES = \
$(SLO)$/delcodlg.obj \
$(SLO)$/inscodlg.obj \
$(SLO)$/strindlg.obj \
- $(SLO)$/tabbgcolordlg.obj \
$(SLO)$/mtrindlg.obj \
$(SLO)$/lbseldlg.obj \
$(SLO)$/filldlg.obj \
@@ -72,6 +71,7 @@ SLOFILES = \
$(SLO)$/conflictsdlg.obj \
$(SLO)$/sharedocdlg.obj \
$(SLO)$/protectiondlg.obj \
+ $(SLO)$/tabbgcolordlg.obj \
$(SLO)$/retypepassdlg.obj
EXCEPTIONSFILES = \
@@ -83,6 +83,7 @@ EXCEPTIONSFILES = \
$(SLO)$/crnrdlg.obj \
$(SLO)$/solverutil.obj \
$(SLO)$/protectiondlg.obj \
+ $(SLO)$/tabbgcolordlg.obj \
$(SLO)$/retypepassdlg.obj
SRS1NAME=$(TARGET)
diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
index e70f065240b5..f6881279bb18 100644
--- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
+++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
@@ -89,9 +89,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.
-
+ XColorListSharedPtr aColorTable;
const Size aSize15x15 = Size( 15, 15 );
const Size aSize10x10 = Size( 10, 10 );
const Size aSize5x5 = Size( 5, 5 );
@@ -101,24 +99,23 @@ void ScTabBgColorDlg::FillColorValueSets_Impl()
if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) ) )
{
- pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+ aColorTable = static_cast< const SvxColorTableItem* >(pItem)->GetColorTable();
}
- if ( !pColorTable )
+ if ( !aColorTable.get() )
{
- pOwnColorTable.reset(new XColorList(SvtPathOptions().GetPalettePath()));
- pColorTable = pOwnColorTable.get();
+ aColorTable = XPropertyListFactory::CreateSharedXColorList(SvtPathOptions().GetPalettePath());
}
long nColorCount(0);
- if ( pColorTable )
+ if ( aColorTable.get() )
{
- nColorCount = pColorTable->Count();
+ nColorCount = aColorTable->Count();
Color aColWhite( COL_WHITE );
String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) );
- aTabBgColorSet.addEntriesForXColorList(*pColorTable);
+ aTabBgColorSet.addEntriesForXColorList(aColorTable);
}
if(nColorCount)
diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx
index bb73f18a56f4..29d2ab0124e4 100644
--- a/sc/source/ui/optdlg/opredlin.cxx
+++ b/sc/source/ui/optdlg/opredlin.cxx
@@ -171,7 +171,7 @@ sal_Bool __EXPORT ScRedlineOptionsTabPage::FillItemSet( SfxItemSet& /* rSet */ )
void __EXPORT ScRedlineOptionsTabPage::Reset( const SfxItemSet& /* rSet */ )
{
- XColorList* pColorTbl = XColorList::GetStdColorList();
+ XColorListSharedPtr aColorTbl = XColorList::GetStdColorList();
aContentColorLB.InsertEntry(aAuthorStr);
aMoveColorLB.InsertEntry(aAuthorStr);
aInsertColorLB.InsertEntry(aAuthorStr);
@@ -182,9 +182,9 @@ void __EXPORT ScRedlineOptionsTabPage::Reset( const SfxItemSet& /* rSet */ )
aInsertColorLB.SetUpdateMode( sal_False);
aRemoveColorLB.SetUpdateMode( sal_False);
- for( sal_uInt16 i = 0; i < pColorTbl->Count(); ++i )
+ for( sal_uInt16 i = 0; i < aColorTbl->Count(); ++i )
{
- XColorEntry* pEntry = pColorTbl->GetColor( i );
+ XColorEntry* pEntry = aColorTbl->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 c16dda6d829a..c2e4cb515d99 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -351,19 +351,19 @@ void ScTpContentOptions::InitGridOpt()
// hier koennte auch eine andere DocShell kommen!
pDocSh = PTR_CAST(ScDocShell, pDocSh);
- XColorList* pColorTable = NULL;
+ XColorListSharedPtr aColorTable;
if ( pDocSh )
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
if ( pItem )
- pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
+ aColorTable = static_cast< const SvxColorTableItem* >(pItem)->GetColorTable();
}
else
- pColorTable = XColorList::GetStdColorList();
+ aColorTable = XColorList::GetStdColorList();
- if ( !pColorTable )
+ if ( !aColorTable.get() )
return;
//------------------------------------------------------
@@ -372,10 +372,10 @@ void ScTpContentOptions::InitGridOpt()
// Eintraege aus der Colortable
- long nCount = pColorTable->Count();
+ long nCount = aColorTable->Count();
for ( long n=0; n<nCount; n++ )
{
- XColorEntry* pEntry = pColorTable->GetColor(n);
+ XColorEntry* pEntry = aColorTable->GetColor(n);
aColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}