summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-24 17:47:01 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-25 22:50:50 -0400
commit05efb605b36ea340762ef1583b3aea6a6b5cdddb (patch)
treebda32d32b165bc566c4b0ab24b4d10da8d3c6cfd /chart2
parentb7c3e851465638d4416ca8837937946353561088 (diff)
Add a new skeleton plotter for the GL3D bar chart.
It plots absolutely nothing. It's just a place holder for now. Change-Id: I6eb9cc23481391b83f6946a8b49a6176c5b29cd7
Diffstat (limited to 'chart2')
-rw-r--r--chart2/Library_chartcore.mk1
-rw-r--r--chart2/source/chartcore.component4
-rw-r--r--chart2/source/model/template/GL3DBarChartType.cxx12
-rw-r--r--chart2/source/model/template/GL3DBarChartType.hxx2
-rw-r--r--chart2/source/model/template/GL3DBarChartTypeTemplate.cxx25
-rw-r--r--chart2/source/model/template/GL3DBarChartTypeTemplate.hxx2
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx2
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx29
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.hxx30
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx15
-rw-r--r--chart2/source/view/main/PlotterBase.cxx6
11 files changed, 119 insertions, 9 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 63171f40a9f5..6dafd718fbbe 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -87,6 +87,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
chart2/source/view/charttypes/BubbleChart \
chart2/source/view/charttypes/CandleStickChart \
chart2/source/view/charttypes/CategoryPositionHelper \
+ chart2/source/view/charttypes/GL3DBarChart \
chart2/source/view/charttypes/NetChart \
chart2/source/view/charttypes/PieChart \
chart2/source/view/charttypes/Splines \
diff --git a/chart2/source/chartcore.component b/chart2/source/chartcore.component
index 5df1a183b55f..40296700d080 100644
--- a/chart2/source/chartcore.component
+++ b/chart2/source/chartcore.component
@@ -101,6 +101,10 @@
<service name="com.sun.star.chart2.BubbleChartType"/>
<service name="com.sun.star.chart2.ChartType"/>
</implementation>
+ <implementation name="com.sun.star.comp.chart.GL3DBarChartType">
+ <service name="com.sun.star.chart2.GL3DBarChartType"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ </implementation>
<implementation name="com.sun.star.comp.chart.CandleStickChartType">
<service name="com.sun.star.beans.PropertySet"/>
<service name="com.sun.star.chart2.CandleStickChartType"/>
diff --git a/chart2/source/model/template/GL3DBarChartType.cxx b/chart2/source/model/template/GL3DBarChartType.cxx
index 1dd889d4a8ba..033c38c4a2b4 100644
--- a/chart2/source/model/template/GL3DBarChartType.cxx
+++ b/chart2/source/model/template/GL3DBarChartType.cxx
@@ -15,7 +15,14 @@ using namespace com::sun::star;
namespace chart {
GL3DBarChartType::GL3DBarChartType( const uno::Reference<uno::XComponentContext>& xContext ) :
- ChartType(xContext) {}
+ ChartType(xContext)
+{
+}
+
+GL3DBarChartType::GL3DBarChartType( const GL3DBarChartType& rOther ) :
+ ChartType(rOther)
+{
+}
GL3DBarChartType::~GL3DBarChartType() {}
@@ -30,9 +37,6 @@ uno::Sequence<OUString> GL3DBarChartType::getSupportedServiceNames_Static()
return aServices;
}
-GL3DBarChartType::GL3DBarChartType( const GL3DBarChartType& rOther ) :
- ChartType(rOther) {}
-
OUString SAL_CALL GL3DBarChartType::getChartType()
throw (::com::sun::star::uno::RuntimeException, std::exception)
{
diff --git a/chart2/source/model/template/GL3DBarChartType.hxx b/chart2/source/model/template/GL3DBarChartType.hxx
index 49510508bb3a..ee9d0ab69b50 100644
--- a/chart2/source/model/template/GL3DBarChartType.hxx
+++ b/chart2/source/model/template/GL3DBarChartType.hxx
@@ -22,7 +22,7 @@ namespace chart {
class GL3DBarChartType : public ChartType
{
public:
- GL3DBarChartType( const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& xContext );
+ GL3DBarChartType( const css::uno::Reference<css::uno::XComponentContext>& xContext );
virtual ~GL3DBarChartType();
APPHELPER_XSERVICEINFO_DECL()
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
index 262828c2c8aa..e65c8f562c48 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
@@ -8,6 +8,8 @@
*/
#include "GL3DBarChartTypeTemplate.hxx"
+#include "GL3DBarChartType.hxx"
+
#include <servicenames_charttypes.hxx>
#include <macros.hxx>
@@ -15,6 +17,12 @@ using namespace com::sun::star;
namespace chart {
+namespace {
+
+const OUString aServiceName("com.sun.star.chart2.BubbleChartTypeTemplate");
+
+}
+
GL3DBarChartTypeTemplate::GL3DBarChartTypeTemplate(
const uno::Reference<uno::XComponentContext>& xContext, const OUString& rServiceName ) :
ChartTypeTemplate(xContext, rServiceName) {}
@@ -51,8 +59,13 @@ GL3DBarChartTypeTemplate::getChartTypeForNewSeries(
uno::Reference<lang::XMultiServiceFactory> xFact(
GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW);
+#if 1
+ // I gave up trying to use UNO just to instantiate this little thing...
+ xResult.set(new GL3DBarChartType(GetComponentContext()));
+#else
+ // This never works for me.
xResult.set(xFact->createInstance(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR), uno::UNO_QUERY_THROW);
-
+#endif
ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem(xOldChartTypes, xResult);
}
catch (const uno::Exception & ex)
@@ -68,6 +81,16 @@ sal_Bool GL3DBarChartTypeTemplate::supportsCategories()
return false;
}
+uno::Sequence<OUString> GL3DBarChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ uno::Sequence<OUString> aServices(2);
+ aServices[0] = aServiceName;
+ aServices[1] = "com.sun.star.chart2.ChartTypeTemplate";
+ return aServices;
+}
+
+APPHELPER_XSERVICEINFO_IMPL(GL3DBarChartTypeTemplate, aServiceName);
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
index 47a7b06cf2d7..56aa2208f3cb 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
@@ -20,6 +20,8 @@ namespace chart {
class GL3DBarChartTypeTemplate : public ChartTypeTemplate
{
public:
+ APPHELPER_XSERVICEINFO_DECL()
+
GL3DBarChartTypeTemplate(
const css::uno::Reference<
css::uno::XComponentContext>& xContext,
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 2443e20aeea8..2cc53b6204e6 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -136,7 +136,7 @@ drawing::Direction3D AreaChart::getPreferredDiagramAspectRatio() const
drawing::Direction3D aRet(1,-1,1);
if( m_nDimension == 2 )
aRet = drawing::Direction3D(-1,-1,-1);
- else
+ else if (m_pPosHelper)
{
drawing::Direction3D aScale( m_pPosHelper->getScaledLogicWidth() );
aRet.DirectionZ = aScale.DirectionZ*0.2;
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
new file mode 100644
index 000000000000..bd0250bb37eb
--- /dev/null
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -0,0 +1,29 @@
+/* -*- 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 "GL3DBarChart.hxx"
+
+namespace chart {
+
+GL3DBarChart::GL3DBarChart( const css::uno::Reference<css::chart2::XChartType>& xChartTypeModel ) :
+ VSeriesPlotter(xChartTypeModel, 3, false)
+{
+}
+
+GL3DBarChart::~GL3DBarChart()
+{
+}
+
+void GL3DBarChart::createShapes()
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/GL3DBarChart.hxx b/chart2/source/view/charttypes/GL3DBarChart.hxx
new file mode 100644
index 000000000000..d5ecf7766680
--- /dev/null
+++ b/chart2/source/view/charttypes/GL3DBarChart.hxx
@@ -0,0 +1,30 @@
+/* -*- 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_GL3DBARCHART_HXX
+#define CHART2_GL3DBARCHART_HXX
+
+#include <VSeriesPlotter.hxx>
+
+namespace chart {
+
+class GL3DBarChart : public VSeriesPlotter
+{
+public:
+ GL3DBarChart( const css::uno::Reference<css::chart2::XChartType>& xChartTypeModel );
+ virtual ~GL3DBarChart();
+
+ virtual void createShapes();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 5202cc10dee2..79e1e28b89fe 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -51,7 +51,7 @@
#include "CandleStickChart.hxx"
#include "BubbleChart.hxx"
#include "NetChart.hxx"
-
+#include "GL3DBarChart.hxx"
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart/TimeUnit.hpp>
@@ -250,6 +250,9 @@ void VSeriesPlotter::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32
drawing::Direction3D VSeriesPlotter::getPreferredDiagramAspectRatio() const
{
drawing::Direction3D aRet(1.0,1.0,1.0);
+ if (!m_pPosHelper)
+ return aRet;
+
drawing::Direction3D aScale( m_pPosHelper->getScaledLogicWidth() );
aRet.DirectionZ = aScale.DirectionZ*0.2;
if(aRet.DirectionZ>1.0)
@@ -803,6 +806,9 @@ void VSeriesPlotter::createErrorBar(
if(nErrorBarStyle==::com::sun::star::chart::ErrorBarStyle::NONE)
return;
+ if (!m_pPosHelper)
+ return;
+
drawing::Position3D aUnscaledLogicPosition(rUnscaledLogicPosition);
if(nErrorBarStyle==::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION)
{
@@ -967,6 +973,9 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries& rVDataSeries,
if(!xContainer.is())
return;
+ if (!m_pPosHelper)
+ return;
+
uno::Sequence< uno::Reference< XRegressionCurve > > aCurveList = xContainer->getRegressionCurves();
for(sal_Int32 nN=0; nN<aCurveList.getLength(); nN++)
@@ -1882,7 +1891,7 @@ PlottingPositionHelper& VSeriesPlotter::getPlottingPositionHelper( sal_Int32 nAx
{
pRet = aPosIt->second;
}
- else
+ else if (m_pPosHelper)
{
tSecondaryValueScales::const_iterator aScaleIt = m_aSecondaryValueScales.find( nAxisIndex );
if( aScaleIt != m_aSecondaryValueScales.end() )
@@ -2434,6 +2443,8 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter(
pRet = new AreaChart(xChartTypeModel,nDimensionCount,false,true);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
pRet = new BubbleChart(xChartTypeModel,nDimensionCount);
+ else if (aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR))
+ pRet = new GL3DBarChart(xChartTypeModel);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
pRet = new PieChart(xChartTypeModel,nDimensionCount, bExcludingPositioning );
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
diff --git a/chart2/source/view/main/PlotterBase.cxx b/chart2/source/view/main/PlotterBase.cxx
index f38b57052906..c27389910634 100644
--- a/chart2/source/view/main/PlotterBase.cxx
+++ b/chart2/source/view/main/PlotterBase.cxx
@@ -60,12 +60,18 @@ PlotterBase::~PlotterBase()
void PlotterBase::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
{
+ if (!m_pPosHelper)
+ return;
+
OSL_PRECOND(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension of Plotter does not fit two dimension of given scale sequence");
m_pPosHelper->setScales( rScales, bSwapXAndYAxis );
}
void PlotterBase::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
{
+ if (!m_pPosHelper)
+ return;
+
OSL_PRECOND(m_nDimension==2,"Set this transformation only in case of 2D");
if(m_nDimension!=2)
return;