[Libreoffice-commits] core.git: chart2/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Tue Jul 12 06:31:30 UTC 2016


 chart2/source/controller/dialogs/res_DataLabel.cxx |   16 ++++++++--------
 chart2/source/controller/dialogs/res_DataLabel.hxx |    3 ---
 2 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 43bc09d6ddfafe4989f922ac2b41f0ac2bedc136
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sun Jul 10 16:29:10 2016 +0200

    chart2: make m_aEntryMap a non member constant
    
    Change-Id: Ic45ba10808ea2ce6bc6520bb4222cd8b3ebd8ea6
    Reviewed-on: https://gerrit.libreoffice.org/27098
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index 7ff9187..7bcb605 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; 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
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
index e716320..2f715e5 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 <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;


More information about the Libreoffice-commits mailing list