[PATCH] Port SfxIntegerListItem to SvULongs

Maciej Rumianowski maciej.rumianowski at gmail.com
Sun Jul 17 14:49:10 PDT 2011


For calc to be free of SvULongs SfxIntegerListItem has to use SvULongs.
Additionaly a constructor with Sequence used in calc.
---
 svl/inc/svl/ilstitem.hxx      |    8 ++++----
 svl/source/items/ilstitem.cxx |   25 ++++++++++++++++---------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/svl/inc/svl/ilstitem.hxx b/svl/inc/svl/ilstitem.hxx
index 286edf2..46586e9 100644
--- a/svl/inc/svl/ilstitem.hxx
+++ b/svl/inc/svl/ilstitem.hxx
@@ -32,8 +32,7 @@
 #include "svl/svldllapi.h"
 #include <svl/poolitem.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
-
-class SvULongs;
+#include <vector>
 
 class SVL_DLLPUBLIC SfxIntegerListItem : public SfxPoolItem
 {
@@ -43,7 +42,8 @@ public:
     TYPEINFO();
 
     SfxIntegerListItem();
-    SfxIntegerListItem( sal_uInt16 nWhich, const SvULongs& rList );
+    SfxIntegerListItem( sal_uInt16 nWhich, const ::std::vector < sal_uLong >& rList );
+    SfxIntegerListItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Sequence < sal_Int32 >& rList );
     SfxIntegerListItem( const SfxIntegerListItem& rItem );
     ~SfxIntegerListItem();
 
@@ -52,7 +52,7 @@ public:
     ::com::sun::star::uno::Sequence < sal_Int32 > GetConstSequence() const
     { return SAL_CONST_CAST(SfxIntegerListItem *, this)->GetSequence(); }
 
-    void                    GetList( SvULongs& rList ) const;
+    void                    GetList( ::std::vector < sal_uLong >& rList ) const;
 
     virtual int 			operator==( const SfxPoolItem& ) const;
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx
index 1a897a8..0111bb8 100644
--- a/svl/source/items/ilstitem.cxx
+++ b/svl/source/items/ilstitem.cxx
@@ -35,20 +35,25 @@
 
 #include <svl/ilstitem.hxx>
 
-#define _SVSTDARR_ULONGS
-#include <svl/svstdarr.hxx>
-
 TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem);
 
 SfxIntegerListItem::SfxIntegerListItem()
 {
 }
 
-SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const SvULongs& rList )
+SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::std::vector < sal_uLong >& rList )
+    : SfxPoolItem( which )
+{
+    m_aList.realloc( rList.size() );
+    for ( sal_uInt16 n=0; n<rList.size(); n++ )
+        m_aList[n] = rList[n];
+}
+
+SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::com::sun::star::uno::Sequence < sal_Int32 >& rList )
     : SfxPoolItem( which )
 {
-    m_aList.realloc( rList.Count() );
-    for ( sal_uInt16 n=0; n<rList.Count(); n++ )
+    m_aList.realloc( rList.getLength() );
+    for ( sal_Int32 n=0; n<rList.getLength(); n++ )
         m_aList[n] = rList[n];
 }
 
@@ -97,10 +102,12 @@ bool SfxIntegerListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 )
     return true;
 }
 
-void SfxIntegerListItem::GetList( SvULongs& rList ) const
+void SfxIntegerListItem::GetList( ::std::vector< sal_uLong >& rList ) const
 {
-    for ( sal_Int32 n=0; n<m_aList.getLength(); n++ )
-        rList.Insert( m_aList[n], sal::static_int_cast< sal_uInt16 >(n) );
+    ::std::vector< sal_uLong >::iterator aIt = rList.begin();
+    rList.reserve( m_aList.getLength() );
+    for ( sal_Int32 n=0; n<m_aList.getLength(); n++, aIt++ )
+        rList.insert( aIt, m_aList[n] );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-- 
1.7.4.1


--=-6hG//ceUjPkPnjTTqojy--



More information about the LibreOffice mailing list