diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-23 15:43:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-24 08:55:14 +0200 |
commit | e8e558488217b8d2c381191389f2a785aaa5ca27 (patch) | |
tree | ed93f63487fb670fd3d0a9f3a55d19c39eaa7f82 /svx/source | |
parent | 68b9553d44769947dfe3899b396d9236d4406ddf (diff) |
pass DelFormats around using std::vector
instead of an array and a separate count
Change-Id: Ia12a549da7e35092da2db35f8b2b9fc6a9e9c2be
Reviewed-on: https://gerrit.libreoffice.org/59506
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/items/numfmtsh.cxx | 16 | ||||
-rw-r--r-- | svx/source/items/numinf.cxx | 62 |
2 files changed, 11 insertions, 67 deletions
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index e2b7faf2ece7..673ed349e4a3 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -177,21 +177,9 @@ SvxNumberFormatShell::~SvxNumberFormatShell() } -size_t SvxNumberFormatShell::GetUpdateDataCount() const +std::vector<sal_uInt32> const & SvxNumberFormatShell::GetUpdateData() const { - return aDelList.size(); -} - - -void SvxNumberFormatShell::GetUpdateData( sal_uInt32* pDelArray, const sal_uInt32 nSize ) -{ - const size_t nListSize = aDelList.size(); - - DBG_ASSERT( pDelArray && ( nSize == nListSize ), "Array not initialised!" ); - - if ( pDelArray && ( nSize == nListSize ) ) - for (std::vector<sal_uInt32>::const_iterator it(aDelList.begin()); it != aDelList.end(); ++it ) - *pDelArray++ = *it; + return aDelList; } diff --git a/svx/source/items/numinf.cxx b/svx/source/items/numinf.cxx index 0dcf67964b1b..f47706ad5936 100644 --- a/svx/source/items/numinf.cxx +++ b/svx/source/items/numinf.cxx @@ -26,9 +26,7 @@ pFormatter ( pNum ), \ eValueType ( eVal ), \ aStringVal ( rStr ), \ - nDoubleVal ( nDouble ), \ - pDelFormatArr ( nullptr ), \ - nDelCount ( 0 ) + nDoubleVal ( nDouble ) \ SvxNumberInfoItem::SvxNumberInfoItem( const sal_uInt16 nId ) : @@ -83,17 +81,8 @@ SvxNumberInfoItem::SvxNumberInfoItem( const SvxNumberInfoItem& rItem ) : eValueType ( rItem.eValueType ), aStringVal ( rItem.aStringVal ), nDoubleVal ( rItem.nDoubleVal ), - pDelFormatArr( nullptr ), - nDelCount ( rItem.nDelCount ) - + mvDelFormats( rItem.mvDelFormats ) { - if ( rItem.nDelCount > 0 ) - { - pDelFormatArr.reset( new sal_uInt32[ rItem.nDelCount ] ); - - for ( sal_uInt32 i = 0; i < rItem.nDelCount; ++i ) - pDelFormatArr[i] = rItem.pDelFormatArr[i]; - } } @@ -121,30 +110,11 @@ bool SvxNumberInfoItem::operator==( const SfxPoolItem& rItem ) const const SvxNumberInfoItem& rOther = static_cast<const SvxNumberInfoItem&>(rItem); - bool bEqual = false; - - if ( nDelCount == rOther.nDelCount ) - { - if ( nDelCount > 0 ) - { - if ( pDelFormatArr != nullptr && rOther.pDelFormatArr != nullptr ) - { - bEqual = true; - - for ( sal_uInt32 i = 0; i < nDelCount && bEqual; ++i ) - bEqual = ( pDelFormatArr[i] == rOther.pDelFormatArr[i] ); - } - } - else if ( nDelCount == 0 ) - bEqual = ( pDelFormatArr == nullptr && rOther.pDelFormatArr == nullptr ); - - bEqual = bEqual && - pFormatter == rOther.pFormatter && - eValueType == rOther.eValueType && - nDoubleVal == rOther.nDoubleVal && - aStringVal == rOther.aStringVal; - } - return bEqual; + return mvDelFormats == rOther.mvDelFormats && + pFormatter == rOther.pFormatter && + eValueType == rOther.eValueType && + nDoubleVal == rOther.nDoubleVal && + aStringVal == rOther.aStringVal; } @@ -154,23 +124,9 @@ SfxPoolItem* SvxNumberInfoItem::Clone( SfxItemPool * ) const } -void SvxNumberInfoItem::SetDelFormatArray( const sal_uInt32* pData, - const sal_uInt32 nCount ) +void SvxNumberInfoItem::SetDelFormats( std::vector<sal_uInt32> const & aData ) { - pDelFormatArr.reset(); - - nDelCount = nCount; - - if ( nCount > 0 ) - { - pDelFormatArr.reset( new sal_uInt32[ nCount ] ); - - if ( pData != nullptr ) - { - for ( sal_uInt32 i = 0; i < nCount; ++i ) - pDelFormatArr[i] = pData[i]; - } - } + mvDelFormats = aData; } |