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 /sw | |
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 'sw')
-rw-r--r-- | sw/sdi/_docsh.sdi | 2 | ||||
-rw-r--r-- | sw/source/core/draw/drawdoc.cxx | 12 | ||||
-rwxr-xr-x | sw/source/ui/app/docsh2.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/app/docshdrw.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/app/docshini.cxx | 9 | ||||
-rw-r--r-- | sw/source/ui/config/optpage.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/column.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/misc/pgfnote.cxx | 12 | ||||
-rw-r--r-- | sw/source/ui/misc/pggrid.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/shells/drawdlg.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/shells/drawsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/shells/drwtxtsh.cxx | 2 |
12 files changed, 31 insertions, 46 deletions
diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi index ad37160a3c1f..1f239ecec264 100644 --- a/sw/sdi/_docsh.sdi +++ b/sw/sdi/_docsh.sdi @@ -65,7 +65,7 @@ interface BaseTextDocument StateMethod = NoState ; ] - SID_GET_COLORTABLE + SID_GET_COLORLIST [ ExecMethod = Execute ; ] diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx index f594f758d80e..9214c46c0274 100644 --- a/sw/source/core/draw/drawdoc.cxx +++ b/sw/source/core/draw/drawdoc.cxx @@ -75,14 +75,14 @@ SwDrawDocument::SwDrawDocument( SwDoc* pD ) : if ( pDocSh ) { SetObjectShell( pDocSh ); - SvxColorTableItem* pColItem = ( SvxColorTableItem* ) + SvxColorListItem* pColItem = ( SvxColorListItem* ) ( pDocSh->GetItem( SID_COLOR_TABLE ) ); - XColorList *pXCol = pColItem ? pColItem->GetColorTable() : - &XColorList::GetStdColorTable(); - SetColorTable( pXCol ); + XColorListRef pXCol = pColItem ? pColItem->GetColorList() : + XColorList::GetStdColorList(); + SetPropertyList( static_cast<XPropertyList *> (pXCol.get()) ); if ( !pColItem ) - pDocSh->PutItem( SvxColorTableItem( pXCol, SID_COLOR_TABLE ) ); + pDocSh->PutItem( SvxColorListItem( pXCol, SID_COLOR_TABLE ) ); pDocSh->PutItem( SvxGradientListItem( GetGradientList(), SID_GRADIENT_LIST )); pDocSh->PutItem( SvxHatchListItem( GetHatchList(), SID_HATCH_LIST ) ); @@ -93,7 +93,7 @@ SwDrawDocument::SwDrawDocument( SwDoc* pD ) : SetObjectShell( pDocSh ); } else - SetColorTable( &XColorList::GetStdColorTable() ); + SetPropertyList( static_cast<XPropertyList *> (XColorList::GetStdColorList().get()) ); // copy all the default values to the SdrModel SfxItemPool* pSdrPool = pD->GetAttrPool().GetSecondaryPool(); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 47799963fac4..a0481d19c069 100755 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -973,11 +973,11 @@ void SwDocShell::Execute(SfxRequest& rReq) pViewFrm->GetBindings().Invalidate( FN_PRINT_LAYOUT ); } break; - case SID_GET_COLORTABLE: + case SID_GET_COLORLIST: { - 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; case FN_ABSTRACT_STARIMPRESS: diff --git a/sw/source/ui/app/docshdrw.cxx b/sw/source/ui/app/docshdrw.cxx index b72cb3fe71bf..be7a298b812b 100644 --- a/sw/source/ui/app/docshdrw.cxx +++ b/sw/source/ui/app/docshdrw.cxx @@ -64,7 +64,7 @@ void SwDocShell::InitDraw() rOutliner.SetHyphenator( xHyphenator ); } else - PutItem( SvxColorTableItem( &XColorList::GetStdColorTable(), SID_COLOR_TABLE )); + PutItem( SvxColorListItem( XColorList::GetStdColorList(), SID_COLOR_TABLE )); } diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index a480ac5c2f0c..f2663d3dfdf7 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -428,15 +428,6 @@ SwDocShell::SwDocShell( SwDoc *pD, SfxObjectCreateMode eMode ): // we, as BroadCaster also become our own Listener // (for DocInfo/FileNames/....) EndListening( *this ); - SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE); - // when only DocInfo is read for the Explorer, the Item is not there - if(pColItem) - { - XColorList* pTable = pColItem->GetColorTable(); - // when a new Table was created, it has to be deleted as well. - if(pTable != &XColorList::GetStdColorTable()) - delete pTable; - } delete pOLEChildList; } diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 8a2956aac6a4..daf1e79cfdb7 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1984,11 +1984,11 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet& ) aDeletedColorLB.InsertEntry(sAuthor); aChangedColorLB.InsertEntry(sAuthor); - XColorList& rColorTbl = XColorList::GetStdColorTable(); + XColorListRef pColorLst = XColorList::GetStdColorList(); sal_uInt16 i; - for( i = 0; i < rColorTbl.Count(); ++i ) + for( i = 0; i < pColorLst->Count(); ++i ) { - XColorEntry* pEntry = rColorTbl.GetColor( i ); + XColorEntry* pEntry = pColorLst->GetColor( i ); Color aColor = pEntry->GetColor(); String sName = pEntry->GetName(); diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index cb5a56fb7171..a1357dbaac82 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -547,21 +547,21 @@ SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet) // Fill the color listbox SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = NULL; - XColorList* pColorTable = NULL; + XColorListRef pColorList; if ( pDocSh ) { pItem = pDocSh->GetItem( SID_COLOR_TABLE ); if ( pItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorList = ( (SvxColorListItem*)pItem )->GetColorList(); } - if ( pColorTable ) + if ( pColorList.is() ) { aLineColorDLB.SetUpdateMode( sal_False ); - for ( i = 0; i < pColorTable->Count(); ++i ) + for ( i = 0; i < pColorList->Count(); ++i ) { - XColorEntry* pEntry = pColorTable->GetColor(i); + XColorEntry* pEntry = pColorList->GetColor(i); aLineColorDLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); } aLineColorDLB.SetUpdateMode( sal_True ); diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index 5e2de384f9f6..187a2b68d8fe 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -232,7 +232,7 @@ void SwFootNotePage::Reset(const SfxItemSet &rSet) // Separator Color SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pColorItem = NULL; - XColorList* pColorTable = NULL; + XColorListRef pColorList; OSL_ENSURE( pDocSh, "DocShell not found!" ); @@ -240,18 +240,18 @@ void SwFootNotePage::Reset(const SfxItemSet &rSet) { pColorItem = pDocSh->GetItem( SID_COLOR_TABLE ); if ( pColorItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pColorItem )->GetColorTable(); + pColorList = ( (SvxColorListItem*)pColorItem )->GetColorList(); } - OSL_ENSURE( pColorTable, "ColorTable not found!" ); + OSL_ENSURE( pColorList.is(), "ColorTable not found!" ); - if ( pColorTable ) + if ( pColorList.is() ) { aLineColorBox.SetUpdateMode( sal_False ); - for ( long i = 0; i < pColorTable->Count(); ++i ) + for ( long i = 0; i < pColorList->Count(); ++i ) { - XColorEntry* pEntry = pColorTable->GetColor(i); + XColorEntry* pEntry = pColorList->GetColor(i); aLineColorBox.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); } aLineColorBox.SetUpdateMode( sal_True ); diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 0f6de4bb4df2..7d315d8ba631 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -148,11 +148,11 @@ SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) : aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl)); - XColorList& rColorTbl = XColorList::GetStdColorTable(); + XColorListRef pColorLst = XColorList::GetStdColorList(); aColorLB.InsertAutomaticEntryColor( Color( COL_AUTO ) ); - for( sal_uInt16 i = 0; i < rColorTbl.Count(); ++i ) + for( sal_uInt16 i = 0; i < pColorLst->Count(); ++i ) { - XColorEntry* pEntry = rColorTbl.GetColor( i ); + XColorEntry* pEntry = pColorLst->GetColor( i ); Color aColor = pEntry->GetColor(); String sName = pEntry->GetName(); aColorLB.InsertEntry( aColor, sName ); diff --git a/sw/source/ui/shells/drawdlg.cxx b/sw/source/ui/shells/drawdlg.cxx index 82069bf044c4..af080dc2db3d 100644 --- a/sw/source/ui/shells/drawdlg.cxx +++ b/sw/source/ui/shells/drawdlg.cxx @@ -93,16 +93,10 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) sal_Bool bHasMarked = pView->AreObjectsMarked(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialogdiet Factory fail!"); AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( NULL, &aNewAttr, pDoc, pView); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); - const SvxColorTableItem* pColorItem = (const SvxColorTableItem*) - GetView().GetDocShell()->GetItem(SID_COLOR_TABLE); - if(pColorItem->GetColorTable() == &XColorList::GetStdColorTable()) - pDlg->DontDeleteColorTable(); if (pDlg->Execute() == RET_OK) { pSh->StartAction(); diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx index f8000b63c821..695dddc69013 100644 --- a/sw/source/ui/shells/drawsh.cxx +++ b/sw/source/ui/shells/drawsh.cxx @@ -464,7 +464,7 @@ void SwDrawShell::GetFormTextState(SfxItemSet& rSet) else { if ( pDlg ) - pDlg->SetColorTable(&XColorList::GetStdColorTable()); + pDlg->SetColorList(XColorList::GetStdColorList()); pDrView->GetAttributes( rSet ); } diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 6d54195846d2..399c3271ff4c 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -304,7 +304,7 @@ void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet) else { if ( pDlg ) - pDlg->SetColorTable(&XColorList::GetStdColorTable()); + pDlg->SetColorList(XColorList::GetStdColorList()); pDrView->GetAttributes( rSet ); } |