From 43bc09d6ddfafe4989f922ac2b41f0ac2bedc136 Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Sun, 10 Jul 2016 16:29:10 +0200 Subject: chart2: make m_aEntryMap a non member constant Change-Id: Ic45ba10808ea2ce6bc6520bb4222cd8b3ebd8ea6 Reviewed-on: https://gerrit.libreoffice.org/27098 Tested-by: Jenkins Reviewed-by: Noel Grandin --- chart2/source/controller/dialogs/res_DataLabel.cxx | 16 ++++++++-------- chart2/source/controller/dialogs/res_DataLabel.hxx | 3 --- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'chart2') diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index 7ff918745909..7bcb6053909a 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -40,6 +40,11 @@ namespace chart namespace { +const OUString our_aLBEntryMap[] = {" ", + ", ", + "; ", + "\n"}; + bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, sal_uInt16 nValueWhich, sal_uInt16 nSourceFormatWhich, sal_uLong& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut ) { bool bSet = false; @@ -123,11 +128,6 @@ DataLabelResources::DataLabelResources(VclBuilderContainer* pWindow, vcl::Window pWindow->get(m_pSeparatorResources, "boxSEPARATOR"); pWindow->get(m_pLB_Separator, "LB_TEXT_SEPARATOR"); - m_aEntryMap[0] = " "; - m_aEntryMap[1] = ", "; - m_aEntryMap[2] = "; "; - m_aEntryMap[3] = "\n" ; - //fill label placement list std::map< sal_Int32, OUString > aPlacementToStringMap; for( sal_Int32 nEnum=0; nEnumGetEntryCount(); ++nEnum ) @@ -298,7 +298,7 @@ bool DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const if( m_pCBWrapText->GetState()!= TRISTATE_INDET ) rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_WRAP_TEXT, m_pCBWrapText->IsChecked()) ); - OUString aSep = m_aEntryMap[m_pLB_Separator->GetSelectEntryPos()]; + OUString aSep = our_aLBEntryMap[m_pLB_Separator->GetSelectEntryPos()]; rOutAttrs->Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, aSep) ); ::std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_pLB_LabelPlacement->GetSelectEntryPos()) ); @@ -336,9 +336,9 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) const SfxPoolItem *pPoolItem = nullptr; if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, true, &pPoolItem) == SfxItemState::SET ) - for(sal_Int32 i=0; i < NUMBER_SEPARATORS; ++i ) + for(sal_uInt32 i=0; i < SAL_N_ELEMENTS(our_aLBEntryMap); ++i ) { - if( m_aEntryMap[i] == static_cast(pPoolItem)->GetValue()) + if( our_aLBEntryMap[i] == static_cast(pPoolItem)->GetValue()) m_pLB_Separator->SelectEntryPos( i ); } else diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx index e716320072dc..2f715e5a44f5 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.hxx +++ b/chart2/source/controller/dialogs/res_DataLabel.hxx @@ -19,8 +19,6 @@ #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_DATALABEL_HXX #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_DATALABEL_HXX -#define NUMBER_SEPARATORS 4 - #include #include #include @@ -56,7 +54,6 @@ private: VclPtr m_pSeparatorResources; VclPtr m_pLB_Separator; - OUString m_aEntryMap[NUMBER_SEPARATORS]; VclPtr m_pBxLabelPlacement; VclPtr m_pLB_LabelPlacement; -- cgit