diff options
126 files changed, 871 insertions, 1370 deletions
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index 54e0a606cd3d..b6704e17cc59 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -526,7 +526,7 @@ void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) case TP_LAYOUT: break; case RID_SVXPAGE_LINE: - aSet.Put (SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE)); aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST)); aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST)); aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); @@ -544,7 +544,7 @@ void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) break; case RID_SVXPAGE_AREA: - aSet.Put(SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE)); + aSet.Put(SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE)); aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST)); aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST)); aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST)); diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index 0ddb6c1b4038..6cb32f881d92 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.cxx +++ b/chart2/source/controller/dialogs/dlg_View3D.cxx @@ -60,7 +60,7 @@ using namespace ::com::sun::star::chart2; sal_uInt16 View3DDialog::m_nLastPageId = 0; -View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorList* pColorTable ) +View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, const XColorListRef &pColorTable ) : TabDialog(pParent,SchResId(DLG_3D_VIEW)) , m_aTabControl(this,SchResId(TABCTRL)) , m_aBtnOK(this,SchResId(BTN_OK)) diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index 0621e1883318..d23ce48fab16 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -287,7 +287,7 @@ namespace ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( Window* pWindow , const uno::Reference< beans::XPropertySet > & xSceneProperties , const uno::Reference< frame::XModel >& xChartModel - , XColorList* pColorTable ) + , const XColorListRef & pColorTable ) : TabPage ( pWindow, SchResId( TP_3D_SCENEILLUMINATION ) ) , m_aFT_LightSource( this, SchResId( FT_LIGHTSOURCE ) ) , m_aBtn_Light1( this, SchResId( BTN_LIGHT_1 ), 1 ) @@ -313,7 +313,7 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( Window* pWin { FreeResource(); - if(pColorTable) + if( pColorTable.is() ) { m_aLB_AmbientLight.Fill( pColorTable ); m_aLB_LightSource.Fill( pColorTable ); diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx index 990ece9af8f9..56b04ccc5a1e 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx @@ -79,7 +79,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSceneProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel, - XColorList* pColorTable=0 ); + const XColorListRef &pColorTable ); virtual ~ThreeD_SceneIllumination_TabPage(); // has to be called in case the dialog was closed with OK diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx index 0f209a85afb3..0be5cc4c79b4 100644 --- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx +++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx @@ -94,45 +94,48 @@ ViewElementListProvider::~ViewElementListProvider() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -XColorList* ViewElementListProvider::GetColorTable() const +XColorListRef ViewElementListProvider::GetColorTable() const { if(m_pDrawModelWrapper) - return m_pDrawModelWrapper->GetColorTable(); - return NULL; + return m_pDrawModelWrapper->GetColorList(); + return XColorListRef(); } -XDashList* ViewElementListProvider::GetDashList() const + +XDashListRef ViewElementListProvider::GetDashList() const { if(m_pDrawModelWrapper) return m_pDrawModelWrapper->GetDashList(); - return NULL; + return XDashListRef(); } -XLineEndList* ViewElementListProvider::GetLineEndList() const + +XLineEndListRef ViewElementListProvider::GetLineEndList() const { if(m_pDrawModelWrapper) return m_pDrawModelWrapper->GetLineEndList(); - return NULL; + return XLineEndListRef(); } -XGradientList* ViewElementListProvider::GetGradientList() const + +XGradientListRef ViewElementListProvider::GetGradientList() const { if(m_pDrawModelWrapper) return m_pDrawModelWrapper->GetGradientList(); - return NULL; + return XGradientListRef(); } -XHatchList* ViewElementListProvider::GetHatchList() const +XHatchListRef ViewElementListProvider::GetHatchList() const { if(m_pDrawModelWrapper) return m_pDrawModelWrapper->GetHatchList(); return NULL; } -XBitmapList* ViewElementListProvider::GetBitmapList() const + +XBitmapListRef ViewElementListProvider::GetBitmapList() const { if(m_pDrawModelWrapper) return m_pDrawModelWrapper->GetBitmapList(); - return NULL; + return XBitmapListRef(); } //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- //create chartspecific symbols for linecharts SdrObjList* ViewElementListProvider::GetSymbolList() const diff --git a/chart2/source/controller/inc/ViewElementListProvider.hxx b/chart2/source/controller/inc/ViewElementListProvider.hxx index ef1ced680dda..cdede1666300 100644 --- a/chart2/source/controller/inc/ViewElementListProvider.hxx +++ b/chart2/source/controller/inc/ViewElementListProvider.hxx @@ -46,12 +46,12 @@ public: ViewElementListProvider( DrawModelWrapper* pDrawModelWrapper ); virtual ~ViewElementListProvider(); - XColorList* GetColorTable() const; - XDashList* GetDashList() const; - XLineEndList* GetLineEndList() const; - XGradientList* GetGradientList() const; - XHatchList* GetHatchList() const; - XBitmapList* GetBitmapList() const; + XColorListRef GetColorTable() const; + XDashListRef GetDashList() const; + XLineEndListRef GetLineEndList() const; + XGradientListRef GetGradientList() const; + XHatchListRef GetHatchList() const; + XBitmapListRef GetBitmapList() const; //create chartspecific symbols for linecharts SdrObjList* GetSymbolList() const; diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx index 699916ff7b88..fd5fb02900b1 100644 --- a/chart2/source/controller/inc/dlg_View3D.hxx +++ b/chart2/source/controller/inc/dlg_View3D.hxx @@ -55,7 +55,7 @@ class View3DDialog : public TabDialog public: View3DDialog( Window* pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel, - XColorList* pColorTable=0 ); + const XColorListRef &pColorTable ); ~View3DDialog(); // from Dialog (base of TabDialog) diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 6de3c53bdefe..ba16343ef7ac 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -840,7 +840,7 @@ void SAL_CALL ChartController::executeDispatch_View3D() //open dialog SolarMutexGuard aSolarGuard; - View3DDialog aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorTable() ); + View3DDialog aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorList() ); if( aDlg.Execute() == RET_OK ) aUndoGuard.commit(); } diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index b4d25161f467..e8ee2e07dffb 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -119,8 +119,8 @@ bool DrawCommandDispatch::isFeatureSupported( const ::rtl::OUString& rCommandURL ::basegfx::B2DPolyPolygon getPolygon( sal_uInt16 nResId, SdrModel& rModel ) { ::basegfx::B2DPolyPolygon aReturn; - XLineEndList* pLineEndList = rModel.GetLineEndList(); - if ( pLineEndList ) + XLineEndListRef pLineEndList = rModel.GetLineEndList(); + if ( pLineEndList.is() ) { String aName( SVX_RES( nResId ) ); long nCount = pLineEndList->Count(); diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index 9f67c4b5893d..c4db4bbd564f 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -327,11 +327,7 @@ void ShapeController::executeDispatch_FormatArea() { SfxItemPool& rItemPool = pDrawViewWrapper->GetModel()->GetItemPool(); SfxItemSet aSet( rItemPool, rItemPool.GetFirstWhich(), rItemPool.GetLastWhich() ); - const SvxColorTableItem* pColorItem = static_cast< const SvxColorTableItem* >( aSet.GetItem( SID_COLOR_TABLE ) ); - if ( pColorItem && pColorItem->GetColorTable() == &XColorList::GetStdColorTable() ) - { - pDlg->DontDeleteColorTable(); - } + const SvxColorListItem* pColorItem = static_cast< const SvxColorListItem* >( aSet.GetItem( SID_COLOR_TABLE ) ); if ( pDlg->Execute() == RET_OK ) { const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx index f2ae17ddb2a5..57ef7477b367 100644 --- a/chart2/source/inc/chartview/DrawModelWrapper.hxx +++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx @@ -96,12 +96,12 @@ public: getUnoModel(); SdrModel& getSdrModel(); - XColorList* GetColorTable() const; - XDashList* GetDashList() const; - XLineEndList* GetLineEndList() const; - XGradientList* GetGradientList() const; - XHatchList* GetHatchList() const; - XBitmapList* GetBitmapList() const; + XColorListRef GetColorList() const; + XDashListRef GetDashList() const; + XLineEndListRef GetLineEndList() const; + XGradientListRef GetGradientList() const; + XHatchListRef GetHatchList() const; + XBitmapListRef GetBitmapList() const; SdrObject* getNamedSdrObject( const rtl::OUString& rName ); static SdrObject* getNamedSdrObject( const String& rName, SdrObjList* pObjList ); diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index 44f2f37c36b7..0a009b41074e 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -339,27 +339,27 @@ const SfxItemPool& DrawModelWrapper::GetItemPool() const { return this->SdrModel::GetItemPool(); } -XColorList* DrawModelWrapper::GetColorTable() const +XColorListRef DrawModelWrapper::GetColorList() const { - return this->SdrModel::GetColorTable(); + return this->SdrModel::GetColorList(); } -XDashList* DrawModelWrapper::GetDashList() const +XDashListRef DrawModelWrapper::GetDashList() const { return this->SdrModel::GetDashList(); } -XLineEndList* DrawModelWrapper::GetLineEndList() const +XLineEndListRef DrawModelWrapper::GetLineEndList() const { return this->SdrModel::GetLineEndList(); } -XGradientList* DrawModelWrapper::GetGradientList() const +XGradientListRef DrawModelWrapper::GetGradientList() const { return this->SdrModel::GetGradientList(); } -XHatchList* DrawModelWrapper::GetHatchList() const +XHatchListRef DrawModelWrapper::GetHatchList() const { return this->SdrModel::GetHatchList(); } -XBitmapList* DrawModelWrapper::GetBitmapList() const +XBitmapListRef DrawModelWrapper::GetBitmapList() const { return this->SdrModel::GetBitmapList(); } diff --git a/cui/source/dialogs/sdrcelldlg.cxx b/cui/source/dialogs/sdrcelldlg.cxx index 99596c1123c7..1f45fc831a85 100644 --- a/cui/source/dialogs/sdrcelldlg.cxx +++ b/cui/source/dialogs/sdrcelldlg.cxx @@ -39,7 +39,7 @@ SvxFormatCellsDialog::SvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel ) : SfxTabDialog ( pParent, CUI_RES( RID_SVX_FORMAT_CELLS_DLG ), pAttr ) , mrOutAttrs ( *pAttr ) -, mpColorTab ( pModel->GetColorTable() ) +, mpColorTab ( pModel->GetColorList() ) , mpGradientList ( pModel->GetGradientList() ) , mpHatchingList ( pModel->GetHatchList() ) , mpBitmapList ( pModel->GetBitmapList() ) @@ -62,7 +62,7 @@ void SvxFormatCellsDialog::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 ); diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 08a1068f471d..e7c4574f6aef 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -905,11 +905,6 @@ String AbstractSvxAreaTabDialog_Impl::GetText() const return pDlg->GetText(); } -void AbstractSvxAreaTabDialog_Impl::DontDeleteColorTable() -{ - return pDlg->DontDeleteColorTable(); -} - void AbstractSvxPostItDialog_Impl::SetText( const XubString& rStr ) { pDlg->SetText( rStr ); diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 79cdbe7dad0b..a5a54335a4ea 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -503,7 +503,7 @@ class AbstractGraphicFilterDialog_Impl :public AbstractGraphicFilterDialog }; //for GraphicFilterDialog end -//add for SvxAreaTabDialog begin +// add for SvxAreaTabDialog begin class SvxAreaTabDialog; class AbstractSvxAreaTabDialog_Impl :public AbstractSvxAreaTabDialog { @@ -512,12 +512,11 @@ class AbstractSvxAreaTabDialog_Impl :public AbstractSvxAreaTabDialog virtual const SfxItemSet* GetOutputItemSet() const; virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ); virtual void SetInputSet( const SfxItemSet* pInSet ); - //From class Window. + // From class Window. virtual void SetText( const XubString& rStr ); virtual String GetText() const; - virtual void DontDeleteColorTable() ; }; -//add for SvxAreaTabDialog end +// add for SvxAreaTabDialog end class AbstractInsertObjectDialog_Impl : public SfxAbstractInsertObjectDialog { diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index a7ce897d3f06..6bec35fa33e1 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -39,14 +39,14 @@ class SvxAreaTabDialog : public SfxTabDialog private: SdrModel* mpDrawModel; - XColorList* mpColorTab; - XColorList* mpNewColorTab; - XGradientList* mpGradientList; - XGradientList* mpNewGradientList; - XHatchList* mpHatchingList; - XHatchList* mpNewHatchingList; - XBitmapList* mpBitmapList; - XBitmapList* mpNewBitmapList; + XColorListRef mpColorTab; + XColorListRef mpNewColorTab; + XGradientListRef mpGradientList; + XGradientListRef mpNewGradientList; + XHatchListRef mpHatchingList; + XHatchListRef mpNewHatchingList; + XBitmapListRef mpBitmapList; + XBitmapListRef mpNewBitmapList; const SfxItemSet& mrOutAttrs; @@ -59,7 +59,6 @@ private: sal_uInt16 mnDlgType; sal_uInt16 mnPos; sal_Bool mbAreaTP; - sal_Bool mbDeleteColorTable; virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); @@ -76,29 +75,27 @@ public: const SdrView* pSdrView = NULL ); ~SvxAreaTabDialog(); - void SetNewColorTable( XColorList* pColTab ) + void SetNewColorTable( XColorListRef pColTab ) { mpNewColorTab = pColTab; } - XColorList* GetNewColorTable() const { return mpNewColorTab; } - const XColorList* GetColorTable() const { return mpColorTab; } + XColorListRef GetNewColorTable() const { return mpNewColorTab; } + const XColorListRef GetColorList() const { return mpColorTab; } - void SetNewGradientList( XGradientList* pGrdLst) + void SetNewGradientList( XGradientListRef pGrdLst) { mpNewGradientList = pGrdLst; } - XGradientList* GetNewGradientList() const + XGradientListRef GetNewGradientList() const { return mpNewGradientList; } - const XGradientList* GetGradientList() const { return mpGradientList; } + const XGradientListRef GetGradientList() const { return mpGradientList; } - void SetNewHatchingList( XHatchList* pHtchLst) + void SetNewHatchingList( XHatchListRef pHtchLst) { mpNewHatchingList = pHtchLst; } - XHatchList* GetNewHatchingList() const + XHatchListRef GetNewHatchingList() const { return mpNewHatchingList; } - const XHatchList* GetHatchingList() const { return mpHatchingList; } + const XHatchListRef GetHatchingList() const { return mpHatchingList; } - void SetNewBitmapList( XBitmapList* pBmpLst) + void SetNewBitmapList( XBitmapListRef pBmpLst) { mpNewBitmapList = pBmpLst; } - XBitmapList* GetNewBitmapList() const { return mpNewBitmapList; } - const XBitmapList* GetBitmapList() const { return mpBitmapList; } - - void DontDeleteColorTable() { mbDeleteColorTable = sal_False; } + XBitmapListRef GetNewBitmapList() const { return mpNewBitmapList; } + const XBitmapListRef GetBitmapList() const { return mpBitmapList; } }; /************************************************************************/ @@ -231,10 +228,10 @@ private: const SfxItemSet& rOutAttrs; RECT_POINT eRP; - XColorList* pColorTab; - XGradientList* pGradientList; - XHatchList* pHatchingList; - XBitmapList* pBitmapList; + XColorListRef pColorTab; + XGradientListRef pGradientList; + XHatchListRef pHatchingList; + XBitmapListRef pBitmapList; ChangeType* pnColorTableState; ChangeType* pnBitmapListState; @@ -286,12 +283,12 @@ public: virtual int DeactivatePage( SfxItemSet* pSet ); virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - void SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; } - void SetGradientList( XGradientList* pGrdLst) + void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetGradientList( XGradientListRef pGrdLst) { pGradientList = pGrdLst; } - void SetHatchingList( XHatchList* pHtchLst) + void SetHatchingList( XHatchListRef pHtchLst) { pHatchingList = pHtchLst; } - void SetBitmapList( XBitmapList* pBmpLst) { pBitmapList = pBmpLst; } + void SetBitmapList( XBitmapListRef pBmpLst) { pBitmapList = pBmpLst; } void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; } void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; } @@ -326,7 +323,7 @@ private: const SfxItemSet& rOutAttrs; RECT_POINT eRP; - XColorList* pColorTab; + XColorListRef pColorTab; ChangeType* pnColorTableState; sal_uInt16 nPageType; sal_uInt16 nDlgType; @@ -358,7 +355,7 @@ public: virtual int DeactivatePage( SfxItemSet* pSet ); virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - void SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; } void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; } void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } @@ -402,8 +399,8 @@ private: const SfxItemSet& rOutAttrs; - XColorList* pColorTab; - XGradientList* pGradientList; + XColorListRef pColorTab; + XGradientListRef pGradientList; ChangeType* pnGradientListState; ChangeType* pnColorTableState; @@ -443,8 +440,8 @@ public: virtual void ActivatePage( const SfxItemSet& rSet ); virtual int DeactivatePage( SfxItemSet* pSet ); - void SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; } - void SetGradientList( XGradientList* pGrdLst) + void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetGradientList( XGradientListRef pGrdLst) { pGradientList = pGrdLst; } void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } @@ -485,8 +482,8 @@ private: const SfxItemSet& rOutAttrs; RECT_POINT eRP; - XColorList* pColorTab; - XHatchList* pHatchingList; + XColorListRef pColorTab; + XHatchListRef pHatchingList; ChangeType* pnHatchingListState; ChangeType* pnColorTableState; @@ -529,8 +526,8 @@ public: virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - void SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; } - void SetHatchingList( XHatchList* pHtchLst) + void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetHatchingList( XHatchListRef pHtchLst) { pHatchingList = pHtchLst; } void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } @@ -573,8 +570,8 @@ private: const SfxItemSet& rOutAttrs; - XColorList* pColorTab; - XBitmapList* pBitmapList; + XColorListRef pColorTab; + XBitmapListRef pBitmapList; ChangeType* pnBitmapListState; ChangeType* pnColorTableState; @@ -619,8 +616,8 @@ public: virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - void SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; } - void SetBitmapList( XBitmapList* pBmpLst) { pBitmapList = pBmpLst; } + void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetBitmapList( XBitmapListRef pBmpLst) { pBitmapList = pBmpLst; } void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } @@ -651,7 +648,7 @@ public: // FIXME: privatise these members ... ImageButton aBtnSave; SvxLoadSaveEmbed( Window *pParent, const ResId &aLoad, const ResId &aSave, const ResId &aEmbed ); - XPropertyList *GetList(); + XPropertyListRef GetList(); void HideLoadSaveEmbed(); bool GetEmbed(); void SetEmbed( bool bEmbed ); @@ -672,7 +669,7 @@ private: ColorLB aLbColor; FixedText aTableNameFT; - ValueSet aValSetColorTable; + ValueSet aValSetColorList; SvxXRectPreview aCtlPreviewOld; SvxXRectPreview aCtlPreviewNew; @@ -695,14 +692,13 @@ private: const SfxItemSet& rOutAttrs; - XColorList* pColorTab; + XColorListRef pColorTab; ChangeType* pnColorTableState; sal_uInt16* pPageType; sal_uInt16* pDlgType; sal_uInt16* pPos; sal_Bool* pbAreaTP; - sal_Bool bDeleteColorTable; XOutdevItemPool* pXPool; XFillStyleItem aXFStyleItem; @@ -751,7 +747,7 @@ public: virtual void ActivatePage( const SfxItemSet& rSet ); virtual int DeactivatePage( SfxItemSet* pSet ); - void SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } @@ -760,8 +756,6 @@ public: void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } - void SetDeleteColorTable( sal_Bool bIn ) { bDeleteColorTable = bIn; } - virtual void FillUserData(); }; diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index 31481a571114..8d8d456f7020 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -30,13 +30,7 @@ // include --------------------------------------------------------------- #include <vector> - #include <svx/tabline.hxx> -/************************************************************************* -|* -|* Transform-Tab-Dialog -|* -\************************************************************************/ class SvxLineTabDialog : public SfxTabDialog { @@ -46,12 +40,12 @@ private: const SfxItemSet& rOutAttrs; - XColorList* pColorTab; - XColorList* mpNewColorTab; - XDashList* pDashList; - XDashList* pNewDashList; - XLineEndList* pLineEndList; - XLineEndList* pNewLineEndList; + XColorListRef pColorTab; + XColorListRef mpNewColorTab; + XDashListRef pDashList; + XDashListRef pNewDashList; + XLineEndListRef pLineEndList; + XLineEndListRef pNewLineEndList; sal_Bool bObjSelected; ChangeType nLineEndListState; @@ -64,7 +58,6 @@ private: sal_uInt16 nPosLineEndLb; sal_uInt16 mnPos; sal_Bool mbAreaTP; - sal_Bool mbDeleteColorTable; virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); @@ -81,19 +74,19 @@ public: sal_Bool bHasObj = sal_True ); ~SvxLineTabDialog(); - void SetNewDashList( XDashList* pInLst) + void SetNewDashList( XDashListRef pInLst) { pNewDashList = pInLst; } - XDashList* GetNewDashList() const { return pNewDashList; } - const XDashList* GetDashList() const { return pDashList; } + XDashListRef GetNewDashList() const { return pNewDashList; } + XDashListRef GetDashList() const { return pDashList; } - void SetNewLineEndList( XLineEndList* pInLst) + void SetNewLineEndList( XLineEndListRef pInLst) { pNewLineEndList = pInLst; } - XLineEndList* GetNewLineEndList() const { return pNewLineEndList; } - const XLineEndList* GetLineEndList() const { return pLineEndList; } + XLineEndListRef GetNewLineEndList() const { return pNewLineEndList; } + XLineEndListRef GetLineEndList() const { return pLineEndList; } - void SetNewColorTable( XColorList* pColTab ) { mpNewColorTab = pColTab; } - XColorList* GetNewColorTable() const { return mpNewColorTab; } - const XColorList* GetColorTable() const { return pColorTab; } + void SetNewColorTable( XColorListRef pColTab ) { mpNewColorTab = pColTab; } + XColorListRef GetNewColorTable() const { return mpNewColorTab; } + XColorListRef GetColorList() const { return pColorTab; } }; /************************************************************************* @@ -172,9 +165,9 @@ private: XLineAttrSetItem aXLineAttr; SfxItemSet& rXLSet; - XColorList* pColorTab; - XDashList* pDashList; - XLineEndList* pLineEndList; + XColorListRef pColorTab; + XDashListRef pDashList; + XLineEndListRef pLineEndList; ChangeType* pnLineEndListState; ChangeType* pnDashListState; @@ -232,9 +225,9 @@ public: virtual void FillUserData(); - void SetColorTable( XColorList* pColTab ) { pColorTab = pColTab; } - void SetDashList( XDashList* pDshLst ) { pDashList = pDshLst; } - void SetLineEndList( XLineEndList* pLneEndLst) { pLineEndList = pLneEndLst; } + void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetDashList( XDashListRef pDshLst ) { pDashList = pDshLst; } + void SetLineEndList( XLineEndListRef pLneEndLst) { pLineEndList = pLneEndLst; } void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; } void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; } @@ -295,7 +288,7 @@ private: XLineAttrSetItem aXLineAttr; SfxItemSet& rXLSet; - XDashList* pDashList; + XDashListRef pDashList; ChangeType* pnDashListState; sal_uInt16* pPageType; @@ -336,7 +329,7 @@ public: virtual void ActivatePage( const SfxItemSet& rSet ); virtual int DeactivatePage( SfxItemSet* pSet ); - void SetDashList( XDashList* pDshLst ) { pDashList = pDshLst; } + void SetDashList( XDashListRef pDshLst ) { pDashList = pDshLst; } void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; } void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } @@ -384,7 +377,7 @@ private: XLineAttrSetItem aXLineAttr; SfxItemSet& rXLSet; - XLineEndList* pLineEndList; + XLineEndListRef pLineEndList; ChangeType* pnLineEndListState; sal_uInt16* pPageType; @@ -416,7 +409,7 @@ public: virtual void ActivatePage( const SfxItemSet& rSet ); virtual int DeactivatePage( SfxItemSet* pSet ); - void SetLineEndList( XLineEndList* pInList ) { pLineEndList = pInList; } + void SetLineEndList( XLineEndListRef pInList ) { pLineEndList = pInList; } void SetPolyObj( const SdrObject* pObj ) { pPolyObj = pObj; } void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; } diff --git a/cui/source/inc/sdrcelldlg.hxx b/cui/source/inc/sdrcelldlg.hxx index 5760c58c8b6e..3714d3c59b51 100644 --- a/cui/source/inc/sdrcelldlg.hxx +++ b/cui/source/inc/sdrcelldlg.hxx @@ -31,22 +31,18 @@ #include <sfx2/tabdlg.hxx> +#include <svx/xtable.hxx> -class XColorList; -class XGradientList; -class XHatchList; -class XBitmapList; class SdrModel; - class SvxFormatCellsDialog : public SfxTabDialog { private: const SfxItemSet& mrOutAttrs; - XColorList* mpColorTab; - XGradientList* mpGradientList; - XHatchList* mpHatchingList; - XBitmapList* mpBitmapList; + XColorListRef mpColorTab; + XGradientListRef mpGradientList; + XHatchListRef mpHatchingList; + XBitmapListRef mpBitmapList; protected: virtual void Apply(); diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx index 178786e0be4a..a5b7fd312848 100644 --- a/cui/source/inc/treeopt.hxx +++ b/cui/source/inc/treeopt.hxx @@ -34,6 +34,7 @@ #include <vcl/image.hxx> #include <vcl/fixbrd.hxx> #include <vcl/fixed.hxx> +#include <svx/xtable.hxx> #include <vector> @@ -200,7 +201,7 @@ private: // for the ColorTabPage SfxItemSet* pColorPageItemSet; - XColorList* pColorTab; + XColorListRef pColorList; sal_uInt16 nChangeType; sal_uInt16 nUnknownType; sal_uInt16 nUnknownPos; @@ -271,8 +272,8 @@ public: void ActivatePage( const String& rPageURL ); void ApplyItemSets(); - sal_uInt16 GetColorChanged() const { return nChangeType; } - XColorList* GetColorTable() { return pColorTab; } + sal_uInt16 GetColorChanged() const { return nChangeType; } + XColorListRef GetColorList() { return pColorList; } // helper functions to call the language settings TabPage from the SpellDialog static void ApplyLanguageOptions(const SfxItemSet& rSet); diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx index 969eae062fb2..bac4fb45bfc8 100644 --- a/cui/source/options/cfgchart.cxx +++ b/cui/source/options/cfgchart.cxx @@ -310,7 +310,7 @@ int SvxChartColorTableItem::operator==( const SfxPoolItem& rAttr ) const const SvxChartColorTableItem * rCTItem( dynamic_cast< const SvxChartColorTableItem * >( & rAttr )); if( rCTItem ) { - return (this->m_aColorTable == rCTItem->GetColorTable()); + return (this->m_aColorTable == rCTItem->GetColorList()); } return 0; @@ -323,12 +323,12 @@ void SvxChartColorTableItem::SetOptions( SvxChartOptions* pOpts ) const } -SvxChartColorTable & SvxChartColorTableItem::GetColorTable() +SvxChartColorTable & SvxChartColorTableItem::GetColorList() { return m_aColorTable; } -const SvxChartColorTable & SvxChartColorTableItem::GetColorTable() const +const SvxChartColorTable & SvxChartColorTableItem::GetColorList() const { return m_aColorTable; } diff --git a/cui/source/options/cfgchart.hxx b/cui/source/options/cfgchart.hxx index 95e038557779..7fcf8e2c0d94 100644 --- a/cui/source/options/cfgchart.hxx +++ b/cui/source/options/cfgchart.hxx @@ -110,8 +110,8 @@ public: virtual int operator==( const SfxPoolItem& ) const; void SetOptions( SvxChartOptions* pOpts ) const; - const SvxChartColorTable & GetColorTable() const ; - SvxChartColorTable & GetColorTable(); + const SvxChartColorTable & GetColorList() const ; + SvxChartColorTable & GetColorList(); void ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry ); private: diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index 0279a352b6df..9200d647cf31 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -81,7 +81,7 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage( Window* pParent, const SfxItemSe aValSetColorBox.Show(); pChartOptions = new SvxChartOptions; - pColorTab = new XColorList( SvtPathOptions().GetPalettePath() ); + pColorList = XColorList::CreateStdColorList(); const SfxPoolItem* pItem = NULL; if ( rInAttrs.GetItemState( SID_SCH_EDITOPTIONS, sal_False, &pItem ) == SFX_ITEM_SET ) @@ -102,18 +102,17 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage( Window* pParent, const SfxItemSe SvxDefaultColorOptPage::~SvxDefaultColorOptPage() { // save changes - pChartOptions->SetDefaultColors( pColorConfig->GetColorTable() ); + pChartOptions->SetDefaultColors( pColorConfig->GetColorList() ); pChartOptions->Commit(); delete pColorConfig; - delete pColorTab; delete pChartOptions; } void SvxDefaultColorOptPage::Construct() { if( pColorConfig ) - aLbChartColors.FillBox( pColorConfig->GetColorTable() ); + aLbChartColors.FillBox( pColorConfig->GetColorList() ); FillColorBox(); @@ -143,9 +142,9 @@ void SvxDefaultColorOptPage::Reset( const SfxItemSet& ) void SvxDefaultColorOptPage::FillColorBox() { - if( !pColorTab ) return; + if( !pColorList.is() ) return; - long nCount = pColorTab->Count(); + long nCount = pColorList->Count(); XColorEntry* pColorEntry; if( nCount > 104 ) @@ -153,7 +152,7 @@ void SvxDefaultColorOptPage::FillColorBox() for( long i = 0; i < nCount; i++ ) { - pColorEntry = pColorTab->GetColor( i ); + pColorEntry = pColorList->GetColor( i ); aValSetColorBox.InsertItem( (sal_uInt16) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() ); } } @@ -161,16 +160,16 @@ void SvxDefaultColorOptPage::FillColorBox() long SvxDefaultColorOptPage::GetColorIndex( const Color& rCol ) { - if( pColorTab ) + if( pColorList.is() ) { - long nCount = pColorTab->Count(); + long nCount = pColorList->Count(); XColorEntry* pColorEntry; for( long i = nCount - 1; i >= 0; i-- ) // default chart colors are at the end of the table { - pColorEntry = pColorTab->GetColor( i ); + pColorEntry = pColorList->GetColor( i ); if( pColorEntry && pColorEntry->GetColor() == rCol ) - return SAL_STATIC_CAST( XPropertyList*, pColorTab )->Get( pColorEntry->GetName() ); + return pColorList->Get( pColorEntry->GetName() ); } } return -1L; @@ -189,10 +188,10 @@ IMPL_LINK( SvxDefaultColorOptPage, ResetToDefaults, void *, EMPTYARG ) { if( pColorConfig ) { - pColorConfig->GetColorTable().useDefault(); + pColorConfig->GetColorList().useDefault(); aLbChartColors.Clear(); - aLbChartColors.FillBox( pColorConfig->GetColorTable() ); + aLbChartColors.FillBox( pColorConfig->GetColorList() ); aLbChartColors.GetFocus(); aLbChartColors.SelectEntryPos( 0 ); @@ -211,13 +210,13 @@ IMPL_LINK( SvxDefaultColorOptPage, AddChartColor, void *, EMPTYARG ) { ColorData black = RGB_COLORDATA( 0x00, 0x00, 0x00 ); - pColorConfig->GetColorTable().append (XColorEntry ( black, pColorConfig->GetColorTable().getDefaultName(pColorConfig->GetColorTable().size()))); + pColorConfig->GetColorList().append (XColorEntry ( black, pColorConfig->GetColorList().getDefaultName(pColorConfig->GetColorList().size()))); aLbChartColors.Clear(); - aLbChartColors.FillBox( pColorConfig->GetColorTable() ); + aLbChartColors.FillBox( pColorConfig->GetColorList() ); aLbChartColors.GetFocus(); - aLbChartColors.SelectEntryPos( pColorConfig->GetColorTable().size() - 1 ); + aLbChartColors.SelectEntryPos( pColorConfig->GetColorList().size() - 1 ); aPBRemove.Enable( sal_True ); } @@ -236,21 +235,21 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, PushButton*, pButton ) if( pColorConfig ) { - OSL_ENSURE(pColorConfig->GetColorTable().size() > 1, "don't delete the last chart color"); + OSL_ENSURE(pColorConfig->GetColorList().size() > 1, "don't delete the last chart color"); QueryBox aQuery(pButton, CUI_RES(RID_OPTQB_COLOR_CHART_DELETE)); aQuery.SetText(String(CUI_RES(RID_OPTSTR_COLOR_CHART_DELETE))); if(RET_YES == aQuery.Execute()) { - pColorConfig->GetColorTable().remove( nIndex ); + pColorConfig->GetColorList().remove( nIndex ); aLbChartColors.Clear(); - aLbChartColors.FillBox( pColorConfig->GetColorTable() ); + aLbChartColors.FillBox( pColorConfig->GetColorList() ); aLbChartColors.GetFocus(); if (nIndex == aLbChartColors.GetEntryCount() && aLbChartColors.GetEntryCount() > 0) - aLbChartColors.SelectEntryPos( pColorConfig->GetColorTable().size() - 1 ); + aLbChartColors.SelectEntryPos( pColorConfig->GetColorList().size() - 1 ); else if (aLbChartColors.GetEntryCount() > 0) aLbChartColors.SelectEntryPos( nIndex ); else @@ -261,30 +260,20 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, PushButton*, pButton ) return 0L; } -// ListClickedHdl -// -------------- - -IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ChartColorLB*, pColorList ) +IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ChartColorLB*, _pColorList ) { - Color aCol = pColorList->GetSelectEntryColor(); + Color aCol = _pColorList->GetSelectEntryColor(); long nIndex = GetColorIndex( aCol ); if( nIndex == -1 ) // not found - { aValSetColorBox.SetNoSelection(); - } else - { aValSetColorBox.SelectItem( (sal_uInt16)nIndex + 1 ); // ValueSet is 1-based - } return 0L; } -// BoxClickedHdl -// ------------- - IMPL_LINK( SvxDefaultColorOptPage, BoxClickedHdl, ValueSet*, EMPTYARG ) { sal_uInt16 nIdx = aLbChartColors.GetSelectEntryPos(); diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx index 1b2d528e59df..3d9bd772f657 100644 --- a/cui/source/options/optchart.hxx +++ b/cui/source/options/optchart.hxx @@ -67,7 +67,7 @@ private: SvxChartOptions* pChartOptions; SvxChartColorTableItem* pColorConfig; - XColorList* pColorTab; + XColorListRef pColorList; DECL_LINK( ResetToDefaults, void * ); DECL_LINK( AddChartColor, void * ); 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 ) ); } } } 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) diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index ee55c3d8845c..83d694da668f 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -684,26 +684,26 @@ namespace pcr :OColorControl_Base( PropertyControlType::ColorListBox, pParent, nWinStyle ) { // initialize the color listbox - XColorList* pColorTable = NULL; + XColorListRef pColorList; SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = pDocSh ? pDocSh->GetItem( SID_COLOR_TABLE ) : NULL; if ( pItem ) { - DBG_ASSERT(pItem->ISA(SvxColorTableItem), "OColorControl::OColorControl: invalid color item!"); - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + DBG_ASSERT(pItem->ISA(SvxColorListItem), "OColorControl::OColorControl: invalid color item!"); + pColorList = ( (SvxColorListItem*)pItem )->GetColorList(); } - if ( !pColorTable ) - pColorTable = &XColorList::GetStdColorTable(); + if ( !pColorList.is() ) + pColorList = XColorList::GetStdColorList(); - DBG_ASSERT(pColorTable, "OColorControl::OColorControl: no color table!"); + DBG_ASSERT(pColorList, "OColorControl::OColorControl: no color table!"); - if (pColorTable) + if ( pColorList.is() ) { - for (sal_uInt16 i = 0; i < pColorTable->Count(); ++i) + for (sal_uInt16 i = 0; i < pColorList->Count(); ++i) { - XColorEntry* pEntry = pColorTable->GetColor( i ); + XColorEntry* pEntry = pColorList->GetColor( i ); getTypedControlWindow()->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); } } diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index aad4c9bc5fd0..a5d55fbe6278 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -151,9 +151,9 @@ OColorPopup::OColorPopup(Window* _pParent,Condition* _pCondition) m_aColorSet.SetHelpId( HID_RPT_POPUP_COLOR_CTRL ); SetHelpId( HID_RPT_POPUP_COLOR ); const Size aSize12( 13, 13 ); - ::std::auto_ptr<XColorList> pColorTable(new XColorList( SvtPathOptions().GetPalettePath() )); short i = 0; - long nCount = pColorTable->Count(); + XColorListRef pColorList( XColorList::CreateStdColorList() ); + long nCount = pColorList->Count(); XColorEntry* pEntry = NULL; Color aColWhite( COL_WHITE ); String aStrWhite( ModuleRes(STR_COLOR_WHITE) ); @@ -164,7 +164,7 @@ OColorPopup::OColorPopup(Window* _pParent,Condition* _pCondition) for ( i = 0; i < nCount; i++ ) { - pEntry = pColorTable->GetColor(i); + pEntry = pColorList->GetColor(i); m_aColorSet.InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() ); } diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 4904169a89ab..e8e815ee5cc4 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -660,7 +660,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow ); SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr<FontList> pFontList(new FontList( pParent )); - ::std::auto_ptr<XColorList> pColorTable( new XColorList( SvtPathOptions().GetPalettePath() )); + XColorListRef pColorList( XColorList::CreateStdColorList() ); SAL_WNODEPRECATED_DECLARATIONS_POP SfxPoolItem* pDefaults[] = { @@ -682,7 +682,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep new SvxEscapementItem(ITEMID_ESCAPEMENT), new SvxFontListItem(pFontList.get(),ITEMID_FONTLIST), new SvxAutoKernItem(sal_False,ITEMID_AUTOKERN), - new SvxColorTableItem(pColorTable.get(),ITEMID_COLOR_TABLE), + new SvxColorListItem(pColorList.get(),ITEMID_COLOR_TABLE), new SvxBlinkItem(sal_False,ITEMID_BLINK), new SvxEmphasisMarkItem(EMPHASISMARK_NONE,ITEMID_EMPHASISMARK), new SvxTwoLinesItem(sal_True,0,0,ITEMID_TWOLINES), @@ -777,18 +777,9 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent,pDescriptor.get(),pModel.get() )); SAL_WNODEPRECATED_DECLARATIONS_POP - // #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*>( pDescriptor->GetItem(SID_COLOR_TABLE) ); - if (pColorItem && pColorItem->GetColorTable() == &XColorList::GetStdColorTable()) - pDialog->DontDeleteColorTable(); - bSuccess = ( RET_OK == pDialog->Execute() ); - if ( bSuccess ) - { + if ( ( bSuccess = ( RET_OK == pDialog->Execute() ) ) ) lcl_fillItemsToShape(_xShape,*pDialog->GetOutputItemSet()); - } } - } catch(uno::Exception&) { diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 30a3639989b4..0d1e13de9363 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -235,7 +235,7 @@ private: SfxPrinter* pPrinter; VirtualDevice* pVirtualDevice_100th_mm; ScDrawLayer* pDrawLayer; // SdrModel - XColorList* pColorTable; + rtl::Reference<XColorList> pColorList; ScConditionalFormatList* pCondFormList; // conditional formats ScValidationDataList* pValidationList; // validity SvNumberFormatterIndexTable* pFormatExchangeList; // for application of number formats @@ -433,8 +433,8 @@ public: void GetDocStat( ScDocStat& rDocStat ); - SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL ); - XColorList* GetColorTable(); + SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL ); + rtl::Reference<XColorList> GetColorList(); SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager() const; @@ -1837,7 +1837,6 @@ private: // CLOOK-Impl-methods 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/sdi/docsh.sdi b/sc/sdi/docsh.sdi index edf00e877e1f..3cc5609918e2 100644 --- a/sc/sdi/docsh.sdi +++ b/sc/sdi/docsh.sdi @@ -100,7 +100,7 @@ interface TableDocument SID_REIMPORT_AFTER_LOAD [ ExecMethod = Execute; ] SID_AUTO_STYLE [ ExecMethod = Execute; ] - SID_GET_COLORTABLE [ ExecMethod = Execute; ] + SID_GET_COLORLIST [ ExecMethod = Execute; ] FID_CHG_RECORD [ ExecMethod = Execute; StateMethod = GetState; ] SID_DOCUMENT_COMPARE [ ExecMethod = Execute; StateMethod = GetState; ] diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 2c6cee5e1bbd..97d834455659 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -37,6 +37,7 @@ #include <editeng/editeng.hxx> #include <editeng/forbiddencharacterstable.hxx> +#include <svx/xtable.hxx> #include <sfx2/linkmgr.hxx> #include <svx/svdpool.hxx> #include <svx/svdobj.hxx> @@ -135,7 +136,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, pPrinter( NULL ), pVirtualDevice_100th_mm( NULL ), pDrawLayer( NULL ), - pColorTable( NULL ), pCondFormList( NULL ), pValidationList( NULL ), pFormatExchangeList( NULL ), @@ -451,7 +451,6 @@ ScDocument::~ScDocument() xPoolHelper->SourceDocumentGone(); xPoolHelper.clear(); - DeleteColorTable(); delete pScriptTypeData; delete pOtherObjects; delete pRecursionHelper; diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index f7561608e50d..87115e4c4af5 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -83,19 +83,15 @@ void ScDocument::BeginDrawUndo() pDrawLayer->BeginCalcUndo(); } -XColorList* ScDocument::GetColorTable() +rtl::Reference<XColorList> ScDocument::GetColorList() { if (pDrawLayer) - return pDrawLayer->GetColorTable(); + return pDrawLayer->GetColorList(); else { - if (!pColorTable) - { - SvtPathOptions aPathOpt; - pColorTable = new XColorList( aPathOpt.GetPalettePath() ); - } - - return pColorTable; + if (!pColorList.is()) + pColorList = XColorList::CreateStdColorList(); + return pColorList; } } @@ -239,7 +235,7 @@ sal_Bool ScDocument::IsChart( const SdrObject* pObject ) IMPL_LINK_INLINE_START( ScDocument, GetUserDefinedColor, sal_uInt16 *, pColorIndex ) { - return (long) &((GetColorTable()->GetColor(*pColorIndex))->GetColor()); + return (long) &((GetColorList()->GetColor(*pColorIndex))->GetColor()); } IMPL_LINK_INLINE_END( ScDocument, GetUserDefinedColor, sal_uInt16 *, pColorIndex ) @@ -248,11 +244,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 9ef0e337bef5..6e22a8c42625 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -236,17 +236,17 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const String& rName ) : pGlobalDrawPersist = NULL; // nur einmal benutzen SfxObjectShell* pObjSh = pDocument ? pDocument->GetDocumentShell() : NULL; + XColorListRef pXCol = XColorList::GetStdColorList(); if ( pObjSh ) { SetObjectShell( pObjSh ); // set color table - SvxColorTableItem* pColItem = (SvxColorTableItem*) pObjSh->GetItem( SID_COLOR_TABLE ); - XColorList* pXCol = pColItem ? pColItem->GetColorTable() : &XColorList::GetStdColorTable(); - SetColorTable( pXCol ); + SvxColorListItem* pColItem = (SvxColorListItem*) pObjSh->GetItem( SID_COLOR_TABLE ); + if ( pColItem ) + pXCol = pColItem->GetColorList(); } - else - SetColorTable( &XColorList::GetStdColorTable() ); + SetPropertyList( static_cast<XPropertyList *> (pXCol.get()) ); SetSwapGraphics(sal_True); 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() ); } diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx index 02a9b7d372fb..09aabe3a87b5 100644 --- a/sd/inc/sdabstdlg.hxx +++ b/sd/inc/sdabstdlg.hxx @@ -30,6 +30,7 @@ // include --------------------------------------------------------------- +#include <rtl/ref.hxx> #include <tools/solar.h> #include <tools/string.hxx> #include <sfx2/sfxdlg.hxx> @@ -188,7 +189,7 @@ public: static SdAbstractDialogFactory* Create(); virtual VclAbstractDialog* CreateBreakDlg(::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ) = 0; - virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorList* pColTab, ::sd::View* pView ) = 0; + virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, const rtl::Reference<XColorList> &pColTab, ::sd::View* pView ) = 0; virtual AbstractSdCustomShowDlg* CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc ) = 0; virtual SfxAbstractTabDialog* CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ) = 0; virtual SfxAbstractTabDialog* CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage = sal_True ) = 0; diff --git a/sd/sdi/_docsh.sdi b/sd/sdi/_docsh.sdi index c63d20c0f5f6..178d0dcf26e9 100644 --- a/sd/sdi/_docsh.sdi +++ b/sd/sdi/_docsh.sdi @@ -71,7 +71,7 @@ interface DrawDocument Cachable ; ] - SID_GET_COLORTABLE + SID_GET_COLORLIST [ ExecMethod = Execute; ] diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index cdd455a4ebfe..4c2f535df793 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -223,32 +223,25 @@ ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, Window* pParent, con SfxObjectShell* pDocSh = SfxObjectShell::Current(); DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorList* pColorTable = NULL; - bool bKillTable = false; + XColorListRef pColorList; const SfxPoolItem* pItem = NULL; if ( pDocSh && ( ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != 0) ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorList = ( (SvxColorListItem*)pItem )->GetColorList(); - if ( !pColorTable ) - { - pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); - bKillTable = sal_True; - } + if ( !pColorList.is() ) + pColorList = XColorList::CreateStdColorList(); sal_Int32 nColor = 0; rValue >>= nColor; - 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); sal_uInt16 nPos = mpControl->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); if( pEntry->GetColor().GetRGBColor() == (sal_uInt32)nColor ) mpControl->SelectEntryPos( nPos ); } - - if ( bKillTable ) - delete pColorTable; } // -------------------------------------------------------------------- @@ -1231,36 +1224,28 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( Window* pParent, con // fill the color box SfxObjectShell* pDocSh = SfxObjectShell::Current(); DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorList* pColorTable = NULL; - bool bKillTable = false; + XColorListRef pColorList; const SfxPoolItem* pItem = NULL; if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != 0 ) ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorList = ( (SvxColorListItem*)pItem )->GetColorList(); - if ( !pColorTable ) - { - pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); - bKillTable = sal_True; - } + if ( !pColorList.is() ) + pColorList = XColorList::CreateStdColorList(); mpCLBDimColor->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); mpCLBDimColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); } mpCLBDimColor->SetUpdateMode( sal_True ); - if ( bKillTable ) - delete pColorTable; - // // init settings controls // - int nOffsetY = 0; int nOffsetX = 0; diff --git a/sd/source/ui/dlg/celltempl.cxx b/sd/source/ui/dlg/celltempl.cxx index 195b59d46019..5be01ee3e09c 100644 --- a/sd/source/ui/dlg/celltempl.cxx +++ b/sd/source/ui/dlg/celltempl.cxx @@ -58,7 +58,7 @@ SdPresCellTemplateDlg::SdPresCellTemplateDlg( SdrModel* pModel, Window* pParent, SfxStyleSheetBase& rStyleBase ) : SfxStyleDialog( pParent, SdResId(TAB_CELL_TEMPLATE), rStyleBase, sal_False ) -, mpColorTab( pModel->GetColorTable() ) +, mpColorList( pModel->GetColorList() ) , mpGradientList( pModel->GetGradientList() ) , mpHatchingList( pModel->GetHatchList() ) , mpBitmapList( pModel->GetBitmapList() ) @@ -86,7 +86,7 @@ void SdPresCellTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) case RID_SVXPAGE_AREA: { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - aSet.Put (SvxColorTableItem(mpColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(mpColorList,SID_COLOR_TABLE)); aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST)); aSet.Put (SvxHatchListItem(mpHatchingList,SID_HATCH_LIST)); aSet.Put (SvxBitmapListItem(mpBitmapList,SID_BITMAP_LIST)); diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index 2fb53f0b9d8d..83144e7d82ba 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -67,7 +67,7 @@ namespace sd { CopyDlg::CopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, - XColorList* pColTab, + const XColorListRef &pColList, ::sd::View* pInView ) : SfxModalDialog ( pWindow, SdResId( DLG_COPY ) ), maFtCopies ( this, SdResId( FT_COPIES ) ), @@ -94,10 +94,10 @@ CopyDlg::CopyDlg( maBtnCancel ( this, SdResId( BTN_CANCEL ) ), maBtnHelp ( this, SdResId( BTN_HELP ) ), maBtnSetDefault ( this, SdResId( BTN_SET_DEFAULT ) ), - mrOutAttrs ( rInAttrs ), - mpColorTab ( pColTab ), + mrOutAttrs ( rInAttrs ), + mpColorList ( pColList ), maUIScale(pInView->GetDoc()->GetUIScale()), - mpView ( pInView ) + mpView ( pInView ) { FreeResource(); @@ -105,8 +105,8 @@ CopyDlg::CopyDlg( maBtnSetViewData.SetAccessibleName (maBtnSetViewData.GetQuickHelpText()); // Farbtabellen - DBG_ASSERT( mpColorTab, "Keine gueltige ColorTable uebergeben!" ); - maLbStartColor.Fill( mpColorTab ); + DBG_ASSERT( mpColorList, "Keine gueltige ColorTable uebergeben!" ); + maLbStartColor.Fill( mpColorList ); maLbEndColor.CopyEntries( maLbStartColor ); maLbStartColor.SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) ); diff --git a/sd/source/ui/dlg/dlgpage.cxx b/sd/source/ui/dlg/dlgpage.cxx index f09c6ea21db5..6d34292ae9cc 100644 --- a/sd/source/ui/dlg/dlgpage.cxx +++ b/sd/source/ui/dlg/dlgpage.cxx @@ -57,7 +57,7 @@ SdPageDlg::SdPageDlg( SfxObjectShell* pDocSh, Window* pParent, const SfxItemSet* mrOutAttrs ( *pAttr ), mpDocShell ( pDocSh ) { - SvxColorTableItem aColorTableItem(*( (const SvxColorTableItem*) + SvxColorListItem aColorListItem(*( (const SvxColorListItem*) ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) ); SvxGradientListItem aGradientListItem(*( (const SvxGradientListItem*) ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) ); @@ -66,7 +66,7 @@ SdPageDlg::SdPageDlg( SfxObjectShell* pDocSh, Window* pParent, const SfxItemSet* SvxHatchListItem aHatchListItem(*( (const SvxHatchListItem*) ( mpDocShell->GetItem( SID_HATCH_LIST ) ) ) ); - mpColorTab = aColorTableItem.GetColorTable(); + mpColorList = aColorListItem.GetColorList(); mpGradientList = aGradientListItem.GetGradientList(); mpHatchingList = aHatchListItem.GetHatchList(); mpBitmapList = aBitmapListItem.GetBitmapList(); @@ -99,7 +99,7 @@ void SdPageDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) rPage.PageCreated(aSet); break; case RID_SVXPAGE_AREA: - aSet.Put (SvxColorTableItem(mpColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(mpColorList,SID_COLOR_TABLE)); aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST)); aSet.Put (SvxHatchListItem(mpHatchingList,SID_HATCH_LIST)); aSet.Put (SvxBitmapListItem(mpBitmapList,SID_BITMAP_LIST)); diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx index 112eb6e3c68e..a7c06e56b151 100644 --- a/sd/source/ui/dlg/prltempl.cxx +++ b/sd/source/ui/dlg/prltempl.cxx @@ -136,7 +136,7 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, FreeResource(); - SvxColorTableItem aColorTableItem(*( (const SvxColorTableItem*) + SvxColorListItem aColorListItem(*( (const SvxColorListItem*) ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) ); SvxGradientListItem aGradientListItem(*( (const SvxGradientListItem*) ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) ); @@ -149,7 +149,7 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, SvxLineEndListItem aLineEndListItem(*( (const SvxLineEndListItem*) ( mpDocShell->GetItem( SID_LINEEND_LIST ) ) ) ); - pColorTab = aColorTableItem.GetColorTable(); + pColorTab = aColorListItem.GetColorList(); pDashList = aDashListItem.GetDashList(); pLineEndList = aLineEndListItem.GetLineEndList(); pGradientList = aGradientListItem.GetGradientList(); @@ -261,7 +261,7 @@ void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { case RID_SVXPAGE_LINE: { - aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(pColorTab,SID_COLOR_TABLE)); aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST)); aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST)); aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); @@ -272,7 +272,7 @@ void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) case RID_SVXPAGE_AREA: { - aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(pColorTab,SID_COLOR_TABLE)); aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST)); aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST)); aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST)); @@ -285,7 +285,7 @@ void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) break; case RID_SVXPAGE_SHADOW: - aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(pColorTab,SID_COLOR_TABLE)); aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); rPage.PageCreated(aSet); diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 57683a9f5f19..4b9eda9134b1 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -396,7 +396,8 @@ VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateBreakDlg( //add for CopyDlg begin AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, - XColorList* pColTab, ::sd::View* pView ) //add for CopyDlg + const rtl::Reference<XColorList> &pColTab, + ::sd::View* pView ) //add for CopyDlg { return new AbstractCopyDlg_Impl( new ::sd::CopyDlg( pWindow, rInAttrs, pColTab, pView ) ); } diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index 4b6f4b76002e..9a0f5f829d1e 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -260,7 +260,7 @@ class SdAbstractDialogFactory_Impl : public SdAbstractDialogFactory public: virtual VclAbstractDialog* CreateBreakDlg(::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ); - virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorList* pColTab, ::sd::View* pView ); + virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, const rtl::Reference<XColorList> &pColTab, ::sd::View* pView ); virtual AbstractSdCustomShowDlg* CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc ); virtual SfxAbstractTabDialog* CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ); virtual SfxAbstractTabDialog* CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage = sal_True ); diff --git a/sd/source/ui/dlg/tabtempl.cxx b/sd/source/ui/dlg/tabtempl.cxx index fc8333658ba1..17fee1a6e186 100644 --- a/sd/source/ui/dlg/tabtempl.cxx +++ b/sd/source/ui/dlg/tabtempl.cxx @@ -74,7 +74,7 @@ SdTabTemplateDlg::SdTabTemplateDlg( Window* pParent, SfxStyleDialog ( pParent, SdResId( TAB_TEMPLATE ), rStyleBase, sal_False ), rDocShell ( *pDocShell ), pSdrView ( pView ), - pColorTab ( pModel->GetColorTable() ), + pColorList ( pModel->GetColorList() ), pGradientList ( pModel->GetGradientList() ), pHatchingList ( pModel->GetHatchList() ), pBitmapList ( pModel->GetBitmapList() ), @@ -128,7 +128,7 @@ void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) switch( nId ) { case RID_SVXPAGE_LINE: - aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE)); aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST)); aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST)); aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); @@ -136,7 +136,7 @@ void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) break; case RID_SVXPAGE_AREA: - aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE)); aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST)); aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST)); aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST)); @@ -149,7 +149,7 @@ void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) break; case RID_SVXPAGE_SHADOW: - aSet.Put (SvxColorTableItem(pColorTab,SID_COLOR_TABLE)); + aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE)); aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType)); rPage.PageCreated(aSet); diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 988b288871e0..0e64d8940d6f 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -187,9 +187,9 @@ void SdTPAction::SetView( const ::sd::View* pSdView ) aLbTree.SetViewFrame( pFrame ); aLbTreeDocument.SetViewFrame( pFrame ); - SvxColorTableItem aItem( *(const SvxColorTableItem*)( pDocSh->GetItem( SID_COLOR_TABLE ) ) ); - pColTab = aItem.GetColorTable(); - DBG_ASSERT( pColTab, "Keine Farbtabelle vorhanden!" ); + SvxColorListItem aItem( *(const SvxColorListItem*)( pDocSh->GetItem( SID_COLOR_TABLE ) ) ); + pColList = aItem.GetColorList(); + DBG_ASSERT( pColList, "Keine Farbtabelle vorhanden!" ); } else { diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index c853a6c72d8a..75cbaf86d656 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -188,12 +188,11 @@ void DrawDocShell::Execute( SfxRequest& rReq ) } 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/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index d87363f30b06..ce1f9469a6d6 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -443,7 +443,7 @@ void DrawDocShell::Deactivate( sal_Bool ) void DrawDocShell::UpdateTablePointers() { - PutItem( SvxColorTableItem( mpDoc->GetColorTable(), SID_COLOR_TABLE ) ); + PutItem( SvxColorListItem( mpDoc->GetColorList(), SID_COLOR_TABLE ) ); PutItem( SvxGradientListItem( mpDoc->GetGradientList(), SID_GRADIENT_LIST ) ); PutItem( SvxHatchListItem( mpDoc->GetHatchList(), SID_HATCH_LIST ) ); PutItem( SvxBitmapListItem( mpDoc->GetBitmapList(), SID_BITMAP_LIST ) ); diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index 85cd8cc5945a..79d10da3a998 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -592,9 +592,9 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj) ::basegfx::B2DPolyPolygon getPolygon( sal_uInt16 nResId, SdrModel* pDoc ) { ::basegfx::B2DPolyPolygon aRetval; - XLineEndList* pLineEndList = pDoc->GetLineEndList(); + XLineEndListRef pLineEndList = pDoc->GetLineEndList(); - if( pLineEndList ) + if( pLineEndList.is() ) { String aArrowName( SVX_RES(nResId) ); long nCount = pLineEndList->Count(); diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx index ee83ece60cc9..2ecfccc95f3c 100644 --- a/sd/source/ui/func/fucopy.cxx +++ b/sd/source/ui/func/fucopy.cxx @@ -119,7 +119,7 @@ void FuCopy::DoExecute( SfxRequest& rReq ) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); if( pFact ) { - AbstractCopyDlg* pDlg = pFact->CreateCopyDlg(NULL, aSet, mpDoc->GetColorTable(), mpView ); + AbstractCopyDlg* pDlg = pFact->CreateCopyDlg(NULL, aSet, mpDoc->GetColorList(), mpView ); if( pDlg ) { sal_uInt16 nResult = pDlg->Execute(); diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx index b3086c316e21..023b1f376bef 100644 --- a/sd/source/ui/func/fulinend.cxx +++ b/sd/source/ui/func/fulinend.cxx @@ -111,7 +111,7 @@ void FuLineEnd::DoExecute( SfxRequest& ) // Loeschen des angelegten PolyObjektes SdrObject::Free( pConvPolyObj ); - XLineEndList* pLineEndList = mpDoc->GetLineEndList(); + XLineEndListRef pLineEndList = mpDoc->GetLineEndList(); XLineEndEntry* pEntry; String aNewName( SdResId( STR_LINEEND ) ); diff --git a/sd/source/ui/inc/celltempl.hxx b/sd/source/ui/inc/celltempl.hxx index ca2b3736e345..621c7507541f 100644 --- a/sd/source/ui/inc/celltempl.hxx +++ b/sd/source/ui/inc/celltempl.hxx @@ -41,10 +41,10 @@ class SdrModel; class SdPresCellTemplateDlg : public SfxStyleDialog { private: - XColorList* mpColorTab; - XGradientList* mpGradientList; - XHatchList* mpHatchingList; - XBitmapList* mpBitmapList; + XColorListRef mpColorTab; + XGradientListRef mpGradientList; + XHatchListRef mpHatchingList; + XBitmapListRef mpBitmapList; virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); virtual const SfxItemSet* GetRefreshedSet(); diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index 17da615a5583..1fa4e08342e9 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -52,7 +52,7 @@ class CopyDlg { public: CopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, - XColorList* pColTab, ::sd::View* pView ); + const XColorListRef &pColList, ::sd::View* pView ); ~CopyDlg(); void GetAttr( SfxItemSet& rOutAttrs ); @@ -89,7 +89,7 @@ private: PushButton maBtnSetDefault; const SfxItemSet& mrOutAttrs; - XColorList* mpColorTab; + XColorListRef mpColorList; Fraction maUIScale; ::sd::View* mpView; diff --git a/sd/source/ui/inc/dlgpage.hxx b/sd/source/ui/inc/dlgpage.hxx index 40b931ae0e80..1b7e8de35862 100644 --- a/sd/source/ui/inc/dlgpage.hxx +++ b/sd/source/ui/inc/dlgpage.hxx @@ -53,10 +53,10 @@ private: const SfxObjectShell* mpDocShell; - XColorList* mpColorTab; - XGradientList* mpGradientList; - XHatchList* mpHatchingList; - XBitmapList* mpBitmapList; + XColorListRef mpColorList; + XGradientListRef mpGradientList; + XHatchListRef mpHatchingList; + XBitmapListRef mpBitmapList; public: SdPageDlg( SfxObjectShell* pDocSh, Window* pParent, const SfxItemSet* pAttr, sal_Bool bAreaPage = sal_True ); diff --git a/sd/source/ui/inc/prltempl.hxx b/sd/source/ui/inc/prltempl.hxx index 3d502708f066..eafa1a3fc1b0 100644 --- a/sd/source/ui/inc/prltempl.hxx +++ b/sd/source/ui/inc/prltempl.hxx @@ -57,12 +57,12 @@ class SdPresLayoutTemplateDlg : public SfxTabDialog private: const SfxObjectShell* mpDocShell; - XColorList* pColorTab; - XGradientList* pGradientList; - XHatchList* pHatchingList; - XBitmapList* pBitmapList; - XDashList* pDashList; - XLineEndList* pLineEndList; + XColorListRef pColorTab; + XGradientListRef pGradientList; + XHatchListRef pHatchingList; + XBitmapListRef pBitmapList; + XDashListRef pDashList; + XLineEndListRef pLineEndList; sal_uInt16 nPageType; sal_uInt16 nDlgType; diff --git a/sd/source/ui/inc/tabtempl.hxx b/sd/source/ui/inc/tabtempl.hxx index fccf3f789276..005dd57bc26c 100644 --- a/sd/source/ui/inc/tabtempl.hxx +++ b/sd/source/ui/inc/tabtempl.hxx @@ -54,12 +54,12 @@ private: const SfxObjectShell& rDocShell; SdrView* pSdrView; - XColorList* pColorTab; - XGradientList* pGradientList; - XHatchList* pHatchingList; - XBitmapList* pBitmapList; - XDashList* pDashList; - XLineEndList* pLineEndList; + XColorListRef pColorList; + XGradientListRef pGradientList; + XHatchListRef pHatchingList; + XBitmapListRef pBitmapList; + XDashListRef pDashList; + XLineEndListRef pLineEndList; sal_uInt16 nPageType; sal_uInt16 nDlgType; diff --git a/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx index f3fd62d5e6c0..4dd08c840162 100644 --- a/sd/source/ui/inc/tpaction.hxx +++ b/sd/source/ui/inc/tpaction.hxx @@ -93,7 +93,7 @@ private: const SfxItemSet& rOutAttrs; const ::sd::View* mpView; SdDrawDocument* mpDoc; - XColorList* pColTab; + XColorListRef pColList; sal_Bool bTreeUpdated; std::vector<com::sun::star::presentation::ClickAction> maCurrentActions; diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index ffd645e03248..56d8a850ff3e 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -237,35 +237,6 @@ DocumentSettings::~DocumentSettings() throw() { } -static inline bool SetPropertyList( SdDrawDocument *pDoc, XPropertyListType t, XPropertyList *pList ) -{ - switch (t) { - case XCOLOR_LIST: pDoc->SetColorTable( static_cast<XColorList *>(pList) ); break; - case XDASH_LIST: pDoc->SetDashList( static_cast<XDashList *>(pList) ); break; - case XLINE_END_LIST: pDoc->SetLineEndList( static_cast<XLineEndList *>(pList) ); break; - case XHATCH_LIST: pDoc->SetHatchList( static_cast<XHatchList *>(pList) ); break; - case XGRADIENT_LIST: pDoc->SetGradientList( static_cast<XGradientList *>(pList) ); break; - case XBITMAP_LIST: pDoc->SetBitmapList( static_cast<XBitmapList *>(pList) ); break; - default: - return false; - } - return true; -} - -static inline XPropertyList *GetPropertyList( SdDrawDocument *pDoc, XPropertyListType t) -{ - switch (t) { - case XCOLOR_LIST: return pDoc->GetColorTable(); - case XDASH_LIST: return pDoc->GetDashList(); - case XLINE_END_LIST: return pDoc->GetLineEndList(); - case XHATCH_LIST: return pDoc->GetHatchList(); - case XGRADIENT_LIST: return pDoc->GetGradientList(); - case XBITMAP_LIST: return pDoc->GetBitmapList(); - default: - return NULL; - } -} - bool DocumentSettings::LoadList( XPropertyListType t, const rtl::OUString &rInPath, const uno::Reference< embed::XStorage > &xStorage ) { @@ -280,14 +251,15 @@ bool DocumentSettings::LoadList( XPropertyListType t, const rtl::OUString &rInPa aPath = rInPath.copy( 0, nSlash ); } - XPropertyList *pList = XPropertyList::CreatePropertyList( + XPropertyListRef pList = XPropertyList::CreatePropertyList( t, aPath, (XOutdevItemPool*)&pDoc->GetPool() ); pList->SetName( aName ); if( pList->LoadFrom( xStorage, rInPath ) ) - return SetPropertyList( pDoc, t, pList ); - else - delete pList; + { + pDoc->SetPropertyList( pList ); + return true; + } return false; } @@ -369,9 +341,8 @@ uno::Sequence<beans::PropertyValue> SdDrawDocument* pDoc = mpModel->GetDoc(); for( size_t i = 0; i < SAL_N_ELEMENTS( aURLPropertyNames ); i++ ) { - XPropertyListType t = (XPropertyListType) i; - XPropertyList *pList = GetPropertyList( pDoc, t ); - if( ( bHasEmbed = pList && pList->IsEmbedInDocument() ) ) + XPropertyListRef pList = pDoc->GetPropertyList( (XPropertyListType) i ); + if( ( bHasEmbed = pList.is() && pList->IsEmbedInDocument() ) ) break; } if( !bHasEmbed ) @@ -392,8 +363,8 @@ uno::Sequence<beans::PropertyValue> XPropertyListType t = getTypeOfName( aConfigProps[i].Name ); aRet[i] = aConfigProps[i]; if (t >= 0) { - XPropertyList *pList = GetPropertyList( pDoc, t ); - if( !pList || !pList->IsEmbedInDocument() ) + XPropertyListRef pList = pDoc->GetPropertyList( t ); + if( !pList.is() || !pList->IsEmbedInDocument() ) continue; // no change ... else { @@ -967,8 +938,8 @@ void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, c void DocumentSettings::ExtractURL( XPropertyListType t, Any* pValue ) { - XPropertyList *pList = GetPropertyList( mpModel->GetDoc(), t ); - if( !pList ) + XPropertyListRef pList = mpModel->GetDoc()->GetPropertyList( t ); + if( !pList.is() ) return; INetURLObject aPathURL( pList->GetPath() ); diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index 73c4eded2346..9d93c312adde 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -166,9 +166,7 @@ void DrawViewShell::GetFormTextState(SfxItemSet& rSet) else { if ( pDlg ) - { - pDlg->SetColorTable(GetDoc()->GetColorTable()); - } + pDlg->SetColorList(GetDoc()->GetColorList()); SfxItemSet aSet( GetDoc()->GetPool() ); mpDrawView->GetAttributes( aSet ); @@ -420,8 +418,8 @@ void DrawViewShell::GetBmpMaskState( SfxItemSet& rSet ) { pDlg = (SvxBmpMask*) ( GetViewFrame()->GetChildWindow( nId )->GetWindow() ); - if ( pDlg->NeedsColorTable() ) - pDlg->SetColorTable( GetDoc()->GetColorTable() ); + if ( pDlg->NeedsColorList() ) + pDlg->SetColorList( GetDoc()->GetColorList() ); } if ( rMarkList.GetMarkCount() == 1 ) diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index c1b3cbf249f1..9a9b67cc5f79 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -371,7 +371,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False); SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False); - XGradientList *pGradientList = GetDoc()->GetGradientList (); + XGradientListRef pGradientList = GetDoc()->GetGradientList (); long nCounts = pGradientList->Count (); Color aColor ((sal_uInt8) pRed->GetValue (), (sal_uInt8) pGreen->GetValue (), @@ -431,7 +431,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False); SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False); - XHatchList *pHatchList = GetDoc()->GetHatchList (); + XHatchListRef pHatchList = GetDoc()->GetHatchList (); long nCounts = pHatchList->Count (); Color aColor ((sal_uInt8) pRed->GetValue (), (sal_uInt8) pGreen->GetValue (), @@ -496,7 +496,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->ClearItem (XATTR_LINEDASH); pAttr->ClearItem (XATTR_LINESTYLE); - XDashList *pDashList = GetDoc()->GetDashList (); + XDashListRef pDashList = GetDoc()->GetDashList(); long nCounts = pDashList->Count (); XDashEntry *pEntry = new XDashEntry (aNewDash, pName->GetValue ()); long i; @@ -548,7 +548,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->ClearItem (XATTR_FILLGRADIENT); pAttr->ClearItem (XATTR_FILLSTYLE); - XGradientList *pGradientList = GetDoc()->GetGradientList (); + XGradientListRef pGradientList = GetDoc()->GetGradientList (); long nCounts = pGradientList->Count (); long i; @@ -614,7 +614,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->ClearItem (XATTR_FILLHATCH); pAttr->ClearItem (XATTR_FILLSTYLE); - XHatchList *pHatchList = GetDoc()->GetHatchList (); + XHatchListRef pHatchList = GetDoc()->GetHatchList (); long nCounts = pHatchList->Count (); long i; @@ -664,7 +664,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) { SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False); - XGradientList *pGradientList = GetDoc()->GetGradientList (); + XGradientListRef pGradientList = GetDoc()->GetGradientList (); long nCounts = pGradientList->Count (); for (long i = 0; @@ -698,7 +698,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) { SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False); - XHatchList *pHatchList = GetDoc()->GetHatchList (); + XHatchListRef pHatchList = GetDoc()->GetHatchList (); long nCounts = pHatchList->Count (); for (long i = 0; diff --git a/svx/inc/svx/bmpmask.hxx b/svx/inc/svx/bmpmask.hxx index 6848337a85ef..407cf5ee8c37 100644 --- a/svx/inc/svx/bmpmask.hxx +++ b/svx/inc/svx/bmpmask.hxx @@ -124,7 +124,7 @@ class SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow CheckBox aCbxTrans; ColorLB aLbColorTrans; - const XColorList* pColTab; + XColorListRef pColLst; Color aPipetteColor; SvxBmpMaskSelectItem aSelItem; @@ -164,8 +164,8 @@ public: void SetColor( const Color& rColor ); void PipetteClicked(); - sal_Bool NeedsColorTable() const; - void SetColorTable( const XColorList* pColorTable ); + sal_Bool NeedsColorList() const; + void SetColorList( const XColorListRef &pColorList ); void SetExecState( sal_Bool bEnable ); diff --git a/svx/inc/svx/colrctrl.hxx b/svx/inc/svx/colrctrl.hxx index 9470c78657b6..39ebc0520023 100644 --- a/svx/inc/svx/colrctrl.hxx +++ b/svx/inc/svx/colrctrl.hxx @@ -33,9 +33,9 @@ #include <svtools/valueset.hxx> #include <svtools/transfer.hxx> #include <svl/lstner.hxx> -#include "svx/svxdllapi.h" +#include <svx/svxdllapi.h> +#include <svx/xtable.hxx> -class XColorList; class SvData; /************************************************************************* @@ -100,7 +100,7 @@ class SvxColorDockingWindow : public SfxDockingWindow, public SfxListener friend class SvxColorChildWindow; private: - XColorList* pColorTable; + XColorListRef pColorList; SvxColorValueSet aColorSet; sal_uInt16 nLeftSlot; sal_uInt16 nRightSlot; diff --git a/svx/inc/svx/dlgctrl.hxx b/svx/inc/svx/dlgctrl.hxx index a02103de842f..2ed5e7ebe698 100644 --- a/svx/inc/svx/dlgctrl.hxx +++ b/svx/inc/svx/dlgctrl.hxx @@ -35,24 +35,7 @@ #include "svx/svxdllapi.h" #include <svx/rectenum.hxx> #include <vcl/graph.hxx> -#ifndef _XTABLE_HXX -class XBitmapEntry; -class XBitmapList; -class XColorEntry; -class XColorList; -class XDash; -class XDashEntry; -class XDashList; -class XGradient; -class XGradientEntry; -class XGradientList; -class XHatch; -class XHatchEntry; -class XHatchList; -class XLineEndEntry; -class XLineEndList; -class XFillAttrSetItem; -#endif +#include <svx/xtable.hxx> class XOBitmap; class XOutdevItemPool; @@ -62,11 +45,10 @@ namespace com { namespace sun { namespace star { namespace awt { } } } } /************************************************************************* -|* |* Derived from SfxTabPage for being able to get notified through the |* virtual method from the control. -|* \************************************************************************/ + class SvxTabPage : public SfxTabPage { @@ -78,11 +60,10 @@ public: }; /************************************************************************* -|* |* Control for display and selection of the corner and center points of |* an object -|* \************************************************************************/ + typedef sal_uInt16 CTL_STATE; #define CS_NOHORZ 1 // no horizontal input information is used #define CS_NOVERT 2 // no vertikal input information is used @@ -154,11 +135,10 @@ public: }; /************************************************************************* -|* |* Control for display and selecton of the angle of the corner points |* of an object -|* \************************************************************************/ + class SvxAngleCtl : public SvxRectCtl { private: @@ -179,9 +159,7 @@ public: }; /************************************************************************* -|* |* Preview control for the display of bitmaps -|* \************************************************************************/ class SVX_DLLPUBLIC SvxBitmapCtl @@ -196,7 +174,7 @@ public: SvxBitmapCtl( Window* pParent, const Size& rSize ); ~SvxBitmapCtl(); - XOBitmap GetXBitmap(); + XOBitmap GetXBitmap(); void SetBmpArray( const sal_uInt16* pPixel ) { pBmpArray = pPixel; } void SetLines( sal_uInt16 nLns ) { nLines = nLns; } @@ -205,10 +183,9 @@ public: }; /************************************************************************* -|* |* Control for editing bitmaps -|* \************************************************************************/ + class SVX_DLLPUBLIC SvxPixelCtl : public Control { private: @@ -250,11 +227,8 @@ public: void Reset(); }; -/************************************************************************* -|* -|* ColorLB can be filled with colors and names -|* -\************************************************************************/ +/************************************************************************/ + class SVX_DLLPUBLIC ColorLB : public ColorListBox { @@ -262,68 +236,54 @@ public: ColorLB( Window* pParent, ResId Id ) : ColorListBox( pParent, Id ) {} ColorLB( Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {} - virtual void Fill( const XColorList* pTab ); + virtual void Fill( const XColorListRef &pTab ); void Append( XColorEntry* pEntry, Bitmap* pBmp = NULL ); void Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); }; -/************************************************************************* -|* -|* HatchingLB -|* -\************************************************************************/ +/************************************************************************/ + class SVX_DLLPUBLIC HatchingLB : public ListBox { - + XHatchListRef mpList; + sal_Bool mbUserDraw; public: - HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True ); + HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True ); - virtual void Fill( const XHatchList* pList ); + virtual void Fill( const XHatchListRef &pList ); virtual void UserDraw( const UserDrawEvent& rUDEvt ); void Append( XHatchEntry* pEntry, Bitmap* pBmp = NULL ); void Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); - -private: - XHatchList* mpList; - sal_Bool mbUserDraw; }; -/************************************************************************* -|* -|* GradientLB -|* -\************************************************************************/ +/************************************************************************/ + class SVX_DLLPUBLIC GradientLB : public ListBox { + XGradientListRef mpList; + sal_Bool mbUserDraw; public: GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True ); - virtual void Fill( const XGradientList* pList ); + virtual void Fill( const XGradientListRef &pList ); virtual void UserDraw( const UserDrawEvent& rUDEvt ); void Append( XGradientEntry* pEntry, Bitmap* pBmp = NULL ); void Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); - void SelectEntryByList( const XGradientList* pList, const String& rStr, - const XGradient& rXGradient, sal_uInt16 nDist = 0 ); - -private: - XGradientList* mpList; - sal_Bool mbUserDraw; + void SelectEntryByList( const XGradientListRef &pList, const String& rStr, + const XGradient& rXGradient, sal_uInt16 nDist = 0 ); }; -/************************************************************************* -|* -|* BitmapLB -|* -\************************************************************************/ +/************************************************************************/ + class SVX_DLLPUBLIC BitmapLB : public ListBox { public: - BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True ); + BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True ); - virtual void Fill( const XBitmapList* pList ); + virtual void Fill( const XBitmapListRef &pList ); virtual void UserDraw( const UserDrawEvent& rUDEvt ); void Append( XBitmapEntry* pEntry, Bitmap* pBmp = NULL ); @@ -333,17 +293,14 @@ private: VirtualDevice aVD; Bitmap aBitmap; - XBitmapList* mpList; - sal_Bool mbUserDraw; + XBitmapListRef mpList; + sal_Bool mbUserDraw; SVX_DLLPRIVATE void SetVirtualDevice(); }; -/************************************************************************* -|* -|* FillAttrLB unites all fill attributes an a ListBox -|* -\************************************************************************/ +/************************************************************************/ + class FillAttrLB : public ColorListBox { private: @@ -355,17 +312,14 @@ private: public: FillAttrLB( Window* pParent, WinBits aWB ); - virtual void Fill( const XColorList* pTab ); - virtual void Fill( const XHatchList* pList ); - virtual void Fill( const XGradientList* pList ); - virtual void Fill( const XBitmapList* pList ); + virtual void Fill( const XColorListRef &pList ); + virtual void Fill( const XHatchListRef &pList ); + virtual void Fill( const XGradientListRef &pList ); + virtual void Fill( const XBitmapListRef &pList ); }; -/************************************************************************* -|* -|* FillTypeLB -|* -\************************************************************************/ +/************************************************************************/ + class FillTypeLB : public ListBox { @@ -376,11 +330,8 @@ public: virtual void Fill(); }; -/************************************************************************* -|* -|* LineLB -|* -\************************************************************************/ +/************************************************************************/ + class SVX_DLLPUBLIC LineLB : public ListBox { @@ -388,18 +339,15 @@ public: LineLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {} LineLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {} - virtual void Fill( const XDashList* pList ); + virtual void Fill( const XDashListRef &pList ); void Append( XDashEntry* pEntry, Bitmap* pBmp = NULL ); void Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); void FillStyles(); }; -/************************************************************************* -|* -|* LineEndsLB -|* -\************************************************************************/ +/************************************************************************/ + class SVX_DLLPUBLIC LineEndLB : public ListBox { @@ -407,7 +355,7 @@ public: LineEndLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {} LineEndLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {} - virtual void Fill( const XLineEndList* pList, sal_Bool bStart = sal_True ); + virtual void Fill( const XLineEndListRef &pList, sal_Bool bStart = sal_True ); void Append( XLineEndEntry* pEntry, Bitmap* pBmp = NULL, sal_Bool bStart = sal_True ); diff --git a/svx/inc/svx/drawitem.hxx b/svx/inc/svx/drawitem.hxx index 6264ccbbd27b..8aaec07c864a 100644 --- a/svx/inc/svx/drawitem.hxx +++ b/svx/inc/svx/drawitem.hxx @@ -31,26 +31,25 @@ // include --------------------------------------------------------------- #include <svl/poolitem.hxx> +#include <svx/xtable.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/drawing/LineDash.hpp> #include "svx/svxdllapi.h" //================================================================== -// SvxColorTableItem +// SvxColorListItem //================================================================== -class XColorList; - -class SVX_DLLPUBLIC SvxColorTableItem: public SfxPoolItem +class SVX_DLLPUBLIC SvxColorListItem: public SfxPoolItem { - XColorList* pColorTable; + XColorListRef pColorList; public: TYPEINFO(); - SvxColorTableItem(); - SvxColorTableItem( XColorList* pTable, + SvxColorListItem(); + SvxColorListItem( XColorListRef pTable, sal_uInt16 nWhich ); - SvxColorTableItem( const SvxColorTableItem& ); + SvxColorListItem( const SvxColorListItem& ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -62,9 +61,8 @@ public: virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ); - XColorList* GetColorTable() const { return pColorTable; } - void SetColorTable( XColorList* pTable ) { - pColorTable = pTable; } + XColorListRef GetColorList() const { return pColorList; } + void SetColorList( const XColorListRef &pTable ) { pColorList = pTable; } }; @@ -72,17 +70,14 @@ public: // SvxGradientListItem //================================================================== - -class XGradientList; - class SVX_DLLPUBLIC SvxGradientListItem: public SfxPoolItem { - XGradientList* pGradientList; + XGradientListRef pGradientList; public: TYPEINFO(); SvxGradientListItem(); - SvxGradientListItem( XGradientList* pList, + SvxGradientListItem( XGradientListRef pList, sal_uInt16 nWhich ); SvxGradientListItem( const SvxGradientListItem& ); @@ -96,28 +91,23 @@ public: virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ); - XGradientList* GetGradientList() const { return pGradientList; } - void SetGradientList( XGradientList* pList ) { + XGradientListRef GetGradientList() const { return pGradientList; } + void SetGradientList( XGradientListRef pList ) { pGradientList = pList; } }; - //================================================================== // SvxHatchListItem //================================================================== - - -class XHatchList; - class SVX_DLLPUBLIC SvxHatchListItem: public SfxPoolItem { - XHatchList* pHatchList; + XHatchListRef pHatchList; public: TYPEINFO(); SvxHatchListItem(); - SvxHatchListItem( XHatchList* pList, + SvxHatchListItem( XHatchListRef pList, sal_uInt16 nWhich ); SvxHatchListItem( const SvxHatchListItem& ); @@ -131,8 +121,8 @@ public: virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ); - XHatchList* GetHatchList() const { return pHatchList; } - void SetHatchList( XHatchList* pList ) { + XHatchListRef GetHatchList() const { return pHatchList; } + void SetHatchList( XHatchListRef pList ) { pHatchList = pList; } }; @@ -141,18 +131,14 @@ public: //================================================================== // SvxBitmapListItem //================================================================== - - -class XBitmapList; - class SVX_DLLPUBLIC SvxBitmapListItem: public SfxPoolItem { - XBitmapList* pBitmapList; + XBitmapListRef pBitmapList; public: TYPEINFO(); SvxBitmapListItem(); - SvxBitmapListItem( XBitmapList* pBL, + SvxBitmapListItem( XBitmapListRef pBL, sal_uInt16 nWhich ); SvxBitmapListItem( const SvxBitmapListItem& ); @@ -166,8 +152,8 @@ public: virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ); - XBitmapList* GetBitmapList() const { return pBitmapList; } - void SetBitmapList( XBitmapList* pList ) { + XBitmapListRef GetBitmapList() const { return pBitmapList; } + void SetBitmapList( XBitmapListRef pList ) { pBitmapList = pList; } }; @@ -176,18 +162,14 @@ public: //================================================================== // SvxDashListItem //================================================================== - - -class XDashList; - class SVX_DLLPUBLIC SvxDashListItem: public SfxPoolItem { - XDashList* pDashList; + XDashListRef pDashList; public: TYPEINFO(); SvxDashListItem(); - SvxDashListItem( XDashList* pList, + SvxDashListItem( XDashListRef pList, sal_uInt16 nWhich ); SvxDashListItem( const SvxDashListItem& ); @@ -201,26 +183,21 @@ public: virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ); - XDashList* GetDashList() const { return pDashList; } + XDashListRef GetDashList() const { return pDashList; } }; - //================================================================== // SvxLineEndListItem //================================================================== - - -class XLineEndList; - class SVX_DLLPUBLIC SvxLineEndListItem: public SfxPoolItem { - XLineEndList* pLineEndList; + XLineEndListRef pLineEndList; public: TYPEINFO(); SvxLineEndListItem(); - SvxLineEndListItem( XLineEndList* pList, + SvxLineEndListItem( XLineEndListRef pList, sal_uInt16 nWhich ); SvxLineEndListItem( const SvxLineEndListItem& ); @@ -234,8 +211,8 @@ public: virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ); - XLineEndList* GetLineEndList() const { return pLineEndList; } - void SetLineEndList( XLineEndList* pList ) { + XLineEndListRef GetLineEndList() const { return pLineEndList; } + void SetLineEndList( XLineEndListRef pList ) { pLineEndList = pList; } }; diff --git a/svx/inc/svx/fontwork.hxx b/svx/inc/svx/fontwork.hxx index bd67fd103c6c..347864342c8c 100644 --- a/svx/inc/svx/fontwork.hxx +++ b/svx/inc/svx/fontwork.hxx @@ -135,7 +135,7 @@ class SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow ImageList maImageList; - const XColorList* pColorTable; + XColorListRef pColorList; #ifdef _SVX_FONTWORK_CXX friend class SvxFontWorkChildWindow; @@ -181,7 +181,7 @@ class SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow const ResId& rResId ); ~SvxFontWorkDialog(); - void SetColorTable(const XColorList* pTable); + void SetColorList(const XColorListRef &pTable); void SetActive(sal_Bool bActivate = sal_True); void CreateStdFormObj(SdrView& rView, SdrPageView& rPV, diff --git a/svx/inc/svx/linectrl.hxx b/svx/inc/svx/linectrl.hxx index c5a3ca384bb9..2c3d10c7b751 100644 --- a/svx/inc/svx/linectrl.hxx +++ b/svx/inc/svx/linectrl.hxx @@ -32,14 +32,14 @@ #include <svtools/valueset.hxx> #include <svl/lstner.hxx> #include <sfx2/tbxctrl.hxx> -#include "svx/svxdllapi.h" +#include <svx/svxdllapi.h> +#include <svx/xtable.hxx> class XLineStyleItem; class XLineDashItem; class SvxLineBox; class SvxMetricField; class SvxColorBox; -class XLineEndList; //======================================================================== // SvxLineStyleController: @@ -108,7 +108,7 @@ class SvxLineEndWindow : public SfxPopupWindow using FloatingWindow::StateChanged; private: - XLineEndList* pLineEndList; + XLineEndListRef pLineEndList; ValueSet aLineEndSet; sal_uInt16 nCols; sal_uInt16 nLines; diff --git a/svx/inc/svx/ofaitem.hxx b/svx/inc/svx/ofaitem.hxx index 9f9610cbf7ad..e619e4504d3b 100644 --- a/svx/inc/svx/ofaitem.hxx +++ b/svx/inc/svx/ofaitem.hxx @@ -31,6 +31,7 @@ // include ---------------------------------------------------------------- #include <svl/poolitem.hxx> +#include <rtl/ref.hxx> #include "svx/svxdllapi.h" // class OfaPtrItem ------------------------------------------------------ @@ -51,6 +52,38 @@ public: void SetValue( void* pNewPtr ) { pPtr = pNewPtr; } }; +// class OfaRefItem - for ref counting items + +template <class reference_type> +class SVX_DLLPUBLIC OfaRefItem : public SfxPoolItem +{ + private: + rtl::Reference<reference_type> mxRef; +public: + OfaRefItem( sal_uInt16 _nWhich, const rtl::Reference<reference_type> &xRef ) + : SfxPoolItem( _nWhich ), mxRef( xRef ) + {} + OfaRefItem( const OfaRefItem& rItem ) + : SfxPoolItem( rItem.Which() ), mxRef( rItem.mxRef ) + {} + virtual int operator==( const SfxPoolItem& rItem ) const + { + return mxRef == ((OfaRefItem<reference_type> &)rItem).mxRef; + } + virtual SfxPoolItem*Clone( SfxItemPool *pPool = 0 ) const + { + return new OfaRefItem( *this ); + } + rtl::Reference<reference_type> GetValue() const + { + return mxRef; + } + void SetValue( const rtl::Reference<reference_type> &xRef ) + { + mxRef = xRef; + } +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx index 77c799508939..b8c2e3d19f23 100644 --- a/svx/inc/svx/svdmodel.hxx +++ b/svx/inc/svx/svdmodel.hxx @@ -42,6 +42,7 @@ #include <svl/hint.hxx> #include <svl/style.hxx> +#include <svx/xtable.hxx> #include <svx/pageitem.hxx> #include <vcl/field.hxx> @@ -275,13 +276,8 @@ public: bool mbAddExtLeading; bool mbInDestruction; - // Zeiger auf Paletten, Listen und Tabellen - XColorList* pColorTable; - XDashList* pDashList; - XLineEndList* pLineEndList; - XHatchList* pHatchList; - XGradientList* pGradientList; - XBitmapList* pBitmapList; + // Color, Dash, Line-End, Hatch, Gradient, Bitmap property lists ... + XPropertyListRef maProperties[XPROPERTY_LIST_COUNT]; // New src638: NumberFormatter for drawing layer and // method for getting it. It is constructed on demand @@ -645,18 +641,16 @@ public: // Accessor methods for Palettes, Lists and Tabeles // FIXME: this badly needs re-factoring ... - void SetColorTable(XColorList* pTable) { pColorTable=pTable; } - XColorList* GetColorTable() const { return pColorTable; } - void SetDashList(XDashList* pList) { pDashList=pList; } - XDashList* GetDashList() const { return pDashList; } - void SetLineEndList(XLineEndList* pList) { pLineEndList=pList; } - XLineEndList* GetLineEndList() const { return pLineEndList; } - void SetHatchList(XHatchList* pList) { pHatchList=pList; } - XHatchList* GetHatchList() const { return pHatchList; } - void SetGradientList(XGradientList* pList) { pGradientList=pList; } - XGradientList* GetGradientList() const { return pGradientList; } - void SetBitmapList(XBitmapList* pList) { pBitmapList=pList; } - XBitmapList* GetBitmapList() const { return pBitmapList; } + XPropertyListRef GetPropertyList( XPropertyListType t ) const { return maProperties[ t ]; } + void SetPropertyList( XPropertyListRef p ) { maProperties[ p->Type() ] = p; } + + // friendlier helpers + XDashListRef GetDashList() const { return GetPropertyList( XDASH_LIST )->AsDashList(); } + XHatchListRef GetHatchList() const { return GetPropertyList( XHATCH_LIST )->AsHatchList(); } + XColorListRef GetColorList() const { return GetPropertyList( XCOLOR_LIST )->AsColorList(); } + XBitmapListRef GetBitmapList() const { return GetPropertyList( XBITMAP_LIST )->AsBitmapList(); } + XLineEndListRef GetLineEndList() const { return GetPropertyList( XLINE_END_LIST )->AsLineEndList(); } + XGradientListRef GetGradientList() const { return GetPropertyList( XGRADIENT_LIST )->AsGradientList(); } // Der StyleSheetPool wird der DrawingEngine nur bekanntgemacht. // Zu loeschen hat ihn schliesslich der, der ihn auch konstruiert hat. diff --git a/svx/inc/svx/svxdlg.hxx b/svx/inc/svx/svxdlg.hxx index 6778da743c92..d3bb8b129f53 100644 --- a/svx/inc/svx/svxdlg.hxx +++ b/svx/inc/svx/svxdlg.hxx @@ -271,8 +271,6 @@ public: class AbstractSvxAreaTabDialog :public SfxAbstractTabDialog //add for SvxAreaTabDialog { -public: - virtual void DontDeleteColorTable() = 0; }; class AbstractSvxTransformTabDialog : public SfxAbstractTabDialog diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index 0aa6db4e7fb1..5dad09bca2dc 100755 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -783,7 +783,7 @@ #define SID_SIM_EDITOPTIONS ( SID_SVX_START + 438 ) #define SID_SW_ONLINEOPTIONS ( SID_SVX_START + 439 ) #define SID_MN_OPTIONS ( SID_SVX_START + 440 ) -#define SID_GET_COLORTABLE ( SID_SVX_START + 441 ) +#define SID_GET_COLORLIST ( SID_SVX_START + 441 ) #define SID_MN_INSERT_OBJECT_DLGS ( SID_SVX_START + 442 ) #define SID_OUTLINE_TO_IMPRESS ( SID_SVX_START + 443 ) #define SID_SIM_TP_COLOR ( SID_SVX_START + 444 ) diff --git a/svx/inc/svx/xattr.hxx b/svx/inc/svx/xattr.hxx index be117e6b14c6..dad046eb93fb 100644 --- a/svx/inc/svx/xattr.hxx +++ b/svx/inc/svx/xattr.hxx @@ -41,7 +41,6 @@ #include <svx/xsetit.hxx> #include <svx/xlinjoit.hxx> - #endif // _XATTR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/svx/xit.hxx b/svx/inc/svx/xit.hxx index 30ef1c8469eb..73b7dfb5fc4d 100644 --- a/svx/inc/svx/xit.hxx +++ b/svx/inc/svx/xit.hxx @@ -30,6 +30,7 @@ #define _SVX_XIT_HXX #include <svl/stritem.hxx> +#include <svx/xtable.hxx> #include <svx/xdef.hxx> #include "svx/svxdllapi.h" @@ -37,7 +38,6 @@ class SfxItemPool; class NameOrIndex; -class XPropertyList; typedef sal_Bool (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p2 ); @@ -77,7 +77,7 @@ public: Argument pPool2 can be null. If returned string equals NameOrIndex->GetName(), the name was already unique. */ - static String CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* pPool2, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, XPropertyList* pDefaults = NULL ); + static String CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* pPool2, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults ); }; #endif diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx index 00c0cb45ad08..cebbc75e86dc 100644 --- a/svx/inc/svx/xtable.hxx +++ b/svx/inc/svx/xtable.hxx @@ -30,6 +30,7 @@ // include --------------------------------------------------------------- +#include <rtl/ref.hxx> #include <svx/xpoly.hxx> #include <svx/xdash.hxx> #include <svx/xhatch.hxx> @@ -41,6 +42,8 @@ #include <tools/color.hxx> #include <tools/string.hxx> +#include <cppuhelper/weak.hxx> + #include <tools/table.hxx> #include "svx/svxdllapi.h" #include <com/sun/star/embed/XStorage.hpp> @@ -199,10 +202,24 @@ enum XPropertyListType { XHATCH_LIST, XGRADIENT_LIST, XBITMAP_LIST, + XPROPERTY_LIST_COUNT }; -class SVX_DLLPUBLIC XPropertyList +typedef rtl::Reference< class XPropertyList > XPropertyListRef; + +class XDashList ; typedef rtl::Reference< class XDashList > XDashListRef; +class XHatchList ; typedef rtl::Reference< class XHatchList > XHatchListRef; +class XColorList ; typedef rtl::Reference< class XColorList > XColorListRef; +class XBitmapList ; typedef rtl::Reference< class XBitmapList > XBitmapListRef; +class XLineEndList ; typedef rtl::Reference< class XLineEndList > XLineEndListRef; +class XGradientList ; typedef rtl::Reference< class XGradientList > XGradientListRef; + +class SVX_DLLPUBLIC XPropertyList : public cppu::OWeakObject { + private: + SAL_DLLPRIVATE void* operator new(size_t); + protected: + SAL_DLLPRIVATE void operator delete(void *); protected: typedef ::std::vector< XPropertyEntry* > XPropertyEntryList_impl; typedef ::std::vector< Bitmap* > BitmapList_impl; @@ -230,6 +247,7 @@ protected: public: virtual ~XPropertyList(); + XPropertyListType Type() const { return eType; } long Count() const; void Insert( XPropertyEntry* pEntry, long nIndex = LIST_APPEND ); @@ -269,9 +287,17 @@ public: virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0; // Factory method for sub-classes - static XPropertyList *CreatePropertyList( XPropertyListType t, - const String& rPath, - XOutdevItemPool* pXPool = NULL ); + static XPropertyListRef CreatePropertyList( XPropertyListType t, + const String& rPath, + XOutdevItemPool* pXPool = NULL ); + + // helper accessors + inline XDashListRef AsDashList(); + inline XHatchListRef AsHatchList(); + inline XColorListRef AsColorList(); + inline XBitmapListRef AsBitmapList(); + inline XLineEndListRef AsLineEndList(); + inline XGradientListRef AsGradientList(); }; // ------------------ @@ -290,16 +316,16 @@ public: using XPropertyList::Remove; using XPropertyList::Get; - XColorEntry* Replace(long nIndex, XColorEntry* pEntry ); - XColorEntry* Remove(long nIndex); - XColorEntry* GetColor(long nIndex) const; - + XColorEntry* Replace(long nIndex, XColorEntry* pEntry ); + XColorEntry* Remove(long nIndex); + XColorEntry* GetColor(long nIndex) const; virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); - virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); + virtual sal_Bool Create(); + virtual sal_Bool CreateBitmapsForUI(); + virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); - static XColorList& GetStdColorTable(); + static XColorListRef CreateStdColorList(); + static XColorListRef GetStdColorList(); // returns a singleton }; // ------------------- @@ -380,11 +406,9 @@ private: void impDestroy(); public: - explicit XHatchList( - const String& rPath, - XOutdevItemPool* pXPool = 0 - ); - ~XHatchList(); + explicit XHatchList( const String& rPath, + XOutdevItemPool* pXPool = 0 ); + virtual ~XHatchList(); using XPropertyList::Replace; XHatchEntry* Replace(XHatchEntry* pEntry, long nIndex); @@ -456,6 +480,15 @@ public: virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); }; + +// FIXME: could add type checking too ... +inline XDashListRef XPropertyList::AsDashList() { return XDashListRef( static_cast<XDashList *> (this) ); } +inline XHatchListRef XPropertyList::AsHatchList() { return XHatchListRef( static_cast<XHatchList *> (this) ); } +inline XColorListRef XPropertyList::AsColorList() { return XColorListRef( static_cast<XColorList *> (this) ); } +inline XBitmapListRef XPropertyList::AsBitmapList() { return XBitmapListRef( static_cast<XBitmapList *> (this) ); } +inline XLineEndListRef XPropertyList::AsLineEndList() { return XLineEndListRef( static_cast<XLineEndList *> (this) ); } +inline XGradientListRef XPropertyList::AsGradientList() { return XGradientListRef( static_cast<XGradientList *> (this) ); } + #endif // _XTABLE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 05733064d502..1775fa2220fb 100755 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -13188,7 +13188,7 @@ SfxBoolItem FontworkKernCharacterPairs SID_FONTWORK_KERN_CHARACTER_PAIRS ] //-------------------------------------------------------------------------- -OfaPtrItem GetColorTable SID_GET_COLORTABLE +OfaRefItem GetColorTable SID_GET_COLORLIST () [ /* flags: */ @@ -13767,7 +13767,7 @@ SvxLineEndListItem LineEndListState SID_LINEEND_LIST GroupId = GID_EDIT; ] -SvxColorTableItem ColorTableState SID_COLOR_TABLE +SvxColorListItem ColorTableState SID_COLOR_TABLE [ /* flags: */ AutoUpdate = FALSE, diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index 3cd78dd5f09a..a4f3c3106321 100755 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -403,9 +403,10 @@ item INT16 SdrTextFitToSizeTypeItem; // enum item String SfxStringListItem; // serialized into one concatenated string item double SvxDoubleItem; item String OfaPtrItem; // serialized into one concatenated string +item String OfaRefItem; item String SvxDashListItem; item String SvxLineEndListItem; -item String SvxColorTableItem; +item String SvxColorListItem; item String SvxGradientListItem; item String SvxHatchListItem; item String SvxBitmapListItem; diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index ae88d8bb17e7..d85cbaf1cb00 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -445,7 +445,6 @@ SvxBmpMask::SvxBmpMask( SfxBindings *pBindinx, pData ( new MaskData( this, *pBindinx ) ), aCbxTrans ( this, BMP_RESID( CBX_TRANS ) ), aLbColorTrans ( this, BMP_RESID ( LB_TRANS ) ), - pColTab ( NULL ), aPipetteColor ( COL_WHITE ), aSelItem ( SID_BMPMASK_EXEC, *this, *pBindinx ), maImgPipette ( BMP_RESID ( IMG_PIPETTE ) ) @@ -586,37 +585,37 @@ sal_Bool SvxBmpMask::Close() //------------------------------------------------------------------------- -sal_Bool SvxBmpMask::NeedsColorTable() const +sal_Bool SvxBmpMask::NeedsColorList() const { return ( aLbColor1.GetEntryCount() == 0 ); } //------------------------------------------------------------------------- -void SvxBmpMask::SetColorTable( const XColorList* pTable ) +void SvxBmpMask::SetColorList( const XColorListRef &pList ) { - if ( pTable && ( pTable != pColTab ) ) + if ( pList.is() && ( pList != pColLst ) ) { const String aTransp( BMP_RESID( RID_SVXDLG_BMPMASK_STR_TRANSP ) ); - pColTab = pTable; + pColLst = pList; - aLbColorTrans.Fill( pColTab ); + aLbColorTrans.Fill( pColLst ); aLbColorTrans.SelectEntryPos( 0 ); - aLbColor1.Fill( pColTab ); + aLbColor1.Fill( pColLst ); aLbColor1.InsertEntry( TRANSP_COL, aTransp, 0 ); aLbColor1.SelectEntryPos( 0 ); - aLbColor2.Fill( pColTab ); + aLbColor2.Fill( pColLst ); aLbColor2.InsertEntry( TRANSP_COL, aTransp, 0 ); aLbColor2.SelectEntryPos( 0 ); - aLbColor3.Fill( pColTab ); + aLbColor3.Fill( pColLst ); aLbColor3.InsertEntry( TRANSP_COL, aTransp, 0 ); aLbColor3.SelectEntryPos( 0 ); - aLbColor4.Fill( pColTab ); + aLbColor4.Fill( pColLst ); aLbColor4.InsertEntry( TRANSP_COL, aTransp, 0 ); aLbColor4.SelectEntryPos( 0 ); } diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 9007e01eb767..10e7ea5d73b4 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -65,8 +65,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::accessibility; -// Control fo display and selection of the corner points and mid point of an -// object +// Control for display and selection of the corner points and +// mid point of an object Bitmap& SvxRectCtl::GetRectBitmap( void ) { @@ -976,7 +976,7 @@ XOBitmap SvxBitmapCtl::GetXBitmap() // Fills the Listbox with color and strings -void ColorLB::Fill( const XColorList* pColorTab ) +void ColorLB::Fill( const XColorListRef &pColorTab ) { long nCount = pColorTab->Count(); XColorEntry* pEntry; @@ -1007,7 +1007,7 @@ void ColorLB::Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* ) // Fills the Listbox with color and strings -void FillAttrLB::Fill( const XColorList* pColorTab ) +void FillAttrLB::Fill( const XColorListRef &pColorTab ) { long nCount = pColorTab->Count(); XColorEntry* pEntry; @@ -1031,9 +1031,9 @@ HatchingLB::HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_Tr EnableUserDraw( mbUserDraw ); } -void HatchingLB::Fill( const XHatchList* pList ) +void HatchingLB::Fill( const XHatchListRef &pList ) { - mpList = (XHatchList*)pList; + mpList = pList; XHatchEntry* pEntry; long nCount = pList->Count(); @@ -1122,7 +1122,7 @@ void HatchingLB::Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp ) // Fills the listbox (provisional) with strings -void FillAttrLB::Fill( const XHatchList* pList ) +void FillAttrLB::Fill( const XHatchListRef &pList ) { long nCount = pList->Count(); XHatchEntry* pEntry; @@ -1150,9 +1150,9 @@ GradientLB::GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_Tr EnableUserDraw( mbUserDraw); } -void GradientLB::Fill( const XGradientList* pList ) +void GradientLB::Fill( const XGradientListRef &pList ) { - mpList = (XGradientList*)pList; + mpList = pList; XGradientEntry* pEntry; long nCount = pList->Count(); @@ -1254,8 +1254,8 @@ void GradientLB::Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp ) /************************************************************************/ -void GradientLB::SelectEntryByList( const XGradientList* pList, const String& rStr, - const XGradient& rGradient, sal_uInt16 nDist ) +void GradientLB::SelectEntryByList( const XGradientListRef &pList, const String& rStr, + const XGradient& rGradient, sal_uInt16 nDist ) { long nCount = pList->Count(); XGradientEntry* pEntry; @@ -1278,7 +1278,7 @@ void GradientLB::SelectEntryByList( const XGradientList* pList, const String& rS // Fills the listbox (provisional) with strings -void FillAttrLB::Fill( const XGradientList* pList ) +void FillAttrLB::Fill( const XGradientListRef &pList ) { long nCount = pList->Count(); XGradientEntry* pEntry; @@ -1331,9 +1331,9 @@ void BitmapLB::SetVirtualDevice() /************************************************************************/ -void BitmapLB::Fill( const XBitmapList* pList ) +void BitmapLB::Fill( const XBitmapListRef &pList ) { - mpList = (XBitmapList*)pList; + mpList = pList; XBitmapEntry* pEntry; long nCount = pList->Count(); @@ -1469,7 +1469,7 @@ void FillAttrLB::SetVirtualDevice() /************************************************************************/ -void FillAttrLB::Fill( const XBitmapList* pList ) +void FillAttrLB::Fill( const XBitmapListRef &pList ) { long nCount = pList->Count(); XBitmapEntry* pEntry; @@ -1502,7 +1502,7 @@ void FillTypeLB::Fill() // Fills the listbox (provisional) with strings -void LineLB::Fill( const XDashList* pList ) +void LineLB::Fill( const XDashListRef &pList ) { long nCount = pList->Count(); XDashEntry* pEntry; @@ -1511,7 +1511,7 @@ void LineLB::Fill( const XDashList* pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetDash( i ); - Bitmap* pBitmap = const_cast<XDashList*>(pList)->CreateBitmapForUI( i ); + Bitmap* pBitmap = pList->CreateBitmapForUI( i ); if( pBitmap ) { InsertEntry( pEntry->GetName(), *pBitmap ); @@ -1571,7 +1571,7 @@ void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp ) // Fills the listbox (provisional) with strings -void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart ) +void LineEndLB::Fill( const XLineEndListRef &pList, sal_Bool bStart ) { long nCount = pList->Count(); XLineEndEntry* pEntry; @@ -1581,7 +1581,7 @@ void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetLineEnd( i ); - Bitmap* pBitmap = const_cast<XLineEndList*>(pList)->CreateBitmapForUI( i ); + Bitmap* pBitmap = pList->CreateBitmapForUI( i ); if( pBitmap ) { Size aBmpSize( pBitmap->GetSizePixel() ); diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index 3584163a823a..c194a59c6eb6 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -232,9 +232,7 @@ SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx, nSaveShadowAngle(450), nSaveShadowSize (100), - maImageList (ResId(IL_FONTWORK,*rResId.GetResMgr())), - - pColorTable (NULL) + maImageList (ResId(IL_FONTWORK,*rResId.GetResMgr())) { FreeResource(); @@ -844,13 +842,13 @@ IMPL_LINK( SvxFontWorkDialog, ColorSelectHdl_Impl, void *, EMPTYARG ) return 0; } -void SvxFontWorkDialog::SetColorTable(const XColorList* pTable) +void SvxFontWorkDialog::SetColorList(const XColorListRef &pList) { - if ( pTable && pTable != pColorTable ) + if ( pList.is() && pList != pColorList ) { - pColorTable = pTable; + pColorList = pList; aShadowColorLB.Clear(); - aShadowColorLB.Fill(pColorTable); + aShadowColorLB.Fill(pColorList); } } diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index ea7ba5b82443..2a0ff26f5296 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -3142,7 +3142,7 @@ void Svx3DWin::DocumentReload() // ----------------------------------------------------------------------- void Svx3DWin::InitColorLB( const SdrModel* pDoc ) { - aLbLight1.Fill( pDoc->GetColorTable() ); + aLbLight1.Fill( pDoc->GetColorList() ); aLbLight2.CopyEntries( aLbLight1 ); aLbLight3.CopyEntries( aLbLight1 ); aLbLight4.CopyEntries( aLbLight1 ); diff --git a/svx/source/items/drawitem.cxx b/svx/source/items/drawitem.cxx index 09852a13fd3f..9b3aa4486920 100644 --- a/svx/source/items/drawitem.cxx +++ b/svx/source/items/drawitem.cxx @@ -32,51 +32,43 @@ // include --------------------------------------------------------------- #include <svx/svxids.hrc> - - -#include "svx/drawitem.hxx" +#include <svx/drawitem.hxx> #include <svx/xtable.hxx> using namespace ::com::sun::star; -// ----------------------------------------------------------------------- - -TYPEINIT1_FACTORY( SvxColorTableItem, SfxPoolItem , new SvxColorTableItem); -TYPEINIT1_FACTORY( SvxGradientListItem, SfxPoolItem , new SvxGradientListItem); -TYPEINIT1_FACTORY( SvxHatchListItem, SfxPoolItem , new SvxHatchListItem); -TYPEINIT1_FACTORY( SvxBitmapListItem, SfxPoolItem , new SvxBitmapListItem); -TYPEINIT1_FACTORY( SvxDashListItem, SfxPoolItem , new SvxDashListItem); -TYPEINIT1_FACTORY( SvxLineEndListItem, SfxPoolItem , new SvxLineEndListItem); +TYPEINIT1_FACTORY( SvxColorListItem, SfxPoolItem , new SvxColorListItem ); +TYPEINIT1_FACTORY( SvxGradientListItem, SfxPoolItem , new SvxGradientListItem ); +TYPEINIT1_FACTORY( SvxHatchListItem, SfxPoolItem , new SvxHatchListItem ); +TYPEINIT1_FACTORY( SvxBitmapListItem, SfxPoolItem , new SvxBitmapListItem ); +TYPEINIT1_FACTORY( SvxDashListItem, SfxPoolItem , new SvxDashListItem ); +TYPEINIT1_FACTORY( SvxLineEndListItem, SfxPoolItem , new SvxLineEndListItem ); //================================================================== // -// SvxColorTableItem +// SvxColorListItem // //================================================================== -SvxColorTableItem::SvxColorTableItem() +SvxColorListItem::SvxColorListItem() { } -// ----------------------------------------------------------------------- -SvxColorTableItem::SvxColorTableItem( XColorList* pTable, sal_uInt16 nW ) : +SvxColorListItem::SvxColorListItem( XColorListRef pTable, sal_uInt16 nW ) : SfxPoolItem( nW ), - pColorTable( pTable ) + pColorList( pTable ) { } -// ----------------------------------------------------------------------- -SvxColorTableItem::SvxColorTableItem( const SvxColorTableItem& rItem ) : +SvxColorListItem::SvxColorListItem( const SvxColorListItem& rItem ) : SfxPoolItem( rItem ), - pColorTable( rItem.pColorTable ) + pColorList( rItem.pColorList ) { } -//------------------------------------------------------------------------ - -SfxItemPresentation SvxColorTableItem::GetPresentation +SfxItemPresentation SvxColorListItem::GetPresentation ( SfxItemPresentation /*ePres*/, SfxMapUnit /*eCoreUnit*/, @@ -88,49 +80,37 @@ SfxItemPresentation SvxColorTableItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -// ----------------------------------------------------------------------- - -int SvxColorTableItem::operator==( const SfxPoolItem& rItem ) const +int SvxColorListItem::operator==( const SfxPoolItem& rItem ) const { DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return ( ( SvxColorTableItem& ) rItem).pColorTable == pColorTable; + return ( ( SvxColorListItem& ) rItem).pColorList == pColorList; } -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxColorTableItem::Clone( SfxItemPool * ) const +SfxPoolItem* SvxColorListItem::Clone( SfxItemPool * ) const { - return new SvxColorTableItem( *this ); + return new SvxColorListItem( *this ); } -// ----------------------------------------------------------------------- -bool SvxColorTableItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - // Please ask CD if you want to change this. - sal_Int64 aValue = sal_Int64( (sal_uLong)pColorTable ); - rVal = uno::makeAny( aValue ); - return true; +// Should be a template class but ... +#define QUERY_PUT_IMPL(svtype, xtype) \ +bool svtype::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const \ +{ \ + rVal = uno::makeAny( uno::Reference< uno::XWeak >( p##xtype.get() ) ); \ + return true; \ +} \ +\ +bool svtype::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) \ +{ \ + uno::Reference< uno::XWeak > xRef; \ + if( rVal >>= xRef ) { \ + p##xtype = X##xtype##Ref(dynamic_cast<X##xtype *>(xRef.get())); \ + return true; \ + } \ + return false; \ } -// ----------------------------------------------------------------------- - -bool SvxColorTableItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - // Please ask CD if you want to change this. - sal_Int64 aValue = 0; - if ( rVal >>= aValue ) - { - pColorTable = (XColorList*)(sal_uLong)aValue; - return true; - } - - return false; -} +QUERY_PUT_IMPL( SvxColorListItem, ColorList ) //================================================================== // @@ -142,15 +122,12 @@ SvxGradientListItem::SvxGradientListItem() { } -// ----------------------------------------------------------------------- - -SvxGradientListItem::SvxGradientListItem( XGradientList* pList, sal_uInt16 nW ) : +SvxGradientListItem::SvxGradientListItem( XGradientListRef pList, sal_uInt16 nW ) : SfxPoolItem( nW ), pGradientList( pList ) { } -// ----------------------------------------------------------------------- SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem& rItem ) : SfxPoolItem( rItem ), @@ -172,7 +149,6 @@ SfxItemPresentation SvxGradientListItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -// ----------------------------------------------------------------------- int SvxGradientListItem::operator==( const SfxPoolItem& rItem ) const { @@ -180,41 +156,14 @@ int SvxGradientListItem::operator==( const SfxPoolItem& rItem ) const return ( ( SvxGradientListItem& ) rItem).pGradientList == pGradientList; } -// ----------------------------------------------------------------------- SfxPoolItem* SvxGradientListItem::Clone( SfxItemPool * ) const { return new SvxGradientListItem( *this ); } -// ----------------------------------------------------------------------- -bool SvxGradientListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - // Please ask CD if you want to change this. - sal_Int64 aValue = sal_Int64( (sal_uLong)pGradientList ); - rVal = uno::makeAny( aValue ); - return true; -} - -// ----------------------------------------------------------------------- - -bool SvxGradientListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - // Please ask CD if you want to change this. - sal_Int64 aValue = 0; - if ( rVal >>= aValue ) - { - pGradientList = (XGradientList *)(sal_uLong)aValue; - return true; - } - - return false; -} +QUERY_PUT_IMPL( SvxGradientListItem, GradientList ) //================================================================== // @@ -226,15 +175,13 @@ SvxHatchListItem::SvxHatchListItem() { } -// ----------------------------------------------------------------------- -SvxHatchListItem::SvxHatchListItem( XHatchList* pList, sal_uInt16 nW ) : +SvxHatchListItem::SvxHatchListItem( XHatchListRef pList, sal_uInt16 nW ) : SfxPoolItem( nW ), pHatchList( pList ) { } -// ----------------------------------------------------------------------- SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem& rItem ) : SfxPoolItem( rItem ), @@ -256,7 +203,6 @@ SfxItemPresentation SvxHatchListItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -// ----------------------------------------------------------------------- int SvxHatchListItem::operator==( const SfxPoolItem& rItem ) const { @@ -264,41 +210,14 @@ int SvxHatchListItem::operator==( const SfxPoolItem& rItem ) const return ( ( SvxHatchListItem& ) rItem).pHatchList == pHatchList; } -// ----------------------------------------------------------------------- SfxPoolItem* SvxHatchListItem::Clone( SfxItemPool * ) const { return new SvxHatchListItem( *this ); } -// ----------------------------------------------------------------------- - -bool SvxHatchListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - // Please ask CD if you want to change this. - sal_Int64 aValue = sal_Int64( (sal_uLong)pHatchList ); - rVal = uno::makeAny( aValue ); - return true; -} +QUERY_PUT_IMPL( SvxHatchListItem, HatchList ) -// ----------------------------------------------------------------------- - -bool SvxHatchListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - // Please ask CD if you want to change this. - sal_Int64 aValue = 0; - if ( rVal >>= aValue ) - { - pHatchList = (XHatchList *)(sal_uLong)aValue; - return true; - } - - return false; -} //================================================================== // @@ -310,24 +229,18 @@ SvxBitmapListItem::SvxBitmapListItem() { } -// ----------------------------------------------------------------------- - -SvxBitmapListItem::SvxBitmapListItem( XBitmapList* pList, sal_uInt16 nW ) : +SvxBitmapListItem::SvxBitmapListItem( XBitmapListRef pList, sal_uInt16 nW ) : SfxPoolItem( nW ), pBitmapList( pList ) { } -// ----------------------------------------------------------------------- - SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem& rItem ) : SfxPoolItem( rItem ), pBitmapList( rItem.pBitmapList ) { } -//------------------------------------------------------------------------ - SfxItemPresentation SvxBitmapListItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -340,50 +253,18 @@ SfxItemPresentation SvxBitmapListItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -// ----------------------------------------------------------------------- - int SvxBitmapListItem::operator==( const SfxPoolItem& rItem ) const { DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); return ( ( SvxBitmapListItem& ) rItem).pBitmapList == pBitmapList; } -// ----------------------------------------------------------------------- - SfxPoolItem* SvxBitmapListItem::Clone( SfxItemPool * ) const { return new SvxBitmapListItem( *this ); } -// ----------------------------------------------------------------------- - -bool SvxBitmapListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - // Please ask CD if you want to change this. - sal_Int64 aValue = sal_Int64( (sal_uLong)pBitmapList ); - rVal = uno::makeAny( aValue ); - return true; -} - -// ----------------------------------------------------------------------- - -bool SvxBitmapListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - // Please ask CD if you want to change this. - sal_Int64 aValue = 0; - if ( rVal >>= aValue ) - { - pBitmapList = (XBitmapList *)(sal_uLong)aValue; - return true; - } - - return false; -} - +QUERY_PUT_IMPL( SvxBitmapListItem, BitmapList ) //================================================================== // @@ -396,24 +277,18 @@ SvxDashListItem::SvxDashListItem() : { } -// ----------------------------------------------------------------------- - -SvxDashListItem::SvxDashListItem( XDashList* pList, sal_uInt16 nW ) : +SvxDashListItem::SvxDashListItem( XDashListRef pList, sal_uInt16 nW ) : SfxPoolItem( nW ), pDashList( pList ) { } -// ----------------------------------------------------------------------- - SvxDashListItem::SvxDashListItem( const SvxDashListItem& rItem ) : SfxPoolItem( rItem ), pDashList( rItem.pDashList ) { } -//------------------------------------------------------------------------ - SfxItemPresentation SvxDashListItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -426,47 +301,18 @@ SfxItemPresentation SvxDashListItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -// ----------------------------------------------------------------------- - int SvxDashListItem::operator==( const SfxPoolItem& rItem ) const { DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); return ( ( SvxDashListItem& ) rItem).pDashList == pDashList; } -// ----------------------------------------------------------------------- - SfxPoolItem* SvxDashListItem::Clone( SfxItemPool * ) const { return new SvxDashListItem( *this ); } -// ----------------------------------------------------------------------- - -bool SvxDashListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - sal_Int64 aValue = sal_Int64( (sal_uLong)pDashList ); - rVal = uno::makeAny( aValue ); - return true; -} - -// ----------------------------------------------------------------------- - -bool SvxDashListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - sal_Int64 aValue = 0; - if ( rVal >>= aValue ) - { - pDashList = (XDashList *)(sal_uLong)aValue; - return true; - } - - return false; -} +QUERY_PUT_IMPL( SvxDashListItem, DashList ) //================================================================== // @@ -478,24 +324,18 @@ SvxLineEndListItem::SvxLineEndListItem() { } -// ----------------------------------------------------------------------- - -SvxLineEndListItem::SvxLineEndListItem( XLineEndList* pList, sal_uInt16 nW ) : +SvxLineEndListItem::SvxLineEndListItem( XLineEndListRef pList, sal_uInt16 nW ) : SfxPoolItem( nW ), pLineEndList( pList ) { } -// ----------------------------------------------------------------------- - SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem& rItem ) : SfxPoolItem( rItem ), pLineEndList( rItem.pLineEndList ) { } -//------------------------------------------------------------------------ - SfxItemPresentation SvxLineEndListItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -508,46 +348,18 @@ SfxItemPresentation SvxLineEndListItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -// ----------------------------------------------------------------------- - int SvxLineEndListItem::operator==( const SfxPoolItem& rItem ) const { DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); return ( ( SvxLineEndListItem& ) rItem).pLineEndList == pLineEndList; } -// ----------------------------------------------------------------------- - SfxPoolItem* SvxLineEndListItem::Clone( SfxItemPool * ) const { return new SvxLineEndListItem( *this ); } -// ----------------------------------------------------------------------- - -bool SvxLineEndListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - sal_Int64 aValue = sal_Int64( (sal_uLong)pLineEndList ); - rVal = uno::makeAny( aValue ); - return true; -} - -// ----------------------------------------------------------------------- - -bool SvxLineEndListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) -{ - // This is only a quick helper to have UI support for these list items. Don't use - // this method to query for a valid UNO representation. - sal_Int64 aValue = 0; - if ( rVal >>= aValue ) - { - pLineEndList = (XLineEndList *)(sal_uLong)aValue; - return true; - } +QUERY_PUT_IMPL( SvxLineEndListItem, LineEndList ) - return false; -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/items/ofaitem.cxx b/svx/source/items/ofaitem.cxx index e3c7bc2cb114..5d5c43e3d0b4 100644 --- a/svx/source/items/ofaitem.cxx +++ b/svx/source/items/ofaitem.cxx @@ -51,44 +51,4 @@ SfxPoolItem* OfaPtrItem::Clone( SfxItemPool * ) const return new OfaPtrItem( *this ); } -//--------------------------------------------------------------------------- -/* -TYPEINIT1_FACTORY(DashListPtrItem, SvxDashListPtrItem, new DashListPtrItem(0)); - -DashListPtrItem::DashListPtrItem( sal_uInt16 nWhich, SvxDashListItem* pPtr ) - : OfaPtrItem( nWhich ), pPtr( pPtr ) -{ -} - -DashListPtrItem::DashListPtrItem( const DashListPtrItem& ) - : OfaPtrItem( rItem.Which() ), pPtr( rItem.pPtr ) -{ -} - -int DashListPtrItem::operator==( const SfxPoolItem& rItem ) const -{ - return ((DashListPtrItem&)rItem).GetValue() == GetValue(); -} - -SfxPoolItem* DashListPtrItem::Clone( SfxItemPool *pPool ) const -{ - return new DashListPtrItem( *this ); -} - -sal_Bool DashListPtrItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const -{ -} - -sal_Bool DashListPtrItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) -{ - sal_Int64 nHyper; - if ( rVal >>= nHyper ) - { - SetValue( (SvxDash - } - - return sal_False; -} -*/ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 68ed040f9f04..56e6c7b67f49 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -163,12 +163,6 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe nStreamCompressMode=COMPRESSMODE_NONE; nStreamNumberFormat=NUMBERFORMAT_INT_BIGENDIAN; nDefaultTabulator=0; - pColorTable=NULL; - pDashList=NULL; - pLineEndList=NULL; - pHatchList=NULL; - pGradientList=NULL; - pBitmapList=NULL; mpNumberFormatter = NULL; bTransparentTextFrames=sal_False; bStarDrawPreviewMode = sal_False; @@ -360,15 +354,6 @@ SdrModel::~SdrModel() if( mpForbiddenCharactersTable ) mpForbiddenCharactersTable->release(); - // Tabellen, Listen und Paletten loeschen - if (!bExtColorTable) - delete pColorTable; - delete pDashList; - delete pLineEndList; - delete pHatchList; - delete pGradientList; - delete pBitmapList; - if(mpNumberFormatter) delete mpNumberFormatter; @@ -757,17 +742,14 @@ bool SdrModel::IsUndoEnabled() const } } -//////////////////////////////////////////////////////////////////////////////////////////////////// - void SdrModel::ImpCreateTables() { - // der Writer hat seinen eigenen ColorTable - if (!bExtColorTable) pColorTable = new XColorList( aTablePath, (XOutdevItemPool*)pItemPool ); - pDashList =new XDashList (aTablePath,(XOutdevItemPool*)pItemPool); - pLineEndList =new XLineEndList (aTablePath,(XOutdevItemPool*)pItemPool); - pHatchList =new XHatchList (aTablePath,(XOutdevItemPool*)pItemPool); - pGradientList=new XGradientList(aTablePath,(XOutdevItemPool*)pItemPool); - pBitmapList =new XBitmapList (aTablePath,(XOutdevItemPool*)pItemPool); + for( int i = 0; i < XPROPERTY_LIST_COUNT; i++ ) + { + if( !bExtColorTable || i != XCOLOR_LIST ) + maProperties[i] = XPropertyList::CreatePropertyList ( + (XPropertyListType) i, aTablePath, (XOutdevItemPool*)pItemPool ); + } } // #116168# diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 29b8b3186932..2caccd8f4540 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -284,8 +284,7 @@ SvxColorDockingWindow::SvxColorDockingWindow ) : SfxDockingWindow( _pBindings, pCW, _pParent, rResId ), - - pColorTable ( NULL ), + pColorList (), aColorSet ( this, ResId( 1, *rResId.GetResMgr() ) ), nLeftSlot ( SID_ATTR_FILL_COLOR ), nRightSlot ( SID_ATTR_LINE_COLOR ), @@ -322,7 +321,7 @@ SvxColorDockingWindow::SvxColorDockingWindow const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); if( pItem ) { - pColorTable = ( (SvxColorTableItem*) pItem )->GetColorTable(); + pColorList = ( (SvxColorListItem*) pItem )->GetColorList(); FillValueSet(); } } @@ -359,10 +358,10 @@ void SvxColorDockingWindow::Notify( SfxBroadcaster& , const SfxHint& rHint ) { const SfxPoolItemHint *pPoolItemHint = PTR_CAST(SfxPoolItemHint, &rHint); if ( pPoolItemHint - && ( pPoolItemHint->GetObject()->ISA( SvxColorTableItem ) ) ) + && ( pPoolItemHint->GetObject()->ISA( SvxColorListItem ) ) ) { // Die Liste der Farben hat sich geaendert - pColorTable = ( (SvxColorTableItem*) pPoolItemHint->GetObject() )->GetColorTable(); + pColorList = ( (SvxColorListItem*) pPoolItemHint->GetObject() )->GetColorList(); FillValueSet(); } } @@ -375,7 +374,7 @@ void SvxColorDockingWindow::Notify( SfxBroadcaster& , const SfxHint& rHint ) void SvxColorDockingWindow::FillValueSet() { - if( pColorTable ) + if( pColorList.is() ) { aColorSet.Clear(); @@ -394,11 +393,11 @@ void SvxColorDockingWindow::FillValueSet() aColorSet.InsertItem( (sal_uInt16)1, Image(aBmp), SVX_RESSTR( RID_SVXSTR_INVISIBLE ) ); XColorEntry* pEntry; - nCount = pColorTable->Count(); + nCount = pColorList->Count(); for( long i = 0; i < nCount; i++ ) { - pEntry = pColorTable->GetColor( i ); + pEntry = pColorList->GetColor( i ); aColorSet.InsertItem( (sal_uInt16)i+2, pEntry->GetColor(), pEntry->GetName() ); } diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 98efd9bfe7d4..f3ecb1e68165 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -456,12 +456,12 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue(); // Die Listen haben sich geaendert ? - if( pState->ISA( SvxColorTableItem ) && + if( pState->ISA( SvxColorListItem ) && eXFS == XFILL_SOLID ) { ::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() ); pFillAttrLB->Clear(); - pFillAttrLB->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() ); + pFillAttrLB->Fill( ( (SvxColorListItem*)pState )->GetColorList() ); pFillAttrLB->SelectEntry( aTmpColor ); } if( pState->ISA( SvxGradientListItem ) && @@ -602,10 +602,10 @@ IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox ) { if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) ) { - SvxColorTableItem aItem( *(const SvxColorTableItem*)( + SvxColorListItem aItem( *(const SvxColorListItem*)( pSh->GetItem( SID_COLOR_TABLE ) ) ); pLbFillAttr->Enable(); - pLbFillAttr->Fill( aItem.GetColorTable() ); + pLbFillAttr->Fill( aItem.GetColorList() ); } else pLbFillAttr->Disable(); diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index e7fe6fd333bf..5de78ed1d021 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -294,10 +294,10 @@ SvxColorBox::SvxColorBox( if ( pSh ) { - const SvxColorTableItem* pItem = - (const SvxColorTableItem*)( pSh->GetItem( SID_COLOR_TABLE ) ); + const SvxColorListItem* pItem = + (const SvxColorListItem*)( pSh->GetItem( SID_COLOR_TABLE ) ); if(pItem) - Fill( pItem->GetColorTable() ); + Fill( pItem->GetColorList() ); } } @@ -309,9 +309,9 @@ IMPL_LINK( SvxColorBox, DelayHdl_Impl, Timer *, EMPTYARG ) if ( pSh ) { - const SvxColorTableItem* pItem = (const SvxColorTableItem*)( pSh->GetItem( SID_COLOR_TABLE ) ); + const SvxColorListItem* pItem = (const SvxColorListItem*)( pSh->GetItem( SID_COLOR_TABLE ) ); if ( pItem ) - Fill( pItem->GetColorTable() ); + Fill( pItem->GetColorList() ); } return 0; } diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 1bfae3ee5dfc..2d419d246e70 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -348,7 +348,7 @@ void SvxLineColorToolBoxControl::StateChanged( void SvxLineColorToolBoxControl::Update( const SfxPoolItem* pState ) { - if ( pState && ( pState->ISA( SvxColorTableItem ) ) ) + if ( pState && ( pState->ISA( SvxColorListItem ) ) ) { SvxColorBox* pBox = (SvxColorBox*)GetToolBox().GetItemWindow( GetId() ); @@ -357,7 +357,7 @@ void SvxLineColorToolBoxControl::Update( const SfxPoolItem* pState ) // Die Liste der Farben (ColorTable) hat sich geaendert: ::Color aTmpColor( pBox->GetSelectEntryColor() ); pBox->Clear(); - pBox->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() ); + pBox->Fill( ( (SvxColorListItem*)pState )->GetColorList() ); pBox->SelectEntry( aTmpColor ); } } @@ -382,7 +382,7 @@ SvxLineEndWindow::SvxLineEndWindow( SfxPopupWindow( nSlotId, rFrame, WinBits( WB_STDPOPUP ) ), - pLineEndList ( NULL ), + pLineEndList (), aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ), nCols ( 2 ), nLines ( 12 ), @@ -525,7 +525,7 @@ IMPL_LINK( SvxLineEndWindow, SelectHdl, void *, EMPTYARG ) void SvxLineEndWindow::FillValueSet() { - if( pLineEndList ) + if( pLineEndList.is() ) { XLineEndEntry* pEntry = NULL; Bitmap* pBmp = NULL; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 046804b4d35e..b1859d5073b8 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -836,19 +836,15 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, { SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = NULL; - XColorList* pColorTable = NULL; - sal_Bool bKillTable = sal_False; + XColorListRef pColorList; const Size aSize12( 13, 13 ); if ( pDocSh ) if ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + pColorList = ( (SvxColorListItem*)pItem )->GetColorList(); - if ( !pColorTable ) - { - pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); - bKillTable = sal_True; - } + if ( !pColorList.is() ) + pColorList = XColorList::CreateStdColorList(); if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId ) { @@ -877,10 +873,10 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) ); } - if ( pColorTable ) + if ( pColorList.is() ) { short i = 0; - long nCount = pColorTable->Count(); + long nCount = pColorList->Count(); XColorEntry* pEntry = NULL; ::Color aColWhite( COL_WHITE ); String aStrWhite( EditResId(RID_SVXITEMS_COLOR_WHITE) ); @@ -891,7 +887,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, for ( i = 0; i < nCount; i++ ) { - pEntry = pColorTable->GetColor(i); + pEntry = pColorList->GetColor(i); aColorSet.InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() ); if( pEntry->GetColor() == mLastColor ) aColorSet.SelectItem( i+1 ); @@ -918,8 +914,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, aColorSet.Show(); AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColorTableState" ))); - if ( bKillTable ) - delete pColorTable; } SvxColorWindow_Impl::~SvxColorWindow_Impl() @@ -1015,15 +1009,14 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co { if (( SFX_ITEM_DISABLED != eState ) && pState ) { - if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorTableItem ))) + if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem ))) { - XColorList* pColorTable = pState ? ((SvxColorTableItem *)pState)->GetColorTable() : NULL; - - if ( pColorTable ) + if ( pState ) { - // Die Liste der Farben (ColorTable) hat sich ge"andert: + XColorListRef pColorList = ((SvxColorListItem *)pState)->GetColorList(); + short i = 0; - long nCount = pColorTable->Count(); + long nCount = pColorList->Count(); XColorEntry* pEntry = NULL; ::Color aColWhite( COL_WHITE ); String aStrWhite( SVX_RES( RID_SVXITEMS_COLOR_WHITE ) ); @@ -1038,7 +1031,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co for ( i = 0; i < nCount; ++i ) { - pEntry = pColorTable->GetColor(i); + pEntry = pColorList->GetColor(i); aColorSet.SetItemColor( i + 1, pEntry->GetColor() ); aColorSet.SetItemText ( i + 1, pEntry->GetName() ); } diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 094432ac68ec..669caf41d93e 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -49,16 +49,16 @@ using namespace ::cppu; class SvxUnoColorTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo > { private: - XColorList* pTable; + XColorListRef pList; public: SvxUnoColorTable() throw(); virtual ~SvxUnoColorTable() throw(); // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException ); + virtual OUString SAL_CALL getImplementationName() throw( uno::RuntimeException ); virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( uno::RuntimeException); - virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException); + virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( uno::RuntimeException); static OUString getImplementationName_Static() throw() { @@ -77,23 +77,22 @@ public: // XNameAccess virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); - virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException); + virtual uno::Sequence< OUString > SAL_CALL getElementNames() throw( uno::RuntimeException); virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw( uno::RuntimeException); // XElementAccess - virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException); - virtual sal_Bool SAL_CALL hasElements( ) throw( uno::RuntimeException); + virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw( uno::RuntimeException); }; SvxUnoColorTable::SvxUnoColorTable() throw() { - pTable = new XColorList( SvtPathOptions().GetPalettePath() ); + pList = XPropertyList::CreatePropertyList( XCOLOR_LIST, SvtPathOptions().GetPalettePath() )->AsColorList(); } SvxUnoColorTable::~SvxUnoColorTable() throw() { - delete pTable; } sal_Bool SAL_CALL SvxUnoColorTable::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) @@ -113,7 +112,7 @@ OUString SAL_CALL SvxUnoColorTable::getImplementationName() throw( uno::RuntimeE return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoColorTable") ); } -uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getSupportedServiceNames( ) +uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getSupportedServiceNames() throw( uno::RuntimeException ) { return getSupportedServiceNames_Static(); @@ -137,21 +136,21 @@ void SAL_CALL SvxUnoColorTable::insertByName( const OUString& aName, const uno:: if( !(aElement >>= nColor) ) throw lang::IllegalArgumentException(); - if( pTable ) + if( pList.is() ) { XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName ); - pTable->Insert( pEntry, pTable->Count() ); + pList->Insert( pEntry, pList->Count() ); } } void SAL_CALL SvxUnoColorTable::removeByName( const OUString& Name ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - long nIndex = pTable ? ((XPropertyList*)pTable)->Get( Name ) : -1; + long nIndex = pList.is() ? pList->Get( Name ) : -1; if( nIndex == -1 ) throw container::NoSuchElementException(); - pTable->Remove( nIndex ); + pList->Remove( nIndex ); } // XNameReplace @@ -162,37 +161,37 @@ void SAL_CALL SvxUnoColorTable::replaceByName( const OUString& aName, const uno: if( !(aElement >>= nColor) ) throw lang::IllegalArgumentException(); - long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1; + long nIndex = pList.is() ? pList->Get( aName ) : -1; if( nIndex == -1 ) throw container::NoSuchElementException(); XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName ); - delete pTable->Replace( nIndex, pEntry ); + delete pList->Replace( nIndex, pEntry ); } // XNameAccess -uno::Any SAL_CALL SvxUnoColorTable::getByName( const OUString& aName ) +uno::Any SAL_CALL SvxUnoColorTable::getByName( const OUString& aName ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1; + long nIndex = pList.is() ? pList->Get( aName ) : -1; if( nIndex == -1 ) throw container::NoSuchElementException(); - XColorEntry* pEntry = ((XColorList*)pTable)->GetColor( nIndex ); + XColorEntry* pEntry = pList->GetColor( nIndex ); return uno::Any( (sal_Int32) pEntry->GetColor().GetRGBColor() ); } -uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getElementNames( ) +uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getElementNames() throw( uno::RuntimeException ) { - const long nCount = pTable ? pTable->Count() : 0; + const long nCount = pList.is() ? pList->Count() : 0; uno::Sequence< OUString > aSeq( nCount ); OUString* pStrings = aSeq.getArray(); for( long nIndex = 0; nIndex < nCount; nIndex++ ) { - XColorEntry* pEntry = pTable->GetColor( (long)nIndex ); + XColorEntry* pEntry = pList->GetColor( (long)nIndex ); pStrings[nIndex] = pEntry->GetName(); } @@ -202,21 +201,21 @@ uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getElementNames( ) sal_Bool SAL_CALL SvxUnoColorTable::hasByName( const OUString& aName ) throw( uno::RuntimeException ) { - long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1; + long nIndex = pList.is() ? pList->Get( aName ) : -1; return nIndex != -1; } // XElementAccess -uno::Type SAL_CALL SvxUnoColorTable::getElementType( ) +uno::Type SAL_CALL SvxUnoColorTable::getElementType() throw( uno::RuntimeException ) { return ::getCppuType((const sal_Int32*)0); } -sal_Bool SAL_CALL SvxUnoColorTable::hasElements( ) +sal_Bool SAL_CALL SvxUnoColorTable::hasElements() throw( uno::RuntimeException ) { - return pTable && pTable->Count() != 0; + return pList.is() && pList->Count() != 0; } /** diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index d28c4dd62d8e..4fcce2aa29d8 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1528,12 +1528,12 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUStr { case XATTR_FILLBITMAP: { - XBitmapList* pBitmapList = pModel->GetBitmapList(); + XBitmapListRef pBitmapList = pModel->GetBitmapList(); - if( !pBitmapList ) + if( !pBitmapList.is() ) return sal_False; - long nPos = ((XPropertyList*)pBitmapList)->Get(aStrName); + long nPos = pBitmapList->Get(aStrName); if( nPos == -1 ) return sal_False; @@ -1547,12 +1547,12 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUStr } case XATTR_FILLGRADIENT: { - XGradientList* pGradientList = pModel->GetGradientList(); + XGradientListRef pGradientList = pModel->GetGradientList(); - if( !pGradientList ) + if( !pGradientList.is() ) return sal_False; - long nPos = ((XPropertyList*)pGradientList)->Get(aStrName); + long nPos = pGradientList->Get(aStrName); if( nPos == -1 ) return sal_False; @@ -1566,12 +1566,12 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUStr } case XATTR_FILLHATCH: { - XHatchList* pHatchList = pModel->GetHatchList(); + XHatchListRef pHatchList = pModel->GetHatchList(); - if( !pHatchList ) + if( !pHatchList.is() ) return sal_False; - long nPos = ((XPropertyList*)pHatchList)->Get(aStrName); + long nPos = pHatchList->Get(aStrName); if( nPos == -1 ) return sal_False; @@ -1586,12 +1586,12 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUStr case XATTR_LINEEND: case XATTR_LINESTART: { - XLineEndList* pLineEndList = pModel->GetLineEndList(); + XLineEndListRef pLineEndList = pModel->GetLineEndList(); - if( !pLineEndList ) + if( !pLineEndList.is() ) return sal_False; - long nPos = ((XPropertyList*)pLineEndList)->Get(aStrName); + long nPos = pLineEndList->Get(aStrName); if( nPos == -1 ) return sal_False; @@ -1617,12 +1617,12 @@ sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUStr } case XATTR_LINEDASH: { - XDashList* pDashList = pModel->GetDashList(); + XDashListRef pDashList = pModel->GetDashList(); - if( !pDashList ) + if( !pDashList.is() ) return sal_False; - long nPos = ((XPropertyList*)pDashList)->Get(aStrName); + long nPos = pDashList->Get(aStrName); if( nPos == -1 ) return sal_False; diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 2fb5b79c419a..6596e75c2e17 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -205,7 +205,7 @@ SvStream& NameOrIndex::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const Argument pPool2 can be null. If returned string equals NameOrIndex->GetName(), the name was already unique. */ -String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, XPropertyList* pDefaults ) +String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults ) { sal_Bool bForceNew = sal_False; @@ -248,7 +248,7 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn String aUser( aRes ); aUser += sal_Unicode( ' ' ); - if( pDefaults ) + if( pDefaults.get() ) { const int nCount = pDefaults->Count(); int nIndex; @@ -1248,19 +1248,15 @@ XLineDashItem* XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const { if( pModel ) { - const String aUniqueName = NameOrIndex::CheckNamedItem( this, - XATTR_LINEDASH, - &pModel->GetItemPool(), - pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, - XLineDashItem::CompareValueFunc, - RID_SVXSTR_DASH11, - pModel->GetDashList() ); + const String aUniqueName = NameOrIndex::CheckNamedItem( + this, XATTR_LINEDASH, &pModel->GetItemPool(), + pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, + XLineDashItem::CompareValueFunc, RID_SVXSTR_DASH11, + pModel->GetPropertyList( XDASH_LIST ) ); // if the given name is not valid, replace it! if( aUniqueName != GetName() ) - { return new XLineDashItem( aUniqueName, aDash ); - } } return (XLineDashItem*)this; @@ -3604,19 +3600,15 @@ XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) con { if( pModel ) { - const String aUniqueName = NameOrIndex::CheckNamedItem( this, - XATTR_FILLGRADIENT, - &pModel->GetItemPool(), - pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, - XFillGradientItem::CompareValueFunc, - RID_SVXSTR_GRADIENT, - pModel->GetGradientList() ); + const String aUniqueName = NameOrIndex::CheckNamedItem( + this, XATTR_FILLGRADIENT, &pModel->GetItemPool(), + pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, + XFillGradientItem::CompareValueFunc, RID_SVXSTR_GRADIENT, + pModel->GetPropertyList( XGRADIENT_LIST ) ); // if the given name is not valid, replace it! if( aUniqueName != GetName() ) - { return new XFillGradientItem( aUniqueName, aGradient ); - } } return (XFillGradientItem*)this; @@ -3747,7 +3739,7 @@ XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrM pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, XFillFloatTransparenceItem::CompareValueFunc, RID_SVXSTR_TRASNGR0, - NULL ); + XPropertyListRef() ); // if the given name is not valid, replace it! if( aUniqueName != GetName() ) @@ -4156,19 +4148,15 @@ XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const { if( pModel ) { - const String aUniqueName = NameOrIndex::CheckNamedItem( this, - XATTR_FILLHATCH, - &pModel->GetItemPool(), - pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, - XFillHatchItem::CompareValueFunc, - RID_SVXSTR_HATCH10, - pModel->GetHatchList() ); + const String aUniqueName = NameOrIndex::CheckNamedItem( + this, XATTR_FILLHATCH, &pModel->GetItemPool(), + pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, + XFillHatchItem::CompareValueFunc, RID_SVXSTR_HATCH10, + pModel->GetPropertyList( XHATCH_LIST ) ); // if the given name is not valid, replace it! if( aUniqueName != GetName() ) - { return new XFillHatchItem( aUniqueName, aHatch ); - } } return (XFillHatchItem*)this; diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 1f421c4a5d7b..b6df09a947fd 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -775,19 +775,15 @@ XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const { if( pModel ) { - const String aUniqueName = NameOrIndex::CheckNamedItem( this, - XATTR_FILLBITMAP, - &pModel->GetItemPool(), - pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, - XFillBitmapItem::CompareValueFunc, - RID_SVXSTR_BMP21, - pModel->GetBitmapList() ); + const String aUniqueName = NameOrIndex::CheckNamedItem( + this, XATTR_FILLBITMAP, &pModel->GetItemPool(), + pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, + XFillBitmapItem::CompareValueFunc, RID_SVXSTR_BMP21, + pModel->GetPropertyList( XBITMAP_LIST ) ); // if the given name is not valid, replace it! if( aUniqueName != GetName() ) - { return new XFillBitmapItem( aUniqueName, aXOBitmap ); - } } return (XFillBitmapItem*)this; diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx index ab11883e7ba8..c67a89510af3 100644 --- a/svx/source/xoutdev/xtabcolr.cxx +++ b/svx/source/xoutdev/xtabcolr.cxx @@ -39,9 +39,16 @@ using namespace com::sun::star; -XColorList& XColorList::GetStdColorTable() + +XColorListRef XColorList::CreateStdColorList() +{ + return XPropertyList::CreatePropertyList( + XCOLOR_LIST, SvtPathOptions().GetPalettePath() )->AsColorList(); +} + +XColorListRef XColorList::GetStdColorList() { - static XColorList aTable(SvtPathOptions().GetPalettePath()); + static XColorListRef aTable( CreateStdColorList() ); return aTable; } diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 84185609145f..fb0f77af2d0e 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -46,6 +46,8 @@ Color RGB_Color( ColorData nColorName ) return aRGBColor; } +static int count = 0; + XPropertyList::XPropertyList( XPropertyListType type, const char *pDefaultExtension, @@ -68,13 +70,15 @@ XPropertyList::XPropertyList( pXPool = new XOutdevItemPool; DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" ); } + fprintf (stderr, "Create type %d count %d\n", (int)eType, count++); } XPropertyList::~XPropertyList() { - for( size_t i = 0, n = aList.size(); i < n; ++i ) { + fprintf (stderr, "Destroy type %d count %d\n", (int)eType, --count); + for( size_t i = 0, n = aList.size(); i < n; ++i ) delete aList[ i ]; - } + aList.clear(); if( pBmpList ) @@ -88,9 +92,7 @@ XPropertyList::~XPropertyList() } if( bOwnPool && pXPool ) - { SfxItemPool::Free(pXPool); - } } void XPropertyList::Clear() @@ -291,14 +293,14 @@ bool XPropertyList::SaveTo( const uno::Reference< embed::XStorage > &xStorage, return SvxXMLXTableExportComponent::save( rURL, createInstance(), xStorage, pOptName ); } -XPropertyList *XPropertyList::CreatePropertyList( XPropertyListType t, - const String& rPath, - XOutdevItemPool* pXPool ) +XPropertyListRef XPropertyList::CreatePropertyList( XPropertyListType t, + const String& rPath, + XOutdevItemPool* pXPool ) { - XPropertyList *pRet = NULL; + XPropertyListRef pRet; #define MAP(e,c) \ - case e: pRet = new c( rPath, pXPool ); break + case e: pRet = XPropertyListRef (new c( rPath, pXPool ) ); break switch (t) { MAP( XCOLOR_LIST, XColorList ); MAP( XLINE_END_LIST, XLineEndList ); @@ -311,9 +313,21 @@ XPropertyList *XPropertyList::CreatePropertyList( XPropertyListType t, break; } #undef MAP - OSL_ASSERT( !pRet || pRet->eType == t ); + OSL_ASSERT( !pRet.is() || pRet->eType == t ); return pRet; } +// catch people being silly with ref counting ... + +void* XPropertyList::operator new (size_t nCount) +{ + return rtl_allocateMemory( nCount ); +} + +void XPropertyList::operator delete(void *pPtr) +{ + return rtl_freeMemory( pPtr ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 ); } |