basctl/source/inc/basobj.hxx | 1 + svl/inc/svl/svarray.hxx | 18 +----------------- svl/source/memtools/svarray.cxx | 10 ++++++++++ sw/inc/modcfg.hxx | 16 ++++++++-------- sw/source/ui/config/modcfg.cxx | 22 +++++++++++----------- sw/source/ui/inc/caption.hxx | 5 ----- 6 files changed, 31 insertions(+), 41 deletions(-)
New commits: commit 321216ea83533db83a603f6c8ea2eec0abccf288 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Jul 29 22:41:25 2012 +0100 Remove strange DummyType I can see no purpose to DummyType Change-Id: I25d9d3b321df28f8c2bcb4bf915eb176a14fdaf8 diff --git a/basctl/source/inc/basobj.hxx b/basctl/source/inc/basobj.hxx index 2ad5328..36fc8c0 100644 --- a/basctl/source/inc/basobj.hxx +++ b/basctl/source/inc/basobj.hxx @@ -27,6 +27,7 @@ class SbMethod; class SbModule; class SbxVariable; class StarBASIC; +class String; class SfxUInt16Item; class SfxBindings; class Window; diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx index 1f405f8..556f104 100644 --- a/svl/inc/svl/svarray.hxx +++ b/svl/inc/svl/svarray.hxx @@ -49,21 +49,11 @@ #include "svl/svldllapi.h" -#include <string.h> // memmove() #include <limits.h> // USHRT_MAX #include <osl/diagnose.h> #include <rtl/alloc.h> #include <tools/solar.h> -class String; - -class DummyType; -inline void* operator new( size_t, DummyType* pPtr ) -{ - return pPtr; -} -inline void operator delete( void*, DummyType* ) {} - typedef void* VoidPtr; class SVL_DLLPUBLIC SvPtrarr { @@ -81,13 +71,7 @@ public: VoidPtr& operator[](sal_uInt16 nP) const { return *(pData+nP); } void Insert( const SvPtrarr * pI, sal_uInt16 nP, - sal_uInt16 nS = 0, sal_uInt16 nE = USHRT_MAX ) - { - if( USHRT_MAX == nE ) - nE = pI->nA; - if( nS < nE ) - Insert( (const VoidPtr*)pI->pData+nS, (sal_uInt16)nE-nS, nP ); - } + sal_uInt16 nS = 0, sal_uInt16 nE = USHRT_MAX ); VoidPtr& GetObject(sal_uInt16 nP) const { return (*this)[nP]; } diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index c6fa6dd..6f1f1cb 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -18,6 +18,7 @@ */ #include <svl/svarray.hxx> +#include <string.h> // memmove() SvPtrarr::SvPtrarr( sal_uInt16 nInit ) : pData (0), @@ -65,6 +66,15 @@ void SvPtrarr::Insert( const VoidPtr* pE, sal_uInt16 nL, sal_uInt16 nP ) nA = nA + nL; nFree = nFree - nL; } +void SvPtrarr::Insert( const SvPtrarr * pI, sal_uInt16 nP, + sal_uInt16 nS, sal_uInt16 nE ) +{ + if( USHRT_MAX == nE ) + nE = pI->nA; + if( nS < nE ) + Insert( (const VoidPtr*)pI->pData+nS, (sal_uInt16)nE-nS, nP ); +} + void SvPtrarr::Remove( sal_uInt16 nP, sal_uInt16 nL ) { if( !nL ) commit dc89ef154f076e7578f82d67cc4c4ef7f4101fe0 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Jul 29 22:39:19 2012 +0100 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 diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx index 37bcc83..22590e8 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 6334954..51ef2eb 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 70f39be..178337d 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
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits