diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-05-16 16:10:02 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-07-17 21:49:32 +0200 |
commit | 6b481f8bb44a14ebbfe010476cf2ca3728e7d539 (patch) | |
tree | 0459cf56287cd06c2414a7e19053a46b8d0a4dc8 /chart2/source | |
parent | 71bcaa477e9379f4c584b3309d7a6149c801702c (diff) |
chart2: add DataTable to AxisProperties, take account at rendering
The Diagram model has the DataTable class, but now we need to
take this into account at rendering. First add the DataTable to
AxisProperties, to decide if the data table should be rendered or
not.
Change-Id: Ia18fcffccc632e4d36011544066072ae3cdfbfc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137152
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/view/axes/VAxisProperties.cxx | 10 | ||||
-rw-r--r-- | chart2/source/view/axes/VAxisProperties.hxx | 8 | ||||
-rw-r--r-- | chart2/source/view/axes/VCartesianCoordinateSystem.cxx | 5 | ||||
-rw-r--r-- | chart2/source/view/axes/VPolarCoordinateSystem.cxx | 6 |
4 files changed, 22 insertions, 7 deletions
diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx index d07cc33d8b9a..f39420c9ce02 100644 --- a/chart2/source/view/axes/VAxisProperties.cxx +++ b/chart2/source/view/axes/VAxisProperties.cxx @@ -153,8 +153,9 @@ TickmarkProperties AxisProperties::getBiggestTickmarkProperties() return aTickmarkProperties; } -AxisProperties::AxisProperties( rtl::Reference< Axis > xAxisModel - , ExplicitCategoriesProvider* pExplicitCategoriesProvider ) +AxisProperties::AxisProperties(rtl::Reference<::chart::Axis> xAxisModel, + ExplicitCategoriesProvider* pExplicitCategoriesProvider, + rtl::Reference<::chart::DataTable> const& xDataTableModel) : m_xAxisModel(std::move(xAxisModel)) , m_nDimensionIndex(0) , m_bIsMainAxis(true) @@ -174,6 +175,7 @@ AxisProperties::AxisProperties( rtl::Reference< Axis > xAxisModel , m_bComplexCategories(false) , m_pExplicitCategoriesProvider(pExplicitCategoriesProvider) , m_bLimitSpaceForLabels(false) + , m_xDataTableModel(xDataTableModel) { } @@ -256,7 +258,9 @@ void AxisProperties::init( bool bCartesian ) if( bCartesian ) { if (m_nDimensionIndex == 0) - m_bDisplayDataTable = false; + { + m_bDisplayDataTable = m_xDataTableModel.is(); + } if( m_nDimensionIndex == 0 && m_nAxisType == AxisType::CATEGORY && m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() ) diff --git a/chart2/source/view/axes/VAxisProperties.hxx b/chart2/source/view/axes/VAxisProperties.hxx index d66b2f3a919e..6b6b7c361ea2 100644 --- a/chart2/source/view/axes/VAxisProperties.hxx +++ b/chart2/source/view/axes/VAxisProperties.hxx @@ -21,6 +21,7 @@ #include "TickmarkProperties.hxx" #include <Axis.hxx> #include <LabelAlignment.hxx> +#include <DataTable.hxx> #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> @@ -139,10 +140,13 @@ struct AxisProperties final bool m_bLimitSpaceForLabels; + rtl::Reference<::chart::DataTable> m_xDataTableModel; + //methods: - AxisProperties( rtl::Reference< ::chart::Axis > xAxisModel - , ExplicitCategoriesProvider* pExplicitCategoriesProvider ); + AxisProperties(rtl::Reference<::chart::Axis> xAxisModel, + ExplicitCategoriesProvider* pExplicitCategoriesProvider, + rtl::Reference<::chart::DataTable> const& xDataTableModel); void init(bool bCartesian=false);//init from model data (m_xAxisModel) diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index e1a2ba5046e3..cd0d49188a1c 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -23,6 +23,8 @@ #include <BaseCoordinateSystem.hxx> #include <AxisIndexDefines.hxx> #include <Axis.hxx> +#include <DataTable.hxx> +#include <Diagram.hxx> #include <AxisHelper.hxx> #include <cppuhelper/implbase.hxx> #include <ChartModel.hxx> @@ -130,7 +132,8 @@ void VCartesianCoordinateSystem::createVAxisList( if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel )) continue; - AxisProperties aAxisProperties(xAxis,getExplicitCategoriesProvider()); + rtl::Reference<Diagram> xDiagram(xChartDoc->getFirstChartDiagram()); + AxisProperties aAxisProperties(xAxis, getExplicitCategoriesProvider(), xDiagram->getDataTableRef()); aAxisProperties.m_nDimensionIndex = nDimensionIndex; aAxisProperties.m_bSwapXAndY = bSwapXAndY; aAxisProperties.m_bIsMainAxis = (nAxisIndex==0); diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx index 3a3351a54fc3..338a1c4ab7ed 100644 --- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx +++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx @@ -24,6 +24,8 @@ #include <AxisIndexDefines.hxx> #include <Axis.hxx> #include <AxisHelper.hxx> +#include <Diagram.hxx> +#include <DataTable.hxx> #include <ChartModel.hxx> namespace chart @@ -90,7 +92,9 @@ void VPolarCoordinateSystem::createVAxisList( rtl::Reference< Axis > xAxis = getAxisByDimension(nDimensionIndex,nAxisIndex); if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel )) continue; - AxisProperties aAxisProperties(xAxis,getExplicitCategoriesProvider()); + + rtl::Reference<Diagram> xDiagram(xChartDoc->getFirstChartDiagram()); + AxisProperties aAxisProperties(xAxis,getExplicitCategoriesProvider(), xDiagram->getDataTableRef()); aAxisProperties.init(); if(aAxisProperties.m_bDisplayLabels) aAxisProperties.m_nNumberFormatKey = getNumberFormatKeyForAxis(xAxis, xChartDoc); |