diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-07-29 22:39:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-07-29 23:09:38 +0100 |
commit | dc89ef154f076e7578f82d67cc4c4ef7f4101fe0 (patch) | |
tree | e53803515091f2fc10e9a9a6adc804423a014ff3 /sw | |
parent | 3638561bef4558102f5b5e8f6f9004d8da787f8d (diff) |
Convert InsCaptionOptArr to boost::ptr_vector
I can't see any reason to keep these sorted, there are only two operations
used, Insert and Find, and neither makes any use of the sort order.
Change-Id: Iac3c327084dfdb83c0065a4a1786ac1f6b6b387e
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/modcfg.hxx | 16 | ||||
-rw-r--r-- | sw/source/ui/config/modcfg.cxx | 22 | ||||
-rw-r--r-- | sw/source/ui/inc/caption.hxx | 5 |
3 files changed, 19 insertions, 24 deletions
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx index 37bcc839aca7..22590e8088c9 100644 --- a/sw/inc/modcfg.hxx +++ b/sw/inc/modcfg.hxx @@ -28,10 +28,10 @@ #ifndef _MODOPT_HXX #define _MODOPT_HXX +#include <boost/ptr_container/ptr_vector.hpp> #include <tools/string.hxx> #include <tools/wintypes.hxx> #include <vcl/field.hxx> -#include <svl/svarray.hxx> #include <unotools/configitem.hxx> #include "swdllapi.h" #include "authratr.hxx" @@ -43,15 +43,15 @@ class SwModuleOptions; class InsCaptionOpt; -typedef InsCaptionOpt* InsCaptionOptPtr; -SV_DECL_PTRARR_SORT_DEL(InsCapOptArr, InsCaptionOptPtr, 0) -class InsCaptionOptArr : public InsCapOptArr +class InsCaptionOptArr { - friend class SwModuleOptions; - friend class SwInsertConfig; -protected: - InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0) const; +private: + typedef boost::ptr_vector<InsCaptionOpt> InsCapOptArr; + InsCapOptArr m_aInsCapOptArr; +public: + InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0); + void Insert(InsCaptionOpt* pObj); }; class SwRevisionConfig : public utl::ConfigItem diff --git a/sw/source/ui/config/modcfg.cxx b/sw/source/ui/config/modcfg.cxx index 63349544ef6b..51ef2eb62ad6 100644 --- a/sw/source/ui/config/modcfg.cxx +++ b/sw/source/ui/config/modcfg.cxx @@ -56,21 +56,21 @@ using namespace com::sun::star::uno; #define GLOB_NAME_MATH 3 #define GLOB_NAME_CHART 4 -SV_IMPL_PTRARR_SORT(InsCapOptArr, InsCaptionOptPtr) - -InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId) const +InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId) { - for (sal_uInt16 i = 0; i < Count(); i++ ) + for (InsCapOptArr::iterator aI = m_aInsCapOptArr.begin(); aI != m_aInsCapOptArr.end(); ++aI) { - InsCaptionOpt* pObj = GetObject(i); - if (pObj->GetObjType() == eType && - (eType != OLE_CAP || - (pOleId && - pObj->GetOleId() == *pOleId))) - return pObj; + InsCaptionOpt &rObj = *aI; + if (rObj.GetObjType() == eType && (eType != OLE_CAP || (pOleId && rObj.GetOleId() == *pOleId))) + return &rObj; } - return 0; + return NULL; +} + +void InsCaptionOptArr::Insert(InsCaptionOpt* pObj) +{ + m_aInsCapOptArr.push_back(pObj); //takes ownership } const InsCaptionOpt* SwModuleOptions::GetCapOption( diff --git a/sw/source/ui/inc/caption.hxx b/sw/source/ui/inc/caption.hxx index 70f39be1b7e0..178337df1d16 100644 --- a/sw/source/ui/inc/caption.hxx +++ b/sw/source/ui/inc/caption.hxx @@ -45,7 +45,6 @@ private: String sCaption; sal_uInt16 nPos; sal_uInt16 nLevel; -// sal_Unicode cSeparator; String sSeparator; String sCharacterStyle; @@ -84,8 +83,6 @@ public: inline sal_uInt16 GetLevel() const { return nLevel; } inline void SetLevel(const sal_uInt16 nLvl) { nLevel = nLvl; } -// inline sal_Unicode GetSeparator() const { return cSeparator; } -// inline void SetSeparator(const sal_Unicode cSep){ cSeparator = cSep; } inline const String& GetSeparator() const { return sSeparator; } inline void SetSeparator(const String& rSep) { sSeparator = rSep; } @@ -103,8 +100,6 @@ public: InsCaptionOpt& operator= ( const InsCaptionOpt& rOpt ); inline sal_Bool operator< ( const InsCaptionOpt & rObj ) const { return aOleId < rObj.aOleId; } -// friend SvStream& operator>>( SvStream& rIStream, InsCaptionOpt& rCapOpt ); -// friend SvStream& operator<<( SvStream& rOStream, const InsCaptionOpt& rCapOpt ); }; #endif |