uno::Sequence->std::vector in SfxIntegerListItem

Change-Id: Icdbb361feea2ebee74f9d0a906bdd3c2882443e8
This commit is contained in:
Noel Grandin 2015-12-03 12:03:14 +02:00
parent ea297dd202
commit e6721d2d17
6 changed files with 22 additions and 31 deletions

View file

@ -133,13 +133,13 @@ DataLabelResources::DataLabelResources(VclBuilderContainer* pWindow, vcl::Window
for( sal_Int32 nEnum=0; nEnum<m_pLB_LabelPlacement->GetEntryCount(); ++nEnum )
aPlacementToStringMap[nEnum] = m_pLB_LabelPlacement->GetEntry(static_cast<sal_uInt16>(nEnum));
::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList;
std::vector< sal_Int32 > aAvailabelPlacementList;
const SfxPoolItem *pPoolItem = nullptr;
if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, true, &pPoolItem) == SfxItemState::SET )
aAvailabelPlacementList = static_cast<const SfxIntegerListItem*>(pPoolItem)->GetConstSequence();
aAvailabelPlacementList = static_cast<const SfxIntegerListItem*>(pPoolItem)->GetList();
m_pLB_LabelPlacement->Clear();
for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN )
for( size_t nN=0; nN<aAvailabelPlacementList.size(); ++nN )
{
sal_uInt16 nListBoxPos = static_cast<sal_uInt16>( nN );
sal_Int32 nPlacement = aAvailabelPlacementList[nN];

View file

@ -189,17 +189,17 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
//missing value treatment
{
::com::sun::star::uno::Sequence < sal_Int32 > aMissingValueTreatments;
std::vector< sal_Int32 > aMissingValueTreatments;
if( rInAttrs->GetItemState(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, true, &pPoolItem) == SfxItemState::SET )
aMissingValueTreatments =static_cast<const SfxIntegerListItem*>(pPoolItem)->GetConstSequence();
aMissingValueTreatments = static_cast<const SfxIntegerListItem*>(pPoolItem)->GetList();
if ( aMissingValueTreatments.getLength()>1 && rInAttrs->GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,true, &pPoolItem) == SfxItemState::SET)
if ( aMissingValueTreatments.size()>1 && rInAttrs->GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,true, &pPoolItem) == SfxItemState::SET)
{
m_pRB_DontPaint->Enable(false);
m_pRB_AssumeZero->Enable(false);
m_pRB_ContinueLine->Enable(false);
for( sal_Int32 nN =0; nN<aMissingValueTreatments.getLength(); nN++ )
for( sal_Int32 nN =0; nN<aMissingValueTreatments.size(); nN++ )
{
sal_Int32 nVal = aMissingValueTreatments[nN];
if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)

View file

@ -162,8 +162,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore
if (rCoreAttrs.HasItem(SID_ATTR_BORDER_STYLES, &pItem))
{
const SfxIntegerListItem* p = static_cast<const SfxIntegerListItem*>(pItem);
std::vector<sal_Int32> aUsedStyles;
p->GetList(aUsedStyles);
std::vector<sal_Int32> aUsedStyles = p->GetList();
for (size_t i = 0, n = aUsedStyles.size(); i < n; ++i)
maUsedBorderStyles.insert(static_cast<sal_Int16>(aUsedStyles[i]));
}

View file

@ -27,7 +27,7 @@
class SVL_DLLPUBLIC SfxIntegerListItem : public SfxPoolItem
{
css::uno::Sequence < sal_Int32 > m_aList;
std::vector < sal_Int32 > m_aList;
public:
static SfxPoolItem* CreateDefault();
@ -37,12 +37,8 @@ public:
SfxIntegerListItem( const SfxIntegerListItem& rItem );
virtual ~SfxIntegerListItem();
css::uno::Sequence < sal_Int32 > GetSequence()
{ return m_aList; }
css::uno::Sequence < sal_Int32 > GetConstSequence() const
{ return (const_cast< SfxIntegerListItem * >(this))->GetSequence(); }
void GetList( ::std::vector < sal_Int32 >& rList ) const;
std::vector< sal_Int32 >& GetList() { return m_aList; }
const std::vector< sal_Int32 >& GetList() const { return m_aList; }
virtual bool operator==( const SfxPoolItem& ) const override;
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;

View file

@ -796,7 +796,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
::std::vector < sal_Int32 > aIndexList;
const SfxIntegerListItem* pItem = rReq.GetArg<SfxIntegerListItem>(SID_SELECT_TABLES);
if ( pItem )
pItem->GetList( aIndexList );
aIndexList = pItem->GetList();
else
{
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();

View file

@ -21,6 +21,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <svl/ilstitem.hxx>
@ -33,24 +34,22 @@ SfxIntegerListItem::SfxIntegerListItem()
SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::std::vector < sal_Int32 >& rList )
: SfxPoolItem( which )
, m_aList( rList )
{
m_aList.realloc( rList.size() );
for ( size_t n=0; n<rList.size(); ++n )
m_aList[n] = rList[n];
}
SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const css::uno::Sequence < sal_Int32 >& rList )
: SfxPoolItem( which )
{
m_aList.realloc( rList.getLength() );
m_aList.resize( rList.getLength() );
for ( sal_Int32 n=0; n<rList.getLength(); ++n )
m_aList[n] = rList[n];
}
SfxIntegerListItem::SfxIntegerListItem( const SfxIntegerListItem& rItem )
: SfxPoolItem( rItem )
, m_aList( rItem.m_aList )
{
m_aList = rItem.m_aList;
}
SfxIntegerListItem::~SfxIntegerListItem()
@ -82,20 +81,17 @@ bool SfxIntegerListItem::PutValue ( const css::uno::Any& rVal, sal_uInt8 )
return true;
}
return ( aNew >>= m_aList );
css::uno::Sequence<sal_Int32> aTempSeq;
bool bRet = aNew >>= aTempSeq;
if (bRet)
m_aList = comphelper::sequenceToContainer<std::vector<sal_Int32>>(aTempSeq);
return bRet;
}
bool SfxIntegerListItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const
{
rVal <<= m_aList;
rVal <<= comphelper::containerToSequence(m_aList);
return true;
}
void SfxIntegerListItem::GetList( ::std::vector< sal_Int32 >& rList ) const
{
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: */