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 /sw | |
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 'sw')
-rw-r--r-- | sw/source/uibase/shells/tabsh.cxx | 19 | ||||
-rw-r--r-- | sw/source/uibase/utlui/numfmtlb.cxx | 8 |
2 files changed, 11 insertions, 16 deletions
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index c319c895483c..fecda67dd7cf 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -681,26 +681,23 @@ void SwTableShell::Execute(SfxRequest &rReq) if (RET_OK == pDlg->Execute()) { - const SfxPoolItem* pNumberFormatItem = GetView().GetDocShell()-> - GetItem( SID_ATTR_NUMBERFORMAT_INFO ); + const SvxNumberInfoItem* pNumberFormatItem + = GetView().GetDocShell()->GetItem( SID_ATTR_NUMBERFORMAT_INFO ); - if( pNumberFormatItem && 0 != static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)->GetDelCount() ) + if( pNumberFormatItem ) { - const sal_uInt32* pDelArr = static_cast<const SvxNumberInfoItem*>( - pNumberFormatItem)->GetDelArray(); - - for ( sal_uInt32 i = 0; i < static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)->GetDelCount(); i++ ) - static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)-> - GetNumberFormatter()->DeleteEntry( pDelArr[i] ); + for ( sal_uInt32 key : pNumberFormatItem->GetDelFormats() ) + pNumberFormatItem->GetNumberFormatter()->DeleteEntry( key ); } + const SfxPoolItem* pNumberFormatValueItem = nullptr; if( SfxItemState::SET == pDlg->GetOutputItemSet()->GetItemState( - SID_ATTR_NUMBERFORMAT_VALUE, false, &pNumberFormatItem )) + SID_ATTR_NUMBERFORMAT_VALUE, false, &pNumberFormatValueItem )) { SfxItemSet aBoxFormatSet( *aCoreSet.GetPool(), svl::Items<RES_BOXATR_FORMAT, RES_BOXATR_FORMAT>{} ); aBoxFormatSet.Put( SwTableBoxNumFormat( - static_cast<const SfxUInt32Item*>(pNumberFormatItem)->GetValue() )); + static_cast<const SfxUInt32Item*>(pNumberFormatValueItem)->GetValue() )); rSh.SetTableBoxFormulaAttrs( aBoxFormatSet ); } diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx index 089e0e9f7445..fef26cf61c3b 100644 --- a/sw/source/uibase/utlui/numfmtlb.cxx +++ b/sw/source/uibase/utlui/numfmtlb.cxx @@ -378,12 +378,10 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox&, rBox, void ) const SfxPoolItem* pItem = pView->GetDocShell()-> GetItem( SID_ATTR_NUMBERFORMAT_INFO ); - if( pItem && 0 != static_cast<const SvxNumberInfoItem*>(pItem)->GetDelCount() ) + if( pItem ) { - const sal_uInt32* pDelArr = static_cast<const SvxNumberInfoItem*>(pItem)->GetDelArray(); - - for ( sal_uInt32 i = 0; i < static_cast<const SvxNumberInfoItem*>(pItem)->GetDelCount(); i++ ) - pFormatter->DeleteEntry( pDelArr[i] ); + for ( sal_uInt32 key : static_cast<const SvxNumberInfoItem*>(pItem)->GetDelFormats() ) + pFormatter->DeleteEntry( key ); } const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); |