[Libreoffice-commits] core.git: Branch 'private/kohei/new-chart-type-skeleton' - chart2/inc chart2/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Mar 28 09:29:11 PDT 2014


 chart2/inc/unonames.hxx                                              |    2 
 chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx |    6 +-
 chart2/source/controller/dialogs/ChartTypeDialogController.cxx       |   12 ++--
 chart2/source/model/template/LineChartType.cxx                       |    8 +-
 chart2/source/model/template/LineChartTypeTemplate.cxx               |   24 ++++----
 chart2/source/model/template/ScatterChartType.cxx                    |    8 +-
 chart2/source/model/template/ScatterChartTypeTemplate.cxx            |   28 +++++-----
 chart2/source/view/charttypes/AreaChart.cxx                          |    7 +-
 8 files changed, 53 insertions(+), 42 deletions(-)

New commits:
commit 4faba715f9d0061cb17e6e05c3276ab9c781be57
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Mar 28 12:29:13 2014 -0400

    More on replacing string literals with define macro constants.
    
    Change-Id: I86446a21f042b2b80ab2523fc9df6a90eace3b4e

diff --git a/chart2/inc/unonames.hxx b/chart2/inc/unonames.hxx
index a02ba61..9f9d1cb 100644
--- a/chart2/inc/unonames.hxx
+++ b/chart2/inc/unonames.hxx
@@ -15,6 +15,8 @@
 #define CHART_UNONAME_SPLINE_TYPE           "SplineType"
 #define CHART_UNONAME_SPLINE_ORDER          "SplineOrder"
 #define CHART_UNONAME_SPLINE_RESOLUTION     "SplineResolution"
+#define CHART_UNONAME_CURVE_STYLE           "CurveStyle"
+#define CHART_UNONAME_CURVE_RESOLUTION      "CurveResolution"
 
 #endif
 
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
index baa7683..a72e9e7 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -212,16 +212,16 @@ void WrappedSplineProperties::addWrappedProperties( std::vector< WrappedProperty
     rList.push_back( new WrappedSplineTypeProperty( spChart2ModelContact ) );
     rList.push_back(
         new WrappedSplineProperty<sal_Int32>(
-            CHART_UNONAME_SPLINE_ORDER, "SplineOrder", // same name ?
+            CHART_UNONAME_SPLINE_ORDER, CHART_UNONAME_SPLINE_ORDER, // same name ?
             uno::makeAny(sal_Int32(3)), spChart2ModelContact));
     rList.push_back(
         new WrappedSplineProperty<sal_Int32>(
-            CHART_UNONAME_SPLINE_RESOLUTION, "CurveResolution",
+            CHART_UNONAME_SPLINE_RESOLUTION, CHART_UNONAME_CURVE_RESOLUTION,
             uno::makeAny(sal_Int32(20)), spChart2ModelContact));
 }
 
 WrappedSplineTypeProperty::WrappedSplineTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
-    : WrappedSplineProperty<sal_Int32>(CHART_UNONAME_SPLINE_TYPE, "CurveStyle", uno::makeAny(sal_Int32(0)), spChart2ModelContact )
+    : WrappedSplineProperty<sal_Int32>(CHART_UNONAME_SPLINE_TYPE, CHART_UNONAME_CURVE_STYLE, uno::makeAny(sal_Int32(0)), spChart2ModelContact )
 {
 }
 WrappedSplineTypeProperty::~WrappedSplineTypeProperty()
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index c31ffc8..ee1d899 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -146,9 +146,9 @@ ChartTypeParameter ChartTypeDialogController::getChartTypeParameterForService(
     {
         try
         {
-            xTemplateProps->getPropertyValue( "CurveStyle" ) >>= aRet.eCurveStyle;
-            xTemplateProps->getPropertyValue( "CurveResolution" ) >>= aRet.nCurveResolution;
-            xTemplateProps->getPropertyValue( "SplineOrder" ) >>= aRet.nSplineOrder;
+            xTemplateProps->getPropertyValue( CHART_UNONAME_CURVE_STYLE ) >>= aRet.eCurveStyle;
+            xTemplateProps->getPropertyValue( CHART_UNONAME_CURVE_RESOLUTION ) >>= aRet.nCurveResolution;
+            xTemplateProps->getPropertyValue( CHART_UNONAME_SPLINE_ORDER ) >>= aRet.nSplineOrder;
         }
         catch( uno::Exception & ex )
         {
@@ -291,9 +291,9 @@ uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTempla
             {
                 try
                 {
-                    xTemplateProps->setPropertyValue( "CurveStyle" , uno::makeAny(rParameter.eCurveStyle) );
-                    xTemplateProps->setPropertyValue( "CurveResolution" , uno::makeAny(rParameter.nCurveResolution) );
-                    xTemplateProps->setPropertyValue( "SplineOrder" , uno::makeAny(rParameter.nSplineOrder) );
+                    xTemplateProps->setPropertyValue( CHART_UNONAME_CURVE_STYLE , uno::makeAny(rParameter.eCurveStyle) );
+                    xTemplateProps->setPropertyValue( CHART_UNONAME_CURVE_RESOLUTION , uno::makeAny(rParameter.nCurveResolution) );
+                    xTemplateProps->setPropertyValue( CHART_UNONAME_SPLINE_ORDER , uno::makeAny(rParameter.nSplineOrder) );
                 }
                 catch( uno::Exception & ex )
                 {
diff --git a/chart2/source/model/template/LineChartType.cxx b/chart2/source/model/template/LineChartType.cxx
index 7733ed5..d1b9185 100644
--- a/chart2/source/model/template/LineChartType.cxx
+++ b/chart2/source/model/template/LineChartType.cxx
@@ -22,6 +22,8 @@
 #include "macros.hxx"
 #include "servicenames_charttypes.hxx"
 #include "ContainerHelper.hxx"
+#include <unonames.hxx>
+
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/chart2/CurveStyle.hpp>
 
@@ -47,20 +49,20 @@ void lcl_AddPropertiesToVector(
     ::std::vector< Property > & rOutProperties )
 {
     rOutProperties.push_back(
-        Property( "CurveStyle",
+        Property( CHART_UNONAME_CURVE_STYLE,
                   PROP_LINECHARTTYPE_CURVE_STYLE,
                   ::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     rOutProperties.push_back(
-        Property( "CurveResolution",
+        Property( CHART_UNONAME_CURVE_RESOLUTION,
                   PROP_LINECHARTTYPE_CURVE_RESOLUTION,
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     rOutProperties.push_back(
-        Property( "SplineOrder",
+        Property( CHART_UNONAME_SPLINE_ORDER,
                   PROP_LINECHARTTYPE_SPLINE_ORDER,
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
                   beans::PropertyAttribute::BOUND
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
index 5d833df..232ccce 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -23,10 +23,12 @@
 #include "servicenames_charttypes.hxx"
 #include "ContainerHelper.hxx"
 #include "DataSeriesHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <unonames.hxx>
+
 #include <com/sun/star/chart2/SymbolStyle.hpp>
 #include <com/sun/star/chart2/Symbol.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
-#include "PropertyHelper.hxx"
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 
 #include <algorithm>
@@ -56,19 +58,19 @@ void lcl_AddPropertiesToVector(
     ::std::vector< Property > & rOutProperties )
 {
     rOutProperties.push_back(
-        Property( "CurveStyle",
+        Property( CHART_UNONAME_CURVE_STYLE,
                   PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE,
                   ::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     rOutProperties.push_back(
-        Property( "CurveResolution",
+        Property( CHART_UNONAME_CURVE_RESOLUTION,
                   PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     rOutProperties.push_back(
-        Property( "SplineOrder",
+        Property( CHART_UNONAME_SPLINE_ORDER,
                   PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER,
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
                   beans::PropertyAttribute::BOUND
@@ -275,9 +277,9 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
             uno::Reference< beans::XPropertySet > xChartTypeProp(
                 DiagramHelper::getChartTypeByIndex( xDiagram, 0 ),
                 uno::UNO_QUERY_THROW );
-            setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue("CurveStyle") );
-            setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue("CurveResolution") );
-            setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue("SplineOrder") );
+            setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_STYLE) );
+            setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) );
+            setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) );
         }
         catch( const uno::Exception & ex )
         {
@@ -303,9 +305,9 @@ Reference< chart2::XChartType > LineChartTypeTemplate::getChartTypeForIndex( sal
         if( xCTProp.is())
         {
             xCTProp->setPropertyValue(
-                "CurveStyle", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+                CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
             xCTProp->setPropertyValue(
-                "CurveResolution", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+                CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
             xCTProp->setPropertyValue(
                 "SplineOrder", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
         }
@@ -337,9 +339,9 @@ Reference< chart2::XChartType > SAL_CALL LineChartTypeTemplate::getChartTypeForN
         if( xCTProp.is())
         {
             xCTProp->setPropertyValue(
-                "CurveStyle", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+                CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
             xCTProp->setPropertyValue(
-                "CurveResolution", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+                CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
             xCTProp->setPropertyValue(
                 "SplineOrder", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
         }
diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx
index 9f33147..7d83da3 100644
--- a/chart2/source/model/template/ScatterChartType.cxx
+++ b/chart2/source/model/template/ScatterChartType.cxx
@@ -25,6 +25,8 @@
 #include "CartesianCoordinateSystem.hxx"
 #include "AxisHelper.hxx"
 #include "AxisIndexDefines.hxx"
+#include <unonames.hxx>
+
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/chart2/AxisType.hpp>
 #include <com/sun/star/chart2/CurveStyle.hpp>
@@ -51,20 +53,20 @@ void lcl_AddPropertiesToVector(
     ::std::vector< Property > & rOutProperties )
 {
     rOutProperties.push_back(
-        Property( "CurveStyle",
+        Property( CHART_UNONAME_CURVE_STYLE,
                   PROP_SCATTERCHARTTYPE_CURVE_STYLE,
                   ::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     rOutProperties.push_back(
-        Property( "CurveResolution",
+        Property( CHART_UNONAME_CURVE_RESOLUTION,
                   PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION,
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     rOutProperties.push_back(
-        Property( "SplineOrder",
+        Property( CHART_UNONAME_SPLINE_ORDER,
                   PROP_SCATTERCHARTTYPE_SPLINE_ORDER,
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
                   beans::PropertyAttribute::BOUND
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index 2312ae8..0f9d3a3 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -25,10 +25,12 @@
 #include "servicenames_charttypes.hxx"
 #include "ContainerHelper.hxx"
 #include "DataSeriesHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <unonames.hxx>
+
 #include <com/sun/star/chart2/SymbolStyle.hpp>
 #include <com/sun/star/chart2/Symbol.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
-#include "PropertyHelper.hxx"
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 
 #include <algorithm>
@@ -58,19 +60,19 @@ void lcl_AddPropertiesToVector(
     ::std::vector< Property > & rOutProperties )
 {
     rOutProperties.push_back(
-        Property( "CurveStyle",
+        Property( CHART_UNONAME_CURVE_STYLE,
                   PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE,
                   ::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     rOutProperties.push_back(
-        Property( "CurveResolution",
+        Property( CHART_UNONAME_CURVE_RESOLUTION,
                   PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     rOutProperties.push_back(
-        Property( "SplineOrder",
+        Property( CHART_UNONAME_SPLINE_ORDER,
                   PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER,
                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
                   beans::PropertyAttribute::BOUND
@@ -309,9 +311,9 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
             uno::Reference< beans::XPropertySet > xChartTypeProp(
                 DiagramHelper::getChartTypeByIndex( xDiagram, 0 ),
                 uno::UNO_QUERY_THROW );
-            setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue("CurveStyle") );
-            setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue("CurveResolution") );
-            setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue("SplineOrder") );
+            setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_STYLE) );
+            setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) );
+            setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) );
         }
         catch( const uno::Exception & ex )
         {
@@ -337,11 +339,11 @@ Reference< chart2::XChartType > ScatterChartTypeTemplate::getChartTypeForIndex(
         if( xCTProp.is())
         {
             xCTProp->setPropertyValue(
-                "CurveStyle", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+                CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
             xCTProp->setPropertyValue(
-                "CurveResolution", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+                CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
             xCTProp->setPropertyValue(
-                "SplineOrder", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+                CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
         }
     }
     catch( const uno::Exception & ex )
@@ -371,11 +373,11 @@ Reference< chart2::XChartType > SAL_CALL ScatterChartTypeTemplate::getChartTypeF
         if( xCTProp.is())
         {
             xCTProp->setPropertyValue(
-                "CurveStyle", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+                CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
             xCTProp->setPropertyValue(
-                "CurveResolution", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+                CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
             xCTProp->setPropertyValue(
-                "SplineOrder", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+                CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
         }
     }
     catch( const uno::Exception & ex )
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 2cc53b6..ce557ad 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -30,6 +30,7 @@
 #include "Clipping.hxx"
 #include "Stripe.hxx"
 #include "DateHelper.hxx"
+#include <unonames.hxx>
 
 #include <com/sun/star/chart2/Symbol.hpp>
 #include <com/sun/star/chart/DataLabelPlacement.hpp>
@@ -76,9 +77,9 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
     {
         if( m_xChartTypeModelProps.is() )
         {
-            m_xChartTypeModelProps->getPropertyValue("CurveStyle") >>= m_eCurveStyle;
-            m_xChartTypeModelProps->getPropertyValue("CurveResolution") >>= m_nCurveResolution;
-            m_xChartTypeModelProps->getPropertyValue("SplineOrder") >>= m_nSplineOrder;
+            m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle;
+            m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution;
+            m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder;
         }
     }
     catch( uno::Exception& e )


More information about the Libreoffice-commits mailing list