diff options
author | Maciej Rumianowski <maciej.rumianowski@gmail.com> | 2011-07-19 10:19:45 +0200 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-07-20 17:05:29 -0400 |
commit | b0a77d0b6e97cb0e4d93a657a788a3ee7dee0d77 (patch) | |
tree | 00ae3d5432914dd4143db3a93489abe94251849b /svl | |
parent | 1a44a8fc7e8f86af327034bf66ca08e9a414fb75 (diff) |
Port SfxIntegerListItem to ::std::vector
For calc to be free of SvULongs SfxIntegerListItem has to use SvULongs.
Additionaly a constructor with Sequence used in calc.
Diffstat (limited to 'svl')
-rw-r--r-- | svl/inc/svl/ilstitem.hxx | 8 | ||||
-rw-r--r-- | svl/source/items/ilstitem.cxx | 24 |
2 files changed, 19 insertions, 13 deletions
diff --git a/svl/inc/svl/ilstitem.hxx b/svl/inc/svl/ilstitem.hxx index a0527cec556c..2973c066c4d8 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_Int32 >& 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_Int32 >& 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 f8d575b52175..dbf8825e90ba 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_Int32 >& 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,11 @@ 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_Int32 >& rList ) const { - for ( sal_Int32 n=0; n<m_aList.getLength(); n++ ) - rList.Insert( m_aList[n], sal::static_int_cast< sal_uInt16 >(n) ); + rList.reserve( m_aList.getLength() ); + for ( sal_Int32 n=0; n<m_aList.getLength(); ++n ) + rList.push_back( m_aList[n] ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |