chart2: make m_aEntryMap a non member constant

Change-Id: Ic45ba10808ea2ce6bc6520bb4222cd8b3ebd8ea6
Reviewed-on: https://gerrit.libreoffice.org/27098
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Jochen Nitschke
2016-07-10 16:29:10 +02:00
committed by Noel Grandin
parent 0168bdc231
commit 43bc09d6dd
2 changed files with 8 additions and 11 deletions

View File

@@ -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; nEnum<m_pLB_LabelPlacement->GetEntryCount(); ++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<const SfxStringItem*>(pPoolItem)->GetValue())
if( our_aLBEntryMap[i] == static_cast<const SfxStringItem*>(pPoolItem)->GetValue())
m_pLB_Separator->SelectEntryPos( i );
}
else

View File

@@ -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 <vcl/button.hxx>
#include <vcl/layout.hxx>
#include <svl/itemset.hxx>
@@ -56,7 +54,6 @@ private:
VclPtr<VclHBox> m_pSeparatorResources;
VclPtr<ListBox> m_pLB_Separator;
OUString m_aEntryMap[NUMBER_SEPARATORS];
VclPtr<VclHBox> m_pBxLabelPlacement;
VclPtr<ListBox> m_pLB_LabelPlacement;