diff options
author | Noel Grandin <noel@peralex.com> | 2012-07-19 14:26:38 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-26 14:30:11 +0200 |
commit | ef3990b07b1a9b05b135807765f9dd2732ee085b (patch) | |
tree | 9391376d7da8b85b2c1e345abf97804ce0b558d9 /editeng/inc | |
parent | f7f99968f2014c9e7f1f216c6ef0d2d31630087d (diff) |
Convert SV_DECL_VARARR_SORT_VISIBILITY(SvxTabStopArr) o3tl::sorted_vector
And convert it from a private superclass to a member. The code
is cleaner and easier to read as a consequence.
Change-Id: I35501a208c96615ce5797ad06d34d3b7efc2c4db
Diffstat (limited to 'editeng/inc')
-rw-r--r-- | editeng/inc/editeng/tstpitem.hxx | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/editeng/inc/editeng/tstpitem.hxx b/editeng/inc/editeng/tstpitem.hxx index 90052bfc3426..62923aac3974 100644 --- a/editeng/inc/editeng/tstpitem.hxx +++ b/editeng/inc/editeng/tstpitem.hxx @@ -33,6 +33,7 @@ #include <svl/poolitem.hxx> #include <editeng/svxenum.hxx> #include <editeng/editengdllapi.h> +#include <o3tl/sorted_vector.hxx> // class SvxTabStop ------------------------------------------------------ @@ -103,16 +104,16 @@ public: // class SvxTabStopItem -------------------------------------------------- -SV_DECL_VARARR_SORT_VISIBILITY( SvxTabStopArr, SvxTabStop, SVX_TAB_DEFCOUNT, EDITENG_DLLPUBLIC ) +typedef o3tl::sorted_vector<SvxTabStop> SvxTabStopArr; /* [Description] This item describes a list of TabStops. */ -class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem, private SvxTabStopArr +class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem { -//friend class SvxTabStopObject_Impl; + SvxTabStopArr maTabStops; public: TYPEINFO(); @@ -131,14 +132,14 @@ public: sal_uInt16 GetPos( const sal_Int32 nPos ) const; // unprivatized: - sal_uInt16 Count() const { return SvxTabStopArr::Count(); } - sal_Bool Insert( const SvxTabStop& rTab ); - void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0, + sal_uInt16 Count() const { return maTabStops.size(); } + bool Insert( const SvxTabStop& rTab ); + void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX ); - void Remove( SvxTabStop& rTab ) - { SvxTabStopArr::Remove( rTab ); } - void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 ) - { SvxTabStopArr::Remove( nPos, nLen ); } + void Remove( SvxTabStop& rTab ) + { maTabStops.erase( rTab ); } + void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 ) + { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); } // Assignment operator, equality operator (caution: expensive!) SvxTabStopItem& operator=( const SvxTabStopItem& rTSI ); @@ -147,15 +148,10 @@ public: //int operator!=( const SvxTabStopItem& rTSI ) const // { return !( operator==( rTSI ) ); } - // SortedArrays returns only Stackobjects! const SvxTabStop& operator[]( const sal_uInt16 nPos ) const - { - DBG_ASSERT( GetStart() && - nPos < Count(), "op[]" ); - return *( GetStart() + nPos ); - } - const SvxTabStop* GetStart() const - { return SvxTabStopArr::GetData(); } + { return maTabStops[nPos]; } + SvxTabStop& operator[]( const sal_uInt16 nPos ) + { return maTabStops[nPos]; } // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; @@ -171,8 +167,6 @@ public: virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; - using SvxTabStopArr::Insert; - using SvxTabStopArr::Remove; }; #endif |