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

Kohei Yoshida kohei.yoshida at collabora.com
Mon Mar 24 19:21:44 PDT 2014


 chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx |   11 ++++++++++
 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx       |    4 +++
 chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx |    6 +++--
 chart2/source/model/template/ChartTypeManager.cxx                 |    5 ++++
 chart2/source/model/template/GL3DBarChartTypeTemplate.cxx         |    2 -
 include/xmloff/xmltoken.hxx                                       |    1 
 xmloff/source/chart/SchXMLTools.cxx                               |    8 +++++++
 xmloff/source/chart/SchXMLTools.hxx                               |    1 
 xmloff/source/core/xmltoken.cxx                                   |    1 
 9 files changed, 36 insertions(+), 3 deletions(-)

New commits:
commit 1571316555cc83aff29a8e4b77c31154f9ca1c27
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Mar 24 22:20:02 2014 -0400

    Properly import and export the new chart type to and from ODF.
    
    Change-Id: I38e9813c6eb853dfb92b1537cea0b9ad97473b57

diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index dea17aa..c7eb4ef 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -91,6 +91,7 @@ enum eServiceType
     SERVICE_NAME_STOCK_DIAGRAM,
     SERVICE_NAME_XY_DIAGRAM,
     SERVICE_NAME_BUBBLE_DIAGRAM,
+    SERVICE_NAME_GL3DBAR_DIAGRAM,
 
     SERVICE_NAME_DASH_TABLE,
     SERVICE_NAME_GARDIENT_TABLE,
@@ -121,6 +122,7 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
         ( "com.sun.star.chart.StockDiagram",                   SERVICE_NAME_STOCK_DIAGRAM )
         ( "com.sun.star.chart.XYDiagram",                      SERVICE_NAME_XY_DIAGRAM )
         ( "com.sun.star.chart.BubbleDiagram",                  SERVICE_NAME_BUBBLE_DIAGRAM )
+        ( "com.sun.star.chart.GL3DBarDiagram",                 SERVICE_NAME_GL3DBAR_DIAGRAM )
 
         ( "com.sun.star.drawing.DashTable",                    SERVICE_NAME_DASH_TABLE )
         ( "com.sun.star.drawing.GradientTable",                SERVICE_NAME_GARDIENT_TABLE )
@@ -1263,6 +1265,15 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
                     bCreateDiagram = true;
                 }
                 break;
+            case SERVICE_NAME_GL3DBAR_DIAGRAM:
+                if( xManagerFact.is())
+                {
+                    xTemplate.set(
+                        xManagerFact->createInstance("com.sun.star.chart2.template.GL3DBar"),
+                                uno::UNO_QUERY );
+                    bCreateDiagram = true;
+                }
+                break;
 
             case SERVICE_NAME_DASH_TABLE:
             case SERVICE_NAME_GARDIENT_TABLE:
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 1dc2dd1..04670ad 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -522,6 +522,9 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
     {
         const OUString aName( rTemplateServiceName.copy( aPrefix.getLength()));
 
+        if (aName.indexOf("GL3DBar") != -1)
+            return OUString("com.sun.star.chart.GL3DBarDiagram");
+
         // "Area" "StackedArea" "PercentStackedArea" "ThreeDArea"
         // "StackedThreeDArea" "PercentStackedThreeDArea"
         if( aName.indexOf( "Area" ) != -1 )
@@ -597,6 +600,7 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
         ( "com.sun.star.chart2.NetChartType", "com.sun.star.chart.NetDiagram" )
         ( "com.sun.star.chart2.CandleStickChartType", "com.sun.star.chart.StockDiagram" )
         ( "com.sun.star.chart2.BubbleChartType", "com.sun.star.chart.BubbleDiagram" )
+        ( "com.sun.star.chart2.GL3DBarChartType", "com.sun.star.chart.GL3DBarDiagram" )
         ;
     return g_aChartTypeNameMap;
 }
diff --git a/chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx b/chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx
index 053cbe7..1b3bfdc 100644
--- a/chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx
+++ b/chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx
@@ -33,8 +33,10 @@ Image GL3DBarChartDialogController::getImage()
 const tTemplateServiceChartTypeParameterMap&
 GL3DBarChartDialogController::getTemplateMap() const
 {
-    static tTemplateServiceChartTypeParameterMap aMap(
-        "com.sun.star.chart2.template.GL3DBarRoundedRectangle", ChartTypeParameter(1));
+    static tTemplateServiceChartTypeParameterMap aMap =
+        tTemplateServiceChartTypeParameterMap
+        ("com.sun.star.chart2.template.GL3DBar", ChartTypeParameter(1))
+        ("com.sun.star.chart2.template.GL3DBarRoundedRectangle", ChartTypeParameter(2));
     return aMap;
 }
 
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index 49775f9..f6ebbee 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -122,6 +122,7 @@ enum TemplateId
     TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
     TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
     TEMPLATE_BUBBLE,
+    TEMPLATE_GL3DBAR,
     TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE,
 //    TEMPLATE_SURFACE,
 //     TEMPLATE_ADDIN,
@@ -198,6 +199,7 @@ const tTemplateMapType & lcl_DefaultChartTypeMap()
         ( "com.sun.star.chart2.template.StockVolumeLowHighClose",        TEMPLATE_STOCKVOLUMELOWHIGHCLOSE )
         ( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose",    TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE )
         ( "com.sun.star.chart2.template.Bubble",                         TEMPLATE_BUBBLE )
+        ( "com.sun.star.chart2.template.GL3DBar",                        TEMPLATE_GL3DBAR )
         ( "com.sun.star.chart2.template.GL3DBarRoundedRectangle",        TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE )
 //      ( "com.sun.star.chart2.template.Surface",                        TEMPLATE_SURFACE )
 //      ( "com.sun.star.chart2.template.Addin",                          TEMPLATE_ADDIN )
@@ -532,6 +534,9 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
                 xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
                 break;
 
+            case TEMPLATE_GL3DBAR:
+                xTemplate.set(new GL3DBarChartTypeTemplate(m_xContext, aServiceSpecifier));
+                break;
             case TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE:
                 xTemplate.set(new GL3DBarChartTypeTemplate(m_xContext, aServiceSpecifier));
                 break;
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
index e65c8f5..c551111 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
@@ -19,7 +19,7 @@ namespace chart {
 
 namespace {
 
-const OUString aServiceName("com.sun.star.chart2.BubbleChartTypeTemplate");
+const OUString aServiceName("com.sun.star.chart2.GL3DBarChartTypeTemplate");
 
 }
 
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 8935eb4..3a5996a 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -900,6 +900,7 @@ namespace xmloff { namespace token {
         XML_GCD,
         XML_GENERATOR,
         XML_GEQ,
+        XML_GL3DBAR,
         XML_GOURAUD,
         XML_GRADIENT,
         XML_GRADIENT_ANGLE,
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index b6fe296..06efa57 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -140,6 +140,7 @@ static const SvXMLEnumMapEntry aXMLChartClassMap[] =
     { XML_BAR,          XML_CHART_CLASS_BAR     },
     { XML_STOCK,        XML_CHART_CLASS_STOCK   },
     { XML_BUBBLE,       XML_CHART_CLASS_BUBBLE  },
+    { XML_GL3DBAR,      XML_CHART_CLASS_GL3DBAR },
     { XML_SURFACE,      XML_CHART_CLASS_BAR     }, //@todo change this if a surface chart is available
     { XML_ADD_IN,       XML_CHART_CLASS_ADDIN   },
     { XML_TOKEN_INVALID, XML_CHART_CLASS_UNKNOWN }
@@ -191,6 +192,9 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
         ( OUString( "com.sun.star.chart.BubbleDiagram" )
         , OUString( "com.sun.star.chart2.BubbleChartType" ) )
 
+        ( OUString( "com.sun.star.chart.GL3DBarDiagram" )
+        , OUString( "com.sun.star.chart2.GL3DBarChartType" ) )
+
         ;
     return g_aChartTypeNameMap;
 }
@@ -268,6 +272,8 @@ OUString GetChartTypeByClassName(
         else
             aResultBuffer.append("Column");
     }
+    else if (IsXMLToken(rClassName, XML_GL3DBAR))
+        aResultBuffer.append("GL3DBar");
     else
         bInternalType = false;
 
@@ -333,6 +339,8 @@ XMLTokenEnum getTokenByChartType(
             else if( (bUseOldNames && aServiceName == "Stock") ||
                      (!bUseOldNames && aServiceName == "CandleStick"))
                 eResult = XML_STOCK;
+            else if (aServiceName == "GL3DBar")
+                eResult = XML_GL3DBAR;
         }
     }
 
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index 9c18303..0b6f49a 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -63,6 +63,7 @@ namespace SchXMLTools
         XML_CHART_CLASS_BAR,
         XML_CHART_CLASS_STOCK,
         XML_CHART_CLASS_BUBBLE,
+        XML_CHART_CLASS_GL3DBAR,
         XML_CHART_CLASS_ADDIN,
         XML_CHART_CLASS_UNKNOWN
     };
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index cedae88..e013431 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -904,6 +904,7 @@ namespace xmloff { namespace token {
         TOKEN( "gcd",                             XML_GCD ),
         TOKEN( "generator",                       XML_GENERATOR ),
         TOKEN( "geq",                             XML_GEQ ),
+        TOKEN( "gl3d-bar",                        XML_GL3DBAR ),
         TOKEN( "gouraud",                         XML_GOURAUD ),
         TOKEN( "gradient",                        XML_GRADIENT ),
         TOKEN( "angle",                           XML_GRADIENT_ANGLE ),


More information about the Libreoffice-commits mailing list