chart2/Library_chart2.mk | 1 chart2/inc/ChartModel.hxx | 18 chart2/inc/pch/precompiled_chart2.hxx | 1 chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx | 3 chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx | 7 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 5 chart2/source/controller/dialogs/ChartTypeDialogController.cxx | 6 chart2/source/controller/dialogs/DataBrowserModel.cxx | 3 chart2/source/controller/dialogs/dlg_ObjectProperties.cxx | 3 chart2/source/controller/dialogs/dlg_View3D.cxx | 1 chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx | 5 chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx | 3 chart2/source/controller/main/ChartController.cxx | 3 chart2/source/controller/main/ChartController_Position.cxx | 3 chart2/source/controller/main/ChartController_Properties.cxx | 3 chart2/source/controller/main/ChartController_Tools.cxx | 3 chart2/source/controller/main/ChartController_Window.cxx | 11 chart2/source/controller/main/ChartModelClone.cxx | 3 chart2/source/inc/ChartModelHelper.hxx | 67 --- chart2/source/model/main/ChartModel.cxx | 137 +++++- chart2/source/model/main/ChartModel_Persistence.cxx | 3 chart2/source/tools/AxisHelper.cxx | 3 chart2/source/tools/ChartModelHelper.cxx | 221 ---------- chart2/source/tools/DataSourceHelper.cxx | 3 chart2/source/tools/DiagramHelper.cxx | 11 chart2/source/tools/ExplicitCategoriesProvider.cxx | 7 chart2/source/tools/InternalDataProvider.cxx | 5 chart2/source/tools/RangeHighlighter.cxx | 3 chart2/source/tools/RegressionCurveHelper.cxx | 3 chart2/source/view/axes/VAxisProperties.cxx | 4 solenv/clang-format/excludelist | 2 31 files changed, 190 insertions(+), 361 deletions(-)
New commits: commit 76d296f7600bddf0b52fe2bd5522594551f10218 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Apr 10 20:02:01 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Fri Apr 11 07:07:23 2025 +0200 fold ChartModelHelper functions into ChartModel This moves functions from ChartModelHelper to ChartModel where it better belongs to. We can access the concrete classes now instead of accessing through UNO si this is possible to do. Change-Id: I21dce8aabe8f8a956863beef7ca5cb4ec6f3b44b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183990 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/Library_chart2.mk b/chart2/Library_chart2.mk index 64eff3eb021a..e48159801ed6 100644 --- a/chart2/Library_chart2.mk +++ b/chart2/Library_chart2.mk @@ -340,7 +340,6 @@ $(eval $(call gb_Library_add_exception_objects,chart2,\ chart2/source/tools/BaseGFXHelper \ chart2/source/tools/CachedDataSequence \ chart2/source/tools/CharacterProperties \ - chart2/source/tools/ChartModelHelper \ chart2/source/tools/ChartTypeHelper \ chart2/source/tools/ChartViewHelper \ chart2/source/tools/ColorPerPointHelper \ diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 44e6c3c60a25..f6186d8b575b 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -78,6 +78,9 @@ class NameContainer; class PageBackground; class RangeHighlighter; class Title; +class BaseCoordinateSystem; +class DataSeries; +class ChartType; namespace impl { @@ -478,6 +481,21 @@ public: rtl::Reference< ::chart::Title > getTitleObject2() const; void setTitleObject( const rtl::Reference< ::chart::Title >& Title ); + rtl::Reference< BaseCoordinateSystem > getFirstCoordinateSystem(); + + std::vector< rtl::Reference< ::chart::DataSeries > > getDataSeries(); + + rtl::Reference< ChartType > getChartTypeOfSeries( const rtl::Reference< ::chart::DataSeries >& xGivenDataSeries ); + + static css::awt::Size getDefaultPageSize(); + + css::awt::Size getPageSize(); + + void triggerRangeHighlighting(); + + bool isIncludeHiddenCells(); + bool setIncludeHiddenCells( bool bIncludeHiddenCells ); + private: void dumpAsXml(xmlTextWriterPtr pWriter) const; diff --git a/chart2/inc/pch/precompiled_chart2.hxx b/chart2/inc/pch/precompiled_chart2.hxx index 650f30948bec..26610805a1e2 100644 --- a/chart2/inc/pch/precompiled_chart2.hxx +++ b/chart2/inc/pch/precompiled_chart2.hxx @@ -543,7 +543,6 @@ #include <CharacterPropertyItemConverter.hxx> #include <ChartController.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <ChartTypeManager.hxx> diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx index 7c8aaf08f11b..125d65cdc505 100644 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx @@ -18,7 +18,6 @@ */ #include "Chart2ModelContact.hxx" -#include <ChartModelHelper.hxx> #include <Legend.hxx> #include <LegendHelper.hxx> #include <CommonConverters.hxx> @@ -157,7 +156,7 @@ sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForSeries( awt::Size Chart2ModelContact::GetPageSize() const { - return ChartModelHelper::getPageSize(m_xChartModel.get()); + return m_xChartModel.get()->getPageSize(); } awt::Rectangle Chart2ModelContact::SubstractAxisTitleSizes( const awt::Rectangle& rPositionRect ) diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index f28229ae05a6..b2c38d31bde5 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -20,7 +20,6 @@ #include "ChartDataWrapper.hxx" #include <DiagramHelper.hxx> #include <DataSourceHelper.hxx> -#include <ChartModelHelper.hxx> #include <InternalDataProvider.hxx> #include <ControllerLockGuard.hxx> #include "Chart2ModelContact.hxx" diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 5237b9a08b4f..217921db9f00 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -29,7 +29,6 @@ #include <Diagram.hxx> #include <DiagramHelper.hxx> #include <DataSourceHelper.hxx> -#include <ChartModelHelper.hxx> #include <ChartType.hxx> #include <DataSeries.hxx> #include <WrappedIgnoreProperty.hxx> @@ -1830,12 +1829,12 @@ void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue if( ! (rOuterValue >>= bNewValue) ) throw lang::IllegalArgumentException( u"Property IncludeHiddenCells requires boolean value"_ustr, nullptr, 0 ); - ChartModelHelper::setIncludeHiddenCells( bNewValue, *m_spChart2ModelContact->getDocumentModel() ); + m_spChart2ModelContact->getDocumentModel()->setIncludeHiddenCells(bNewValue); } Any WrappedIncludeHiddenCellsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const { - bool bValue = ChartModelHelper::isIncludeHiddenCells( m_spChart2ModelContact->getDocumentModel() ); + bool bValue = m_spChart2ModelContact->getDocumentModel()->isIncludeHiddenCells(); return uno::Any(bValue); } diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index 365df1c328f9..555600b86edf 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -23,7 +23,6 @@ #include <ResId.hxx> #include <strings.hrc> #include <bitmaps.hlst> -#include <ChartModelHelper.hxx> #include <DataSeries.hxx> #include <DataSeriesHelper.hxx> #include <Diagram.hxx> @@ -790,8 +789,7 @@ void OfPieChartDialogController::fillExtraControls( m_xMF_CompositeSize->set_value(nCompositeSize); // Limit based on number of entries in the series - const std::vector< rtl::Reference< DataSeries > > dataSeriesVec = - ChartModelHelper::getDataSeries( xChartModel); + const std::vector< rtl::Reference< DataSeries > > dataSeriesVec = xChartModel->getDataSeries(); if (!dataSeriesVec.empty()) { const rtl::Reference<DataSeries>& ds = dataSeriesVec[0]; const DataSeries::tDataSequenceContainer data = ds->getDataSequences2(); @@ -1399,7 +1397,7 @@ void CombiColumnLineChartDialogController::fillExtraControls( nNumLines = 0; m_xMF_NumberOfLines->set_value(nNumLines); - sal_Int32 nMaxLines = ChartModelHelper::getDataSeries( xChartModel ).size() - 1; + sal_Int32 nMaxLines = xChartModel->getDataSeries().size() - 1; if( nMaxLines < 0 ) nMaxLines = 0; m_xMF_NumberOfLines->set_max(nMaxLines); diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 4b2a8ecc9776..39ec085f5fbd 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -19,7 +19,6 @@ #include "DialogModel.hxx" #include <DataBrowserModel.hxx> -#include <ChartModelHelper.hxx> #include <ChartType.hxx> #include <ChartTypeManager.hxx> #include <ChartView.hxx> @@ -762,7 +761,7 @@ void DataBrowserModel::updateFromModel() sal_Int32 nHeaderStart = 0; sal_Int32 nHeaderEnd = 0; { - ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(m_xChartDocument), *m_xChartDocument ); + ExplicitCategoriesProvider aExplicitCategoriesProvider( m_xChartDocument->getFirstCoordinateSystem(), *m_xChartDocument ); const std::vector< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList = aExplicitCategoriesProvider.getSplitCategoriesList(); sal_Int32 nLevelCount = rSplitCategoriesList.size(); diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index 39fdc63e611b..9286eb16f854 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -38,7 +38,6 @@ #include "tp_DataTable.hxx" #include <ResId.hxx> #include <ViewElementListProvider.hxx> -#include <ChartModelHelper.hxx> #include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <ObjectNameProvider.hxx> @@ -121,7 +120,7 @@ void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartM m_xChartDocument = xChartModel; rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram(); rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel ); - rtl::Reference< ChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); + rtl::Reference< ChartType > xChartType = xChartModel->getChartTypeOfSeries( xSeries ); sal_Int32 nDimensionCount = 0; if (xDiagram) nDimensionCount = xDiagram->getDimension(); diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index 1e5232dfc387..e8f41a7ff39e 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.cxx +++ b/chart2/source/controller/dialogs/dlg_View3D.cxx @@ -23,7 +23,6 @@ #include "tp_3D_SceneGeometry.hxx" #include "tp_3D_SceneAppearance.hxx" #include "tp_3D_SceneIllumination.hxx" -#include <ChartModelHelper.hxx> #include <ChartModel.hxx> #include <Diagram.hxx> diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx index 3ea7be7c7c52..ead6f3c3b715 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -24,7 +24,6 @@ #include <StatisticsItemConverter.hxx> #include <GraphicPropertyItemConverter.hxx> #include <DataPointItemConverter.hxx> -#include <ChartModelHelper.hxx> #include <ChartModel.hxx> #include <Diagram.hxx> #include <DataSeries.hxx> @@ -105,7 +104,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter( : MultipleItemConverter( rItemPool ) { std::vector< rtl::Reference< DataSeries > > aSeriesList = - ::chart::ChartModelHelper::getDataSeries( xChartModel ); + xChartModel->getDataSeries(); for (auto const& series : aSeriesList) { @@ -168,7 +167,7 @@ AllSeriesStatisticsConverter::AllSeriesStatisticsConverter( : MultipleItemConverter( rItemPool ) { std::vector< rtl::Reference< DataSeries > > aSeriesList = - ::chart::ChartModelHelper::getDataSeries( xChartModel ); + xChartModel->getDataSeries(); for (auto const& series : aSeriesList) { diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index da74846568b4..be3d8ea00170 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -20,7 +20,6 @@ #include <SeriesOptionsItemConverter.hxx> #include "SchWhichPairs.hxx" -#include <ChartModelHelper.hxx> #include <ChartType.hxx> #include <Axis.hxx> #include <AxisHelper.hxx> @@ -332,7 +331,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf if (bIncludeHiddenCells != m_bIncludeHiddenCells) { if (m_xChartModel) - bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, *m_xChartModel ); + bChanged = m_xChartModel->setIncludeHiddenCells( bIncludeHiddenCells ); } } } diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 9781840dcec1..764eb8a4d7dd 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -27,7 +27,6 @@ #include <ResId.hxx> #include <dlg_DataSource.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <ChartType.hxx> #include "ControllerCommandDispatch.hxx" #include <DataSeries.hxx> @@ -480,7 +479,7 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent if( m_aSelection.hasSelection() ) this->impl_selectObjectAndNotiy(); else - ChartModelHelper::triggerRangeHighlighting( getChartModel() ); + getChartModel()->triggerRangeHighlighting(); impl_initializeAccessible(); diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index df047d747afd..6bdedb0565b7 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -22,7 +22,6 @@ #include <DrawViewWrapper.hxx> #include <PositionAndSizeHelper.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <ChartView.hxx> #include "UndoGuard.hxx" #include <ObjectNameProvider.hxx> @@ -173,7 +172,7 @@ void ChartController::executeDispatch_PositionAndSize(const ::css::uno::Sequence awt::Rectangle aNewObjectRect; lcl_getPositionAndSizeFromItemSet( aItemSet, aNewObjectRect, ToSize(aOldObjectRect) ); - awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) ); + awt::Size aPageSize( getChartModel()->getPageSize() ); awt::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height ); bool bChanged = false; diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 0244f7efc28d..2b765d50a71d 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -37,7 +37,6 @@ #include <RegressionCurveItemConverter.hxx> #include <RegressionEquationItemConverter.hxx> #include <ErrorBarItemConverter.hxx> -#include <ChartModelHelper.hxx> #include <Axis.hxx> #include <AxisHelper.hxx> #include <TitleHelper.hxx> @@ -198,7 +197,7 @@ wrapper::ItemConverter* createItemConverter( wrapper::GraphicObjectType::FilledDataPoint; rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( aObjectCID, xChartModel ); - rtl::Reference< ChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); + rtl::Reference< ChartType > xChartType = xChartModel->getChartTypeOfSeries( xSeries ); rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram(); sal_Int32 nDimensionCount = xDiagram->getDimension(); diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index b7ab2e219415..7f42ec25f959 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -20,7 +20,6 @@ #include <ChartController.hxx> #include <ChartWindow.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <ChartType.hxx> #include <TitleHelper.hxx> #include <DataSeries.hxx> @@ -164,7 +163,7 @@ bool lcl_deleteDataCurve( ReferenceSizeProvider ChartController::impl_createReferenceSizeProvider() { - awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) ); + awt::Size aPageSize( getChartModel()->getPageSize() ); return ReferenceSizeProvider(aPageSize, getChartModel()); } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index c6b317176744..92e2983409ea 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -28,7 +28,6 @@ #include <ChartWindow.hxx> #include <ResId.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <ChartType.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> @@ -249,7 +248,7 @@ void SAL_CALL ChartController::setPosSize( //todo: for standalone chart: detect whether we are standalone //change map mode to fit new size - awt::Size aModelPageSize = ChartModelHelper::getPageSize( getChartModel() ); + awt::Size aModelPageSize = getChartModel()->getPageSize(); sal_Int32 nScaleXNumerator = aLogicSize.Width(); sal_Int32 nScaleXDenominator = aModelPageSize.Width; sal_Int32 nScaleYNumerator = aLogicSize.Height(); @@ -789,7 +788,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) { tools::Rectangle aObjectRect = pObj->GetSnapRect(); tools::Rectangle aOldObjectRect = pObj->GetLastBoundRect(); - awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) ); + awt::Size aPageSize( getChartModel()->getPageSize() ); tools::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height ); const E3dObject* pE3dObject(DynCastE3dObject(pObj)); @@ -1454,7 +1453,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) if (pObj) { tools::Rectangle aRect = pObj->GetSnapRect(); - awt::Size aPageSize(ChartModelHelper::getPageSize(getChartModel())); + awt::Size aPageSize(getChartModel()->getPageSize()); if ((fShiftAmountX > 0.0 && (aRect.Right() + fShiftAmountX > aPageSize.Width)) || (fShiftAmountX < 0.0 && (aRect.Left() + fShiftAmountX < 0)) || (fShiftAmountY > 0.0 && (aRect.Bottom() + fShiftAmountY > aPageSize.Height)) || @@ -1480,7 +1479,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { awt::Point aPos( xShape->getPosition() ); awt::Size aSize( xShape->getSize() ); - awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) ); + awt::Size aPageSize( getChartModel()->getPageSize() ); aPos.X = static_cast< tools::Long >( static_cast< double >( aPos.X ) + fShiftAmountX ); aPos.Y = static_cast< tools::Long >( static_cast< double >( aPos.Y ) + fShiftAmountY ); if( aPos.X + aSize.Width > aPageSize.Width ) @@ -1719,7 +1718,7 @@ bool ChartController::impl_moveOrResizeObject( ObjectIdentifier::getObjectPropertySet( rCID, xChartModel )); if( xObjProp.is()) { - awt::Size aRefSize = ChartModelHelper::getPageSize( xChartModel ); + awt::Size aRefSize = xChartModel->getPageSize(); chart2::RelativePosition aRelPos; chart2::RelativeSize aRelSize; diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx index b1228cd383a3..153a37d7f982 100644 --- a/chart2/source/controller/main/ChartModelClone.cxx +++ b/chart2/source/controller/main/ChartModelClone.cxx @@ -19,7 +19,6 @@ #include "ChartModelClone.hxx" #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <ControllerLockGuard.hxx> #include <DataSource.hxx> #include <DataSourceHelper.hxx> @@ -172,7 +171,7 @@ namespace chart ControllerLockGuardUNO aLockedControllers( i_model ); // propagate the correct flag for plotting of hidden values to the data provider and all used sequences - ChartModelHelper::setIncludeHiddenCells(ChartModelHelper::isIncludeHiddenCells( i_modelToCopyFrom ), *i_model); + i_model->setIncludeHiddenCells(i_modelToCopyFrom->isIncludeHiddenCells()); // diagram i_model->setFirstDiagram( i_modelToCopyFrom->getFirstDiagram() ); diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx deleted file mode 100644 index b85a6d078ed0..000000000000 --- a/chart2/source/inc/ChartModelHelper.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#pragma once - -#include <config_options.h> -#include <com/sun/star/awt/Size.hpp> -#include <rtl/ref.hxx> - -#include <vector> - -namespace chart { class ChartModel; } - -namespace chart -{ -class BaseCoordinateSystem; -class ChartType; -class DataSeries; -class InternalDataProvider; - -class ChartModelHelper -{ -public: - static rtl::Reference< ::chart::BaseCoordinateSystem > - getFirstCoordinateSystem( const rtl::Reference<::chart::ChartModel>& xModel ); - - static std::vector< rtl::Reference< ::chart::DataSeries > > - getDataSeries( const rtl::Reference< ::chart::ChartModel > & xModel ); - - static rtl::Reference< ChartType > - getChartTypeOfSeries( - const rtl::Reference<::chart::ChartModel>& xModel - , const rtl::Reference< ::chart::DataSeries >& xGivenDataSeries ); - - static css::awt::Size getDefaultPageSize(); - - static css::awt::Size getPageSize( const rtl::Reference<::chart::ChartModel>& xModel ); - - static void triggerRangeHighlighting( const rtl::Reference<::chart::ChartModel>& xModel ); - - static bool isIncludeHiddenCells( const rtl::Reference<::chart::ChartModel>& xChartModel ); - - static bool setIncludeHiddenCells( bool bIncludeHiddenCells, ChartModel& rModel); - -}; - -} //namespace chart - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 5addc93a4437..ea09799e226e 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -23,11 +23,12 @@ #include <servicenames.hxx> #include <DataSource.hxx> #include <DataSourceHelper.hxx> -#include <ChartModelHelper.hxx> +#include <ChartType.hxx> #include <DisposeHelper.hxx> #include <ControllerLockGuard.hxx> #include <InternalDataProvider.hxx> #include <ObjectIdentifier.hxx> +#include <BaseCoordinateSystem.hxx> #include "PageBackground.hxx" #include <CloneHelper.hxx> #include <NameContainer.hxx> @@ -96,7 +97,7 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > xContext) , m_aControllers( m_aModelMutex ) , m_nControllerLockCount(0) , m_xContext(std::move( xContext )) - , m_aVisualAreaSize( ChartModelHelper::getDefaultPageSize() ) + , m_aVisualAreaSize( ChartModel::getDefaultPageSize() ) , m_xPageBackground( new PageBackground ) , m_xXMLNamespaceMap( new NameContainer() ) , mnStart(0) @@ -794,7 +795,7 @@ void SAL_CALL ChartModel::attachDataProvider( const uno::Reference< chart2::data { try { - bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( this ); + bool bIncludeHiddenCells = isIncludeHiddenCells(); xProp->setPropertyValue(u"IncludeHiddenCells"_ustr, uno::Any(bIncludeHiddenCells)); } catch (const beans::UnknownPropertyException&) @@ -1339,6 +1340,132 @@ bool ChartModel::isDataFromPivotTable() const return xPivotTableDataProvider.is(); } +rtl::Reference< BaseCoordinateSystem > ChartModel::getFirstCoordinateSystem() +{ + if( m_xDiagram ) + { + auto aCooSysSeq( m_xDiagram->getBaseCoordinateSystems() ); + if( !aCooSysSeq.empty() ) + return aCooSysSeq[0]; + } + return nullptr; +} + +std::vector< rtl::Reference< DataSeries > > ChartModel::getDataSeries() +{ + if( m_xDiagram) + return m_xDiagram->getDataSeries(); + + return {}; +} + +rtl::Reference< ChartType > ChartModel::getChartTypeOfSeries( const rtl::Reference< DataSeries >& xGivenDataSeries ) +{ + return m_xDiagram ? m_xDiagram->getChartTypeOfSeries( xGivenDataSeries ) : nullptr; +} + +// static +awt::Size ChartModel::getDefaultPageSize() +{ + return awt::Size( 16000, 9000 ); +} + +awt::Size ChartModel::getPageSize() +{ + return getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ); +} + +void ChartModel::triggerRangeHighlighting() +{ + getRangeHighlighter(); + uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener( m_xRangeHighlighter ); + //trigger selection of cell range + lang::EventObject aEvent( xSelectionChangeListener ); + xSelectionChangeListener->selectionChanged( aEvent ); +} + +bool ChartModel::isIncludeHiddenCells() +{ + bool bIncluded = true; // hidden cells are included by default. + + if (!m_xDiagram) + return bIncluded; + + try + { + m_xDiagram->getPropertyValue(u"IncludeHiddenCells"_ustr) >>= bIncluded; + } + catch( const beans::UnknownPropertyException& ) + { + } + + return bIncluded; +} + +bool ChartModel::setIncludeHiddenCells( bool bIncludeHiddenCells ) +{ + bool bChanged = false; + try + { + ControllerLockGuard aLockedControllers( *this ); + + uno::Reference< beans::XPropertySet > xDiagramProperties( getFirstDiagram(), uno::UNO_QUERY ); + if (!xDiagramProperties) + return false; + + bool bOldValue = bIncludeHiddenCells; + xDiagramProperties->getPropertyValue( u"IncludeHiddenCells"_ustr ) >>= bOldValue; + if( bOldValue == bIncludeHiddenCells ) + bChanged = true; + + //set the property on all instances in all cases to get the different objects in sync! + + uno::Any aNewValue(bIncludeHiddenCells); + + try + { + uno::Reference< beans::XPropertySet > xDataProviderProperties( getDataProvider(), uno::UNO_QUERY ); + if( xDataProviderProperties.is() ) + xDataProviderProperties->setPropertyValue(u"IncludeHiddenCells"_ustr, aNewValue ); + } + catch( const beans::UnknownPropertyException& ) + { + //the property is optional! + } + + try + { + rtl::Reference< DataSource > xUsedData = DataSourceHelper::getUsedData( *this ); + if( xUsedData.is() ) + { + uno::Reference< beans::XPropertySet > xProp; + const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences()); + for( uno::Reference< chart2::data::XLabeledDataSequence > const & labeledData : aData ) + { + xProp.set( uno::Reference< beans::XPropertySet >( labeledData->getValues(), uno::UNO_QUERY ) ); + if(xProp.is()) + xProp->setPropertyValue(u"IncludeHiddenCells"_ustr, aNewValue ); + xProp.set( uno::Reference< beans::XPropertySet >( labeledData->getLabel(), uno::UNO_QUERY ) ); + if(xProp.is()) + xProp->setPropertyValue(u"IncludeHiddenCells"_ustr, aNewValue ); + } + } + } + catch( const beans::UnknownPropertyException& ) + { + //the property is optional! + } + + xDiagramProperties->setPropertyValue( u"IncludeHiddenCells"_ustr, aNewValue); + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("chart2", "" ); + } + return bChanged; +} + + } // namespace chart extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index fe5db160cf32..c819fab153c2 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -21,7 +21,6 @@ #include <ChartModel.hxx> #include <MediaDescriptorHelper.hxx> #include <ChartViewHelper.hxx> -#include <ChartModelHelper.hxx> #include <ChartTypeManager.hxx> #include <ChartTypeTemplate.hxx> #include <DataSourceHelper.hxx> @@ -437,7 +436,7 @@ void ChartModel::insertDefaultChart() DBG_UNHANDLED_EXCEPTION("chart2"); } } - ChartModelHelper::setIncludeHiddenCells( false, *this ); + setIncludeHiddenCells( false ); } catch( const uno::Exception & ) { diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index d82652fe3012..3ace41123085 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -31,7 +31,6 @@ #include <DataSeriesHelper.hxx> #include <Scaling.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <DataSourceHelper.hxx> #include <ReferenceSizeProvider.hxx> #include <ExplicitCategoriesProvider.hxx> @@ -100,7 +99,7 @@ bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling ) chart2::ScaleData AxisHelper::getDateCheckedScale( const rtl::Reference< Axis >& xAxis, ChartModel& rModel ) { ScaleData aScale = xAxis->getScaleData(); - rtl::Reference< BaseCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( &rModel ) ); + rtl::Reference< BaseCoordinateSystem > xCooSys( rModel.getFirstCoordinateSystem() ); if( aScale.AutoDateAxis && aScale.AxisType == AxisType::CATEGORY ) { sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0; diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx deleted file mode 100644 index 8b4aa46962c9..000000000000 --- a/chart2/source/tools/ChartModelHelper.cxx +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <ChartModelHelper.hxx> -#include <Diagram.hxx> -#include <DataSource.hxx> -#include <DataSourceHelper.hxx> -#include <ControllerLockGuard.hxx> -#include <InternalDataProvider.hxx> -#include <ChartModel.hxx> -#include <BaseCoordinateSystem.hxx> -#include <ChartType.hxx> -#include <DataSeries.hxx> - -#include <com/sun/star/chart/ChartDataRowSource.hpp> -#include <com/sun/star/chart/XChartDocument.hpp> -#include <com/sun/star/embed/Aspects.hpp> -#include <com/sun/star/view/XSelectionChangeListener.hpp> -#include <comphelper/diagnose_ex.hxx> - -namespace chart -{ -using namespace ::com::sun::star; -using namespace ::com::sun::star::chart2; - -rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const rtl::Reference<::chart::ChartModel>& xModel ) -{ - rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram(); - if( xDiagram.is() ) - { - auto aCooSysSeq( xDiagram->getBaseCoordinateSystems() ); - if( !aCooSysSeq.empty() ) - return aCooSysSeq[0]; - } - return nullptr; -} - -std::vector< rtl::Reference< DataSeries > > ChartModelHelper::getDataSeries( - const rtl::Reference<::chart::ChartModel> & xChartDoc ) -{ - std::vector< rtl::Reference< DataSeries > > aResult; - - rtl::Reference< Diagram > xDiagram = xChartDoc->getFirstChartDiagram(); - if( xDiagram.is()) - aResult = xDiagram->getDataSeries(); - - return aResult; -} - -rtl::Reference< ChartType > ChartModelHelper::getChartTypeOfSeries( - const rtl::Reference<::chart::ChartModel>& xModel - , const rtl::Reference< DataSeries >& xGivenDataSeries ) -{ - rtl::Reference<Diagram> xDiagram = xModel->getFirstChartDiagram(); - return xDiagram ? xDiagram->getChartTypeOfSeries( xGivenDataSeries ) : nullptr; -} - -awt::Size ChartModelHelper::getDefaultPageSize() -{ - return awt::Size( 16000, 9000 ); -} - -awt::Size ChartModelHelper::getPageSize( const rtl::Reference<::chart::ChartModel>& xModel ) -{ - awt::Size aPageSize( ChartModelHelper::getDefaultPageSize() ); - OSL_ENSURE(xModel.is(),"need xVisualObject for page size"); - if( xModel.is() ) - aPageSize = xModel->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ); - return aPageSize; -} - -void ChartModelHelper::triggerRangeHighlighting( const rtl::Reference<::chart::ChartModel>& xModel ) -{ - if( xModel.is() ) - { - uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener( xModel->getRangeHighlighter(), uno::UNO_QUERY ); - //trigger selection of cell range - if( xSelectionChangeListener.is() ) - { - lang::EventObject aEvent( xSelectionChangeListener ); - xSelectionChangeListener->selectionChanged( aEvent ); - } - } -} - -bool ChartModelHelper::isIncludeHiddenCells( const rtl::Reference<::chart::ChartModel>& xChartModel ) -{ - bool bIncluded = true; // hidden cells are included by default. - - rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() ); - if (!xDiagram.is()) - return bIncluded; - - try - { - xDiagram->getPropertyValue(u"IncludeHiddenCells"_ustr) >>= bIncluded; - } - catch( const beans::UnknownPropertyException& ) - { - } - - return bIncluded; -} - -bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, ChartModel& rModel ) -{ - bool bChanged = false; - try - { - ControllerLockGuard aLockedControllers( rModel ); - - uno::Reference< beans::XPropertySet > xDiagramProperties( rModel.getFirstDiagram(), uno::UNO_QUERY ); - if (xDiagramProperties.is()) - { - bool bOldValue = bIncludeHiddenCells; - xDiagramProperties->getPropertyValue( u"IncludeHiddenCells"_ustr ) >>= bOldValue; - if( bOldValue == bIncludeHiddenCells ) - bChanged = true; - - //set the property on all instances in all cases to get the different objects in sync! - - uno::Any aNewValue(bIncludeHiddenCells); - - try - { - uno::Reference< beans::XPropertySet > xDataProviderProperties( rModel.getDataProvider(), uno::UNO_QUERY ); - if( xDataProviderProperties.is() ) - xDataProviderProperties->setPropertyValue(u"IncludeHiddenCells"_ustr, aNewValue ); - } - catch( const beans::UnknownPropertyException& ) - { - //the property is optional! - } - - try - { - rtl::Reference< DataSource > xUsedData = DataSourceHelper::getUsedData( rModel ); - if( xUsedData.is() ) - { - uno::Reference< beans::XPropertySet > xProp; - const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences()); - for( uno::Reference< chart2::data::XLabeledDataSequence > const & labeledData : aData ) - { - xProp.set( uno::Reference< beans::XPropertySet >( labeledData->getValues(), uno::UNO_QUERY ) ); - if(xProp.is()) - xProp->setPropertyValue(u"IncludeHiddenCells"_ustr, aNewValue ); - xProp.set( uno::Reference< beans::XPropertySet >( labeledData->getLabel(), uno::UNO_QUERY ) ); - if(xProp.is()) - xProp->setPropertyValue(u"IncludeHiddenCells"_ustr, aNewValue ); - } - } - } - catch( const beans::UnknownPropertyException& ) - { - //the property is optional! - } - - xDiagramProperties->setPropertyValue( u"IncludeHiddenCells"_ustr, aNewValue); - } - } - catch (const uno::Exception&) - { - TOOLS_WARN_EXCEPTION("chart2", "" ); - } - return bChanged; -} - -} //namespace chart - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx index 943a46c2909f..3e5681acf419 100644 --- a/chart2/source/tools/DataSourceHelper.cxx +++ b/chart2/source/tools/DataSourceHelper.cxx @@ -19,7 +19,6 @@ #include <DataSourceHelper.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <ChartTypeManager.hxx> #include <Diagram.hxx> #include <DataSeries.hxx> @@ -286,7 +285,7 @@ rtl::Reference< DataSource > DataSourceHelper::getUsedData( if( xCategories.is() ) aResult.push_back( xCategories ); - std::vector< rtl::Reference< DataSeries > > aSeriesVector = ChartModelHelper::getDataSeries( &rModel ); + std::vector< rtl::Reference< DataSeries > > aSeriesVector = rModel.getDataSeries(); for (auto const& series : aSeriesVector) { const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSequences( series->getDataSequences2() ); diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 8a645470f82f..5593eb098b24 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -25,7 +25,6 @@ #include <AxisHelper.hxx> #include <ChartType.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <ExplicitCategoriesProvider.hxx> #include <RelativePositionHelper.hxx> #include <ControllerLockGuard.hxx> @@ -197,7 +196,7 @@ Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const Sequence< OUString > DiagramHelper::getExplicitSimpleCategories( ChartModel& rModel ) { - rtl::Reference< BaseCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( &rModel ) ); + rtl::Reference< BaseCoordinateSystem > xCooSys( rModel.getFirstCoordinateSystem() ); ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, rModel ); return aExplicitCategoriesProvider.getSimpleCategories(); } @@ -292,7 +291,7 @@ void DiagramHelper::switchToDateCategories( const rtl::Reference<::chart::ChartM { ControllerLockGuardUNO aCtrlLockGuard( xChartDoc ); - rtl::Reference< BaseCoordinateSystem > xCooSys = ChartModelHelper::getFirstCoordinateSystem( xChartDoc ); + rtl::Reference< BaseCoordinateSystem > xCooSys = xChartDoc->getFirstCoordinateSystem(); if( xCooSys.is() ) { rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2(0,0); @@ -307,7 +306,7 @@ void DiagramHelper::switchToTextCategories( const rtl::Reference<::chart::ChartM { ControllerLockGuardUNO aCtrlLockGuard( xChartDoc ); - rtl::Reference< BaseCoordinateSystem > xCooSys = ChartModelHelper::getFirstCoordinateSystem( xChartDoc ); + rtl::Reference< BaseCoordinateSystem > xCooSys = xChartDoc->getFirstCoordinateSystem(); if( xCooSys.is() ) { rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2(0,0); @@ -387,7 +386,7 @@ bool DiagramHelper::setDiagramPositioning( const rtl::Reference<::chart::ChartMo ControllerLockGuardUNO aCtrlLockGuard( xChartModel ); bool bChanged = false; - awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) ); + awt::Size aPageSize( xChartModel->getPageSize() ); rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram(); if( !xDiagram.is() ) return bChanged; @@ -434,7 +433,7 @@ awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const rtl::Reference if( !xDiagram.is() ) return aRet; - awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) ); + awt::Size aPageSize( xChartModel->getPageSize() ); RelativePosition aRelPos; RelativeSize aRelSize; diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index aab4bb72dc48..83217a40620c 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -25,7 +25,6 @@ #include <AxisHelper.hxx> #include <DataSourceHelper.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <NumberFormatterWrapper.hxx> #include <unonames.hxx> #include <BaseCoordinateSystem.hxx> @@ -127,7 +126,7 @@ void ExplicitCategoriesProvider::implInitSplit() //->split them in the direction of the first series //detect whether the first series is a row or a column bool bSeriesUsesColumns = true; - std::vector< rtl::Reference< DataSeries > > aSeries = ChartModelHelper::getDataSeries( &mrModel ); + std::vector< rtl::Reference< DataSeries > > aSeries = mrModel.getDataSeries(); if( !aSeries.empty() ) { const rtl::Reference< DataSeries >& xSeriesSource = aSeries.front(); @@ -195,7 +194,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr auto pOutTexts = rOutTexts.getArray(); sal_Int32 nAxisNumberFormat = 0; - rtl::Reference< BaseCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( &rModel ) ); + rtl::Reference< BaseCoordinateSystem > xCooSysModel( rModel.getFirstCoordinateSystem() ); if( xCooSysModel.is() ) { rtl::Reference< Axis > xAxis = xCooSysModel->getAxisByDimension2(0,0); @@ -424,7 +423,7 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& bool bOwnData = false; bool bOwnDataAnddAxisHasAnyFormat = false; bool bOwnDataAnddAxisHasDateFormat = false; - rtl::Reference< BaseCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( &rModel ) ); + rtl::Reference< BaseCoordinateSystem > xCooSysModel( rModel.getFirstCoordinateSystem() ); if( xCooSysModel.is() ) { if( rModel.hasInternalDataProvider() ) diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index a6b93fd86d8d..f432a430b275 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -28,7 +28,6 @@ #include <UncachedDataSequence.hxx> #include <DataSourceHelper.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <Diagram.hxx> #include <ExplicitCategoriesProvider.hxx> #include <BaseCoordinateSystem.hxx> @@ -324,7 +323,7 @@ InternalDataProvider::InternalDataProvider( { std::vector< std::vector< uno::Any > > aNewCategories;//inner count is level { - ExplicitCategoriesProvider aExplicitCategoriesProvider(ChartModelHelper::getFirstCoordinateSystem(xModel), *xModel); + ExplicitCategoriesProvider aExplicitCategoriesProvider(xModel->getFirstCoordinateSystem(), *xModel); const std::vector< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() ); sal_Int32 nLevelCount = rSplitCategoriesList.size(); @@ -370,7 +369,7 @@ InternalDataProvider::InternalDataProvider( } // data series - std::vector< rtl::Reference< DataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( xModel )); + std::vector< rtl::Reference< DataSeries > > aSeriesVector( xModel->getDataSeries()); lcl_internalizeSeries ftor( m_aInternalData, *this, bConnectToModel, m_bDataInColumns ); for( const auto& rxScreen : aSeriesVector ) ftor( rxScreen ); diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx index 63c8809be081..ec23ab54c375 100644 --- a/chart2/source/tools/RangeHighlighter.cxx +++ b/chart2/source/tools/RangeHighlighter.cxx @@ -20,7 +20,6 @@ #include <RangeHighlighter.hxx> #include <WeakListenerAdapter.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <DataSourceHelper.hxx> #include <ObjectIdentifier.hxx> #include <DataSeries.hxx> @@ -97,7 +96,7 @@ void RangeHighlighter::determineRanges() try { - m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( m_xChartModel ); + m_bIncludeHiddenCells = m_xChartModel->isIncludeHiddenCells(); uno::Any aSelection( m_xSelectionSupplier->getSelection()); diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 399d5f41bb9b..9dd5887851ef 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -34,7 +34,6 @@ #include <ChartTypeHelper.hxx> #include <ChartType.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> #include <DataSeries.hxx> #include <ResId.hxx> #include <strings.hrc> @@ -237,7 +236,7 @@ void RegressionCurveHelper::initializeCurveCalculator( const rtl::Reference<::chart::ChartModel> & xModel ) { sal_Int32 nAxisType = ChartTypeHelper::getAxisType( - ChartModelHelper::getChartTypeOfSeries( xModel, xSeries ), 0 ); // x-axis + xModel->getChartTypeOfSeries( xSeries ), 0 ); // x-axis initializeCurveCalculator( xOutCurveCalculator, xSeries, diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx index 11456dc412ea..639adc811d3d 100644 --- a/chart2/source/view/axes/VAxisProperties.cxx +++ b/chart2/source/view/axes/VAxisProperties.cxx @@ -21,7 +21,7 @@ #include <ViewDefines.hxx> #include <Axis.hxx> #include <AxisHelper.hxx> -#include <ChartModelHelper.hxx> +#include <ChartModel.hxx> #include <ExplicitCategoriesProvider.hxx> #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> @@ -346,7 +346,7 @@ void AxisProperties::init( bool bCartesian ) } AxisLabelProperties::AxisLabelProperties() - : m_aFontReferenceSize( ChartModelHelper::getDefaultPageSize() ) + : m_aFontReferenceSize( ChartModel::getDefaultPageSize() ) , m_aMaximumSpaceForLabels( 0 , 0, m_aFontReferenceSize.Width, m_aFontReferenceSize.Height ) , m_nNumberFormatKey(0) , m_eStaggering( AxisLabelStaggering::SideBySide ) diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index a49981581f14..7e1c7be1a273 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -875,7 +875,6 @@ chart2/source/inc/BaseGFXHelper.hxx chart2/source/inc/BaseCoordinateSystem.hxx chart2/source/inc/CachedDataSequence.hxx chart2/source/inc/CharacterProperties.hxx -chart2/source/inc/ChartModelHelper.hxx chart2/source/inc/ChartType.hxx chart2/source/inc/ChartTypeHelper.hxx chart2/source/inc/ChartTypeTemplate.hxx @@ -1028,7 +1027,6 @@ chart2/source/tools/AxisHelper.cxx chart2/source/tools/BaseGFXHelper.cxx chart2/source/tools/CachedDataSequence.cxx chart2/source/tools/CharacterProperties.cxx -chart2/source/tools/ChartModelHelper.cxx chart2/source/tools/ChartTypeHelper.cxx chart2/source/tools/ColorPerPointHelper.cxx chart2/source/tools/CommonConverters.cxx commit 6a75480ce4a7fe32ebfcf5039de3020d734652c8 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Apr 10 19:57:00 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Fri Apr 11 07:07:15 2025 +0200 remove dead code in ChartModelHelper the new ChartModel class does not implement the older chart::XChartDocument interface. Change-Id: I952a870e6c7b592851d30bb0b55de3c5fb41f428 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183989 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 18be04d358de..f28229ae05a6 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -605,9 +605,9 @@ void ChartDataWrapper::initDataAccess() else { //create a separate "internal data provider" that is not connected to the model - auto xInternal = ChartModelHelper::createInternalDataProvider( - xChartDoc, false /*bConnectToModel*/ ); - m_xDataAccess.set( static_cast<cppu::OWeakObject*>(xInternal.get()), uno::UNO_QUERY_THROW ); + rtl::Reference<InternalDataProvider> xInternal + = new InternalDataProvider( xChartDoc, /*bConnectToModel*/false, /*bDefaultDataInColumns*/ true ); + m_xDataAccess = xInternal; } } diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx index 14d16854fb11..b85a6d078ed0 100644 --- a/chart2/source/inc/ChartModelHelper.hxx +++ b/chart2/source/inc/ChartModelHelper.hxx @@ -36,9 +36,6 @@ class InternalDataProvider; class ChartModelHelper { public: - static rtl::Reference< InternalDataProvider > createInternalDataProvider( - const rtl::Reference<::chart::ChartModel>& xChartDoc, bool bConnectToModel ); - static rtl::Reference< ::chart::BaseCoordinateSystem > getFirstCoordinateSystem( const rtl::Reference<::chart::ChartModel>& xModel ); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index e778a227f7d6..5addc93a4437 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -740,10 +740,10 @@ void SAL_CALL ChartModel::createInternalDataProvider( sal_Bool bCloneExistingDat if( !hasInternalDataProvider() ) { if( bCloneExistingData ) - m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( this, true ); + m_xInternalDataProvider = new InternalDataProvider( this, /*bConnectToModel*/true, /*bDefaultDataInColumns*/ true ); else { - m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( nullptr, true ); + m_xInternalDataProvider = new InternalDataProvider( nullptr, /*bConnectToModel*/true, /*bDefaultDataInColumns*/ true ); m_xInternalDataProvider->setChartModel(this); } m_xDataProvider.set( m_xInternalDataProvider ); diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index 70a5accd2eff..8b4aa46962c9 100644 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -39,41 +39,6 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -rtl::Reference< InternalDataProvider > ChartModelHelper::createInternalDataProvider( - const rtl::Reference<::chart::ChartModel>& xChartDoc, bool bConnectToModel ) -{ - bool bDefaultDataInColumns(true); - - // #i120559# Try to access the current state of "DataRowSource" for the - // chart data and use it as default for creating a new InternalDataProvider - if(xChartDoc.is()) - { - // old XChartDocument interface - css::uno::Reference< css::chart::XChartDocument > xDoc(static_cast<cppu::OWeakObject*>(xChartDoc.get()), uno::UNO_QUERY); - - if(xDoc.is()) - { - css::uno::Reference< css::chart::XDiagram > aDiagram = xDoc->getDiagram(); - - if(aDiagram.is()) - { - css::uno::Reference< css::beans::XPropertySet > xProp(aDiagram, uno::UNO_QUERY); - - if(xProp.is()) - { - css::chart::ChartDataRowSource aDataRowSource(css::chart::ChartDataRowSource_COLUMNS); - - xProp->getPropertyValue( u"DataRowSource"_ustr ) >>= aDataRowSource; - - bDefaultDataInColumns = (aDataRowSource == css::chart::ChartDataRowSource_COLUMNS); - } - } - } - } - - return new InternalDataProvider( xChartDoc, bConnectToModel, bDefaultDataInColumns ); -} - rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const rtl::Reference<::chart::ChartModel>& xModel ) { rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram();