summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-15 16:48:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-18 15:47:04 +0000
commitc8fc36154e1933bb3d9e2a549b7ab4d4e5e46c75 (patch)
tree22117667d6b231a3796f0007bffe7c81e5cb052a
parentmove getCategories/setCategories inside chart2::Diagram (diff)
downloadcore-c8fc36154e1933bb3d9e2a549b7ab4d4e5e46c75.tar.gz
core-c8fc36154e1933bb3d9e2a549b7ab4d4e5e46c75.zip
move isCategory inside chart2::Diagram
Change-Id: I568a573004c20d7bbf60a947b34a6a8223217b19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149083 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx2
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx2
-rw-r--r--chart2/source/inc/Diagram.hxx2
-rw-r--r--chart2/source/inc/DiagramHelper.hxx3
-rw-r--r--chart2/source/model/main/Diagram.cxx32
-rw-r--r--chart2/source/tools/DiagramHelper.cxx32
6 files changed, 36 insertions, 37 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index 595efe79cf36..75e4edbbca57 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -201,7 +201,7 @@ private:
bool lcl_ShowCategoriesAsDataLabel( const rtl::Reference< ::chart::Diagram > & xDiagram )
{
- return !DiagramHelper::isCategoryDiagram(xDiagram);
+ return !xDiagram->isCategory();
}
} // anonymous namespace
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 6bd55142670c..1b0f7ed31abe 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -653,7 +653,7 @@ bool DialogModel::isCategoryDiagram() const
{
bool bRet = false;
if( m_xChartDocument.is())
- bRet = DiagramHelper::isCategoryDiagram( m_xChartDocument->getFirstChartDiagram() );
+ bRet = m_xChartDocument->getFirstChartDiagram()->isCategory();
return bRet;
}
diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx
index 1d612902e568..44bca5c24a8c 100644
--- a/chart2/source/inc/Diagram.hxx
+++ b/chart2/source/inc/Diagram.hxx
@@ -234,6 +234,8 @@ public:
bool bSetAxisType = false, // when this flag is true ...
bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER
+ bool isCategory();
+
private:
// ____ XModifyListener ____
virtual void SAL_CALL modified(
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index 4bba95a7b1af..e018a1817ed4 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -178,9 +178,6 @@ public:
getDataSeriesGroups(
const rtl::Reference< ::chart::Diagram > & xDiagram );
- static bool isCategoryDiagram(
- const rtl::Reference< ::chart::Diagram >& xDiagram );
-
static css::uno::Sequence< OUString >
getExplicitSimpleCategories( ChartModel& rModel );
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index bd8d9c06d260..92b443b744f9 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -1179,6 +1179,38 @@ void Diagram::setCategories(
}
}
+bool Diagram::isCategory()
+{
+ try
+ {
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : getBaseCoordinateSystems() )
+ {
+ for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
+ {
+ const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
+ for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
+ {
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( nN,nI );
+ OSL_ASSERT( xAxis.is());
+ if( xAxis.is())
+ {
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ if( aScaleData.AxisType == chart2::AxisType::CATEGORY || aScaleData.AxisType == chart2::AxisType::DATE )
+ return true;
+ }
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ return false;
+}
+
+
} // namespace chart
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 8007a4f3a009..bf7b9f3ee537 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -643,38 +643,6 @@ std::vector< std::vector< rtl::Reference< DataSeries > > >
return aResult;
}
-bool DiagramHelper::isCategoryDiagram(
- const rtl::Reference< Diagram >& xDiagram )
-{
- try
- {
- for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() )
- {
- for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
- {
- const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
- for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
- {
- rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( nN,nI );
- OSL_ASSERT( xAxis.is());
- if( xAxis.is())
- {
- ScaleData aScaleData = xAxis->getScaleData();
- if( aScaleData.AxisType == AxisType::CATEGORY || aScaleData.AxisType == AxisType::DATE )
- return true;
- }
- }
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return false;
-}
-
static void lcl_generateAutomaticCategoriesFromChartType(
Sequence< OUString >& rRet,
const rtl::Reference< ChartType >& xChartType )