diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-09-23 14:05:07 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-09-24 08:33:46 +0100 |
commit | c8dc73720883333a13187865cd0d69b64af6b4b5 (patch) | |
tree | c9037bb6e79fd49507f2de1cf2b22f7159572720 /svx | |
parent | remove obsolete Forte NOOPT files (diff) | |
download | core-c8dc73720883333a13187865cd0d69b64af6b4b5.tar.gz core-c8dc73720883333a13187865cd0d69b64af6b4b5.zip |
re-factor XPropertyList derivatives to use a rtl::Reference
This cleans up a lot of lifecycle nasties and cleans up some serious
cut/paste code duplication issues at the same time. Cleanup the
naming of ColorTable -> ColorList to match the impl. too
Diffstat (limited to 'svx')
33 files changed, 397 insertions, 667 deletions
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: */ |