From 05efb605b36ea340762ef1583b3aea6a6b5cdddb Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 24 Mar 2014 17:47:01 -0400 Subject: 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 --- chart2/source/chartcore.component | 4 +++ chart2/source/model/template/GL3DBarChartType.cxx | 12 ++++++--- chart2/source/model/template/GL3DBarChartType.hxx | 2 +- .../model/template/GL3DBarChartTypeTemplate.cxx | 25 +++++++++++++++++- .../model/template/GL3DBarChartTypeTemplate.hxx | 2 ++ chart2/source/view/charttypes/AreaChart.cxx | 2 +- chart2/source/view/charttypes/GL3DBarChart.cxx | 29 +++++++++++++++++++++ chart2/source/view/charttypes/GL3DBarChart.hxx | 30 ++++++++++++++++++++++ chart2/source/view/charttypes/VSeriesPlotter.cxx | 15 +++++++++-- chart2/source/view/main/PlotterBase.cxx | 6 +++++ 10 files changed, 118 insertions(+), 9 deletions(-) create mode 100644 chart2/source/view/charttypes/GL3DBarChart.cxx create mode 100644 chart2/source/view/charttypes/GL3DBarChart.hxx (limited to 'chart2/source') 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 @@ + + + + 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& xContext ) : - ChartType(xContext) {} + ChartType(xContext) +{ +} + +GL3DBarChartType::GL3DBarChartType( const GL3DBarChartType& rOther ) : + ChartType(rOther) +{ +} GL3DBarChartType::~GL3DBarChartType() {} @@ -30,9 +37,6 @@ uno::Sequence 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& xContext ); + GL3DBarChartType( const css::uno::Reference& 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 #include @@ -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& xContext, const OUString& rServiceName ) : ChartTypeTemplate(xContext, rServiceName) {} @@ -51,8 +59,13 @@ GL3DBarChartTypeTemplate::getChartTypeForNewSeries( uno::Reference 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 GL3DBarChartTypeTemplate::getSupportedServiceNames_Static() +{ + uno::Sequence 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& 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 + +namespace chart { + +class GL3DBarChart : public VSeriesPlotter +{ +public: + GL3DBarChart( const css::uno::Reference& 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 #include @@ -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; nNsecond; } - 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(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; -- cgit v1.2.3