Kaydet (Commit) b0a77d0b authored tarafından Maciej Rumianowski's avatar Maciej Rumianowski Kaydeden (comit) Kohei Yoshida

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.
üst 1a44a8fc
......@@ -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;
......
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment