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

Kohei Yoshida kohei.yoshida at collabora.com
Fri Mar 21 07:57:00 PDT 2014


 chart2/Library_chartcore.mk                               |    1 
 chart2/source/model/template/ChartTypeManager.cxx         |    7 ++
 chart2/source/model/template/GL3DBarChartTypeTemplate.cxx |   36 +++++++++++
 chart2/source/model/template/GL3DBarChartTypeTemplate.hxx |   43 ++++++++++++++
 chart2/source/tools/DiagramHelper.cxx                     |    2 
 5 files changed, 88 insertions(+), 1 deletion(-)

New commits:
commit 7b458d2a6261af6b8eaf16a077b02d0168eea6c0
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Mar 21 10:55:06 2014 -0400

    Skeleton template class for GL3D bar chart type.
    
    Still very much empty.  It needs to be filled with sub-categories.
    
    Change-Id: Iad7ad34efb264025541b585a92ee2ea7b8fff56f

diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 2e09fe3..63171f4 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -154,6 +154,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
     chart2/source/model/template/DataInterpreter \
     chart2/source/model/template/FilledNetChartType \
     chart2/source/model/template/GL3DBarChartType \
+    chart2/source/model/template/GL3DBarChartTypeTemplate \
     chart2/source/model/template/LineChartType \
     chart2/source/model/template/LineChartTypeTemplate \
     chart2/source/model/template/NetChartType \
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index e68744c..49775f9 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -33,6 +33,7 @@
 #include "StockChartTypeTemplate.hxx"
 #include "NetChartTypeTemplate.hxx"
 #include "BubbleChartTypeTemplate.hxx"
+#include "GL3DBarChartTypeTemplate.hxx"
 #include <cppuhelper/component_context.hxx>
 #include <comphelper/InlineContainer.hxx>
 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
@@ -121,6 +122,7 @@ enum TemplateId
     TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
     TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
     TEMPLATE_BUBBLE,
+    TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE,
 //    TEMPLATE_SURFACE,
 //     TEMPLATE_ADDIN,
     TEMPLATE_NOT_FOUND = 0xffff
@@ -196,6 +198,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.GL3DBarRoundedRectangle",        TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE )
 //      ( "com.sun.star.chart2.template.Surface",                        TEMPLATE_SURFACE )
 //      ( "com.sun.star.chart2.template.Addin",                          TEMPLATE_ADDIN )
         );
@@ -529,6 +532,10 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
                 xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
                 break;
 
+            case TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE:
+                xTemplate.set(new GL3DBarChartTypeTemplate(m_xContext, aServiceSpecifier));
+                break;
+
 //            case TEMPLATE_SURFACE:
 //            case TEMPLATE_ADDIN:
 //               break;
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
new file mode 100644
index 0000000..306481e
--- /dev/null
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "GL3DBarChartTypeTemplate.hxx"
+
+using namespace com::sun::star;
+
+namespace chart {
+
+GL3DBarChartTypeTemplate::GL3DBarChartTypeTemplate(
+    const uno::Reference<uno::XComponentContext>& xContext, const OUString& rServiceName ) :
+    ChartTypeTemplate(xContext, rServiceName) {}
+
+GL3DBarChartTypeTemplate::~GL3DBarChartTypeTemplate() {}
+
+uno::Reference<chart2::XChartType> GL3DBarChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+{
+    return uno::Reference<chart2::XChartType>();
+}
+
+uno::Reference<chart2::XChartType>
+GL3DBarChartTypeTemplate::getChartTypeForNewSeries(
+    const uno::Sequence<uno::Reference<chart2::XChartType> >& /*xOldChartTypes*/ )
+{
+    return uno::Reference<chart2::XChartType>();
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
new file mode 100644
index 0000000..2574329
--- /dev/null
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef CHART2_GL3DBARCHARTTYPETEMPLATE_HXX
+#define CHART2_GL3DBARCHARTTYPETEMPLATE_HXX
+
+#include <MutexContainer.hxx>
+#include <ChartTypeTemplate.hxx>
+#include <OPropertySet.hxx>
+#include <ServiceMacros.hxx>
+
+namespace chart {
+
+class GL3DBarChartTypeTemplate : public ChartTypeTemplate
+{
+public:
+    GL3DBarChartTypeTemplate(
+        const css::uno::Reference<
+            css::uno::XComponentContext>& xContext,
+        const OUString& rServiceName );
+
+    virtual ~GL3DBarChartTypeTemplate();
+
+    virtual css::uno::Reference<css::chart2::XChartType> getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+
+    // XChartTypeTemplate
+
+    virtual css::uno::Reference<css::chart2::XChartType> SAL_CALL
+        getChartTypeForNewSeries(
+            const css::uno::Sequence<css::uno::Reference<css::chart2::XChartType> >& xOldChartTypes );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index a683903..d21b6df 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -112,7 +112,7 @@ DiagramHelper::tTemplateWithServiceName
                 Reference< XChartTypeTemplate > xTempl(
                     xChartTypeManager->createInstance( aServiceNames[ i ] ), uno::UNO_QUERY_THROW );
 
-                if( xTempl->matchesTemplate( xDiagram, sal_True ))
+                if (xTempl.is() && xTempl->matchesTemplate(xDiagram, true))
                 {
                     aResult.first = xTempl;
                     aResult.second = aServiceNames[ i ];


More information about the Libreoffice-commits mailing list