[Libreoffice-commits] .: svl/inc svl/source

Nigel Hawkins nhawkins at kemper.freedesktop.org
Tue Aug 9 07:24:32 PDT 2011


 svl/inc/svl/aeitem.hxx      |    6 +++---
 svl/source/items/aeitem.cxx |   15 ++++-----------
 2 files changed, 7 insertions(+), 14 deletions(-)

New commits:
commit bb8ea3fc5f69522073a490782e99c81aed96d02f
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Aug 9 15:23:32 2011 +0100

    Replace SvUShorts with vector in aeitem.[ch]xx
    
    LGPLv3+/MPL1.1

diff --git a/svl/inc/svl/aeitem.hxx b/svl/inc/svl/aeitem.hxx
index 47c437f..edb98f3 100644
--- a/svl/inc/svl/aeitem.hxx
+++ b/svl/inc/svl/aeitem.hxx
@@ -31,14 +31,14 @@
 #include "svl/svldllapi.h"
 #include <svl/poolitem.hxx>
 #include <svl/eitem.hxx>
+#include <vector>
 
 class SfxAllEnumValueArr;
-class SvUShorts;
 
 class SVL_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem
 {
-    SfxAllEnumValueArr*     pValues;
-    SvUShorts*              pDisabledValues;
+    SfxAllEnumValueArr*      pValues;
+    std::vector<sal_uInt16>* pDisabledValues;
 
 protected:
     sal_uInt16                  _GetPosByValue( sal_uInt16 nValue ) const;
diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx
index e45c6ac..e81c67d 100644
--- a/svl/source/items/aeitem.cxx
+++ b/svl/source/items/aeitem.cxx
@@ -31,8 +31,6 @@
 
 #include <tools/string.hxx>
 
-#define _SVSTDARR_USHORTS
-#include <svl/svstdarr.hxx>
 #include <svl/svarray.hxx>
 #include <svl/aeitem.hxx>
 
@@ -129,12 +127,7 @@ SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy):
 
     if( rCopy.pDisabledValues )
     {
-        pDisabledValues = new SvUShorts;
-        for ( sal_uInt16 nPos = 0; nPos < rCopy.pDisabledValues->Count(); ++nPos )
-        {
-            pDisabledValues->Insert( rCopy.pDisabledValues->GetObject(nPos),
-                                     nPos );
-        }
+        pDisabledValues = new std::vector<sal_uInt16>( *(rCopy.pDisabledValues) );
     }
 }
 
@@ -272,16 +265,16 @@ void SfxAllEnumItem::DisableValue( sal_uInt16 nValue )
 {
     DBG_CHKTHIS(SfxAllEnumItem, 0);
     if ( !pDisabledValues )
-        pDisabledValues = new SvUShorts;
+        pDisabledValues = new std::vector<sal_uInt16>;
 
-    pDisabledValues->Insert( nValue, pDisabledValues->Count() );
+    pDisabledValues->push_back( nValue );
 }
 
 sal_Bool SfxAllEnumItem::IsEnabled( sal_uInt16 nValue ) const
 {
     if ( pDisabledValues )
     {
-        for ( sal_uInt16 i=0; i<pDisabledValues->Count(); i++ )
+        for ( size_t i=0; i<pDisabledValues->size(); i++ )
             if ( (*pDisabledValues)[i] == nValue )
                 return sal_False;
     }


More information about the Libreoffice-commits mailing list