summaryrefslogtreecommitdiff
path: root/chart2/source/controller
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller')
-rw-r--r--chart2/source/controller/accessibility/AccessibleBase.cxx104
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartElement.cxx45
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartElement.hxx7
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartShape.cxx7
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartShape.hxx4
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartView.cxx228
-rw-r--r--chart2/source/controller/accessibility/AccessibleTextHelper.cxx44
-rw-r--r--chart2/source/controller/accessibility/AccessibleViewForwarder.cxx6
-rw-r--r--chart2/source/controller/accessibility/ChartElementFactory.cxx3
-rw-r--r--chart2/source/controller/accessibility/ChartElementFactory.hxx4
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.cxx66
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.hxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.cxx85
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.hxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx125
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx30
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx148
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx24
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx355
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx107
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx15
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx426
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.cxx68
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.hxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.cxx68
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.hxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx181
-rw-r--r--chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx11
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.cxx173
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.hxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx154
-rw-r--r--chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx11
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx67
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx42
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx70
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx10
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx23
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx11
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx10
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx10
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx54
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx40
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx23
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx114
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx13
-rw-r--r--chart2/source/controller/chartcontroller.component5
-rw-r--r--chart2/source/controller/dialogs/ChartResourceGroups.cxx146
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx66
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx106
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.hxx6
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx411
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.hxx29
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx380
-rw-r--r--chart2/source/controller/dialogs/DialogModel.hxx49
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx276
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionHelper.cxx39
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionListener.cxx10
-rw-r--r--chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx10
-rw-r--r--chart2/source/controller/dialogs/TitleDialogData.cxx58
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.cxx13
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx13
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.cxx17
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx29
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.cxx22
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.cxx38
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx26
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataTable.cxx61
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx28
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertLegend.cxx4
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.cxx15
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.hxx5
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx110
-rw-r--r--chart2/source/controller/dialogs/dlg_ShapeFont.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx6
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.cxx12
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.cxx4
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx133
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.hxx22
-rw-r--r--chart2/source/controller/dialogs/res_DataTableProperties.cxx111
-rw-r--r--chart2/source/controller/dialogs/res_ErrorBar.cxx32
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.cxx50
-rw-r--r--chart2/source/controller/dialogs/res_Titles.cxx30
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.cxx90
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.hxx8
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx47
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx9
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx36
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx10
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx81
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx28
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.cxx34
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.hxx9
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.cxx47
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx79
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hxx6
-rw-r--r--chart2/source/controller/dialogs/tp_DataPointOption.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx136
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hxx10
-rw-r--r--chart2/source/controller/dialogs/tp_DataTable.cxx43
-rw-r--r--chart2/source/controller/dialogs/tp_DataTable.hxx37
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.hxx4
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.cxx16
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.hxx5
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.cxx6
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx17
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.cxx13
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hxx10
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx99
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.hxx5
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx46
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.cxx13
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.hxx7
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx25
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx8
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx66
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx40
-rw-r--r--chart2/source/controller/inc/AccessibleBase.hxx47
-rw-r--r--chart2/source/controller/inc/AccessibleChartView.hxx24
-rw-r--r--chart2/source/controller/inc/AccessibleTextHelper.hxx34
-rw-r--r--chart2/source/controller/inc/AxisItemConverter.hxx20
-rw-r--r--chart2/source/controller/inc/CharacterPropertyItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/ChartController.hxx108
-rw-r--r--chart2/source/controller/inc/ChartDocumentWrapper.hxx14
-rw-r--r--chart2/source/controller/inc/ChartToolbarController.hxx10
-rw-r--r--chart2/source/controller/inc/ChartWindow.hxx11
-rw-r--r--chart2/source/controller/inc/CommandDispatchContainer.hxx12
-rw-r--r--chart2/source/controller/inc/ConfigurationAccess.hxx38
-rw-r--r--chart2/source/controller/inc/DataPointItemConverter.hxx20
-rw-r--r--chart2/source/controller/inc/DataTableItemConverter.hxx56
-rw-r--r--chart2/source/controller/inc/DrawViewWrapper.hxx2
-rw-r--r--chart2/source/controller/inc/ErrorBarItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/GraphicPropertyItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/ItemConverter.hxx15
-rw-r--r--chart2/source/controller/inc/LegendItemConverter.hxx10
-rw-r--r--chart2/source/controller/inc/MultipleChartConverters.hxx38
-rw-r--r--chart2/source/controller/inc/ObjectHierarchy.hxx59
-rw-r--r--chart2/source/controller/inc/ObjectNameProvider.hxx25
-rw-r--r--chart2/source/controller/inc/PositionAndSizeHelper.hxx4
-rw-r--r--chart2/source/controller/inc/RangeSelectionHelper.hxx8
-rw-r--r--chart2/source/controller/inc/RangeSelectionListener.hxx10
-rw-r--r--chart2/source/controller/inc/RegressionCurveItemConverter.hxx11
-rw-r--r--chart2/source/controller/inc/RegressionEquationItemConverter.hxx10
-rw-r--r--chart2/source/controller/inc/SelectionHelper.hxx9
-rw-r--r--chart2/source/controller/inc/SeriesOptionsItemConverter.hxx18
-rw-r--r--chart2/source/controller/inc/ShapeController.h38
-rw-r--r--chart2/source/controller/inc/StatisticsItemConverter.hxx10
-rw-r--r--chart2/source/controller/inc/TabPageNotifiable.hxx4
-rw-r--r--chart2/source/controller/inc/TextDirectionListBox.hxx2
-rw-r--r--chart2/source/controller/inc/TextLabelItemConverter.hxx19
-rw-r--r--chart2/source/controller/inc/TimerTriggeredControllerLock.hxx8
-rw-r--r--chart2/source/controller/inc/TitleDialogData.hxx13
-rw-r--r--chart2/source/controller/inc/TitleItemConverter.hxx9
-rw-r--r--chart2/source/controller/inc/dlg_ChartType.hxx10
-rw-r--r--chart2/source/controller/inc/dlg_ChartType_UNO.hxx6
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard.hxx14
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx14
-rw-r--r--chart2/source/controller/inc/dlg_DataEditor.hxx11
-rw-r--r--chart2/source/controller/inc/dlg_DataSource.hxx20
-rw-r--r--chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx3
-rw-r--r--chart2/source/controller/inc/dlg_InsertDataLabel.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_InsertDataTable.hxx52
-rw-r--r--chart2/source/controller/inc/dlg_InsertErrorBars.hxx14
-rw-r--r--chart2/source/controller/inc/dlg_InsertLegend.hxx8
-rw-r--r--chart2/source/controller/inc/dlg_InsertTitle.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_ObjectProperties.hxx20
-rw-r--r--chart2/source/controller/inc/dlg_ShapeFont.hxx4
-rw-r--r--chart2/source/controller/inc/dlg_ShapeParagraph.hxx4
-rw-r--r--chart2/source/controller/inc/dlg_View3D.hxx6
-rw-r--r--chart2/source/controller/inc/helpids.h14
-rw-r--r--chart2/source/controller/inc/res_DataTableProperties.hxx48
-rw-r--r--chart2/source/controller/inc/res_ErrorBar.hxx15
-rw-r--r--chart2/source/controller/inc/res_LegendPosition.hxx17
-rw-r--r--chart2/source/controller/inc/uiobject.hxx8
-rw-r--r--chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx94
-rw-r--r--chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx11
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx89
-rw-r--r--chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx92
-rw-r--r--chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx17
-rw-r--r--chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx24
-rw-r--r--chart2/source/controller/itemsetwrapper/ItemConverter.cxx28
-rw-r--r--chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx21
-rw-r--r--chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx74
-rw-r--r--chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx32
-rw-r--r--chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx4
-rw-r--r--chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx241
-rw-r--r--chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx117
-rw-r--r--chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx70
-rw-r--r--chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx62
-rw-r--r--chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx15
-rw-r--r--chart2/source/controller/main/ChartController.cxx441
-rw-r--r--chart2/source/controller/main/ChartController_EditData.cxx7
-rw-r--r--chart2/source/controller/main/ChartController_Insert.cxx480
-rw-r--r--chart2/source/controller/main/ChartController_Position.cxx53
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx304
-rw-r--r--chart2/source/controller/main/ChartController_TextEdit.cxx227
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx272
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx659
-rw-r--r--chart2/source/controller/main/ChartDropTargetHelper.cxx28
-rw-r--r--chart2/source/controller/main/ChartDropTargetHelper.hxx6
-rw-r--r--chart2/source/controller/main/ChartFrameloader.cxx114
-rw-r--r--chart2/source/controller/main/ChartModelClone.cxx71
-rw-r--r--chart2/source/controller/main/ChartModelClone.hxx12
-rw-r--r--chart2/source/controller/main/ChartTransferable.cxx28
-rw-r--r--chart2/source/controller/main/ChartTransferable.hxx4
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx106
-rw-r--r--chart2/source/controller/main/CommandDispatch.cxx70
-rw-r--r--chart2/source/controller/main/CommandDispatch.hxx15
-rw-r--r--chart2/source/controller/main/CommandDispatchContainer.cxx21
-rw-r--r--chart2/source/controller/main/ConfigurationAccess.cxx99
-rw-r--r--chart2/source/controller/main/ControllerCommandDispatch.cxx153
-rw-r--r--chart2/source/controller/main/ControllerCommandDispatch.hxx2
-rw-r--r--chart2/source/controller/main/DragMethod_Base.cxx18
-rw-r--r--chart2/source/controller/main/DragMethod_Base.hxx11
-rw-r--r--chart2/source/controller/main/DragMethod_PieSegment.cxx17
-rw-r--r--chart2/source/controller/main/DragMethod_PieSegment.hxx4
-rw-r--r--chart2/source/controller/main/DragMethod_RotateDiagram.cxx45
-rw-r--r--chart2/source/controller/main/DragMethod_RotateDiagram.hxx2
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx205
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.h42
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.hxx7
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx47
-rw-r--r--chart2/source/controller/main/ElementSelector.hxx12
-rw-r--r--chart2/source/controller/main/FeatureCommandDispatchBase.cxx4
-rw-r--r--chart2/source/controller/main/FeatureCommandDispatchBase.hxx44
-rw-r--r--chart2/source/controller/main/ObjectHierarchy.cxx432
-rw-r--r--chart2/source/controller/main/PositionAndSizeHelper.cxx49
-rw-r--r--chart2/source/controller/main/SelectionHelper.cxx39
-rw-r--r--chart2/source/controller/main/ShapeController.cxx206
-rw-r--r--chart2/source/controller/main/ShapeController.hxx4
-rw-r--r--chart2/source/controller/main/StatusBarCommandDispatch.cxx27
-rw-r--r--chart2/source/controller/main/StatusBarCommandDispatch.hxx7
-rw-r--r--chart2/source/controller/main/ToolbarController.cxx17
-rw-r--r--chart2/source/controller/main/UndoActions.cxx26
-rw-r--r--chart2/source/controller/main/UndoActions.hxx40
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.cxx15
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.hxx8
-rw-r--r--chart2/source/controller/main/UndoGuard.cxx15
-rw-r--r--chart2/source/controller/main/UndoGuard.hxx4
-rw-r--r--chart2/source/controller/sidebar/Chart2PanelFactory.cxx39
-rw-r--r--chart2/source/controller/sidebar/Chart2PanelFactory.hxx10
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx85
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.hxx12
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.cxx135
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.hxx19
-rw-r--r--chart2/source/controller/sidebar/ChartColorWrapper.cxx34
-rw-r--r--chart2/source/controller/sidebar/ChartColorWrapper.hxx22
-rw-r--r--chart2/source/controller/sidebar/ChartElementsPanel.cxx142
-rw-r--r--chart2/source/controller/sidebar/ChartElementsPanel.hxx15
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.cxx99
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.hxx16
-rw-r--r--chart2/source/controller/sidebar/ChartLinePanel.cxx90
-rw-r--r--chart2/source/controller/sidebar/ChartLinePanel.hxx15
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.cxx179
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.hxx16
-rw-r--r--chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx4
-rw-r--r--chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx2
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.cxx141
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.hxx12
-rw-r--r--chart2/source/controller/uitest/uiobject.cxx25
272 files changed, 7156 insertions, 7022 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx
index 6f9192eba064..e1f583a578ee 100644
--- a/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -21,7 +21,8 @@
#include "AccessibleChartShape.hxx"
#include <ObjectHierarchy.hxx>
#include <ObjectIdentifier.hxx>
-#include <chartview/ExplicitValueProvider.hxx>
+#include <ChartView.hxx>
+#include <ChartController.hxx>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
@@ -30,21 +31,17 @@
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <sal/log.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
-#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <i18nlangtag/languagetag.hxx>
-#include <vcl/unohelp.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/window.hxx>
#include <vcl/settings.hxx>
#include <o3tl/functional.hxx>
#include <o3tl/safeint.hxx>
-#include <tools/diagnose_ex.h>
-#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
#include <iterator>
@@ -66,7 +63,7 @@ namespace chart
/** @param bMayHaveChildren is false per default
*/
AccessibleBase::AccessibleBase(
- const AccessibleElementInfo & rAccInfo,
+ AccessibleElementInfo aAccInfo,
bool bMayHaveChildren,
bool bAlwaysTransparent /* default: false */ ) :
impl::AccessibleBase_Base( m_aMutex ),
@@ -74,18 +71,17 @@ AccessibleBase::AccessibleBase(
m_bMayHaveChildren( bMayHaveChildren ),
m_bChildrenInitialized( false ),
m_nEventNotifierId(0),
- m_xStateSetHelper( new ::utl::AccessibleStateSetHelper() ),
- m_aAccInfo( rAccInfo ),
+ m_nStateSet( 0 ),
+ m_aAccInfo(std::move( aAccInfo )),
m_bAlwaysTransparent( bAlwaysTransparent ),
m_bStateSetInitialized( false )
{
// initialize some states
- OSL_ASSERT( m_xStateSetHelper.is() );
- m_xStateSetHelper->AddState( AccessibleStateType::ENABLED );
- m_xStateSetHelper->AddState( AccessibleStateType::SHOWING );
- m_xStateSetHelper->AddState( AccessibleStateType::VISIBLE );
- m_xStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
- m_xStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ m_nStateSet |= AccessibleStateType::ENABLED;
+ m_nStateSet |= AccessibleStateType::SHOWING;
+ m_nStateSet |= AccessibleStateType::VISIBLE;
+ m_nStateSet |= AccessibleStateType::SELECTABLE;
+ m_nStateSet |= AccessibleStateType::FOCUSABLE;
}
AccessibleBase::~AccessibleBase()
@@ -122,7 +118,7 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId
AddState( AccessibleStateType::FOCUSED );
aSelected <<= AccessibleStateType::FOCUSED;
- BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty, true );
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty );
SAL_INFO("chart2.accessibility", "Selection acquired by: " << getAccessibleName());
}
@@ -135,7 +131,7 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId
AddState( AccessibleStateType::FOCUSED );
aSelected <<= AccessibleStateType::FOCUSED;
- BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected, true );
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected );
SAL_INFO("chart2.accessibility", "Selection lost by: " << getAccessibleName());
}
break;
@@ -166,18 +162,16 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId
return false;
}
-void AccessibleBase::AddState( sal_Int16 aState )
+void AccessibleBase::AddState( sal_Int64 aState )
{
CheckDisposeState();
- OSL_ASSERT( m_xStateSetHelper.is() );
- m_xStateSetHelper->AddState( aState );
+ m_nStateSet |= aState;
}
-void AccessibleBase::RemoveState( sal_Int16 aState )
+void AccessibleBase::RemoveState( sal_Int64 aState )
{
CheckDisposeState();
- OSL_ASSERT( m_xStateSetHelper.is() );
- m_xStateSetHelper->RemoveState( aState );
+ m_nStateSet &= ~aState;
}
bool AccessibleBase::UpdateChildren()
@@ -237,7 +231,7 @@ bool AccessibleBase::ImplUpdateChildren()
aAccInfo.m_aOID = childToAdd;
if ( childToAdd.isAutoGeneratedObject() )
{
- AddChild( ChartElementFactory::CreateChartElement( aAccInfo ) );
+ AddChild( ChartElementFactory::CreateChartElement( aAccInfo ).get() );
}
else if ( childToAdd.isAdditionalShape() )
{
@@ -342,32 +336,24 @@ awt::Point AccessibleBase::GetUpperLeftOnScreen() const
void AccessibleBase::BroadcastAccEvent(
sal_Int16 nId,
const Any & rNew,
- const Any & rOld,
- bool bSendGlobally ) const
+ const Any & rOld ) const
{
ClearableMutexGuard aGuard( m_aMutex );
- if ( !m_nEventNotifierId && !bSendGlobally )
+ if ( !m_nEventNotifierId )
return;
// if we don't have a client id for the notifier, then we don't have listeners, then
// we don't need to notify anything
- //except SendGlobally for focus handling?
// the const cast is needed, because UNO parameters are never const
const AccessibleEventObject aEvent(
const_cast< uno::XWeak * >( static_cast< const uno::XWeak * >( this )),
- nId, rNew, rOld );
+ nId, rNew, rOld, -1 );
- if ( m_nEventNotifierId ) // let the notifier handle this event
- ::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent );
+ // let the notifier handle this event
+ ::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent );
aGuard.clear();
-
- // send event to global message queue
- if( bSendGlobally )
- {
- vcl::unohelper::NotifyAccessibleStateEventGlobally( aEvent );
- }
}
void AccessibleBase::KillAllChildren()
@@ -404,8 +390,7 @@ void AccessibleBase::SetInfo( const AccessibleElementInfo & rNewInfo )
{
KillAllChildren();
}
- BroadcastAccEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), uno::Any(),
- true /* global notification */ );
+ BroadcastAccEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), uno::Any());
}
// ________ (XComponent::dispose) ________
@@ -426,11 +411,7 @@ void SAL_CALL AccessibleBase::disposing()
// reset pointers
m_aAccInfo.m_pParent = nullptr;
- // attach new empty state set helper to member reference
- ::utl::AccessibleStateSetHelper * pHelper = new ::utl::AccessibleStateSetHelper();
- pHelper->AddState(AccessibleStateType::DEFUNC);
- // release old helper and attach new one
- m_xStateSetHelper = pHelper;
+ m_nStateSet = AccessibleStateType::DEFUNC;
m_bIsDisposed = true;
@@ -452,7 +433,7 @@ Reference< XAccessibleContext > SAL_CALL AccessibleBase::getAccessibleContext()
}
// ________ AccessibleBase::XAccessibleContext ________
-sal_Int32 SAL_CALL AccessibleBase::getAccessibleChildCount()
+sal_Int64 SAL_CALL AccessibleBase::getAccessibleChildCount()
{
ClearableMutexGuard aGuard( m_aMutex );
if( ! m_bMayHaveChildren ||
@@ -471,12 +452,12 @@ sal_Int32 SAL_CALL AccessibleBase::getAccessibleChildCount()
return ImplGetAccessibleChildCount();
}
-sal_Int32 AccessibleBase::ImplGetAccessibleChildCount() const
+sal_Int64 AccessibleBase::ImplGetAccessibleChildCount() const
{
return m_aChildList.size();
}
-Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleChild( sal_Int64 i )
{
CheckDisposeState();
Reference< XAccessible > xResult;
@@ -495,7 +476,7 @@ Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleChild( sal_Int32
return xResult;
}
-Reference< XAccessible > AccessibleBase::ImplGetAccessibleChildById( sal_Int32 i ) const
+Reference< XAccessible > AccessibleBase::ImplGetAccessibleChildById( sal_Int64 i ) const
{
Reference< XAccessible > xResult;
@@ -528,7 +509,7 @@ Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleParent()
return aResult;
}
-sal_Int32 SAL_CALL AccessibleBase::getAccessibleIndexInParent()
+sal_Int64 SAL_CALL AccessibleBase::getAccessibleIndexInParent()
{
CheckDisposeState();
@@ -548,11 +529,11 @@ Reference< XAccessibleRelationSet > SAL_CALL AccessibleBase::getAccessibleRelati
return aResult;
}
-Reference< XAccessibleStateSet > SAL_CALL AccessibleBase::getAccessibleStateSet()
+sal_Int64 SAL_CALL AccessibleBase::getAccessibleStateSet()
{
if( ! m_bStateSetInitialized )
{
- Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier );
+ rtl::Reference< ::chart::ChartController > xSelSupp( GetInfo().m_xChartController );
if ( xSelSupp.is() )
{
ObjectIdentifier aOID( xSelSupp->getSelection() );
@@ -565,7 +546,7 @@ Reference< XAccessibleStateSet > SAL_CALL AccessibleBase::getAccessibleStateSet(
m_bStateSetInitialized = true;
}
- return m_xStateSetHelper.get();
+ return m_nStateSet;
}
lang::Locale SAL_CALL AccessibleBase::getLocale()
@@ -630,12 +611,11 @@ Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleAtPoint( const aw
awt::Rectangle SAL_CALL AccessibleBase::getBounds()
{
- ExplicitValueProvider *pExplicitValueProvider(
- comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_aAccInfo.m_xView ));
- if( pExplicitValueProvider )
+ rtl::Reference<ChartView> pChartView = m_aAccInfo.m_xView.get();
+ if( pChartView )
{
VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow ));
- awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() ));
+ awt::Rectangle aLogicRect( pChartView->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() ));
if( pWindow )
{
tools::Rectangle aRect( aLogicRect.X, aLogicRect.Y,
@@ -655,8 +635,8 @@ awt::Rectangle SAL_CALL AccessibleBase::getBounds()
awt::Point aOffset( aParentLocOnScreen.X - aULOnScreen.X,
aParentLocOnScreen.Y - aULOnScreen.Y );
- return awt::Rectangle( aRect.getX() - aOffset.X, aRect.getY() - aOffset.Y,
- aRect.getWidth(), aRect.getHeight());
+ return awt::Rectangle( aRect.Left() - aOffset.X, aRect.Top() - aOffset.Y,
+ aRect.getOpenWidth(), aRect.getOpenHeight());
}
}
@@ -697,7 +677,7 @@ void SAL_CALL AccessibleBase::grabFocus()
{
CheckDisposeState();
- Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier );
+ rtl::Reference< ::chart::ChartController > xSelSupp( GetInfo().m_xChartController );
if ( xSelSupp.is() )
{
xSelSupp->select( GetId().getAny() );
@@ -727,13 +707,13 @@ Color AccessibleBase::getColor( eColorType eColType )
if( eType == OBJECTTYPE_LEGEND_ENTRY )
{
// for colors get the data series/point properties
- OUString aParentParticle( ObjectIdentifier::getFullParentParticle( aObjectCID ));
+ std::u16string_view aParentParticle( ObjectIdentifier::getFullParentParticle( aObjectCID ));
aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle );
}
xObjProp =
ObjectIdentifier::getObjectPropertySet(
- aObjectCID, Reference< chart2::XChartDocument >( m_aAccInfo.m_xChartDocument ));
+ aObjectCID, m_aAccInfo.m_xChartDocument );
if( xObjProp.is())
{
try
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx
index cbee2ddbb01a..d3b98c102f76 100644
--- a/chart2/source/controller/accessibility/AccessibleChartElement.cxx
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx
@@ -18,21 +18,17 @@
*/
#include "AccessibleChartElement.hxx"
+#include <AccessibleTextHelper.hxx>
#include <CharacterProperties.hxx>
+#include <ChartModel.hxx>
+#include <ChartController.hxx>
#include <ObjectIdentifier.hxx>
#include <ObjectNameProvider.hxx>
-#include <servicenames.hxx>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/chart2/XTitle.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-
-#include <tools/diagnose_ex.h>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
@@ -65,7 +61,7 @@ bool AccessibleChartElement::ImplUpdateChildren()
bool bResult = false;
Reference< chart2::XTitle > xTitle(
ObjectIdentifier::getObjectPropertySet(
- GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )),
+ GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument ),
uno::UNO_QUERY );
m_bHasText = xTitle.is();
@@ -85,38 +81,21 @@ void AccessibleChartElement::InitTextEdit()
if( ! m_xTextHelper.is())
{
// get hard reference
- Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier );
- // get factory from selection supplier (controller)
- Reference< lang::XMultiServiceFactory > xFact( xSelSupp, uno::UNO_QUERY );
- if( xFact.is())
- {
- m_xTextHelper.set(
- xFact->createInstance( CHART_ACCESSIBLE_TEXT_SERVICE_NAME ), uno::UNO_QUERY );
- }
+ rtl::Reference< ::chart::ChartController > xChartController( GetInfo().m_xChartController );
+ if( xChartController.is())
+ m_xTextHelper = xChartController->createAccessibleTextContext();
}
if( !m_xTextHelper.is())
return;
- try
- {
- Reference< lang::XInitialization > xInit( m_xTextHelper, uno::UNO_QUERY_THROW );
- Sequence< uno::Any > aArgs( 3 );
- aArgs[0] <<= GetInfo().m_aOID.getObjectCID();
- aArgs[1] <<= Reference< XAccessible >( this );
- aArgs[2] <<= Reference< awt::XWindow >( GetInfo().m_xWindow );
- xInit->initialize( aArgs );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xTextHelper->initialize( GetInfo().m_aOID.getObjectCID(), this, GetInfo().m_xWindow );
}
// Interfaces
// ________ AccessibleBase::XAccessibleContext ________
-Reference< XAccessible > AccessibleChartElement::ImplGetAccessibleChildById( sal_Int32 i ) const
+Reference< XAccessible > AccessibleChartElement::ImplGetAccessibleChildById( sal_Int64 i ) const
{
Reference< XAccessible > xResult;
@@ -128,7 +107,7 @@ Reference< XAccessible > AccessibleChartElement::ImplGetAccessibleChildById( sal
return xResult;
}
-sal_Int32 AccessibleChartElement::ImplGetAccessibleChildCount() const
+sal_Int64 AccessibleChartElement::ImplGetAccessibleChildCount() const
{
if( m_bHasText )
{
@@ -171,7 +150,7 @@ Reference< awt::XFont > SAL_CALL AccessibleChartElement::getFont()
{
Reference< beans::XMultiPropertySet > xObjProp(
ObjectIdentifier::getObjectPropertySet(
- GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY );
+ GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument ), uno::UNO_QUERY );
awt::FontDescriptor aDescr(
CharacterProperties::createFontDescriptorFromPropertySet( xObjProp ));
xFont = xDevice->getFont( aDescr );
@@ -190,7 +169,7 @@ OUString SAL_CALL AccessibleChartElement::getToolTipText()
CheckDisposeState();
return ObjectNameProvider::getHelpText(
- GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument ));
+ GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument );
}
// ________ XAccessibleComponent ________
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.hxx b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
index 12982db8faa1..283efed69d80 100644
--- a/chart2/source/controller/accessibility/AccessibleChartElement.hxx
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
@@ -27,6 +27,7 @@ namespace com::sun::star::awt { class XFont; }
namespace chart
{
+class AccessibleTextHelper;
/** Base class for all Chart Accessibility objects except the root node (see AccessibleChartView)
@@ -61,8 +62,8 @@ public:
// ________ AccessibleBase ________
virtual bool ImplUpdateChildren() override;
virtual css::uno::Reference< css::accessibility::XAccessible >
- ImplGetAccessibleChildById( sal_Int32 i ) const override;
- virtual sal_Int32 ImplGetAccessibleChildCount() const override;
+ ImplGetAccessibleChildById( sal_Int64 i ) const override;
+ virtual sal_Int64 ImplGetAccessibleChildCount() const override;
// ________ XAccessibleContext ________
virtual OUString SAL_CALL getAccessibleName() override;
@@ -93,7 +94,7 @@ public:
private:
bool m_bHasText;
- css::uno::Reference< css::accessibility::XAccessibleContext >
+ rtl::Reference< ::chart::AccessibleTextHelper >
m_xTextHelper;
void InitTextEdit();
diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.cxx b/chart2/source/controller/accessibility/AccessibleChartShape.cxx
index 2d4fd3010e4b..771698a84010 100644
--- a/chart2/source/controller/accessibility/AccessibleChartShape.cxx
+++ b/chart2/source/controller/accessibility/AccessibleChartShape.cxx
@@ -24,7 +24,6 @@
#include <svx/ShapeTypeHandler.hxx>
#include <svx/AccessibleShape.hxx>
#include <svx/AccessibleShapeInfo.hxx>
-#include <vcl/window.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
@@ -79,9 +78,9 @@ OUString AccessibleChartShape::getImplementationName()
}
// ________ XAccessibleContext ________
-sal_Int32 AccessibleChartShape::getAccessibleChildCount()
+sal_Int64 AccessibleChartShape::getAccessibleChildCount()
{
- sal_Int32 nCount(0);
+ sal_Int64 nCount(0);
if ( m_pAccShape.is() )
{
nCount = m_pAccShape->getAccessibleChildCount();
@@ -89,7 +88,7 @@ sal_Int32 AccessibleChartShape::getAccessibleChildCount()
return nCount;
}
-Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int64 i )
{
Reference< XAccessible > xChild;
if ( m_pAccShape.is() )
diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.hxx b/chart2/source/controller/accessibility/AccessibleChartShape.hxx
index 4377929fa41d..c31204ed3c8a 100644
--- a/chart2/source/controller/accessibility/AccessibleChartShape.hxx
+++ b/chart2/source/controller/accessibility/AccessibleChartShape.hxx
@@ -50,9 +50,9 @@ public:
virtual OUString SAL_CALL getImplementationName() override;
// ________ XAccessibleContext ________
- virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
- getAccessibleChild( sal_Int32 i ) override;
+ getAccessibleChild( sal_Int64 i ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole() override;
virtual OUString SAL_CALL getAccessibleDescription() override;
virtual OUString SAL_CALL getAccessibleName() override;
diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx b/chart2/source/controller/accessibility/AccessibleChartView.cxx
index 0738f52abc36..8f01816a6504 100644
--- a/chart2/source/controller/accessibility/AccessibleChartView.cxx
+++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx
@@ -18,19 +18,18 @@
*/
#include <AccessibleChartView.hxx>
-#include <chartview/ExplicitValueProvider.hxx>
#include <ObjectHierarchy.hxx>
#include <ObjectIdentifier.hxx>
#include <ResId.hxx>
#include <strings.hrc>
#include "AccessibleViewForwarder.hxx"
+#include <ChartModel.hxx>
+#include <ChartView.hxx>
+#include <ChartController.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-
-#include <comphelper/servicehelper.hxx>
#include <rtl/ustring.hxx>
#include <vcl/window.hxx>
@@ -112,7 +111,7 @@ Reference< XAccessible > SAL_CALL AccessibleChartView::getAccessibleParent()
return Reference< XAccessible >( m_xParent );
}
-sal_Int32 SAL_CALL AccessibleChartView::getAccessibleIndexInParent()
+sal_Int64 SAL_CALL AccessibleChartView::getAccessibleIndexInParent()
{
// the document is always the only child of the window
return 0;
@@ -157,9 +156,11 @@ awt::Point SAL_CALL AccessibleChartView::getLocationOnScreen()
return aResult;
}
-// lang::XInitialization
-
-void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments )
+void AccessibleChartView::initialize( ChartController& rNewChartController,
+ const rtl::Reference<::chart::ChartModel>& xNewChartModel,
+ const rtl::Reference<::chart::ChartView>& xNewChartView,
+ const uno::Reference< XAccessible >& xNewParent,
+ const css::uno::Reference<css::awt::XWindow>& xNewWindow )
{
//0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
//1: frame::XModel representing the chart model - offers access to object data
@@ -170,123 +171,178 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments
bool bOldInvalid = false;
bool bNewInvalid = false;
- Reference< view::XSelectionSupplier > xSelectionSupplier;
- Reference< frame::XModel > xChartModel;
- Reference< uno::XInterface > xChartView;
+ rtl::Reference< ::chart::ChartController > xChartController;
+ rtl::Reference<::chart::ChartModel> xChartModel;
+ rtl::Reference<::chart::ChartView> xChartView;
Reference< XAccessible > xParent;
Reference< awt::XWindow > xWindow;
{
MutexGuard aGuard( m_aMutex);
- xSelectionSupplier.set( m_xSelectionSupplier );
- xChartModel.set( m_xChartModel );
- xChartView.set( m_xChartView );
+ xChartController = m_xChartController;
+ xChartModel = m_xChartModel;
+ xChartView = m_xChartView;
xParent.set( m_xParent );
xWindow.set( m_xWindow );
}
- if( !xSelectionSupplier.is() || !xChartModel.is() || !xChartView.is() )
+ if( !xChartController.is() || !xChartModel.is() || !xChartView.is() )
{
bOldInvalid = true;
}
- if( rArguments.getLength() > 1 )
+ if( xNewChartModel.get() != xChartModel.get() )
{
- Reference< frame::XModel > xNewChartModel;
- rArguments[1] >>= xNewChartModel;
- if( xNewChartModel != xChartModel )
- {
- xChartModel = xNewChartModel;
- bChanged = true;
- }
+ xChartModel = xNewChartModel;
+ bChanged = true;
}
- else if( xChartModel.is() )
+
+ if( xNewChartView != xChartView )
{
+ xChartView = xNewChartView;
bChanged = true;
- xChartModel = nullptr;
}
- if( rArguments.getLength() > 2 )
+ if( xNewParent != xParent )
{
- Reference< uno::XInterface > xNewChartView;
- rArguments[2] >>= xNewChartView;
- if( xNewChartView != xChartView )
- {
- xChartView = xNewChartView;
- bChanged = true;
- }
+ xParent = xNewParent;
+ bChanged = true;
}
- else if( xChartView.is() )
+
+ if( xNewWindow != xWindow )
{
+ xWindow = xNewWindow;
bChanged = true;
- xChartView = nullptr;
}
- if( rArguments.getLength() > 3 )
+ if(xChartController != &rNewChartController)
{
- Reference< XAccessible > xNewParent;
- rArguments[3] >>= xNewParent;
- if( xNewParent != xParent )
- {
- xParent = xNewParent;
- bChanged = true;
- }
+ if (xChartController)
+ xChartController->removeSelectionChangeListener(this);
+ rNewChartController.addSelectionChangeListener(this);
+ xChartController = &rNewChartController;
+ bChanged = true;
}
- if( rArguments.getLength() > 4 )
+ if( !xChartController.is() || !xChartModel.is() || !xChartView.is() )
{
- Reference< awt::XWindow > xNewWindow;
- rArguments[4] >>= xNewWindow;
- if( xNewWindow != xWindow )
+ if(xChartController.is())
{
- xWindow.set( xNewWindow );
- bChanged = true;
+ xChartController->removeSelectionChangeListener(this);
+ xChartController.clear();
}
+ xChartModel.clear();
+ xChartView.clear();
+ xParent.clear();
+ xWindow.clear();
+
+ bNewInvalid = true;
}
- if( rArguments.hasElements() && xChartModel.is() && xChartView.is() )
{
- Reference< view::XSelectionSupplier > xNewSelectionSupplier;
- rArguments[0] >>= xNewSelectionSupplier;
- if(xSelectionSupplier!=xNewSelectionSupplier)
- {
- bChanged = true;
- if(xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(this);
- if(xNewSelectionSupplier.is())
- xNewSelectionSupplier->addSelectionChangeListener(this);
- xSelectionSupplier = xNewSelectionSupplier;
- }
+ MutexGuard aGuard( m_aMutex);
+ m_xChartController = xChartController.get();
+ m_xChartModel = xChartModel.get();
+ m_xChartView = xChartView.get();
+ m_xParent = xParent;
+ m_xWindow = xWindow;
+ }
+
+ if( bOldInvalid && bNewInvalid )
+ bChanged = false;
+
+ if( !bChanged )
+ return;
+
+ {
+ //before notification we prepare for creation of new context
+ //the old context will be deleted after notification than
+ MutexGuard aGuard( m_aMutex);
+ if( xChartModel.is())
+ m_spObjectHierarchy =
+ std::make_shared<ObjectHierarchy>( xChartModel, m_xChartView.get().get() );
+ else
+ m_spObjectHierarchy.reset();
+ }
+
+ {
+ AccessibleElementInfo aAccInfo;
+ aAccInfo.m_aOID = ObjectIdentifier("ROOT");
+ aAccInfo.m_xChartDocument = m_xChartModel;
+ aAccInfo.m_xChartController = m_xChartController;
+ aAccInfo.m_xView = m_xChartView;
+ aAccInfo.m_xWindow = m_xWindow;
+ aAccInfo.m_pParent = nullptr;
+ aAccInfo.m_spObjectHierarchy = m_spObjectHierarchy;
+ aAccInfo.m_pSdrView = m_pSdrView;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( m_xWindow );
+ m_pViewForwarder.reset( new AccessibleViewForwarder( this, pWindow ) );
+ aAccInfo.m_pViewForwarder = m_pViewForwarder.get();
+ // broadcasts an INVALIDATE_ALL_CHILDREN event globally
+ SetInfo( aAccInfo );
}
- else if( xSelectionSupplier.is() )
+}
+
+void AccessibleChartView::initialize()
+{
+ //0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
+ //1: frame::XModel representing the chart model - offers access to object data
+ //2: lang::XInterface representing the normal chart view - offers access to some extra object data
+
+ //all arguments are only valid until next initialization
+ bool bChanged = false;
+ bool bOldInvalid = false;
+
+ rtl::Reference< ::chart::ChartController > xChartController;
+ rtl::Reference<::chart::ChartModel> xChartModel;
+ rtl::Reference<::chart::ChartView> xChartView;
+ Reference< XAccessible > xParent;
+ Reference< awt::XWindow > xWindow;
+ {
+ MutexGuard aGuard( m_aMutex);
+ xChartController = m_xChartController;
+ xChartModel = m_xChartModel;
+ xChartView = m_xChartView;
+ xParent.set( m_xParent );
+ xWindow.set( m_xWindow );
+ }
+
+ if( !xChartController.is() || !xChartModel.is() || !xChartView.is() )
+ {
+ bOldInvalid = true;
+ }
+
+ if( xChartModel.is() )
{
bChanged = true;
- xSelectionSupplier->removeSelectionChangeListener(this);
- xSelectionSupplier = nullptr;
+ xChartModel = nullptr;
}
- if( !xSelectionSupplier.is() || !xChartModel.is() || !xChartView.is() )
+ if( xChartView.is() )
{
- if(xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(this);
- xSelectionSupplier = nullptr;
- xChartModel.clear();
- xChartView.clear();
- xParent.clear();
- xWindow.clear();
+ bChanged = true;
+ xChartView = nullptr;
+ }
- bNewInvalid = true;
+ if( xChartController.is() )
+ {
+ bChanged = true;
+ xChartController->removeSelectionChangeListener(this);
+ xChartController = nullptr;
}
+ xParent.clear();
+ xWindow.clear();
+
{
MutexGuard aGuard( m_aMutex);
- m_xSelectionSupplier = WeakReference< view::XSelectionSupplier >(xSelectionSupplier);
- m_xChartModel = WeakReference< frame::XModel >(xChartModel);
- m_xChartView = WeakReference< uno::XInterface >(xChartView);
+ m_xChartController = xChartController.get();
+ m_xChartModel = xChartModel.get();
+ m_xChartView = xChartView.get();
m_xParent = WeakReference< XAccessible >(xParent);
m_xWindow = WeakReference< awt::XWindow >(xWindow);
}
- if( bOldInvalid && bNewInvalid )
+ if( bOldInvalid )
bChanged = false;
if( !bChanged )
@@ -296,10 +352,9 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments
//before notification we prepare for creation of new context
//the old context will be deleted after notification than
MutexGuard aGuard( m_aMutex);
- Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
- if( xChartDoc.is())
+ if( xChartModel.is())
m_spObjectHierarchy =
- std::make_shared<ObjectHierarchy>( xChartDoc, comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(m_xChartView) );
+ std::make_shared<ObjectHierarchy>( xChartModel, m_xChartView.get().get() );
else
m_spObjectHierarchy.reset();
}
@@ -307,9 +362,8 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments
{
AccessibleElementInfo aAccInfo;
aAccInfo.m_aOID = ObjectIdentifier("ROOT");
- aAccInfo.m_xChartDocument = uno::WeakReference< chart2::XChartDocument >(
- uno::Reference< chart2::XChartDocument >( m_xChartModel.get(), uno::UNO_QUERY ));
- aAccInfo.m_xSelectionSupplier = m_xSelectionSupplier;
+ aAccInfo.m_xChartDocument = m_xChartModel;
+ aAccInfo.m_xChartController = m_xChartController;
aAccInfo.m_xView = m_xChartView;
aAccInfo.m_xWindow = m_xWindow;
aAccInfo.m_pParent = nullptr;
@@ -327,16 +381,16 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments
void SAL_CALL AccessibleChartView::selectionChanged( const lang::EventObject& /*rEvent*/ )
{
- Reference< view::XSelectionSupplier > xSelectionSupplier;
+ rtl::Reference< ::chart::ChartController > xChartController;
{
MutexGuard aGuard( m_aMutex);
- xSelectionSupplier.set(m_xSelectionSupplier);
+ xChartController = m_xChartController.get();
}
- if( !xSelectionSupplier.is() )
+ if( !xChartController.is() )
return;
- ObjectIdentifier aSelectedOID( xSelectionSupplier->getSelection() );
+ ObjectIdentifier aSelectedOID( xChartController->getSelection() );
if ( m_aCurrentSelectionOID.isValid() )
{
NotifyEvent( EventType::LOST_SELECTION, m_aCurrentSelectionOID );
diff --git a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
index 620897210db1..6fc26b1c82ad 100644
--- a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
+++ b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
@@ -33,6 +33,8 @@
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <osl/diagnose.h>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
@@ -44,7 +46,6 @@ namespace chart
AccessibleTextHelper::AccessibleTextHelper(
DrawViewWrapper * pDrawViewWrapper ) :
- impl::AccessibleTextHelper_Base( m_aMutex ),
m_pDrawViewWrapper( pDrawViewWrapper )
{}
@@ -52,19 +53,10 @@ AccessibleTextHelper::~AccessibleTextHelper()
{
}
-// ____ XInitialization ____
-void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArguments )
+void AccessibleTextHelper::initialize( const OUString& aCID,
+ const Reference< XAccessible >& xEventSource,
+ const Reference< awt::XWindow >& xWindow )
{
- OUString aCID;
- Reference< XAccessible > xEventSource;
- Reference< awt::XWindow > xWindow;
-
- if( aArguments.getLength() >= 3 )
- {
- aArguments[0] >>= aCID;
- aArguments[1] >>= xEventSource;
- aArguments[2] >>= xWindow;
- }
OSL_ENSURE( !aCID.isEmpty(), "Empty CID" );
OSL_ENSURE( xEventSource.is(), "Empty Event Source" );
OSL_ENSURE( xWindow.is(), "Empty Window" );
@@ -73,7 +65,7 @@ void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArg
SolarMutexGuard aSolarGuard;
- m_pTextHelper.reset();
+ m_oTextHelper.reset();
VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( xWindow ));
if( pWindow )
@@ -84,32 +76,32 @@ void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArg
SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID );
if( pTextObj )
{
- m_pTextHelper.reset( new ::accessibility::AccessibleTextHelper(std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *pView, *pWindow)) );
- m_pTextHelper->SetEventSource( xEventSource );
+ m_oTextHelper.emplace( std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *pView, *pWindow->GetOutDev()) );
+ m_oTextHelper->SetEventSource( xEventSource );
}
}
}
- OSL_ENSURE( m_pTextHelper, "Couldn't create text helper" );
+ OSL_ENSURE( m_oTextHelper, "Couldn't create text helper" );
}
// ____ XAccessibleContext ____
-::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleChildCount()
+sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleChildCount()
{
- if( m_pTextHelper )
+ if( m_oTextHelper )
{
SolarMutexGuard aSolarGuard;
- return m_pTextHelper->GetChildCount();
+ return m_oTextHelper->GetChildCount();
}
return 0;
}
-Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleChild( ::sal_Int32 i )
+Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleChild( sal_Int64 i )
{
- if( m_pTextHelper )
+ if( m_oTextHelper )
{
SolarMutexGuard aSolarGuard;
- return m_pTextHelper->GetChild( i );
+ return m_oTextHelper->GetChild( i );
}
return Reference< XAccessible >();
}
@@ -120,7 +112,7 @@ Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleParent()
return Reference< XAccessible >();
}
-::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent()
+sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent()
{
OSL_FAIL( "Not implemented in this helper" );
return -1;
@@ -150,10 +142,10 @@ Reference< XAccessibleRelationSet > SAL_CALL AccessibleTextHelper::getAccessible
return Reference< XAccessibleRelationSet >();
}
-Reference< XAccessibleStateSet > SAL_CALL AccessibleTextHelper::getAccessibleStateSet()
+sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleStateSet()
{
OSL_FAIL( "Not implemented in this helper" );
- return Reference< XAccessibleStateSet >();
+ return 0;
}
lang::Locale SAL_CALL AccessibleTextHelper::getLocale()
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
index 31395f1181dc..dbd8ac0d51f2 100644
--- a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
@@ -45,9 +45,9 @@ tools::Rectangle AccessibleViewForwarder::GetVisibleArea() const
tools::Rectangle aVisibleArea;
if ( m_pWindow )
{
- aVisibleArea.SetPos( Point( 0, 0 ) );
- aVisibleArea.SetSize( m_pWindow->GetOutputSizePixel() );
- aVisibleArea = m_pWindow->PixelToLogic( aVisibleArea, m_aMapMode );
+ aVisibleArea = m_pWindow->PixelToLogic(
+ tools::Rectangle( Point( 0, 0 ), m_pWindow->GetOutputSizePixel() ),
+ m_aMapMode );
}
return aVisibleArea;
}
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.cxx b/chart2/source/controller/accessibility/ChartElementFactory.cxx
index cd6c4eed340d..a173ac0f4b18 100644
--- a/chart2/source/controller/accessibility/ChartElementFactory.cxx
+++ b/chart2/source/controller/accessibility/ChartElementFactory.cxx
@@ -23,7 +23,8 @@
namespace chart
{
-AccessibleBase* ChartElementFactory::CreateChartElement(const AccessibleElementInfo& rAccInfo)
+rtl::Reference<AccessibleBase>
+ChartElementFactory::CreateChartElement(const AccessibleElementInfo& rAccInfo)
{
ObjectIdentifier aOID(rAccInfo.m_aOID);
ObjectType eType(aOID.getObjectType());
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.hxx b/chart2/source/controller/accessibility/ChartElementFactory.hxx
index 0177809c40cf..08ae64598bc7 100644
--- a/chart2/source/controller/accessibility/ChartElementFactory.hxx
+++ b/chart2/source/controller/accessibility/ChartElementFactory.hxx
@@ -18,6 +18,8 @@
*/
#pragma once
+#include <rtl/ref.hxx>
+
namespace chart
{
class AccessibleBase;
@@ -29,7 +31,7 @@ public:
/** @return a newly created object (using the new operator) that corresponds
to the given unique id
*/
- static AccessibleBase* CreateChartElement(const AccessibleElementInfo& rAccInfo);
+ static rtl::Reference<AccessibleBase> CreateChartElement(const AccessibleElementInfo& rAccInfo);
};
} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx
index 8920b1eda076..995a0f92cf4d 100644
--- a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx
@@ -20,7 +20,6 @@
#include "AreaWrapper.hxx"
#include "Chart2ModelContact.hxx"
#include <WrappedDirectStateProperty.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -29,51 +28,18 @@
#include <UserDefinedProperties.hxx>
#include <algorithm>
+#include <utility>
using namespace ::com::sun::star;
using ::com::sun::star::beans::Property;
-using ::osl::MutexGuard;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
-namespace
-{
-
-struct StaticAreaWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticAreaWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAreaWrapperPropertyArray_Initializer >
-{
-};
-
-} // anonymous namespace
-
namespace chart::wrapper
{
-AreaWrapper::AreaWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact(spChart2ModelContact)
- , m_aEventListenerContainer(m_aMutex)
+AreaWrapper::AreaWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact(std::move(spChart2ModelContact))
{
}
@@ -110,29 +76,31 @@ OUString SAL_CALL AreaWrapper::getShapeType()
// ____ XComponent ____
void SAL_CALL AreaWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
- MutexGuard aGuard( m_aMutex);
clearWrappedPropertySet();
}
void SAL_CALL AreaWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL AreaWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
// WrappedPropertySet
Reference< beans::XPropertySet > AreaWrapper::getInnerPropertySet()
{
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
if( xChartDoc.is() )
return xChartDoc->getPageBackground();
OSL_FAIL("AreaWrapper::getInnerPropertySet() is NULL");
@@ -141,7 +109,19 @@ Reference< beans::XPropertySet > AreaWrapper::getInnerPropertySet()
const Sequence< beans::Property >& AreaWrapper::getPropertySequence()
{
- return *StaticAreaWrapperPropertyArray::get();
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
}
std::vector< std::unique_ptr<WrappedProperty> > AreaWrapper::createWrappedProperties()
diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
index 4934ac5f1964..c150d5bbfcef 100644
--- a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
@@ -20,7 +20,7 @@
#include <WrappedPropertySet.hxx>
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -40,7 +40,7 @@ class AreaWrapper : public ::cppu::ImplInheritanceHelper<
>
{
public:
- explicit AreaWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit AreaWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~AreaWrapper() override;
/// XServiceInfo declarations
@@ -72,7 +72,7 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
};
} // namespace chart::wrapper
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
index b15f33f1871a..ea50320e506e 100644
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
@@ -18,6 +18,7 @@
*/
#include "AxisWrapper.hxx"
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <TitleHelper.hxx>
#include "Chart2ModelContact.hxx"
@@ -35,8 +36,6 @@
#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <CharacterProperties.hxx>
#include <LinePropertiesHelper.hxx>
@@ -49,7 +48,8 @@
#include "WrappedScaleTextProperties.hxx"
#include <algorithm>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -335,33 +335,23 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
-struct StaticAxisWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
- ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticAxisWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAxisWrapperPropertyArray_Initializer >
+const Sequence< Property >& StaticAxisWrapperPropertyArray()
{
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
};
} // anonymous namespace
@@ -370,9 +360,8 @@ namespace chart::wrapper
{
AxisWrapper::AxisWrapper(
- tAxisType eType, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) :
- m_spChart2ModelContact( spChart2ModelContact ),
- m_aEventListenerContainer( m_aMutex ),
+ tAxisType eType, std::shared_ptr<Chart2ModelContact> spChart2ModelContact) :
+ m_spChart2ModelContact(std::move( spChart2ModelContact )),
m_eType( eType )
{
}
@@ -490,18 +479,18 @@ OUString SAL_CALL AxisWrapper::getShapeType()
// ____ XNumberFormatsSupplier ____
uno::Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getNumberFormatSettings()
{
- Reference< util::XNumberFormatsSupplier > xNumSuppl( m_spChart2ModelContact->getChartModel(), uno::UNO_QUERY );
- if( xNumSuppl.is() )
- return xNumSuppl->getNumberFormatSettings();
+ rtl::Reference<ChartModel> xChartModel( m_spChart2ModelContact->getDocumentModel() );
+ if( xChartModel )
+ return xChartModel->getNumberFormatSettings();
return uno::Reference< beans::XPropertySet >();
}
uno::Reference< util::XNumberFormats > SAL_CALL AxisWrapper::getNumberFormats()
{
- Reference< util::XNumberFormatsSupplier > xNumSuppl( m_spChart2ModelContact->getChartModel(), uno::UNO_QUERY );
- if( xNumSuppl.is() )
- return xNumSuppl->getNumberFormats();
+ rtl::Reference<ChartModel> xChartModel( m_spChart2ModelContact->getDocumentModel() );
+ if( xChartModel )
+ return xChartModel->getNumberFormats();
return uno::Reference< util::XNumberFormats >();
}
@@ -526,8 +515,9 @@ void AxisWrapper::getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDim
// ____ XComponent ____
void SAL_CALL AxisWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
DisposeHelper::DisposeAndClear( m_xAxisTitle );
DisposeHelper::DisposeAndClear( m_xMajorGrid );
@@ -539,13 +529,15 @@ void SAL_CALL AxisWrapper::dispose()
void SAL_CALL AxisWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL AxisWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
//ReferenceSizePropertyProvider
@@ -574,21 +566,20 @@ awt::Size AxisWrapper::getCurrentSizeForReference()
Reference< chart2::XAxis > AxisWrapper::getAxis()
{
- Reference< chart2::XAxis > xAxis;
+ rtl::Reference< Axis > xAxis;
try
{
sal_Int32 nDimensionIndex = 0;
bool bMainAxis = true;
AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
- Reference< XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
xAxis = AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram );
if( !xAxis.is() )
{
xAxis = AxisHelper::createAxis( nDimensionIndex, bMainAxis, xDiagram, m_spChart2ModelContact->m_xContext );
- Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
- if( xProp.is() )
- xProp->setPropertyValue("Show", uno::Any( false ) );
+ if( xAxis.is() )
+ xAxis->setPropertyValue("Show", uno::Any( false ) );
}
}
catch( const uno::Exception & )
@@ -606,7 +597,7 @@ Reference< beans::XPropertySet > AxisWrapper::getInnerPropertySet()
const Sequence< beans::Property >& AxisWrapper::getPropertySequence()
{
- return *StaticAxisWrapperPropertyArray::get();
+ return StaticAxisWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > AxisWrapper::createWrappedProperties()
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
index 7b55173f5d3d..e70c85b23ff8 100644
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
@@ -21,7 +21,7 @@
#include <WrappedPropertySet.hxx>
#include "ReferenceSizePropertyProvider.hxx"
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/chart/XAxis.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -56,7 +56,7 @@ public:
SECOND_Y_AXIS
};
- AxisWrapper(tAxisType eType, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ AxisWrapper(tAxisType eType, std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~AxisWrapper() override;
static void getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, bool& rbMainAxis );
@@ -109,7 +109,7 @@ private: //methods
private: //member
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
tAxisType m_eType;
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
index e0cd9e0311bb..ba286cc62623 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -19,17 +19,24 @@
#include "Chart2ModelContact.hxx"
#include <ChartModelHelper.hxx>
+#include <Legend.hxx>
#include <LegendHelper.hxx>
#include <CommonConverters.hxx>
#include <servicenames.hxx>
#include <ObjectIdentifier.hxx>
#include <chartview/ExplicitValueProvider.hxx>
#include <chartview/DrawModelWrapper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
+#include <ChartView.hxx>
#include <DiagramHelper.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <ChartModel.hxx>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <comphelper/diagnose_ex.hxx>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -41,8 +48,7 @@ namespace chart::wrapper
Chart2ModelContact::Chart2ModelContact(
const Reference< uno::XComponentContext > & xContext ) :
m_xContext( xContext ),
- m_xChartModel( nullptr ),
- mpModel( nullptr )
+ m_xChartModel( nullptr )
{
}
@@ -51,58 +57,59 @@ Chart2ModelContact::~Chart2ModelContact()
clear();
}
-void Chart2ModelContact::setModel( const css::uno::Reference< css::frame::XModel >& xChartModel )
+void Chart2ModelContact::setDocumentModel( ChartModel* pChartModel )
{
clear();
- m_xChartModel = xChartModel;
- mpModel = dynamic_cast<ChartModel*>(xChartModel.get());
- uno::Reference< lang::XMultiServiceFactory > xTableFactory( xChartModel, uno::UNO_QUERY );
- if( !xTableFactory.is() )
+ m_xChartModel = pChartModel;
+ if( !pChartModel )
return;
- uno::Reference< container::XNameContainer > xDashTable( xTableFactory->createInstance("com.sun.star.drawing.DashTable"), uno::UNO_QUERY );
- uno::Reference< container::XNameContainer > xGradientTable( xTableFactory->createInstance("com.sun.star.drawing.GradientTable"), uno::UNO_QUERY );
- uno::Reference< container::XNameContainer > xHatchTable( xTableFactory->createInstance("com.sun.star.drawing.HatchTable"), uno::UNO_QUERY );
- uno::Reference< container::XNameContainer > xBitmapTable( xTableFactory->createInstance("com.sun.star.drawing.BitmapTable"), uno::UNO_QUERY );
- uno::Reference< container::XNameContainer > xTransparencyGradientTable( xTableFactory->createInstance("com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY );
- m_aTableMap["LineDashName"] = xDashTable;
- m_aTableMap["FillGradientName"] = xGradientTable;
- m_aTableMap["FillHatchName"] = xHatchTable;
- m_aTableMap["FillBitmapName"] = xBitmapTable;
- m_aTableMap["FillTransparenceGradientName"] = xTransparencyGradientTable;
+ m_aTableMap["LineDashName"].set(pChartModel->createInstance("com.sun.star.drawing.DashTable"), uno::UNO_QUERY);
+ m_aTableMap["FillGradientName"].set(pChartModel->createInstance("com.sun.star.drawing.GradientTable"), uno::UNO_QUERY);
+ m_aTableMap["FillHatchName"].set(pChartModel->createInstance("com.sun.star.drawing.HatchTable"), uno::UNO_QUERY);
+ m_aTableMap["FillBitmapName"].set(pChartModel->createInstance("com.sun.star.drawing.BitmapTable"), uno::UNO_QUERY);
+ m_aTableMap["FillTransparenceGradientName"].set(pChartModel->createInstance("com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY);
}
void Chart2ModelContact::clear()
{
m_xChartModel.clear();
m_xChartView.clear();
- mpModel = nullptr;
}
-Reference< frame::XModel > Chart2ModelContact::getChartModel() const
+rtl::Reference< ChartModel > Chart2ModelContact::getDocumentModel() const
{
- return Reference< frame::XModel >( m_xChartModel.get(), uno::UNO_QUERY );
+ return m_xChartModel;
}
-Reference< chart2::XChartDocument > Chart2ModelContact::getChart2Document() const
+rtl::Reference< ::chart::Diagram > Chart2ModelContact::getDiagram() const
{
- return Reference< chart2::XChartDocument >( m_xChartModel.get(), uno::UNO_QUERY );
-}
-
-Reference< chart2::XDiagram > Chart2ModelContact::getChart2Diagram() const
-{
- return ChartModelHelper::findDiagram( getChartModel() );
+ try
+ {
+ rtl::Reference<ChartModel> xChartModel = getDocumentModel();
+ if( xChartModel)
+ return xChartModel->getFirstChartDiagram();
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ return nullptr;
}
-uno::Reference< lang::XUnoTunnel > const & Chart2ModelContact::getChartView() const
+rtl::Reference< ::chart::ChartView > const & Chart2ModelContact::getChartView() const
{
if(!m_xChartView.is())
{
// get the chart view
- Reference<frame::XModel> xModel(m_xChartModel);
- uno::Reference< lang::XMultiServiceFactory > xFact( xModel, uno::UNO_QUERY );
- if( xFact.is() )
- m_xChartView.set( xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ rtl::Reference<ChartModel> xChartModel( m_xChartModel );
+ if( xChartModel )
+ {
+ auto xInstance = xChartModel->createInstance( CHART_VIEW_SERVICE_NAME );
+ auto pChartView = dynamic_cast<ChartView*>(xInstance.get());
+ assert(!xInstance || pChartView);
+ m_xChartView = pChartView;
+ }
}
return m_xChartView;
}
@@ -110,28 +117,24 @@ uno::Reference< lang::XUnoTunnel > const & Chart2ModelContact::getChartView() co
ExplicitValueProvider* Chart2ModelContact::getExplicitValueProvider() const
{
getChartView();
- if(!m_xChartView.is())
- return nullptr;
//obtain the ExplicitValueProvider from the chart view
- ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(m_xChartView->getSomething(
- ExplicitValueProvider::getUnoTunnelId() ));
- return pProvider;
+ return m_xChartView.get();
}
-uno::Reference< drawing::XDrawPage > Chart2ModelContact::getDrawPage() const
+rtl::Reference<SvxDrawPage> Chart2ModelContact::getDrawPage() const
{
- uno::Reference< drawing::XDrawPage > xResult;
+ rtl::Reference<SvxDrawPage> xResult;
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider )
{
- xResult.set( pProvider->getDrawModelWrapper()->getMainDrawPage() );
+ xResult = pProvider->getDrawModelWrapper()->getMainDrawPage();
}
return xResult;
}
void Chart2ModelContact::getExplicitValuesForAxis(
- const Reference< XAxis > & xAxis,
+ const rtl::Reference< Axis > & xAxis,
ExplicitScaleData & rOutExplicitScale,
ExplicitIncrementData & rOutExplicitIncrement )
{
@@ -144,14 +147,14 @@ void Chart2ModelContact::getExplicitValuesForAxis(
}
sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForAxis(
- const Reference< chart2::XAxis >& xAxis )
+ const rtl::Reference< ::chart::Axis >& xAxis )
{
- Reference< chart2::XCoordinateSystem > xCooSys(
+ rtl::Reference< BaseCoordinateSystem > xCooSys(
AxisHelper::getCoordinateSystemOfAxis(
- xAxis, ChartModelHelper::findDiagram( m_xChartModel ) ) );
+ xAxis, m_xChartModel.get()->getFirstChartDiagram() ) );
return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( xAxis, xCooSys
- , getChart2Document());
+ , m_xChartModel.get() );
}
sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForSeries(
@@ -163,13 +166,13 @@ sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForSeries(
awt::Size Chart2ModelContact::GetPageSize() const
{
- return ChartModelHelper::getPageSize(m_xChartModel);
+ return ChartModelHelper::getPageSize(m_xChartModel.get());
}
awt::Rectangle Chart2ModelContact::SubstractAxisTitleSizes( const awt::Rectangle& rPositionRect )
{
awt::Rectangle aRect = ExplicitValueProvider::AddSubtractAxisTitleSizes(
- *mpModel, getChartView(), rPositionRect, true );
+ *m_xChartModel.get(), getChartView().get(), rPositionRect, true );
return aRect;
}
@@ -179,7 +182,7 @@ awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingTitle() const
//add axis title sizes to the diagram size
aRect = ExplicitValueProvider::AddSubtractAxisTitleSizes(
- *mpModel, getChartView(), aRect, false );
+ *m_xChartModel.get(), getChartView().get(), aRect, false );
return aRect;
}
@@ -187,10 +190,10 @@ awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingTitle() const
awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingAxes() const
{
awt::Rectangle aRect(0,0,0,0);
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
+ rtl::Reference< Diagram > xDiagram = m_xChartModel.get()->getFirstChartDiagram();
- if( DiagramHelper::getDiagramPositioningMode( xDiagram ) == DiagramPositioningMode_INCLUDING )
- aRect = DiagramHelper::getDiagramRectangleFromModel(m_xChartModel);
+ if( xDiagram && xDiagram->getDiagramPositioningMode() == DiagramPositioningMode::Including )
+ aRect = DiagramHelper::getDiagramRectangleFromModel(m_xChartModel.get());
else
{
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
@@ -203,10 +206,10 @@ awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingAxes() const
awt::Rectangle Chart2ModelContact::GetDiagramRectangleExcludingAxes() const
{
awt::Rectangle aRect(0,0,0,0);
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
+ rtl::Reference< Diagram > xDiagram = m_xChartModel.get()->getFirstChartDiagram();
- if( DiagramHelper::getDiagramPositioningMode( xDiagram ) == DiagramPositioningMode_EXCLUDING )
- aRect = DiagramHelper::getDiagramRectangleFromModel(m_xChartModel);
+ if( xDiagram && xDiagram->getDiagramPositioningMode() == DiagramPositioningMode::Excluding )
+ aRect = DiagramHelper::getDiagramRectangleFromModel(m_xChartModel.get());
else
{
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
@@ -222,8 +225,8 @@ awt::Size Chart2ModelContact::GetLegendSize() const
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider )
{
- uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( *mpModel ) );
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, *mpModel ) );
+ rtl::Reference< Legend > xLegend = LegendHelper::getLegend( *m_xChartModel.get() );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
}
return aSize;
@@ -235,8 +238,8 @@ awt::Point Chart2ModelContact::GetLegendPosition() const
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider )
{
- uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( *mpModel ) );
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, *mpModel ) );
+ rtl::Reference< Legend > xLegend = LegendHelper::getLegend( *m_xChartModel.get() );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
}
return aPoint;
@@ -260,7 +263,7 @@ awt::Point Chart2ModelContact::GetTitlePosition( const uno::Reference< css::char
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider && xTitle.is() )
{
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_xChartModel ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_xChartModel.get() ) );
aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
}
return aPoint;
@@ -272,7 +275,7 @@ awt::Size Chart2ModelContact::GetAxisSize( const uno::Reference< css::chart2::XA
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider && xAxis.is() )
{
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, m_xChartModel ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, m_xChartModel.get() ) );
aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
}
return aSize;
@@ -284,7 +287,7 @@ awt::Point Chart2ModelContact::GetAxisPosition( const uno::Reference< css::chart
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider && xAxis.is() )
{
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, m_xChartModel ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, m_xChartModel.get() ) );
aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
}
return aPoint;
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
index 594bd0d87f31..261f2686240a 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -18,11 +18,14 @@
*/
#pragma once
-#include <cppuhelper/weakref.hxx>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
-
+#include <rtl/ref.hxx>
+#include <svx/unopage.hxx>
+#include <unotools/weakref.hxx>
+#include <ChartModel.hxx>
+#include <Diagram.hxx>
#include <map>
namespace chart { struct ExplicitIncrementData; }
@@ -54,28 +57,25 @@ public:
~Chart2ModelContact();
public:
- void setModel( const css::uno::Reference< css::frame::XModel >& xChartModel );
+ void setDocumentModel( ChartModel* pChartModel );
void clear();
- css::uno::Reference< css::frame::XModel > getChartModel() const;
-
- ChartModel* getModel() const { return mpModel;}
+ rtl::Reference<ChartModel> getDocumentModel() const;
- css::uno::Reference< css::chart2::XChartDocument > getChart2Document() const;
- css::uno::Reference< css::chart2::XDiagram > getChart2Diagram() const;
+ rtl::Reference< ::chart::Diagram > getDiagram() const;
- css::uno::Reference< css::drawing::XDrawPage > getDrawPage() const;
+ rtl::Reference<SvxDrawPage> getDrawPage() const;
/** get the current values calculated for an axis in the current view in
case properties are 'auto'.
*/
void getExplicitValuesForAxis(
- const css::uno::Reference< css::chart2::XAxis > & xAxis,
+ const rtl::Reference< ::chart::Axis > & xAxis,
ExplicitScaleData & rOutExplicitScale,
ExplicitIncrementData & rOutExplicitIncrement );
sal_Int32 getExplicitNumberFormatKeyForAxis(
- const css::uno::Reference< css::chart2::XAxis >& xAxis );
+ const rtl::Reference< ::chart::Axis >& xAxis );
static sal_Int32 getExplicitNumberFormatKeyForSeries(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
@@ -130,17 +130,15 @@ public:
private: //methods
ExplicitValueProvider* getExplicitValueProvider() const;
- css::uno::Reference< css::lang::XUnoTunnel > const & getChartView() const;
+ rtl::Reference< ChartView > const & getChartView() const;
public: //member
css::uno::Reference< css::uno::XComponentContext > m_xContext;
private: //member
- css::uno::WeakReference< css::frame::XModel > m_xChartModel;
-
- ChartModel* mpModel;
+ unotools::WeakReference< ChartModel > m_xChartModel;
- mutable css::uno::Reference< css::lang::XUnoTunnel > m_xChartView;
+ mutable rtl::Reference< ChartView > m_xChartView;
std::map< OUString, css::uno::Reference< css::container::XNameContainer > > m_aTableMap;
};
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
index 9fc30c823a79..7988ef90df94 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
@@ -21,14 +21,16 @@
#include <DiagramHelper.hxx>
#include <DataSourceHelper.hxx>
#include <ChartModelHelper.hxx>
+#include <InternalDataProvider.hxx>
#include <ControllerLockGuard.hxx>
#include "Chart2ModelContact.hxx"
#include <cppuhelper/supportsservice.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <float.h>
-#include <rtl/math.hxx>
+#include <cmath>
+#include <limits>
+#include <utility>
#include <osl/diagnose.h>
using namespace ::com::sun::star;
@@ -48,16 +50,18 @@ uno::Sequence< uno::Sequence< double > > lcl_getNANInsteadDBL_MIN( const uno::Se
uno::Sequence< uno::Sequence< double > > aRet;
const sal_Int32 nOuterSize = rData.getLength();
aRet.realloc( nOuterSize );
+ auto pRet = aRet.getArray();
for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter )
{
sal_Int32 nInnerSize = rData[nOuter].getLength();
- aRet[nOuter].realloc( nInnerSize );
+ pRet[nOuter].realloc( nInnerSize );
+ auto pRet_nOuter = pRet[nOuter].getArray();
for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner )
{
- aRet[nOuter][nInner] = rData[nOuter][nInner];
- double& rValue = aRet[nOuter][nInner];
+ pRet_nOuter[nInner] = rData[nOuter][nInner];
+ double& rValue = pRet_nOuter[nInner];
if( rValue == DBL_MIN )
- ::rtl::math::setNan( &rValue );
+ rValue = std::numeric_limits<double>::quiet_NaN();
}
}
return aRet;
@@ -68,14 +72,16 @@ uno::Sequence< uno::Sequence< double > > lcl_getDBL_MINInsteadNAN( const uno::Se
uno::Sequence< uno::Sequence< double > > aRet;
const sal_Int32 nOuterSize = rData.getLength();
aRet.realloc( nOuterSize );
+ auto pRet = aRet.getArray();
for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter )
{
sal_Int32 nInnerSize = rData[nOuter].getLength();
- aRet[nOuter].realloc( nInnerSize );
+ pRet[nOuter].realloc( nInnerSize );
+ auto pRet_nOuter = pRet[nOuter].getArray();
for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner )
{
- aRet[nOuter][nInner] = rData[nOuter][nInner];
- double& rValue = aRet[nOuter][nInner];
+ pRet_nOuter[nInner] = rData[nOuter][nInner];
+ double& rValue = pRet_nOuter[nInner];
if( std::isnan( rValue ) )
rValue = DBL_MIN;
}
@@ -109,13 +115,17 @@ namespace {
struct lcl_AllOperator : public lcl_Operator
{
explicit lcl_AllOperator( const Reference< XChartData >& xDataToApply )
- : lcl_Operator()
- , m_xDataToApply( xDataToApply )
+ : m_xDataToApply( xDataToApply )
{
}
virtual bool setsCategories( bool /*bDataInColumns*/ ) override
{
+ // Do not force creation of categories, when original has no categories
+ if (auto pDataWrapper = dynamic_cast<const ChartDataWrapper*>(m_xDataToApply.get()))
+ if (auto xChartModel = pDataWrapper->getChartModel())
+ if (auto xDiagram = xChartModel->getFirstChartDiagram())
+ return xDiagram->getCategories().is();
return true;
}
@@ -156,8 +166,7 @@ struct lcl_AllOperator : public lcl_Operator
struct lcl_DataOperator : public lcl_Operator
{
explicit lcl_DataOperator( const Sequence< Sequence< double > >& rData )
- : lcl_Operator()
- , m_rData( rData )
+ : m_rData( rData )
{
}
@@ -173,10 +182,9 @@ struct lcl_DataOperator : public lcl_Operator
struct lcl_RowDescriptionsOperator : public lcl_Operator
{
lcl_RowDescriptionsOperator( const Sequence< OUString >& rRowDescriptions
- , const Reference< chart2::XChartDocument >& xChartDoc )
- : lcl_Operator()
- , m_rRowDescriptions( rRowDescriptions )
- , m_xChartDoc(xChartDoc)
+ , rtl::Reference<::chart::ChartModel> xChartDoc )
+ : m_rRowDescriptions( rRowDescriptions )
+ , m_xChartDoc(std::move(xChartDoc))
, m_bDataInColumns(true)
{
}
@@ -198,17 +206,16 @@ struct lcl_RowDescriptionsOperator : public lcl_Operator
}
const Sequence< OUString >& m_rRowDescriptions;
- Reference< chart2::XChartDocument > m_xChartDoc;
+ rtl::Reference<::chart::ChartModel> m_xChartDoc;
bool m_bDataInColumns;
};
struct lcl_ComplexRowDescriptionsOperator : public lcl_Operator
{
lcl_ComplexRowDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexRowDescriptions
- , const Reference< chart2::XChartDocument >& xChartDoc )
- : lcl_Operator()
- , m_rComplexRowDescriptions( rComplexRowDescriptions )
- , m_xChartDoc(xChartDoc)
+ , rtl::Reference<::chart::ChartModel> xChartDoc )
+ : m_rComplexRowDescriptions( rComplexRowDescriptions )
+ , m_xChartDoc(std::move(xChartDoc))
, m_bDataInColumns(true)
{
}
@@ -230,15 +237,14 @@ struct lcl_ComplexRowDescriptionsOperator : public lcl_Operator
}
const Sequence< Sequence< OUString > >& m_rComplexRowDescriptions;
- Reference< chart2::XChartDocument > m_xChartDoc;
+ rtl::Reference<::chart::ChartModel> m_xChartDoc;
bool m_bDataInColumns;
};
struct lcl_AnyRowDescriptionsOperator : public lcl_Operator
{
explicit lcl_AnyRowDescriptionsOperator( const Sequence< Sequence< uno::Any > >& rAnyRowDescriptions )
- : lcl_Operator()
- , m_rAnyRowDescriptions( rAnyRowDescriptions )
+ : m_rAnyRowDescriptions( rAnyRowDescriptions )
{
}
@@ -259,10 +265,9 @@ struct lcl_AnyRowDescriptionsOperator : public lcl_Operator
struct lcl_ColumnDescriptionsOperator : public lcl_Operator
{
lcl_ColumnDescriptionsOperator( const Sequence< OUString >& rColumnDescriptions
- , const Reference< chart2::XChartDocument >& xChartDoc )
- : lcl_Operator()
- , m_rColumnDescriptions( rColumnDescriptions )
- , m_xChartDoc(xChartDoc)
+ , rtl::Reference<::chart::ChartModel> xChartDoc )
+ : m_rColumnDescriptions( rColumnDescriptions )
+ , m_xChartDoc(std::move(xChartDoc))
, m_bDataInColumns(true)
{
}
@@ -284,17 +289,16 @@ struct lcl_ColumnDescriptionsOperator : public lcl_Operator
}
const Sequence< OUString >& m_rColumnDescriptions;
- Reference< chart2::XChartDocument > m_xChartDoc;
+ rtl::Reference<::chart::ChartModel> m_xChartDoc;
bool m_bDataInColumns;
};
struct lcl_ComplexColumnDescriptionsOperator : public lcl_Operator
{
lcl_ComplexColumnDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexColumnDescriptions
- , const Reference< chart2::XChartDocument >& xChartDoc )
- : lcl_Operator()
- , m_rComplexColumnDescriptions( rComplexColumnDescriptions )
- , m_xChartDoc(xChartDoc)
+ , rtl::Reference<::chart::ChartModel> xChartDoc )
+ : m_rComplexColumnDescriptions( rComplexColumnDescriptions )
+ , m_xChartDoc(std::move(xChartDoc))
, m_bDataInColumns(true)
{
}
@@ -316,15 +320,14 @@ struct lcl_ComplexColumnDescriptionsOperator : public lcl_Operator
}
const Sequence< Sequence< OUString > >& m_rComplexColumnDescriptions;
- Reference< chart2::XChartDocument > m_xChartDoc;
+ rtl::Reference<::chart::ChartModel> m_xChartDoc;
bool m_bDataInColumns;
};
struct lcl_AnyColumnDescriptionsOperator : public lcl_Operator
{
explicit lcl_AnyColumnDescriptionsOperator( const Sequence< Sequence< uno::Any > >& rAnyColumnDescriptions )
- : lcl_Operator()
- , m_rAnyColumnDescriptions( rAnyColumnDescriptions )
+ : m_rAnyColumnDescriptions( rAnyColumnDescriptions )
{
}
@@ -345,8 +348,7 @@ struct lcl_AnyColumnDescriptionsOperator : public lcl_Operator
struct lcl_DateCategoriesOperator : public lcl_Operator
{
explicit lcl_DateCategoriesOperator( const Sequence< double >& rDates )
- : lcl_Operator()
- , m_rDates( rDates )
+ : m_rDates( rDates )
{
}
@@ -367,19 +369,17 @@ struct lcl_DateCategoriesOperator : public lcl_Operator
}
-ChartDataWrapper::ChartDataWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact(spChart2ModelContact)
- , m_aEventListenerContainer(m_aMutex)
+ChartDataWrapper::ChartDataWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact(std::move(spChart2ModelContact))
{
osl_atomic_increment( &m_refCount );
initDataAccess();
osl_atomic_decrement( &m_refCount );
}
-ChartDataWrapper::ChartDataWrapper( const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact,
+ChartDataWrapper::ChartDataWrapper( std::shared_ptr<Chart2ModelContact> spChart2ModelContact,
const Reference< XChartData >& xNewData ) :
- m_spChart2ModelContact( spChart2ModelContact ),
- m_aEventListenerContainer( m_aMutex )
+ m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
osl_atomic_increment( &m_refCount );
lcl_AllOperator aOperator( xNewData );
@@ -469,24 +469,24 @@ void SAL_CALL ChartDataWrapper::setData( const Sequence< Sequence< double > >& r
}
void SAL_CALL ChartDataWrapper::setRowDescriptions( const Sequence< OUString >& rRowDescriptions )
{
- lcl_RowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getChart2Document() );
+ lcl_RowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getDocumentModel() );
applyData( aOperator );
}
void SAL_CALL ChartDataWrapper::setColumnDescriptions( const Sequence< OUString >& rColumnDescriptions )
{
- lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getChart2Document() );
+ lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getDocumentModel() );
applyData( aOperator );
}
// ____ XComplexDescriptionAccess (write) ____
void SAL_CALL ChartDataWrapper::setComplexRowDescriptions( const Sequence< Sequence< OUString > >& rRowDescriptions )
{
- lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getChart2Document() );
+ lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getDocumentModel() );
applyData( aOperator );
}
void SAL_CALL ChartDataWrapper::setComplexColumnDescriptions( const Sequence< Sequence< OUString > >& rColumnDescriptions )
{
- lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getChart2Document() );
+ lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getDocumentModel() );
applyData( aOperator );
}
@@ -505,7 +505,7 @@ void SAL_CALL ChartDataWrapper::setAnyColumnDescriptions( const Sequence< Sequen
// ____ XDateCategories (write) ____
void SAL_CALL ChartDataWrapper::setDateCategories( const Sequence< double >& rDates )
{
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
ControllerLockGuardUNO aCtrlLockGuard( xChartDoc );
lcl_DateCategoriesOperator aOperator( rDates );
applyData( aOperator );
@@ -516,13 +516,15 @@ void SAL_CALL ChartDataWrapper::setDateCategories( const Sequence< double >& rDa
void SAL_CALL ChartDataWrapper::addChartDataChangeEventListener(
const uno::Reference< css::chart::XChartDataChangeEventListener >& aListener )
{
- m_aEventListenerContainer.addInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, aListener );
}
void SAL_CALL ChartDataWrapper::removeChartDataChangeEventListener(
const uno::Reference< css::chart::XChartDataChangeEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
double SAL_CALL ChartDataWrapper::getNotANumber()
@@ -540,20 +542,23 @@ sal_Bool SAL_CALL ChartDataWrapper::isNotANumber( double nNumber )
// ____ XComponent ____
void SAL_CALL ChartDataWrapper::dispose()
{
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
m_xDataAccess=nullptr;
}
void SAL_CALL ChartDataWrapper::addEventListener(
const uno::Reference< lang::XEventListener > & xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL ChartDataWrapper::removeEventListener(
const uno::Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
// ____ XEventListener ____
@@ -563,7 +568,8 @@ void SAL_CALL ChartDataWrapper::disposing( const lang::EventObject& /* Source */
void ChartDataWrapper::fireChartDataChangeEvent( css::chart::ChartDataChangeEvent& aEvent )
{
- if( ! m_aEventListenerContainer.getLength() )
+ std::unique_lock g(m_aMutex);
+ if( ! m_aEventListenerContainer.getLength(g) )
return;
uno::Reference< uno::XInterface > xSrc( static_cast< cppu::OWeakObject* >( this ));
@@ -571,13 +577,19 @@ void ChartDataWrapper::fireChartDataChangeEvent( css::chart::ChartDataChangeEven
if( xSrc.is() )
aEvent.Source = xSrc;
- m_aEventListenerContainer.notifyEach( &css::chart::XChartDataChangeEventListener::chartDataChanged, aEvent );
+ m_aEventListenerContainer.forEach( g,
+ [&aEvent](const uno::Reference<css::lang::XEventListener>& l)
+ {
+ uno::Reference<css::chart::XChartDataChangeEventListener> cl(l, uno::UNO_QUERY);
+ if (cl)
+ cl->chartDataChanged(aEvent);
+ });
}
void ChartDataWrapper::switchToInternalDataProvider()
{
//create an internal data provider that is connected to the model
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
if( xChartDoc.is() )
xChartDoc->createInternalDataProvider( true /*bCloneExistingData*/ );
initDataAccess();
@@ -585,7 +597,7 @@ void ChartDataWrapper::switchToInternalDataProvider()
void ChartDataWrapper::initDataAccess()
{
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
if( !xChartDoc.is() )
return;
if( xChartDoc->hasInternalDataProvider() )
@@ -593,15 +605,16 @@ void ChartDataWrapper::initDataAccess()
else
{
//create a separate "internal data provider" that is not connected to the model
- m_xDataAccess.set( ChartModelHelper::createInternalDataProvider(
- xChartDoc, false /*bConnectToModel*/ ), uno::UNO_QUERY_THROW );
+ auto xInternal = ChartModelHelper::createInternalDataProvider(
+ xChartDoc, false /*bConnectToModel*/ );
+ m_xDataAccess.set( static_cast<cppu::OWeakObject*>(xInternal.get()), uno::UNO_QUERY_THROW );
}
}
void ChartDataWrapper::applyData( lcl_Operator& rDataOperator )
{
//bool bSetValues, bool bSetRowDescriptions, bool bSetColumnDescriptions
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
if( !xChartDoc.is() )
return;
@@ -609,7 +622,7 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator )
bool bStacked = false;
bool bPercent = false;
bool bDeep = false;
- uno::Reference< css::chart::XChartDocument > xOldDoc( xChartDoc, uno::UNO_QUERY );
+ uno::Reference< css::chart::XChartDocument > xOldDoc( static_cast<cppu::OWeakObject*>(xChartDoc.get()), uno::UNO_QUERY );
OSL_ASSERT( xOldDoc.is());
uno::Reference< beans::XPropertySet > xDiaProp( xOldDoc->getDiagram(), uno::UNO_QUERY );
if( xDiaProp.is())
@@ -649,7 +662,7 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator )
return;
uno::Reference< chart2::data::XDataSource > xSource( xDataProvider->createDataSource( aArguments ) );
- uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram() );
+ rtl::Reference< Diagram > xDia( xChartDoc->getFirstChartDiagram() );
if( xDia.is() )
xDia->setDiagramData( xSource, aArguments );
@@ -661,7 +674,7 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator )
eStackMode = StackMode::ZStacked;
else if( bPercent )
eStackMode = StackMode::YStackedPercent;
- DiagramHelper::setStackMode( xDia, eStackMode );
+ xDia->setStackMode( eStackMode );
}
// notify listeners
@@ -690,6 +703,11 @@ css::uno::Sequence< OUString > SAL_CALL ChartDataWrapper::getSupportedServiceNam
};
}
+rtl::Reference<ChartModel> ChartDataWrapper::getChartModel() const
+{
+ return m_spChart2ModelContact->getDocumentModel();
+}
+
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
index fd9dc2f7c50c..9a44e53b8b12 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
@@ -18,9 +18,10 @@
*/
#pragma once
-#include <MutexContainer.hxx>
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
+#include <rtl/ref.hxx>
+
#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
#include <com/sun/star/chart/XDateCategories.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -29,13 +30,17 @@
#include <memory>
-namespace chart::wrapper
+namespace chart
+{
+class ChartModel;
+
+namespace wrapper
{
class Chart2ModelContact;
struct lcl_Operator;
-class ChartDataWrapper final : public MutexContainer, public
+class ChartDataWrapper final : public
::cppu::WeakImplHelper<
css::chart2::XAnyDescriptionAccess,
css::chart::XDateCategories,
@@ -44,8 +49,8 @@ class ChartDataWrapper final : public MutexContainer, public
css::lang::XComponent >
{
public:
- explicit ChartDataWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
- ChartDataWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact
+ explicit ChartDataWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
+ ChartDataWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact
, const css::uno::Reference< css::chart::XChartData >& xNewData );
virtual ~ChartDataWrapper() override;
@@ -54,6 +59,8 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+ rtl::Reference<ChartModel> getChartModel() const;
+
private:
// ____ XDateCategories ____
virtual css::uno::Sequence< double > SAL_CALL getDateCategories() override;
@@ -107,12 +114,13 @@ private:
void initDataAccess();
void applyData( lcl_Operator& rDataOperator );
+ std::mutex m_aMutex;
css::uno::Reference< css::chart2::XAnyDescriptionAccess > m_xDataAccess;
-
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
};
} // namespace chart::wrapper
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 449910274c7c..51c803a1db0c 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -18,9 +18,14 @@
*/
#include <ChartDocumentWrapper.hxx>
+#include <ChartView.hxx>
+#include <ChartViewHelper.hxx>
+#include <ChartTypeManager.hxx>
+#include <ChartTypeTemplate.hxx>
#include <servicenames.hxx>
#include <PropertyHelper.hxx>
#include <TitleHelper.hxx>
+#include <Legend.hxx>
#include <LegendHelper.hxx>
#include <ControllerLockGuard.hxx>
#include <DisposeHelper.hxx>
@@ -28,12 +33,11 @@
#include <chartview/ExplicitValueProvider.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include "Chart2ModelContact.hxx"
+#include <BaseCoordinateSystem.hxx>
#include <ChartModel.hxx>
-#include <DiagramHelper.hxx>
#include <DataSourceHelper.hxx>
-#include <ChartModelHelper.hxx>
#include <AxisHelper.hxx>
#include <ThreeDHelper.hxx>
@@ -47,7 +51,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
-#include <comphelper/servicehelper.hxx>
+#include <utility>
#include <vcl/settings.hxx>
#include <com/sun/star/drawing/ShapeCollection.hpp>
@@ -55,9 +59,8 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/util/XRefreshable.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
-#include <vector>
#include <algorithm>
#include <map>
@@ -216,30 +219,20 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticChartDocumentWrapperPropertyArray_Initializer
+const Sequence< Property > & StaticChartDocumentWrapperPropertyArray()
{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
- return comphelper::containerToSequence( aProperties );
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticChartDocumentWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticChartDocumentWrapperPropertyArray_Initializer >
-{
-};
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
+}
} // anonymous namespace
@@ -252,7 +245,7 @@ namespace {
class WrappedDataSourceLabelsInFirstRowProperty : public WrappedProperty
{
public:
- explicit WrappedDataSourceLabelsInFirstRowProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedDataSourceLabelsInFirstRowProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -267,10 +260,9 @@ private: //member
}
-WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("DataSourceLabelsInFirstRow",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
- , m_aOuterValue()
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
m_aOuterValue = WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( nullptr );
}
@@ -291,19 +283,19 @@ void WrappedDataSourceLabelsInFirstRowProperty::setPropertyValue( const Any& rOu
uno::Sequence< sal_Int32 > aSequenceMapping;
if( !DataSourceHelper::detectRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
, bFirstCellAsLabel, bHasCategories ) )
return;
if( bUseColumns && bNewValue != bFirstCellAsLabel )
{
DataSourceHelper::setRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns ,bNewValue, bHasCategories );
+ m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bUseColumns ,bNewValue, bHasCategories );
}
else if( !bUseColumns && bNewValue != bHasCategories )
{
DataSourceHelper::setRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bFirstCellAsLabel, bNewValue );
+ m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bUseColumns , bFirstCellAsLabel, bNewValue );
}
}
@@ -316,7 +308,7 @@ Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyValue( const Reference
uno::Sequence< sal_Int32 > aSequenceMapping;
if( DataSourceHelper::detectRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
, bFirstCellAsLabel, bHasCategories ) )
{
bool bLabelsInFirstRow = true;
@@ -343,7 +335,7 @@ namespace {
class WrappedDataSourceLabelsInFirstColumnProperty : public WrappedProperty
{
public:
- explicit WrappedDataSourceLabelsInFirstColumnProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedDataSourceLabelsInFirstColumnProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -358,10 +350,9 @@ private: //member
}
-WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("DataSourceLabelsInFirstColumn",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
- , m_aOuterValue()
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
m_aOuterValue = WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( nullptr );
}
@@ -382,19 +373,19 @@ void WrappedDataSourceLabelsInFirstColumnProperty::setPropertyValue( const Any&
uno::Sequence< sal_Int32 > aSequenceMapping;
if( !DataSourceHelper::detectRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
, bFirstCellAsLabel, bHasCategories ) )
return;
if( bUseColumns && bNewValue != bHasCategories )
{
DataSourceHelper::setRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns, bFirstCellAsLabel, bNewValue );
+ m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bUseColumns, bFirstCellAsLabel, bNewValue );
}
else if( !bUseColumns && bNewValue != bFirstCellAsLabel )
{
DataSourceHelper::setRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bNewValue, bHasCategories );
+ m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bUseColumns , bNewValue, bHasCategories );
}
}
@@ -407,7 +398,7 @@ Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyValue( const Refere
uno::Sequence< sal_Int32 > aSequenceMapping;
if( DataSourceHelper::detectRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
, bFirstCellAsLabel, bHasCategories ) )
{
bool bLabelsInFirstColumn = true;
@@ -434,7 +425,7 @@ namespace {
class WrappedHasLegendProperty : public WrappedProperty
{
public:
- explicit WrappedHasLegendProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedHasLegendProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -448,9 +439,9 @@ private: //member
}
-WrappedHasLegendProperty::WrappedHasLegendProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedHasLegendProperty::WrappedHasLegendProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("HasLegend",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
}
@@ -462,15 +453,14 @@ void WrappedHasLegendProperty::setPropertyValue( const Any& rOuterValue, const R
try
{
- Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( *m_spChart2ModelContact->getModel(), m_spChart2ModelContact->m_xContext,bNewValue ));
+ rtl::Reference< Legend > xLegend = LegendHelper::getLegend( *m_spChart2ModelContact->getDocumentModel(), m_spChart2ModelContact->m_xContext,bNewValue );
if(xLegend.is())
{
- Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY_THROW );
bool bOldValue = true;
- Any aAOld = xLegendProp->getPropertyValue("Show");
+ Any aAOld = xLegend->getPropertyValue("Show");
aAOld >>= bOldValue;
if( bOldValue != bNewValue )
- xLegendProp->setPropertyValue("Show", uno::Any( bNewValue ));
+ xLegend->setPropertyValue("Show", uno::Any( bNewValue ));
}
}
catch (const uno::Exception&)
@@ -484,10 +474,10 @@ Any WrappedHasLegendProperty::getPropertyValue( const Reference< beans::XPropert
Any aRet;
try
{
- Reference< beans::XPropertySet > xLegendProp(
- LegendHelper::getLegend( *m_spChart2ModelContact->getModel() ), uno::UNO_QUERY );
- if( xLegendProp.is())
- aRet = xLegendProp->getPropertyValue("Show");
+ rtl::Reference< Legend > xLegend =
+ LegendHelper::getLegend( *m_spChart2ModelContact->getDocumentModel() );
+ if( xLegend.is())
+ aRet = xLegend->getPropertyValue("Show");
else
aRet <<= false;
}
@@ -511,7 +501,7 @@ namespace {
class WrappedHasMainTitleProperty : public WrappedProperty
{
public:
- explicit WrappedHasMainTitleProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedHasMainTitleProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -525,9 +515,9 @@ private: //member
}
-WrappedHasMainTitleProperty::WrappedHasMainTitleProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedHasMainTitleProperty::WrappedHasMainTitleProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("HasMainTitle",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
}
@@ -540,9 +530,9 @@ void WrappedHasMainTitleProperty::setPropertyValue( const Any& rOuterValue, cons
try
{
if( bNewValue )
- TitleHelper::createTitle( TitleHelper::MAIN_TITLE, "main-title", m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ TitleHelper::createTitle( TitleHelper::MAIN_TITLE, "main-title", m_spChart2ModelContact->getDocumentModel(), m_spChart2ModelContact->m_xContext );
else
- TitleHelper::removeTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() );
+ TitleHelper::removeTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getDocumentModel() );
}
catch (const uno::Exception&)
{
@@ -555,7 +545,7 @@ Any WrappedHasMainTitleProperty::getPropertyValue( const Reference< beans::XProp
Any aRet;
try
{
- aRet <<= TitleHelper::getTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() ).is();
+ aRet <<= TitleHelper::getTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getDocumentModel() ).is();
}
catch (const uno::Exception&)
{
@@ -577,7 +567,7 @@ namespace {
class WrappedHasSubTitleProperty : public WrappedProperty
{
public:
- explicit WrappedHasSubTitleProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedHasSubTitleProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -591,9 +581,9 @@ private: //member
}
-WrappedHasSubTitleProperty::WrappedHasSubTitleProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedHasSubTitleProperty::WrappedHasSubTitleProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("HasSubTitle",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
}
@@ -606,9 +596,9 @@ void WrappedHasSubTitleProperty::setPropertyValue( const Any& rOuterValue, const
try
{
if( bNewValue )
- TitleHelper::createTitle( TitleHelper::SUB_TITLE, "", m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ TitleHelper::createTitle( TitleHelper::SUB_TITLE, "", m_spChart2ModelContact->getDocumentModel(), m_spChart2ModelContact->m_xContext );
else
- TitleHelper::removeTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() );
+ TitleHelper::removeTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getDocumentModel() );
}
catch (const uno::Exception&)
{
@@ -621,7 +611,7 @@ Any WrappedHasSubTitleProperty::getPropertyValue( const Reference< beans::XPrope
Any aRet;
try
{
- aRet <<= TitleHelper::getTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() ).is();
+ aRet <<= TitleHelper::getTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getDocumentModel() ).is();
}
catch (const uno::Exception&)
{
@@ -651,6 +641,7 @@ ChartDocumentWrapper::~ChartDocumentWrapper()
}
// ____ XInterface (for new interfaces) ____
+// [-loplugin:unoaggregation]
uno::Any SAL_CALL ChartDocumentWrapper::queryInterface( const uno::Type& aType )
{
if( m_xDelegator.is())
@@ -665,7 +656,7 @@ Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getTitle()
{
if( !m_xTitle.is() )
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChart2Document() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
m_xTitle = new TitleWrapper( TitleHelper::MAIN_TITLE, m_spChart2ModelContact );
}
return m_xTitle;
@@ -675,7 +666,7 @@ Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getSubTitle()
{
if( !m_xSubTitle.is() )
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChart2Document() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
m_xSubTitle = new TitleWrapper( TitleHelper::SUB_TITLE, m_spChart2ModelContact );
}
return m_xSubTitle;
@@ -735,7 +726,7 @@ void SAL_CALL ChartDocumentWrapper::setDiagram( const Reference< XDiagram >& xDi
try
{
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
if( xChartDoc.is() )
{
// set the new diagram
@@ -766,7 +757,7 @@ void SAL_CALL ChartDocumentWrapper::attachData( const Reference< XChartData >& x
if( !xNewData.is() )
return;
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChart2Document() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact, xNewData ) );
}
@@ -775,7 +766,7 @@ sal_Bool SAL_CALL ChartDocumentWrapper::attachResource(
const OUString& URL,
const Sequence< beans::PropertyValue >& Arguments )
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
return xModel->attachResource( URL, Arguments );
return false;
@@ -783,7 +774,7 @@ sal_Bool SAL_CALL ChartDocumentWrapper::attachResource(
OUString SAL_CALL ChartDocumentWrapper::getURL()
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
return xModel->getURL();
return OUString();
@@ -791,7 +782,7 @@ OUString SAL_CALL ChartDocumentWrapper::getURL()
Sequence< beans::PropertyValue > SAL_CALL ChartDocumentWrapper::getArgs()
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
return xModel->getArgs();
return Sequence< beans::PropertyValue >();
@@ -799,7 +790,7 @@ Sequence< beans::PropertyValue > SAL_CALL ChartDocumentWrapper::getArgs()
void SAL_CALL ChartDocumentWrapper::connectController( const Reference< frame::XController >& Controller )
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
xModel->connectController( Controller );
}
@@ -807,28 +798,28 @@ void SAL_CALL ChartDocumentWrapper::connectController( const Reference< frame::X
void SAL_CALL ChartDocumentWrapper::disconnectController(
const Reference< frame::XController >& Controller )
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
xModel->disconnectController( Controller );
}
void SAL_CALL ChartDocumentWrapper::lockControllers()
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
xModel->lockControllers();
}
void SAL_CALL ChartDocumentWrapper::unlockControllers()
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
xModel->unlockControllers();
}
sal_Bool SAL_CALL ChartDocumentWrapper::hasControllersLocked()
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
return xModel->hasControllersLocked();
return false;
@@ -836,7 +827,7 @@ sal_Bool SAL_CALL ChartDocumentWrapper::hasControllersLocked()
Reference< frame::XController > SAL_CALL ChartDocumentWrapper::getCurrentController()
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
return xModel->getCurrentController();
return nullptr;
@@ -845,14 +836,14 @@ Reference< frame::XController > SAL_CALL ChartDocumentWrapper::getCurrentControl
void SAL_CALL ChartDocumentWrapper::setCurrentController(
const Reference< frame::XController >& Controller )
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
xModel->setCurrentController( Controller );
}
Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::getCurrentSelection()
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
return xModel->getCurrentSelection();
return nullptr;
@@ -862,8 +853,7 @@ Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::getCurrentSelection(
void SAL_CALL ChartDocumentWrapper::dispose()
{
if( m_bIsDisposed )
- throw lang::DisposedException("ChartDocumentWrapper is disposed",
- static_cast< ::cppu::OWeakObject* >( this ));
+ return;
m_bIsDisposed = true;
@@ -876,9 +866,9 @@ void SAL_CALL ChartDocumentWrapper::dispose()
DisposeHelper::DisposeAndClear( m_xChartData );
DisposeHelper::DisposeAndClear( m_xDiagram );
DisposeHelper::DisposeAndClear( m_xArea );
- m_xChartView.set( nullptr );
- m_xShapeFactory.set( nullptr );
- m_xDelegator.set( nullptr );
+ m_xChartView.clear();
+ m_xShapeFactory.clear();
+ m_xDelegator.clear();
clearWrappedPropertySet();
m_spChart2ModelContact->clear();
@@ -905,7 +895,7 @@ void SAL_CALL ChartDocumentWrapper::dispose()
void ChartDocumentWrapper::impl_resetAddIn()
{
Reference< util::XRefreshable > xAddIn( m_xAddIn );
- m_xAddIn.set( nullptr );
+ m_xAddIn.clear();
if( !xAddIn.is() )
return;
@@ -941,7 +931,7 @@ void ChartDocumentWrapper::impl_resetAddIn()
void ChartDocumentWrapper::setBaseDiagram( const OUString& rBaseDiagram )
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
m_aBaseDiagram = rBaseDiagram;
uno::Reference< XDiagram > xDiagram( ChartDocumentWrapper::createInstance( rBaseDiagram ), uno::UNO_QUERY );
@@ -954,7 +944,7 @@ void ChartDocumentWrapper::setAddIn( const Reference< util::XRefreshable >& xAdd
if( m_xAddIn == xAddIn )
return;
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
impl_resetAddIn();
m_xAddIn = xAddIn;
// initialize AddIn with this as chart document
@@ -962,7 +952,7 @@ void ChartDocumentWrapper::setAddIn( const Reference< util::XRefreshable >& xAdd
if( xInit.is() )
{
uno::Any aParam;
- uno::Reference< XChartDocument > xDoc( static_cast<XChartDocument*>(this), uno::UNO_QUERY );
+ uno::Reference< XChartDocument > xDoc(this);
aParam <<= xDoc;
uno::Sequence< uno::Any > aSeq( &aParam, 1 );
xInit->initialize( aSeq );
@@ -978,7 +968,7 @@ Reference< drawing::XShapes > ChartDocumentWrapper::getAdditionalShapes() const
{
// get additional non-chart shapes for XML export
uno::Reference< drawing::XShapes > xFoundShapes;
- uno::Reference< drawing::XDrawPage > xDrawPage( impl_getDrawPage() );
+ rtl::Reference<SvxDrawPage> xDrawPage( impl_getDrawPage() );
if( !xDrawPage.is() )
return xFoundShapes;
@@ -1018,14 +1008,14 @@ Reference< drawing::XShapes > ChartDocumentWrapper::getAdditionalShapes() const
void SAL_CALL ChartDocumentWrapper::addEventListener( const Reference< lang::XEventListener >& xListener )
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
xModel->addEventListener( xListener );
}
void SAL_CALL ChartDocumentWrapper::removeEventListener( const Reference< lang::XEventListener >& aListener )
{
- Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ rtl::Reference< ChartModel > xModel( m_spChart2ModelContact->getDocumentModel() );
if( xModel.is() )
xModel->removeEventListener( aListener );
}
@@ -1036,18 +1026,17 @@ uno::Reference< drawing::XDrawPage > SAL_CALL ChartDocumentWrapper::getDrawPage(
return impl_getDrawPage();
}
-uno::Reference< drawing::XDrawPage > ChartDocumentWrapper::impl_getDrawPage() const
+rtl::Reference<SvxDrawPage> ChartDocumentWrapper::impl_getDrawPage() const
{
return m_spChart2ModelContact->getDrawPage();
}
namespace {
-uno::Reference< lang::XMultiServiceFactory > getShapeFactory(const uno::Reference<uno::XInterface>& xChartView)
+uno::Reference< lang::XMultiServiceFactory > getShapeFactory(const rtl::Reference<ChartView>& xChartView)
{
- auto pProvider = comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(xChartView);
- if( pProvider )
- return pProvider->getDrawModelWrapper()->getShapeFactory();
+ if( xChartView )
+ return xChartView->getDrawModelWrapper()->getShapeFactory();
return uno::Reference< lang::XMultiServiceFactory >();
}
@@ -1060,7 +1049,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
{
uno::Reference< uno::XInterface > xResult;
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
if( !xChartDoc.is() )
return xResult;
@@ -1071,102 +1060,92 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
if( aIt != rMap.end())
{
bool bCreateDiagram = false;
- uno::Reference< lang::XMultiServiceFactory > xManagerFact(
- xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- uno::Reference< chart2::XChartTypeTemplate > xTemplate;
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager =
+ xChartDoc->getTypeManager();
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate;
switch( (*aIt).second )
{
case SERVICE_NAME_AREA_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.Area"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.Area");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_BAR_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
// this is for bar and column (the latter is the default if
// no "Vertical=false" property was set)
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.Column"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.Column");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_DONUT_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.Donut"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.Donut");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_LINE_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.Line"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.Line");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_NET_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.Net"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.Net");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_FILLED_NET_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.FilledNet"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.FilledNet");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_PIE_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.Pie"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.Pie");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_STOCK_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.StockLowHighClose"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.StockLowHighClose");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_XY_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.ScatterLineSymbol"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.ScatterLineSymbol");
bCreateDiagram = true;
}
break;
case SERVICE_NAME_BUBBLE_DIAGRAM:
- if( xManagerFact.is())
+ if( xChartTypeManager.is())
{
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.Bubble"),
- uno::UNO_QUERY );
+ xTemplate =
+ xChartTypeManager->createTemplate("com.sun.star.chart2.template.Bubble");
bCreateDiagram = true;
}
break;
@@ -1177,12 +1156,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
case SERVICE_NAME_BITMAP_TABLE:
case SERVICE_NAME_TRANSP_GRADIENT_TABLE:
case SERVICE_NAME_MARKER_TABLE:
- {
- uno::Reference< lang::XMultiServiceFactory > xTableFactory( xChartDoc, uno::UNO_QUERY );
- OSL_ENSURE( xTableFactory.get() != this, "new model is expected to implement service factory for gradient table etc" );
- if( xTableFactory.is() && xTableFactory.get() != this )
- xResult.set( xTableFactory->createInstance( aIt->first ), uno::UNO_QUERY );
- }
+ xResult.set( xChartDoc->createInstance( aIt->first ), uno::UNO_QUERY );
break;
case SERVICE_NAME_NAMESPACE_MAP:
@@ -1202,17 +1176,17 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
{
// locked controllers
ControllerLockGuardUNO aCtrlLockGuard( xChartDoc );
- Reference< chart2::XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartDoc );
- ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram );
- Reference< lang::XMultiServiceFactory > xTemplateManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateWithService(
- DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ));
- if( aTemplateWithService.first.is())
- aTemplateWithService.first->resetStyles( xDiagram );//#i109371#
+ rtl::Reference< Diagram > xDiagram = xChartDoc->getFirstChartDiagram();
+ ThreeDLookScheme e3DScheme = xDiagram->detectScheme();
+ rtl::Reference< ::chart::ChartTypeManager > xTemplateManager = xChartDoc->getTypeManager();
+ Diagram::tTemplateWithServiceName aTemplateWithService(
+ xDiagram->getTemplate( xTemplateManager ));
+ if( aTemplateWithService.xChartTypeTemplate.is())
+ aTemplateWithService.xChartTypeTemplate->resetStyles2( xDiagram );//#i109371#
xTemplate->changeDiagram( xDiagram );
if( AllSettings::GetMathLayoutRTL() )
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
- ThreeDHelper::setScheme( xDiagram, e3DScheme );
+ xDiagram->setScheme( e3DScheme );
}
else
{
@@ -1244,28 +1218,23 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
{
if( !m_xChartView.is() )
{
- Reference< lang::XMultiServiceFactory > xFact(
- m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- Reference< lang::XInitialization > xViewInit( xFact->createInstance(
- CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
- if(xViewInit.is())
+ rtl::Reference<::chart::ChartModel> pChartModel = new ::chart::ChartModel(m_spChart2ModelContact->m_xContext);
+ rtl::Reference<ChartView> xChartView = new ::chart::ChartView(m_spChart2ModelContact->m_xContext, *pChartModel);
+
+ try
{
- try
- {
- m_xChartView = xViewInit;
+ m_xChartView = xChartView;
- Sequence< Any > aArguments(2);
- aArguments[0] <<= Reference<frame::XModel>(this);
- aArguments[1] <<= true; // bRefreshAddIn
- xViewInit->initialize(aArguments);
- }
- catch (const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ Sequence< Any > aArguments{ Any(Reference<frame::XModel>(this)),
+ Any(true) }; // bRefreshAddIn
+ xChartView->initialize(aArguments);
+ }
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
}
}
- xResult.set( m_xChartView );
+ xResult.set( static_cast<cppu::OWeakObject*>(m_xChartView.get()) );
bServiceFound = true;
}
else
@@ -1279,7 +1248,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
}
else
{
- ChartModel* pModel = m_spChart2ModelContact->getModel();
+ rtl::Reference<ChartModel> pModel = m_spChart2ModelContact->getDocumentModel();
if(pModel)
{
m_xChartView = pModel->getChartView();
@@ -1351,7 +1320,9 @@ void SAL_CALL ChartDocumentWrapper::setDelegator(
if( rDelegator.is())
{
m_xDelegator = rDelegator;
- m_spChart2ModelContact->setModel( uno::Reference< frame::XModel >(m_xDelegator, uno::UNO_QUERY) );
+ ChartModel* pChartModel = dynamic_cast<ChartModel*>(rDelegator.get());
+ assert(pChartModel);
+ m_spChart2ModelContact->setDocumentModel( pChartModel );
}
else
{
@@ -1376,21 +1347,35 @@ uno::Any SAL_CALL ChartDocumentWrapper::queryAggregation( const uno::Type& rType
void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource )
{
if( rSource.Source == m_xTitle )
- m_xTitle.set( nullptr );
+ m_xTitle.clear();
else if( rSource.Source == m_xSubTitle )
- m_xSubTitle.set( nullptr );
+ m_xSubTitle.clear();
else if( rSource.Source == m_xLegend )
- m_xLegend.set( nullptr );
+ m_xLegend.clear();
else if( rSource.Source == m_xChartData )
- m_xChartData.set( nullptr );
+ m_xChartData.clear();
else if( rSource.Source == m_xDiagram )
- m_xDiagram.set( nullptr );
+ m_xDiagram.clear();
else if( rSource.Source == m_xArea )
- m_xArea.set( nullptr );
+ m_xArea.clear();
else if( rSource.Source == m_xAddIn )
- m_xAddIn.set( nullptr );
- else if( rSource.Source == m_xChartView )
- m_xChartView.set( nullptr );
+ m_xAddIn.clear();
+ else if( rSource.Source == static_cast<cppu::OWeakObject*>(m_xChartView.get()) )
+ m_xChartView.clear();
+}
+
+// ____ XPropertySet ____
+void SAL_CALL ChartDocumentWrapper::setPropertyValue(const OUString& rPropertyName, const css::uno::Any& rValue)
+{
+ if (rPropertyName == u"ODFImport_UpdateView")
+ {
+ // A hack used at load time to notify the view that it needs an update
+ // See SchXMLImport::~SchXMLImport
+ if (auto xChartModel = rValue.query<css::chart2::XChartDocument>())
+ ChartViewHelper::setViewToDirtyState_UNO(xChartModel);
+ return;
+ }
+ ChartDocumentWrapper_Base::setPropertyValue(rPropertyName, rValue);
}
// WrappedPropertySet
@@ -1400,7 +1385,7 @@ Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet()
}
const Sequence< beans::Property >& ChartDocumentWrapper::getPropertySequence()
{
- return *StaticChartDocumentWrapperPropertyArray::get();
+ return StaticChartDocumentWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > ChartDocumentWrapper::createWrappedProperties()
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index b2c819a87874..ac9a53ce331f 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -19,8 +19,11 @@
#include "DataSeriesPointWrapper.hxx"
#include "Chart2ModelContact.hxx"
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <DiagramHelper.hxx>
+#include <DataSeries.hxx>
+#include <DataSeriesProperties.hxx>
#include <LinePropertiesHelper.hxx>
#include <FillProperties.hxx>
#include <CharacterProperties.hxx>
@@ -37,6 +40,7 @@
#include "WrappedTextRotationProperty.hxx"
#include <unonames.hxx>
+#include <o3tl/safeint.hxx>
#include <rtl/math.hxx>
#include <algorithm>
@@ -45,6 +49,7 @@
#include <com/sun/star/chart/ChartAxisAssign.hpp>
#include <com/sun/star/chart/ChartErrorCategory.hpp>
#include <com/sun/star/chart/ChartSymbolType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
@@ -55,6 +60,7 @@
using namespace ::com::sun::star;
using namespace ::chart::wrapper;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -243,30 +249,16 @@ uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType
return comphelper::containerToSequence( aProperties );
}
-struct StaticSeriesWrapperPropertyArray_Initializer
+const Sequence< Property >& StaticSeriesWrapperPropertyArray()
{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
- return &aPropSeq;
- }
-};
-
-struct StaticSeriesWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticSeriesWrapperPropertyArray_Initializer >
-{
-};
-
-struct StaticPointWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) );
- return &aPropSeq;
- }
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
+ return aPropSeq;
};
-struct StaticPointWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticPointWrapperPropertyArray_Initializer >
+const Sequence< Property >& StaticPointWrapperPropertyArray()
{
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) );
+ return aPropSeq;
};
//PROP_SERIES_ATTACHED_AXIS
@@ -303,7 +295,7 @@ Any WrappedAttachedAxisProperty::getPropertyValue( const Reference< beans::XProp
{
Any aRet;
- uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
+ rtl::Reference< ::chart::DataSeries > xDataSeries( dynamic_cast<::chart::DataSeries*>(xInnerPropertySet.get()) );
bool bAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
if( bAttachedToMainAxis )
aRet <<= css::chart::ChartAxisAssign::PRIMARY_Y;
@@ -314,7 +306,7 @@ Any WrappedAttachedAxisProperty::getPropertyValue( const Reference< beans::XProp
void WrappedAttachedAxisProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
{
- uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
+ rtl::Reference< ::chart::DataSeries > xDataSeries( dynamic_cast<::chart::DataSeries*>(xInnerPropertySet.get()) );
sal_Int32 nChartAxisAssign = css::chart::ChartAxisAssign::PRIMARY_Y;
if( ! (rOuterValue >>= nChartAxisAssign) )
@@ -325,9 +317,9 @@ void WrappedAttachedAxisProperty::setPropertyValue( const Any& rOuterValue, cons
if( bNewAttachedToMainAxis != bOldAttachedToMainAxis)
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
- ::chart::DiagramHelper::attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, xDiagram, m_spChart2ModelContact->m_xContext, false );
+ xDiagram->attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, m_spChart2ModelContact->m_xContext, false );
}
}
@@ -454,9 +446,8 @@ void WrappedLineStyleProperty::setPropertyToDefault( const Reference< beans::XPr
namespace chart::wrapper
{
-DataSeriesPointWrapper::DataSeriesPointWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact( spChart2ModelContact )
- , m_aEventListenerContainer( m_aMutex )
+DataSeriesPointWrapper::DataSeriesPointWrapper( std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact( std::move(spChart2ModelContact) )
, m_eType( DATA_SERIES )
, m_nSeriesIndexInNewAPI( -1 )
, m_nPointIndex( -1 )
@@ -473,7 +464,11 @@ void SAL_CALL DataSeriesPointWrapper::initialize( const uno::Sequence< uno::Any
m_nPointIndex = -1;
if( aArguments.hasElements() )
{
- aArguments[0] >>= m_xDataSeries;
+ uno::Reference<chart2::XDataSeries> xTmp;
+ aArguments[0] >>= xTmp;
+ auto p = dynamic_cast<DataSeries*>(xTmp.get());
+ assert(p);
+ m_xDataSeries = p;
if( aArguments.getLength() >= 2 )
aArguments[1] >>= m_nPointIndex;
}
@@ -493,9 +488,8 @@ void SAL_CALL DataSeriesPointWrapper::initialize( const uno::Sequence< uno::Any
DataSeriesPointWrapper::DataSeriesPointWrapper(eType _eType,
sal_Int32 nSeriesIndexInNewAPI ,
sal_Int32 nPointIndex, //ignored for series
- const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact( spChart2ModelContact )
- , m_aEventListenerContainer( m_aMutex )
+ std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact( std::move(spChart2ModelContact) )
, m_eType( _eType )
, m_nSeriesIndexInNewAPI( nSeriesIndexInNewAPI )
, m_nPointIndex( (_eType == DATA_POINT) ? nPointIndex : -1 )
@@ -510,8 +504,9 @@ DataSeriesPointWrapper::~DataSeriesPointWrapper()
// ____ XComponent ____
void SAL_CALL DataSeriesPointWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
uno::Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
m_xDataSeries.clear();
clearWrappedPropertySet();
@@ -520,13 +515,15 @@ void SAL_CALL DataSeriesPointWrapper::dispose()
void SAL_CALL DataSeriesPointWrapper::addEventListener(
const uno::Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL DataSeriesPointWrapper::removeEventListener(
const uno::Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
// ____ XEventListener ____
@@ -536,24 +533,24 @@ void SAL_CALL DataSeriesPointWrapper::disposing( const lang::EventObject& /*Sour
bool DataSeriesPointWrapper::isSupportingAreaProperties()
{
- Reference< chart2::XDataSeries > xSeries( getDataSeries() );
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ rtl::Reference< DataSeries > xSeries( getDataSeries() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ rtl::Reference< ::chart::ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) );
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
return ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
}
-Reference< chart2::XDataSeries > DataSeriesPointWrapper::getDataSeries()
+rtl::Reference< DataSeries > DataSeriesPointWrapper::getDataSeries()
{
- Reference< chart2::XDataSeries > xSeries( m_xDataSeries );
+ rtl::Reference< DataSeries > xSeries = m_xDataSeries;
if( !xSeries.is() )
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
- ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ std::vector< rtl::Reference< DataSeries > > aSeriesList =
+ xDiagram->getDataSeries();
- if( m_nSeriesIndexInNewAPI >= 0 && m_nSeriesIndexInNewAPI < static_cast<sal_Int32>(aSeriesList.size()) )
+ if( m_nSeriesIndexInNewAPI >= 0 && o3tl::make_unsigned(m_nSeriesIndexInNewAPI) < aSeriesList.size() )
xSeries = aSeriesList[m_nSeriesIndexInNewAPI];
}
@@ -564,7 +561,7 @@ Reference< beans::XPropertySet > DataSeriesPointWrapper::getDataPointProperties(
{
Reference< beans::XPropertySet > xPointProp;
- Reference< chart2::XDataSeries > xSeries( getDataSeries() );
+ rtl::Reference< DataSeries > xSeries( getDataSeries() );
// may throw an IllegalArgumentException
if( xSeries.is() )
@@ -622,9 +619,10 @@ beans::PropertyState SAL_CALL DataSeriesPointWrapper::getPropertyState( const OU
{
if( rPropertyName == "FillColor")
{
- Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries = getDataSeries();
bool bVaryColorsByPoint = false;
- if( xSeriesProp.is() && (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint)
+ // "VaryColorsByPoint"
+ if( xSeries.is() && (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint)
&& bVaryColorsByPoint )
return beans::PropertyState_DIRECT_VALUE;
}
@@ -683,7 +681,7 @@ Any SAL_CALL DataSeriesPointWrapper::getPropertyDefault( const OUString& rProper
if( nHandle > 0 )
{
//always take the series current value as default for points
- Reference< beans::XPropertySet > xInnerPropertySet( getDataSeries(), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xInnerPropertySet = getDataSeries();
if( xInnerPropertySet.is() )
{
const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
@@ -704,16 +702,16 @@ Any SAL_CALL DataSeriesPointWrapper::getPropertyDefault( const OUString& rProper
Reference< beans::XPropertySet > DataSeriesPointWrapper::getInnerPropertySet()
{
if( m_eType == DATA_SERIES )
- return Reference< beans::XPropertySet >( getDataSeries(), uno::UNO_QUERY );
+ return getDataSeries();
return getDataPointProperties();
}
const Sequence< beans::Property >& DataSeriesPointWrapper::getPropertySequence()
{
if( m_eType == DATA_SERIES )
- return *StaticSeriesWrapperPropertyArray::get();
+ return StaticSeriesWrapperPropertyArray();
else
- return *StaticPointWrapperPropertyArray::get();
+ return StaticPointWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > DataSeriesPointWrapper::createWrappedProperties()
@@ -841,15 +839,16 @@ Any SAL_CALL DataSeriesPointWrapper::getPropertyValue( const OUString& rProperty
{
if( rPropertyName == "FillColor" )
{
- Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries = getDataSeries();
bool bVaryColorsByPoint = false;
- if( xSeriesProp.is() && (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint)
+ // "VaryColorsByPoint"
+ if( xSeries.is() && (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint)
&& bVaryColorsByPoint )
{
uno::Reference< beans::XPropertyState > xPointState( DataSeriesPointWrapper::getDataPointProperties(), uno::UNO_QUERY );
if( xPointState.is() && xPointState->getPropertyState("Color") == beans::PropertyState_DEFAULT_VALUE )
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
{
Reference< chart2::XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme() );
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
index 5bf582586d9c..4c79bb25e9bb 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
@@ -21,15 +21,16 @@
#include <WrappedPropertySet.hxx>
#include "ReferenceSizePropertyProvider.hxx"
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-
+#include <rtl/ref.hxx>
#include <memory>
namespace com::sun::star::chart2 { class XDataSeries; }
+namespace chart { class DataSeries; }
namespace chart::wrapper
{
@@ -54,12 +55,12 @@ public:
};
//this constructor needs an initialize call afterwards
- explicit DataSeriesPointWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit DataSeriesPointWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
DataSeriesPointWrapper(eType eType
, sal_Int32 nSeriesIndexInNewAPI
, sal_Int32 nPointIndex //ignored for series
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~DataSeriesPointWrapper() override;
@@ -100,11 +101,11 @@ private:
virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
//own methods
- css::uno::Reference< css::chart2::XDataSeries > getDataSeries();
+ rtl::Reference< ::chart::DataSeries > getDataSeries();
css::uno::Reference< css::beans::XPropertySet > getDataPointProperties();
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
eType m_eType;
sal_Int32 m_nSeriesIndexInNewAPI;
@@ -115,7 +116,7 @@ private:
//this should only be used, if the DataSeriesPointWrapper is initialized via the XInitialize interface
//because a big change in the chartmodel may lead to a dataseriespointer that is not connected to the model anymore
//with the indices instead we can always get the new dataseries
- css::uno::Reference< css::chart2::XDataSeries > m_xDataSeries;
+ rtl::Reference< ::chart::DataSeries > m_xDataSeries;
};
} // namespace chart::wrapper
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index aa12dbc27eea..2917b989f040 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -20,14 +20,18 @@
#include "DiagramWrapper.hxx"
#include <servicenames_charttypes.hxx>
#include "DataSeriesPointWrapper.hxx"
+#include <DataSeriesProperties.hxx>
#include "AxisWrapper.hxx"
#include "Chart2ModelContact.hxx"
#include "WallFloorWrapper.hxx"
#include "MinMaxLineWrapper.hxx"
#include "UpDownBarWrapper.hxx"
+#include <Diagram.hxx>
#include <DiagramHelper.hxx>
#include <DataSourceHelper.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartType.hxx>
+#include <DataSeries.hxx>
#include <WrappedIgnoreProperty.hxx>
#include "WrappedAxisAndGridExistenceProperties.hxx"
#include "WrappedStatisticProperties.hxx"
@@ -43,15 +47,16 @@
#include <unonames.hxx>
#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <ChartTypeManager.hxx>
+#include <ChartTypeTemplate.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
#include <com/sun/star/chart/ChartSolidType.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <LinePropertiesHelper.hxx>
#include <FillProperties.hxx>
@@ -62,17 +67,19 @@
#include <map>
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/util/XRefreshable.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/string_view.hxx>
+#include <utility>
using namespace ::com::sun::star;
using namespace ::chart::wrapper;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::beans::Property;
using ::com::sun::star::chart::XAxis;
-using ::osl::MutexGuard;
namespace
{
@@ -96,6 +103,7 @@ enum
PROP_DIAGRAM_SORT_BY_X_VALUES,
PROP_DIAGRAM_STARTING_ANGLE,
+ PROP_DIAGRAM_OF_PIE_TYPE,
PROP_DIAGRAM_RIGHT_ANGLED_AXES,
PROP_DIAGRAM_PERSPECTIVE,
@@ -132,9 +140,6 @@ enum
PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
PROP_DIAGRAM_AUTOMATIC_SIZE,
- PROP_DIAGRAM_DATATABLEHBORDER,
- PROP_DIAGRAM_DATATABLEVBORDER,
- PROP_DIAGRAM_DATATABLEOUTLINE,
PROP_DIAGRAM_EXTERNALDATA
};
@@ -225,6 +230,11 @@ void lcl_AddPropertiesToVector(
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT );
+ rOutProperties.emplace_back( "SubPieType",
+ PROP_DIAGRAM_OF_PIE_TYPE,
+ cppu::UnoType<chart2::PieChartSubType>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
//new for 3D charts
rOutProperties.emplace_back( "RightAngledAxes",
@@ -376,21 +386,7 @@ void lcl_AddPropertiesToVector(
cppu::UnoType<bool>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( "DataTableHBorder",
- PROP_DIAGRAM_DATATABLEHBORDER,
- cppu::UnoType<bool>::get(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( "DataTableVBorder",
- PROP_DIAGRAM_DATATABLEVBORDER,
- cppu::UnoType<bool>::get(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( "DataTableOutline",
- PROP_DIAGRAM_DATATABLEOUTLINE,
- cppu::UnoType<bool>::get(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
+
rOutProperties.emplace_back( "ExternalData",
PROP_DIAGRAM_EXTERNALDATA,
cppu::UnoType<OUString>::get(),
@@ -398,45 +394,35 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
-struct StaticDiagramWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
- ::chart::SceneProperties::AddPropertiesToVector( aProperties );
- WrappedStatisticProperties::addProperties( aProperties );
- WrappedSymbolProperties::addProperties( aProperties );
- WrappedDataCaptionProperties::addProperties( aProperties );
- WrappedSplineProperties::addProperties( aProperties );
- WrappedStockProperties::addProperties( aProperties );
- WrappedAutomaticPositionProperties::addProperties( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer >
+const Sequence< Property >& StaticDiagramWrapperPropertyArray()
{
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::SceneProperties::AddPropertiesToVector( aProperties );
+ WrappedStatisticProperties::addProperties( aProperties );
+ WrappedSymbolProperties::addProperties( aProperties );
+ WrappedDataCaptionProperties::addProperties( aProperties );
+ WrappedSplineProperties::addProperties( aProperties );
+ WrappedStockProperties::addProperties( aProperties );
+ WrappedAutomaticPositionProperties::addProperties( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
};
-bool lcl_isXYChart( const Reference< chart2::XDiagram >& rDiagram )
+bool lcl_isXYChart( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
bool bRet = false;
- Reference< chart2::XChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( rDiagram, 0 ) );
+ rtl::Reference< ::chart::ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) );
if( xChartType.is() )
{
OUString aChartType( xChartType->getChartType() );
@@ -448,7 +434,7 @@ bool lcl_isXYChart( const Reference< chart2::XDiagram >& rDiagram )
sal_Int32 lcl_getNewAPIIndexForOldAPIIndex(
sal_Int32 nOldAPIIndex
- , const Reference< chart2::XDiagram >& xDiagram )
+ , const rtl::Reference< ::chart::Diagram >& xDiagram )
{
sal_Int32 nNewAPIIndex = nOldAPIIndex;
@@ -458,29 +444,38 @@ sal_Int32 lcl_getNewAPIIndexForOldAPIIndex(
nNewAPIIndex -= 1;
}
- std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
- ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< ::chart::DataSeries > > aSeriesList =
+ xDiagram->getDataSeries();
if( nNewAPIIndex >= static_cast<sal_Int32>(aSeriesList.size()) )
nNewAPIIndex = -1;
return nNewAPIIndex;
}
-OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
+OUString lcl_getDiagramType( std::u16string_view rTemplateServiceName )
{
- const OUString aPrefix("com.sun.star.chart2.template.");
+ static constexpr OUString aPrefix(u"com.sun.star.chart2.template."_ustr);
- if( rTemplateServiceName.match( aPrefix ))
+ if( o3tl::starts_with(rTemplateServiceName, aPrefix) )
{
- const OUString aName( rTemplateServiceName.copy( aPrefix.getLength()));
+ const std::u16string_view aName( rTemplateServiceName.substr( aPrefix.getLength()));
// "Area" "StackedArea" "PercentStackedArea" "ThreeDArea"
// "StackedThreeDArea" "PercentStackedThreeDArea"
- if( aName.indexOf( "Area" ) != -1 )
+ if( aName.find( u"Area" ) != std::u16string_view::npos )
return "com.sun.star.chart.AreaDiagram";
+ // Handle bar-of-pie and pie-of-pie before simple pie
+ // "BarOfPie"
+ if( aName.find( u"BarOfPie" ) != std::u16string_view::npos )
+ return "com.sun.star.chart.BarOfPieDiagram";
+
+ // "PieOfPie"
+ if( aName.find( u"PieOfPie" ) != std::u16string_view::npos )
+ return "com.sun.star.chart.PieOfPieDiagram";
+
// "Pie" "PieAllExploded" "ThreeDPie" "ThreeDPieAllExploded"
- if( aName.indexOf( "Pie" ) != -1 )
+ if( aName.find( u"Pie" ) != std::u16string_view::npos )
return "com.sun.star.chart.PieDiagram";
// "Column" "StackedColumn" "PercentStackedColumn" "ThreeDColumnDeep"
@@ -489,33 +484,33 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
// "PercentStackedBar" "ThreeDBarDeep" "ThreeDBarFlat"
// "StackedThreeDBarFlat" "PercentStackedThreeDBarFlat" "ColumnWithLine"
// "StackedColumnWithLine"
- if( aName.indexOf( "Column" ) != -1 || aName.indexOf( "Bar" ) != -1 )
+ if( aName.find( u"Column" ) != std::u16string_view::npos || aName.find( u"Bar" ) != std::u16string_view::npos )
return "com.sun.star.chart.BarDiagram";
// "Donut" "DonutAllExploded" "ThreeDDonut" "ThreeDDonutAllExploded"
- if( aName.indexOf( "Donut" ) != -1 )
+ if( aName.find( u"Donut" ) != std::u16string_view::npos )
return "com.sun.star.chart.DonutDiagram";
// "ScatterLineSymbol" "ScatterLine" "ScatterSymbol" "ThreeDScatter"
- if( aName.indexOf( "Scatter" ) != -1 )
+ if( aName.find( u"Scatter" ) != std::u16string_view::npos )
return "com.sun.star.chart.XYDiagram";
// "FilledNet" "StackedFilledNet" "PercentStackedFilledNet"
- if( aName.indexOf( "FilledNet" ) != -1 )
+ if( aName.find( u"FilledNet" ) != std::u16string_view::npos )
return "com.sun.star.chart.FilledNetDiagram";
// "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol"
// "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol"
// "PercentStackedNetLine"
- if( aName.indexOf( "Net" ) != -1 )
+ if( aName.find( u"Net" ) != std::u16string_view::npos )
return "com.sun.star.chart.NetDiagram";
// "StockLowHighClose" "StockOpenLowHighClose" "StockVolumeLowHighClose"
// "StockVolumeOpenLowHighClose"
- if( aName.indexOf( "Stock" ) != -1 )
+ if( aName.find( u"Stock" ) != std::u16string_view::npos )
return "com.sun.star.chart.StockDiagram";
- if( aName.indexOf( "Bubble" ) != -1 )
+ if( aName.find( u"Bubble" ) != std::u16string_view::npos )
return "com.sun.star.chart.BubbleDiagram";
// Note: this must be checked after Bar, Net and Scatter
@@ -524,7 +519,7 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
// "PercentStackedLine" "LineSymbol" "StackedLineSymbol"
// "PercentStackedLineSymbol" "ThreeDLine" "StackedThreeDLine"
// "PercentStackedThreeDLine" "ThreeDLineDeep"
- if( aName.indexOf( "Line" ) != -1 || aName.indexOf( "Symbol" ) != -1 )
+ if( aName.find( u"Line" ) != std::u16string_view::npos || aName.find( u"Symbol" ) != std::u16string_view::npos )
return "com.sun.star.chart.LineDiagram";
OSL_FAIL( "unknown template" );
@@ -570,9 +565,8 @@ OUString lcl_getOldChartTypeName( const OUString & rNewChartTypeName )
namespace chart::wrapper
{
-DiagramWrapper::DiagramWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact(spChart2ModelContact)
- , m_aEventListenerContainer(m_aMutex)
+DiagramWrapper::DiagramWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact(std::move(spChart2ModelContact))
{
}
@@ -584,11 +578,11 @@ OUString SAL_CALL DiagramWrapper::getDiagramType()
{
OUString aRet;
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xChartDoc.is() && xDiagram.is() )
{
- Reference< beans::XPropertySet > xChartDocProp( xChartDoc, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xChartDocProp( static_cast<cppu::OWeakObject*>(xChartDoc.get()), uno::UNO_QUERY );
if( xChartDocProp.is() )
{
uno::Reference< util::XRefreshable > xAddIn;
@@ -600,27 +594,30 @@ OUString SAL_CALL DiagramWrapper::getDiagramType()
}
}
- Reference< lang::XMultiServiceFactory > xChartTypeManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager();
+ Diagram::tTemplateWithServiceName aTemplateAndService =
+ xDiagram->getTemplate( xChartTypeManager );
- aRet = lcl_getDiagramType( aTemplateAndService.second );
+ aRet = lcl_getDiagramType( aTemplateAndService.sServiceName );
}
- if( aRet.isEmpty())
+ if( !aRet.isEmpty())
+ return aRet;
+
+ // none of the standard templates matched
+ // use first chart type
+ if (xDiagram)
{
- // none of the standard templates matched
- // use first chart type
- Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) );
if( xChartType.is() )
{
aRet = xChartType->getChartType();
if( !aRet.isEmpty() )
aRet = lcl_getOldChartTypeName( aRet );
}
- if( aRet.isEmpty())
- aRet = "com.sun.star.chart.BarDiagram";
}
+ if( aRet.isEmpty())
+ aRet = "com.sun.star.chart.BarDiagram";
return aRet;
}
@@ -632,7 +629,7 @@ Reference<
throw lang::IndexOutOfBoundsException("DataSeries index invalid",
static_cast< ::cppu::OWeakObject * >( this ));
- sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
+ sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getDiagram() );
if( nNewAPIIndex < 0 )
throw lang::IndexOutOfBoundsException("DataSeries index invalid",
static_cast< ::cppu::OWeakObject * >( this ));
@@ -649,7 +646,7 @@ Reference<
throw lang::IndexOutOfBoundsException("DataSeries index invalid",
static_cast< ::cppu::OWeakObject * >( this ));
- sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
+ sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getDiagram() );
if( nNewAPIIndex < 0 )
throw lang::IndexOutOfBoundsException("DataSeries index invalid",
static_cast< ::cppu::OWeakObject * >( this ));
@@ -671,7 +668,7 @@ awt::Point SAL_CALL DiagramWrapper::getPosition()
void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition )
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
Reference< beans::XPropertySet > xProp( getInnerPropertySet() );
if( !xProp.is() )
return;
@@ -701,7 +698,7 @@ awt::Size SAL_CALL DiagramWrapper::getSize()
void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize )
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
Reference< beans::XPropertySet > xProp( getInnerPropertySet() );
if( !xProp.is() )
return;
@@ -734,7 +731,7 @@ OUString SAL_CALL DiagramWrapper::getShapeType()
void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning()
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
uno::Reference< beans::XPropertySet > xDiaProps( getDiagram(), uno::UNO_QUERY );
if( xDiaProps.is() )
{
@@ -756,8 +753,8 @@ sal_Bool SAL_CALL DiagramWrapper::isAutomaticDiagramPositioning( )
}
void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect )
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
- DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
+ DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getDocumentModel(), rPositionRect );
uno::Reference< beans::XPropertySet > xDiaProps( getDiagram(), uno::UNO_QUERY );
if( xDiaProps.is() )
xDiaProps->setPropertyValue("PosSizeExcludeAxes", uno::Any(true) );
@@ -784,8 +781,8 @@ awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes(
}
void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect )
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
- DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
+ DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getDocumentModel(), rPositionRect );
uno::Reference< beans::XPropertySet > xDiaProps( getDiagram(), uno::UNO_QUERY );
if( xDiaProps.is() )
xDiaProps->setPropertyValue("PosSizeExcludeAxes", uno::Any(false) );
@@ -796,7 +793,7 @@ awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes(
}
void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect )
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) );
DiagramWrapper::setDiagramPositionIncludingAxes( aRect );
}
@@ -1042,21 +1039,21 @@ Reference<
// ____ X3DDefaultSetter ____
void SAL_CALL DiagramWrapper::set3DSettingsToDefault()
{
- Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Diagram > x3DDefaultSetter( m_spChart2ModelContact->getDiagram() );
if( x3DDefaultSetter.is() )
x3DDefaultSetter->set3DSettingsToDefault();
}
void SAL_CALL DiagramWrapper::setDefaultRotation()
{
- Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Diagram > x3DDefaultSetter( m_spChart2ModelContact->getDiagram() );
if( x3DDefaultSetter.is() )
x3DDefaultSetter->setDefaultRotation();
}
void SAL_CALL DiagramWrapper::setDefaultIllumination()
{
- Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Diagram > x3DDefaultSetter( m_spChart2ModelContact->getDiagram() );
if( x3DDefaultSetter.is() )
x3DDefaultSetter->setDefaultIllumination();
}
@@ -1064,9 +1061,8 @@ void SAL_CALL DiagramWrapper::setDefaultIllumination()
// ____ XComponent ____
void SAL_CALL DiagramWrapper::dispose()
{
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
-
- MutexGuard aGuard( m_aMutex);
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
DisposeHelper::DisposeAndClear( m_xXAxis );
DisposeHelper::DisposeAndClear( m_xYAxis );
@@ -1085,13 +1081,15 @@ void SAL_CALL DiagramWrapper::dispose()
void SAL_CALL DiagramWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL DiagramWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
namespace {
@@ -1100,7 +1098,7 @@ namespace {
class WrappedDataRowSourceProperty : public WrappedProperty
{
public:
- explicit WrappedDataRowSourceProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedDataRowSourceProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -1115,10 +1113,9 @@ private: //member
}
-WrappedDataRowSourceProperty::WrappedDataRowSourceProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedDataRowSourceProperty::WrappedDataRowSourceProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("DataRowSource",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
- , m_aOuterValue()
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
m_aOuterValue = WrappedDataRowSourceProperty::getPropertyDefault( nullptr );
}
@@ -1145,14 +1142,14 @@ void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, con
uno::Sequence< sal_Int32 > aSequenceMapping;
if( DataSourceHelper::detectRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
, bFirstCellAsLabel, bHasCategories ) )
{
if( bUseColumns != bNewUseColumns )
{
aSequenceMapping.realloc(0);
DataSourceHelper::setRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aSequenceMapping, bNewUseColumns , bFirstCellAsLabel , bHasCategories);
+ m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bNewUseColumns , bFirstCellAsLabel , bHasCategories);
}
}
}
@@ -1166,7 +1163,7 @@ Any WrappedDataRowSourceProperty::getPropertyValue( const Reference< beans::XPro
uno::Sequence< sal_Int32 > aSequenceMapping;
if( DataSourceHelper::detectRangeSegmentation(
- m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
, bFirstCellAsLabel, bHasCategories ) )
{
css::chart::ChartDataRowSource eChartDataRowSource = css::chart::ChartDataRowSource_ROWS;
@@ -1194,7 +1191,7 @@ namespace {
class WrappedStackingProperty : public WrappedProperty
{
public:
- WrappedStackingProperty(StackMode eStackMode, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ WrappedStackingProperty(StackMode eStackMode, std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -1213,11 +1210,10 @@ std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
}
-WrappedStackingProperty::WrappedStackingProperty(StackMode eStackMode, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedStackingProperty::WrappedStackingProperty(StackMode eStackMode, std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty(OUString(),OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_eStackMode( eStackMode )
- , m_aOuterValue()
{
switch( m_eStackMode )
{
@@ -1240,8 +1236,8 @@ bool WrappedStackingProperty::detectInnerValue( StackMode& eStackMode ) const
{
bool bHasDetectableInnerValue = false;
bool bIsAmbiguous = false;
- eStackMode = DiagramHelper::getStackMode( m_spChart2ModelContact->getChart2Diagram()
- , bHasDetectableInnerValue, bIsAmbiguous );
+ rtl::Reference<Diagram> xDiagram = m_spChart2ModelContact->getDiagram();
+ eStackMode = xDiagram ? xDiagram->getStackMode( bHasDetectableInnerValue, bIsAmbiguous ) : StackMode::NONE;
return bHasDetectableInnerValue;
}
@@ -1265,11 +1261,11 @@ void WrappedStackingProperty::setPropertyValue( const Any& rOuterValue, const Re
if( !bNewValue && eInnerStackMode != m_eStackMode )
return;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
{
StackMode eNewStackMode = bNewValue ? m_eStackMode : StackMode::NONE;
- DiagramHelper::setStackMode( xDiagram, eNewStackMode );
+ xDiagram->setStackMode( eNewStackMode );
}
}
@@ -1297,7 +1293,7 @@ namespace {
class WrappedDim3DProperty : public WrappedProperty
{
public:
- explicit WrappedDim3DProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedDim3DProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -1312,10 +1308,9 @@ private: //member
}
-WrappedDim3DProperty::WrappedDim3DProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedDim3DProperty::WrappedDim3DProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("Dim3D",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
- , m_aOuterValue()
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
m_aOuterValue = WrappedDim3DProperty::getPropertyDefault( nullptr );
}
@@ -1328,21 +1323,21 @@ void WrappedDim3DProperty::setPropertyValue( const Any& rOuterValue, const Refer
m_aOuterValue = rOuterValue;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( !xDiagram.is() )
return;
- bool bOld3D = DiagramHelper::getDimension( xDiagram ) == 3;
+ bool bOld3D = xDiagram->getDimension() == 3;
if( bOld3D != bNew3D )
- DiagramHelper::setDimension( xDiagram, bNew3D ? 3 : 2 );
+ xDiagram->setDimension( bNew3D ? 3 : 2 );
}
Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
{
- bool b3D = DiagramHelper::getDimension( xDiagram ) == 3;
+ bool b3D = xDiagram->getDimension() == 3;
m_aOuterValue <<= b3D;
}
return m_aOuterValue;
@@ -1361,7 +1356,7 @@ namespace {
class WrappedVerticalProperty : public WrappedProperty
{
public:
- explicit WrappedVerticalProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedVerticalProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -1376,10 +1371,9 @@ private: //member
}
-WrappedVerticalProperty::WrappedVerticalProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedVerticalProperty::WrappedVerticalProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("Vertical",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
- , m_aOuterValue()
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
m_aOuterValue = WrappedVerticalProperty::getPropertyDefault( nullptr );
}
@@ -1392,25 +1386,25 @@ void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Re
m_aOuterValue = rOuterValue;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( !xDiagram.is() )
return;
bool bFound = false;
bool bAmbiguous = false;
- bool bOldVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ bool bOldVertical = xDiagram->getVertical( bFound, bAmbiguous );
if( bFound && ( bOldVertical != bNewVertical || bAmbiguous ) )
- DiagramHelper::setVertical( xDiagram, bNewVertical );
+ xDiagram->setVertical( bNewVertical );
}
Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
{
bool bFound = false;
bool bAmbiguous = false;
- bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ bool bVertical = xDiagram->getVertical( bFound, bAmbiguous );
if( bFound )
m_aOuterValue <<= bVertical;
}
@@ -1430,7 +1424,7 @@ namespace {
class WrappedNumberOfLinesProperty : public WrappedProperty
{
public:
- explicit WrappedNumberOfLinesProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedNumberOfLinesProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -1448,9 +1442,9 @@ private: //member
}
-WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("NumberOfLines",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_aOuterValue( getPropertyDefault(nullptr) )
{
}
@@ -1459,22 +1453,22 @@ bool WrappedNumberOfLinesProperty::detectInnerValue( uno::Any& rInnerValue ) con
{
sal_Int32 nNumberOfLines = 0;
bool bHasDetectableInnerValue = false;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
if( xDiagram.is() && xChartDoc.is() )
{
- std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector =
+ xDiagram->getDataSeries();
if( !aSeriesVector.empty() )
{
- Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
- if( aTemplateAndService.second == "com.sun.star.chart2.template.ColumnWithLine" )
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager();
+ Diagram::tTemplateWithServiceName aTemplateAndService =
+ xDiagram->getTemplate( xChartTypeManager );
+ if( aTemplateAndService.sServiceName == "com.sun.star.chart2.template.ColumnWithLine" )
{
try
{
- uno::Reference< beans::XPropertySet > xProp( aTemplateAndService.first, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProp( static_cast<cppu::OWeakObject*>(aTemplateAndService.xChartTypeTemplate.get()), uno::UNO_QUERY );
xProp->getPropertyValue( m_aOuterName ) >>= nNumberOfLines;
bHasDetectableInnerValue = true;
}
@@ -1498,26 +1492,28 @@ void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, con
m_aOuterValue = rOuterValue;
- uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram );
- if( !(xChartDoc.is() && xDiagram.is() && nDimension == 2) )
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ if( !xChartDoc || !xDiagram )
+ return;
+ sal_Int32 nDimension = xDiagram->getDimension();
+ if( nDimension != 2 )
return;
- Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager();
+ Diagram::tTemplateWithServiceName aTemplateAndService =
+ xDiagram->getTemplate( xChartTypeManager );
- uno::Reference< chart2::XChartTypeTemplate > xTemplate;
- if( aTemplateAndService.second == "com.sun.star.chart2.template.ColumnWithLine" )
+ rtl::Reference< ChartTypeTemplate > xTemplate;
+ if( aTemplateAndService.sServiceName == "com.sun.star.chart2.template.ColumnWithLine" )
{
if( nNewValue != 0 )
{
- xTemplate.set( aTemplateAndService.first );
+ xTemplate = aTemplateAndService.xChartTypeTemplate;
try
{
sal_Int32 nOldValue = 0;
- uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProp( static_cast<cppu::OWeakObject*>(xTemplate.get()), uno::UNO_QUERY );
xProp->getPropertyValue( m_aOuterName ) >>= nOldValue;
if( nOldValue == nNewValue )
return;
@@ -1529,14 +1525,14 @@ void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, con
}
else
{
- xTemplate.set( xFact->createInstance("com.sun.star.chart2.template.Column"), uno::UNO_QUERY );
+ xTemplate = xChartTypeManager->createTemplate("com.sun.star.chart2.template.Column");
}
}
- else if( aTemplateAndService.second == "com.sun.star.chart2.template.Column" )
+ else if( aTemplateAndService.sServiceName == "com.sun.star.chart2.template.Column" )
{
if( nNewValue == 0 )
return;
- xTemplate.set( xFact->createInstance( "com.sun.star.chart2.template.ColumnWithLine" ), uno::UNO_QUERY );
+ xTemplate = xChartTypeManager->createTemplate( "com.sun.star.chart2.template.ColumnWithLine" );
}
if(!xTemplate.is())
@@ -1545,8 +1541,8 @@ void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, con
try
{
// locked controllers
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
- uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
+ uno::Reference< beans::XPropertySet > xProp( static_cast<cppu::OWeakObject*>(xTemplate.get()), uno::UNO_QUERY );
xProp->setPropertyValue( "NumberOfLines", uno::Any(nNewValue) );
xTemplate->changeDiagram( xDiagram );
}
@@ -1577,7 +1573,7 @@ namespace {
class WrappedAttributedDataPointsProperty : public WrappedProperty
{
public:
- explicit WrappedAttributedDataPointsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedAttributedDataPointsProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -1592,10 +1588,9 @@ private: //member
}
-WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("AttributedDataPoints",OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
- , m_aOuterValue()
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
m_aOuterValue = WrappedAttributedDataPointsProperty::getPropertyDefault( nullptr );
}
@@ -1608,59 +1603,49 @@ void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterVal
m_aOuterValue = rOuterValue;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
- if( !(xDiagram.is() && xDiaProp.is()))
+ if( !xDiagram )
return;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
- ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector =
+ xDiagram->getDataSeries();
sal_Int32 i = 0;
for (auto const& series : aSeriesVector)
{
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY);
- if( xProp.is())
+ uno::Any aVal;
+ if( i < aNewValue.getLength() )
+ aVal <<= aNewValue[i];
+ else
{
- uno::Any aVal;
- if( i < aNewValue.getLength() )
- aVal <<= aNewValue[i];
- else
- {
- //set empty sequence
- uno::Sequence< sal_Int32 > aSeq;
- aVal <<= aSeq;
- }
- xProp->setPropertyValue( "AttributedDataPoints", aVal );
+ //set empty sequence
+ uno::Sequence< sal_Int32 > aSeq;
+ aVal <<= aSeq;
}
+ series->setFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS, aVal ); // "AttributedDataPoints"
++i;
}
}
Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
- if( xDiagram.is() && xDiaProp.is())
+ if( xDiagram )
{
- std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
- ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector =
+ xDiagram->getDataSeries();
uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() );
-
+ auto aResultRange = asNonConstRange(aResult);
sal_Int32 i = 0;
for (auto const& series : aSeriesVector)
{
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY);
- if( xProp.is())
- {
- uno::Any aVal(
- xProp->getPropertyValue("AttributedDataPoints"));
- uno::Sequence< sal_Int32 > aSeq;
- if( aVal >>= aSeq )
- aResult[ i ] = aSeq;
- }
+ uno::Any aVal(
+ series->getFastPropertyValue(PROP_DATASERIES_ATTRIBUTED_DATA_POINTS)); // "AttributedDataPoints"
+ uno::Sequence< sal_Int32 > aSeq;
+ if( aVal >>= aSeq )
+ aResultRange[ i ] = aSeq;
++i;
}
m_aOuterValue <<= aResult;
@@ -1682,7 +1667,7 @@ namespace {
class WrappedSolidTypeProperty : public WrappedProperty
{
public:
- explicit WrappedSolidTypeProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedSolidTypeProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -1697,10 +1682,9 @@ private: //member
}
-WrappedSolidTypeProperty::WrappedSolidTypeProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedSolidTypeProperty::WrappedSolidTypeProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty( "SolidType", OUString() )
- , m_spChart2ModelContact( spChart2ModelContact )
- , m_aOuterValue()
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
m_aOuterValue = WrappedSolidTypeProperty::getPropertyDefault( nullptr );
}
@@ -1713,25 +1697,25 @@ void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const R
m_aOuterValue = rOuterValue;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( !xDiagram.is() )
return;
bool bFound = false;
bool bAmbiguous = false;
- sal_Int32 nOldSolidType = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
+ sal_Int32 nOldSolidType = xDiagram->getGeometry3D( bFound, bAmbiguous );
if( bFound && ( nOldSolidType != nNewSolidType || bAmbiguous ) )
- DiagramHelper::setGeometry3D( xDiagram, nNewSolidType );
+ xDiagram->setGeometry3D( nNewSolidType );
}
Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
{
bool bFound = false;
bool bAmbiguous = false;
- sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
+ sal_Int32 nGeometry = xDiagram->getGeometry3D( bFound, bAmbiguous );
if( bFound )
m_aOuterValue <<= nGeometry;
}
@@ -1813,7 +1797,7 @@ namespace {
class WrappedIncludeHiddenCellsProperty : public WrappedProperty
{
public:
- explicit WrappedIncludeHiddenCellsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedIncludeHiddenCellsProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
virtual Any getPropertyValue(const Reference<beans::XPropertySet>& xInnerPropertySet) const override;
@@ -1824,9 +1808,9 @@ private: //member
}
-WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty("IncludeHiddenCells","IncludeHiddenCells")
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
}
@@ -1836,19 +1820,19 @@ void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue
if( ! (rOuterValue >>= bNewValue) )
throw lang::IllegalArgumentException( "Property IncludeHiddenCells requires boolean value", nullptr, 0 );
- ChartModelHelper::setIncludeHiddenCells( bNewValue, *m_spChart2ModelContact->getModel() );
+ ChartModelHelper::setIncludeHiddenCells( bNewValue, *m_spChart2ModelContact->getDocumentModel() );
}
Any WrappedIncludeHiddenCellsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
- bool bValue = ChartModelHelper::isIncludeHiddenCells( m_spChart2ModelContact->getChartModel() );
+ bool bValue = ChartModelHelper::isIncludeHiddenCells( m_spChart2ModelContact->getDocumentModel() );
return uno::Any(bValue);
}
// ____ XDiagramProvider ____
Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram()
{
- return m_spChart2ModelContact->getChart2Diagram();
+ return m_spChart2ModelContact->getDiagram();
}
void SAL_CALL DiagramWrapper::setDiagram(
@@ -1860,12 +1844,12 @@ void SAL_CALL DiagramWrapper::setDiagram(
Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet()
{
- return Reference< beans::XPropertySet >( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ return m_spChart2ModelContact->getDiagram();
}
const Sequence< beans::Property >& DiagramWrapper::getPropertySequence()
{
- return *StaticDiagramWrapperPropertyArray::get();
+ return StaticDiagramWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > DiagramWrapper::createWrappedProperties()
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
index d8e35d3bfe17..3a3a8383de05 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
@@ -20,7 +20,7 @@
#include <WrappedPropertySet.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
#include <com/sun/star/chart2/XDiagramProvider.hpp>
#include <com/sun/star/chart/XDiagram.hpp>
@@ -63,7 +63,7 @@ class DiagramWrapper : public cppu::ImplInheritanceHelper<
>
{
public:
- explicit DiagramWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit DiagramWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~DiagramWrapper() override;
/// XServiceInfo declarations
@@ -186,7 +186,7 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
css::uno::Reference<
css::chart::XAxis > m_xXAxis;
diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
index 649086a1a458..5f75aa686a69 100644
--- a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
@@ -21,6 +21,7 @@
#include <AxisHelper.hxx>
#include "Chart2ModelContact.hxx"
#include <AxisIndexDefines.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <LinePropertiesHelper.hxx>
#include <UserDefinedProperties.hxx>
@@ -29,51 +30,20 @@
#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <algorithm>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
-namespace
-{
-
-struct StaticGridWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticGridWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticGridWrapperPropertyArray_Initializer >
-{
-};
-
-} // anonymous namespace
-
namespace chart::wrapper
{
-GridWrapper::GridWrapper(tGridType eType, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact(spChart2ModelContact)
- , m_aEventListenerContainer(m_aMutex)
+GridWrapper::GridWrapper(tGridType eType, std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact(std::move(spChart2ModelContact))
, m_eType(eType)
{
}
@@ -106,8 +76,9 @@ void GridWrapper::getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDime
// ____ XComponent ____
void SAL_CALL GridWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
clearWrappedPropertySet();
}
@@ -115,13 +86,15 @@ void SAL_CALL GridWrapper::dispose()
void SAL_CALL GridWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL GridWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
// WrappedPropertySet
@@ -131,15 +104,15 @@ Reference< beans::XPropertySet > GridWrapper::getInnerPropertySet()
Reference< beans::XPropertySet > xRet;
try
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 /*nCooSysIndex*/ ) );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 /*nCooSysIndex*/ ) );
sal_Int32 nDimensionIndex = 1;
bool bSubGrid = false;
getDimensionAndSubGridBool( m_eType, nDimensionIndex, bSubGrid );
sal_Int32 nSubGridIndex = bSubGrid ? 0 : -1;
- xRet.set( AxisHelper::getGridProperties( xCooSys , nDimensionIndex, MAIN_AXIS_INDEX, nSubGridIndex ) );
+ xRet = AxisHelper::getGridProperties( xCooSys , nDimensionIndex, MAIN_AXIS_INDEX, nSubGridIndex );
}
catch( const uno::Exception & )
{
@@ -150,7 +123,18 @@ Reference< beans::XPropertySet > GridWrapper::getInnerPropertySet()
const Sequence< beans::Property >& GridWrapper::getPropertySequence()
{
- return *StaticGridWrapperPropertyArray::get();
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
}
std::vector< std::unique_ptr<WrappedProperty> > GridWrapper::createWrappedProperties()
diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
index f9e918301a53..c978f3bb8d83 100644
--- a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
@@ -20,7 +20,7 @@
#include <WrappedPropertySet.hxx>
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -48,7 +48,7 @@ public:
Z_MINOR_GRID
};
- GridWrapper(tGridType eType, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ GridWrapper(tGridType eType, std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~GridWrapper() override;
static void getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDimensionIndex, bool& rbSubGrid );
@@ -71,7 +71,7 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
tGridType m_eType;
};
diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
index 01dc74e7b7be..9ec8f02819ef 100644
--- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
@@ -26,7 +26,6 @@
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/chart/ChartLegendExpansion.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
#include <CharacterProperties.hxx>
#include <LinePropertiesHelper.hxx>
@@ -39,10 +38,10 @@
#include "WrappedScaleTextProperties.hxx"
#include <algorithm>
+#include <utility>
using namespace ::com::sun::star;
using ::com::sun::star::beans::Property;
-using ::osl::MutexGuard;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -225,35 +224,25 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticLegendWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
- ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
- ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticLegendWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticLegendWrapperPropertyArray_Initializer >
+const Sequence< Property >& StaticLegendWrapperPropertyArray()
{
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
};
} // anonymous namespace
@@ -261,9 +250,8 @@ struct StaticLegendWrapperPropertyArray : public rtl::StaticAggregate< Sequence<
namespace chart::wrapper
{
-LegendWrapper::LegendWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact(spChart2ModelContact)
- , m_aEventListenerContainer(m_aMutex)
+LegendWrapper::LegendWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact(std::move(spChart2ModelContact))
{
}
@@ -322,23 +310,25 @@ OUString SAL_CALL LegendWrapper::getShapeType()
// ____ XComponent ____
void SAL_CALL LegendWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
- MutexGuard aGuard( m_aMutex);
clearWrappedPropertySet();
}
void SAL_CALL LegendWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL LegendWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
//ReferenceSizePropertyProvider
@@ -370,7 +360,7 @@ awt::Size LegendWrapper::getCurrentSizeForReference()
Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet()
{
Reference< beans::XPropertySet > xRet;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
xRet.set( xDiagram->getLegend(), uno::UNO_QUERY );
OSL_ENSURE(xRet.is(),"LegendWrapper::getInnerPropertySet() is NULL");
@@ -379,7 +369,7 @@ Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet()
const Sequence< beans::Property >& LegendWrapper::getPropertySequence()
{
- return *StaticLegendWrapperPropertyArray::get();
+ return StaticLegendWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > LegendWrapper::createWrappedProperties()
diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
index 5da2b1b1fb4a..5b4deac2a1f9 100644
--- a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
@@ -21,7 +21,7 @@
#include <WrappedPropertySet.hxx>
#include "ReferenceSizePropertyProvider.hxx"
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -42,7 +42,7 @@ class LegendWrapper : public ::cppu::ImplInheritanceHelper<
, public ReferenceSizePropertyProvider
{
public:
- explicit LegendWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit LegendWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~LegendWrapper() override;
/// XServiceInfo declarations
@@ -79,7 +79,7 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
};
} // namespace chart::wrapper
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
index a0f39774b5f1..d0cb5eab6552 100644
--- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
@@ -19,21 +19,19 @@
#include "MinMaxLineWrapper.hxx"
#include "Chart2ModelContact.hxx"
-#include <DiagramHelper.hxx>
+#include <ChartType.hxx>
#include <servicenames_charttypes.hxx>
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <com/sun/star/chart2/XChartType.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
#include <comphelper/sequence.hxx>
-
+#include <DataSeries.hxx>
#include <LinePropertiesHelper.hxx>
#include <UserDefinedProperties.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Reference;
@@ -43,72 +41,34 @@ using ::com::sun::star::uno::Any;
namespace
{
-struct StaticMinMaxLineWrapperDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- ::chart::LinePropertiesHelper::AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-};
-
-struct StaticMinMaxLineWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticMinMaxLineWrapperDefaults_Initializer >
-{
-};
-
-struct StaticMinMaxLineWrapperPropertyArray_Initializer
+Sequence< Property >& StaticMinMaxLineWrapperPropertyArray()
{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
-
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
-struct StaticMinMaxLineWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticMinMaxLineWrapperPropertyArray_Initializer >
-{
-};
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-struct StaticMinMaxLineWrapperInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( *StaticMinMaxLineWrapperPropertyArray::get() );
- return &aPropHelper;
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticMinMaxLineWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticMinMaxLineWrapperInfoHelper_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
};
-struct StaticMinMaxLineWrapperInfo_Initializer
+::cppu::OPropertyArrayHelper& StaticMinMaxLineWrapperInfoHelper()
{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticMinMaxLineWrapperInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
+ static ::cppu::OPropertyArrayHelper aPropHelper( StaticMinMaxLineWrapperPropertyArray() );
+ return aPropHelper;
};
-struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticMinMaxLineWrapperInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& StaticMinMaxLineWrapperInfo()
{
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo( StaticMinMaxLineWrapperInfoHelper() ) );
+ return xPropertySetInfo;
};
} // anonymous namespace
@@ -116,9 +76,8 @@ struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference
namespace chart::wrapper
{
-MinMaxLineWrapper::MinMaxLineWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact( spChart2ModelContact )
- , m_aEventListenerContainer( m_aMutex )
+MinMaxLineWrapper::MinMaxLineWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_aWrappedLineJointProperty( "LineJoint", uno::Any( drawing::LineJoint_NONE ))
{
}
@@ -130,58 +89,53 @@ MinMaxLineWrapper::~MinMaxLineWrapper()
// ____ XComponent ____
void SAL_CALL MinMaxLineWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
}
void SAL_CALL MinMaxLineWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL MinMaxLineWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
//XPropertySet
uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo()
{
- return *StaticMinMaxLineWrapperInfo::get();
+ return StaticMinMaxLineWrapperInfo();
}
void SAL_CALL MinMaxLineWrapper::setPropertyValue( const OUString& rPropertyName, const uno::Any& rValue )
{
- Reference< beans::XPropertySet > xPropSet;
-
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- const Sequence< Reference< chart2::XChartType > > aTypes(
- ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
- for( Reference< chart2::XChartType > const & xType : aTypes )
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ const std::vector< rtl::Reference< ChartType > > & aTypes = xDiagram->getChartTypes();
+ for( rtl::Reference< ChartType > const & xType : aTypes )
{
if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
{
- Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY);
- if( xSeriesContainer.is() )
+ const std::vector< rtl::Reference< DataSeries > > & aSeriesSeq( xType->getDataSeries2() );
+ if(!aSeriesSeq.empty())
{
- Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
- if(aSeriesSeq.hasElements())
+ if(aSeriesSeq[0].is())
{
- xPropSet.set(aSeriesSeq[0],uno::UNO_QUERY);
- if(xPropSet.is())
- {
- if( rPropertyName == "LineColor" )
- xPropSet->setPropertyValue( "Color", rValue );
- else if( rPropertyName == "LineTransparence" )
- xPropSet->setPropertyValue( "Transparency", rValue );
- else if( rPropertyName == m_aWrappedLineJointProperty.getOuterName() )
- m_aWrappedLineJointProperty.setPropertyValue( rValue, xPropSet );
- else
- xPropSet->setPropertyValue( rPropertyName, rValue );
- return;
- }
+ if( rPropertyName == "LineColor" )
+ aSeriesSeq[0]->setPropertyValue( "Color", rValue );
+ else if( rPropertyName == "LineTransparence" )
+ aSeriesSeq[0]->setPropertyValue( "Transparency", rValue );
+ else if( rPropertyName == m_aWrappedLineJointProperty.getOuterName() )
+ m_aWrappedLineJointProperty.setPropertyValue( rValue, aSeriesSeq[0] );
+ else
+ aSeriesSeq[0]->setPropertyValue( rPropertyName, rValue );
+ return;
}
}
}
@@ -191,24 +145,19 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( const OUString& rProperty
{
Any aRet;
- Reference< beans::XPropertySet > xPropSet;
+ rtl::Reference< DataSeries > xPropSet;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- const Sequence< Reference< chart2::XChartType > > aTypes(
- ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
- for( Reference< chart2::XChartType > const & xType : aTypes )
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ const std::vector< rtl::Reference< ChartType > > aTypes = xDiagram->getChartTypes();
+ for( rtl::Reference< ChartType > const & xType : aTypes )
{
if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
{
- Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY);
- if( xSeriesContainer.is() )
+ const std::vector< rtl::Reference< DataSeries > > & aSeriesSeq( xType->getDataSeries2() );
+ if(!aSeriesSeq.empty())
{
- Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
- if(aSeriesSeq.hasElements())
- {
- xPropSet.set(aSeriesSeq[0],uno::UNO_QUERY);
- break;
- }
+ xPropSet = aSeriesSeq[0];
+ break;
}
}
}
@@ -269,10 +218,11 @@ uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyValues( const u
if( rNameSeq.hasElements() )
{
aRetSeq.realloc( rNameSeq.getLength() );
+ auto pRetSeq = aRetSeq.getArray();
for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
{
OUString aPropertyName( rNameSeq[nN] );
- aRetSeq[nN] = getPropertyValue( aPropertyName );
+ pRetSeq[nN] = getPropertyValue( aPropertyName );
}
}
return aRetSeq;
@@ -315,10 +265,11 @@ uno::Sequence< beans::PropertyState > SAL_CALL MinMaxLineWrapper::getPropertySta
if( rNameSeq.hasElements() )
{
aRetSeq.realloc( rNameSeq.getLength() );
+ auto pRetSeq = aRetSeq.getArray();
for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
{
OUString aPropertyName( rNameSeq[nN] );
- aRetSeq[nN] = getPropertyState( aPropertyName );
+ pRetSeq[nN] = getPropertyState( aPropertyName );
}
}
return aRetSeq;
@@ -330,9 +281,14 @@ void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const OUString& rProperty
uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const OUString& rPropertyName )
{
- const tPropertyValueMap& rStaticDefaults = *StaticMinMaxLineWrapperDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( StaticMinMaxLineWrapperInfoHelper::get()->getHandleByName( rPropertyName ) ) );
- if( aFound == rStaticDefaults.end() )
+ static const ::chart::tPropertyValueMap aStaticDefaults = []
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ return aTmp;
+ }();
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( StaticMinMaxLineWrapperInfoHelper().getHandleByName( rPropertyName ) ) );
+ if( aFound == aStaticDefaults.end() )
return uno::Any();
return (*aFound).second;
}
@@ -341,7 +297,7 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const OUString& rProper
//getPropertyStates() already declared in XPropertyState
void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( )
{
- const Sequence< beans::Property >& rPropSeq = *StaticMinMaxLineWrapperPropertyArray::get();
+ const Sequence< beans::Property >& rPropSeq = StaticMinMaxLineWrapperPropertyArray();
for(beans::Property const & prop : rPropSeq)
{
setPropertyToDefault( prop.Name );
@@ -360,10 +316,11 @@ uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyDefaults( const
if( rNameSeq.hasElements() )
{
aRetSeq.realloc( rNameSeq.getLength() );
+ auto pRetSeq = aRetSeq.getArray();
for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
{
OUString aPropertyName( rNameSeq[nN] );
- aRetSeq[nN] = getPropertyDefault( aPropertyName );
+ pRetSeq[nN] = getPropertyDefault( aPropertyName );
}
}
return aRetSeq;
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
index 1ef4367c8f7d..337ca8bdebd7 100644
--- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
@@ -18,9 +18,8 @@
*/
#pragma once
-#include <MutexContainer.hxx>
#include <WrappedIgnoreProperty.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
@@ -37,8 +36,7 @@ namespace chart::wrapper
class Chart2ModelContact;
-class MinMaxLineWrapper : public MutexContainer
- , public ::cppu::WeakImplHelper
+class MinMaxLineWrapper : public ::cppu::WeakImplHelper
< css::lang::XComponent
, css::lang::XServiceInfo
, css::beans::XPropertySet
@@ -48,7 +46,7 @@ class MinMaxLineWrapper : public MutexContainer
>
{
public:
- explicit MinMaxLineWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit MinMaxLineWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~MinMaxLineWrapper() override;
/// XServiceInfo declarations
@@ -93,8 +91,9 @@ public:
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override;
private: //member
+ std::mutex m_aMutex;
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
WrappedIgnoreProperty m_aWrappedLineJointProperty;
};
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
index 7de1b376b3ef..129798d3706f 100644
--- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
@@ -26,8 +26,6 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/XTitle.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <CharacterProperties.hxx>
#include <LinePropertiesHelper.hxx>
@@ -41,10 +39,10 @@
#include <algorithm>
#include <rtl/ustrbuf.hxx>
#include <cppuhelper/propshlp.hxx>
+#include <utility>
using namespace ::com::sun::star;
using ::com::sun::star::beans::Property;
-using ::osl::MutexGuard;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -76,12 +74,12 @@ WrappedTitleStringProperty::WrappedTitleStringProperty( const Reference< uno::XC
void WrappedTitleStringProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
{
- Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
- if(xTitle.is())
+ Title* pTitle = dynamic_cast<Title*>(xInnerPropertySet.get());
+ if(pTitle)
{
OUString aString;
rOuterValue >>= aString;
- TitleHelper::setCompleteString( aString, xTitle, m_xContext );
+ TitleHelper::setCompleteString( aString, pTitle, m_xContext );
}
}
Any WrappedTitleStringProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
@@ -108,6 +106,51 @@ Any WrappedTitleStringProperty::getPropertyDefault( const Reference< beans::XPro
namespace {
+ class WrappedTitleFormStringsProperty : public WrappedProperty
+ {
+ public:
+ explicit WrappedTitleFormStringsProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const override;
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const override;
+ virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const override;
+ };
+
+}
+
+WrappedTitleFormStringsProperty::WrappedTitleFormStringsProperty()
+ : ::chart::WrappedProperty( "FormattedStrings", OUString() )
+{
+}
+
+void WrappedTitleFormStringsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+{
+ Title* pTitle = dynamic_cast<Title*>(xInnerPropertySet.get());
+ if (pTitle)
+ {
+ Sequence< Reference< chart2::XFormattedString >> xFormattedStrings;
+ rOuterValue >>= xFormattedStrings;
+ TitleHelper::setFormattedString(pTitle, xFormattedStrings);
+ }
+}
+Any WrappedTitleFormStringsProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+{
+ Any aRet(getPropertyDefault(Reference< beans::XPropertyState >(xInnerPropertySet, uno::UNO_QUERY)));
+ Reference< chart2::XTitle > xTitle(xInnerPropertySet, uno::UNO_QUERY);
+ if (xTitle.is())
+ {
+ const Sequence< Reference< chart2::XFormattedString > > aStrings(xTitle->getText());
+ aRet <<= aStrings;
+ }
+ return aRet;
+}
+Any WrappedTitleFormStringsProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+{
+ return uno::Any(Sequence< Reference< chart2::XFormattedString > >()); //default title is an empty Sequence of XFormattedStrings
+}
+
+namespace {
+
class WrappedStackedTextProperty : public WrappedProperty
{
public:
@@ -129,6 +172,8 @@ namespace
enum
{
PROP_TITLE_STRING,
+ PROP_TITLE_FORMATTED_STRINGS,
+ PROP_TITLE_VISIBLE,
PROP_TITLE_TEXT_ROTATION,
PROP_TITLE_TEXT_STACKED
};
@@ -142,6 +187,18 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID );
+ rOutProperties.emplace_back( "FormattedStrings",
+ PROP_TITLE_FORMATTED_STRINGS,
+ cppu::UnoType< Sequence< Reference< chart2::XFormattedString >>>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID );
+
+ rOutProperties.emplace_back( "Visible",
+ PROP_TITLE_VISIBLE,
+ cppu::UnoType<OUString>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID );
+
rOutProperties.emplace_back( "TextRotation",
PROP_TITLE_TEXT_ROTATION,
cppu::UnoType<sal_Int32>::get(),
@@ -154,36 +211,27 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticTitleWrapperPropertyArray_Initializer
+const Sequence< Property > & StaticTitleWrapperPropertyArray()
{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
- ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
- ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
};
-struct StaticTitleWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticTitleWrapperPropertyArray_Initializer >
-{
-};
} // anonymous namespace
@@ -191,14 +239,13 @@ namespace chart::wrapper
{
TitleWrapper::TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
- const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact ) :
- m_spChart2ModelContact( spChart2ModelContact ),
- m_aEventListenerContainer( m_aMutex ),
+ std::shared_ptr<Chart2ModelContact> spChart2ModelContact ) :
+ m_spChart2ModelContact(std::move( spChart2ModelContact )),
m_eTitleType(eTitleType)
{
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChart2Document() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
if( !getTitleObject().is() ) //#i83831# create an empty title at the model, thus references to properties can be mapped correctly
- TitleHelper::createTitle( m_eTitleType, OUString(), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ TitleHelper::createTitle( m_eTitleType, OUString(), m_spChart2ModelContact->getDocumentModel(), m_spChart2ModelContact->m_xContext );
}
TitleWrapper::~TitleWrapper()
@@ -245,38 +292,25 @@ OUString SAL_CALL TitleWrapper::getShapeType()
// ____ XComponent ____
void SAL_CALL TitleWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
- MutexGuard aGuard( m_aMutex);
clearWrappedPropertySet();
}
void SAL_CALL TitleWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL TitleWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
-}
-
-Reference< beans::XPropertySet > TitleWrapper::getFirstCharacterPropertySet()
-{
- Reference< beans::XPropertySet > xProp;
-
- Reference< chart2::XTitle > xTitle( getTitleObject() );
- if( xTitle.is())
- {
- Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
- if( aStrings.hasElements() )
- xProp.set( aStrings[0], uno::UNO_QUERY );
- }
-
- return xProp;
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
void TitleWrapper::getFastCharacterPropertyValue( sal_Int32 nHandle, Any& rValue )
@@ -284,7 +318,7 @@ void TitleWrapper::getFastCharacterPropertyValue( sal_Int32 nHandle, Any& rValue
OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
- Reference< beans::XPropertySet > xProp = getFirstCharacterPropertySet();
+ Reference< beans::XPropertySet > xProp = getInnerPropertySet();
Reference< beans::XFastPropertySet > xFastProp( xProp, uno::UNO_QUERY );
if(xProp.is())
{
@@ -324,6 +358,16 @@ void TitleWrapper::setFastCharacterPropertyValue(
else if( xFastPropertySet.is() )
xFastPropertySet->setFastPropertyValue( nHandle, rValue );
}
+
+ Reference< beans::XPropertySet > xInnerProp = getInnerPropertySet();
+ Reference< beans::XFastPropertySet > xFastInnerProp( xInnerProp, uno::UNO_QUERY );
+ if (xInnerProp.is())
+ {
+ if (pWrappedProperty)
+ pWrappedProperty->setPropertyValue(rValue, xInnerProp);
+ else if (xFastInnerProp.is())
+ xFastInnerProp->setFastPropertyValue(nHandle, rValue);
+ }
}
// WrappedPropertySet
@@ -357,7 +401,7 @@ beans::PropertyState SAL_CALL TitleWrapper::getPropertyState( const OUString& rP
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
{
- Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ Reference< beans::XPropertyState > xPropState( getInnerPropertySet(), uno::UNO_QUERY);
if( xPropState.is() )
{
const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
@@ -390,7 +434,7 @@ Any SAL_CALL TitleWrapper::getPropertyDefault( const OUString& rPropertyName )
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
{
- Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ Reference< beans::XPropertyState > xPropState( getInnerPropertySet(), uno::UNO_QUERY );
if( xPropState.is() )
{
const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
@@ -411,7 +455,7 @@ void SAL_CALL TitleWrapper::addPropertyChangeListener( const OUString& rProperty
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
{
- Reference< beans::XPropertySet > xPropSet = getFirstCharacterPropertySet();
+ Reference< beans::XPropertySet > xPropSet = getInnerPropertySet();
if( xPropSet.is() )
xPropSet->addPropertyChangeListener( rPropertyName, xListener );
}
@@ -423,7 +467,7 @@ void SAL_CALL TitleWrapper::removePropertyChangeListener( const OUString& rPrope
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
{
- Reference< beans::XPropertySet > xPropSet = getFirstCharacterPropertySet();
+ Reference< beans::XPropertySet > xPropSet = getInnerPropertySet();
if( xPropSet.is() )
xPropSet->removePropertyChangeListener( rPropertyName, xListener );
}
@@ -458,7 +502,7 @@ awt::Size TitleWrapper::getCurrentSizeForReference()
Reference< chart2::XTitle > TitleWrapper::getTitleObject()
{
- return TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
+ return TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getDocumentModel() );
}
// WrappedPropertySet
@@ -470,7 +514,7 @@ Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet()
const Sequence< beans::Property >& TitleWrapper::getPropertySequence()
{
- return *StaticTitleWrapperPropertyArray::get();
+ return StaticTitleWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > TitleWrapper::createWrappedProperties()
@@ -478,6 +522,7 @@ std::vector< std::unique_ptr<WrappedProperty> > TitleWrapper::createWrappedPrope
std::vector< std::unique_ptr<WrappedProperty> > aWrappedProperties;
aWrappedProperties.emplace_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
+ aWrappedProperties.emplace_back( new WrappedTitleFormStringsProperty() );
aWrappedProperties.emplace_back( new WrappedTextRotationProperty( true ) );
aWrappedProperties.emplace_back( new WrappedStackedTextProperty() );
WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
index 71a0878d9e3a..aecf5f304231 100644
--- a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
@@ -22,7 +22,7 @@
#include "ReferenceSizePropertyProvider.hxx"
#include <TitleHelper.hxx>
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -45,7 +45,7 @@ class TitleWrapper final : public ::cppu::ImplInheritanceHelper<
{
public:
TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
- const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact );
+ std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
virtual ~TitleWrapper() override;
/// XServiceInfo declarations
@@ -100,7 +100,7 @@ private:
css::uno::Reference< css::chart2::XTitle > getTitleObject();
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
::chart::TitleHelper::eTitleType m_eTitleType;
};
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
index ab7e5b333a2c..c63090d81ac8 100644
--- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
@@ -19,20 +19,19 @@
#include "UpDownBarWrapper.hxx"
#include "Chart2ModelContact.hxx"
-#include <DiagramHelper.hxx>
+#include <ChartType.hxx>
#include <servicenames_charttypes.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/propshlp.hxx>
-#include <com/sun/star/chart2/XChartType.hpp>
#include <comphelper/sequence.hxx>
#include <LinePropertiesHelper.hxx>
#include <FillProperties.hxx>
#include <UserDefinedProperties.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Reference;
@@ -42,79 +41,28 @@ using ::com::sun::star::uno::Any;
namespace
{
-struct StaticUpDownBarWrapperPropertyArray_Initializer
+const Sequence< Property > & StaticUpDownBarWrapperPropertyArray()
{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
-
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticUpDownBarWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticUpDownBarWrapperPropertyArray_Initializer >
-{
-};
-
-struct StaticUpDownBarWrapperInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( *StaticUpDownBarWrapperPropertyArray::get() );
- return &aPropHelper;
- }
-};
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
-struct StaticUpDownBarWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticUpDownBarWrapperInfoHelper_Initializer >
-{
-};
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-struct StaticUpDownBarWrapperInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticUpDownBarWrapperInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticUpDownBarWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticUpDownBarWrapperInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
};
-struct StaticUpDownBarWrapperDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap );
- ::chart::FillProperties::AddDefaultsToMap( rOutMap );
- }
-};
-
-struct StaticUpDownBarWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticUpDownBarWrapperDefaults_Initializer >
+::cppu::OPropertyArrayHelper& StaticUpDownBarWrapperInfoHelper()
{
+ static ::cppu::OPropertyArrayHelper aPropHelper( StaticUpDownBarWrapperPropertyArray() );
+ return aPropHelper;
};
} // anonymous namespace
@@ -123,9 +71,8 @@ namespace chart::wrapper
{
UpDownBarWrapper::UpDownBarWrapper(
- bool bUp, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
- : m_spChart2ModelContact( spChart2ModelContact )
- , m_aEventListenerContainer( m_aMutex )
+ bool bUp, std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
+ : m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_aPropertySetName( bUp ? OUString( "WhiteDay" ) : OUString( "BlackDay" ))
{
}
@@ -137,42 +84,44 @@ UpDownBarWrapper::~UpDownBarWrapper()
// ____ XComponent ____
void SAL_CALL UpDownBarWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
}
void SAL_CALL UpDownBarWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL UpDownBarWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
//XPropertySet
uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::getPropertySetInfo()
{
- return *StaticUpDownBarWrapperInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticUpDownBarWrapperInfoHelper() ) );
+ return xPropertySetInfo;
}
+
void SAL_CALL UpDownBarWrapper::setPropertyValue( const OUString& rPropertyName, const uno::Any& rValue )
{
Reference< beans::XPropertySet > xPropSet;
- const Sequence< Reference< chart2::XChartType > > aTypes(
- ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
- for( Reference< chart2::XChartType > const & xType : aTypes )
+ const std::vector< rtl::Reference< ChartType > > aTypes =
+ m_spChart2ModelContact->getDiagram()->getChartTypes();
+ for( rtl::Reference< ChartType > const & xType : aTypes )
{
if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
{
- Reference< beans::XPropertySet > xTypeProps( xType, uno::UNO_QUERY );
- if(xTypeProps.is())
- {
- xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet;
- }
+ xType->getPropertyValue( m_aPropertySetName ) >>= xPropSet;
}
}
if(xPropSet.is())
@@ -184,17 +133,13 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyValue( const OUString& rPropertyN
Reference< beans::XPropertySet > xPropSet;
- const Sequence< Reference< chart2::XChartType > > aTypes(
- ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
- for( Reference< chart2::XChartType > const & xType : aTypes )
+ const std::vector< rtl::Reference< ChartType > > aTypes =
+ m_spChart2ModelContact->getDiagram()->getChartTypes();
+ for( rtl::Reference<ChartType > const & xType : aTypes )
{
if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
{
- Reference< beans::XPropertySet > xTypeProps( xType, uno::UNO_QUERY );
- if(xTypeProps.is())
- {
- xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet;
- }
+ xType->getPropertyValue( m_aPropertySetName ) >>= xPropSet;
}
}
if(xPropSet.is())
@@ -244,10 +189,11 @@ uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyValues( const un
if( rNameSeq.hasElements() )
{
aRetSeq.realloc( rNameSeq.getLength() );
+ auto pRetSeq = aRetSeq.getArray();
for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
{
OUString aPropertyName( rNameSeq[nN] );
- aRetSeq[nN] = getPropertyValue( aPropertyName );
+ pRetSeq[nN] = getPropertyValue( aPropertyName );
}
}
return aRetSeq;
@@ -282,10 +228,11 @@ uno::Sequence< beans::PropertyState > SAL_CALL UpDownBarWrapper::getPropertyStat
if( rNameSeq.hasElements() )
{
aRetSeq.realloc( rNameSeq.getLength() );
+ auto pRetSeq = aRetSeq.getArray();
for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
{
OUString aPropertyName( rNameSeq[nN] );
- aRetSeq[nN] = getPropertyState( aPropertyName );
+ pRetSeq[nN] = getPropertyState( aPropertyName );
}
}
return aRetSeq;
@@ -297,9 +244,15 @@ void SAL_CALL UpDownBarWrapper::setPropertyToDefault( const OUString& rPropertyN
uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const OUString& rPropertyName )
{
- const tPropertyValueMap& rStaticDefaults = *StaticUpDownBarWrapperDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( StaticUpDownBarWrapperInfoHelper::get()->getHandleByName( rPropertyName ) ) );
- if( aFound == rStaticDefaults.end() )
+ static const ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ ::chart::FillProperties::AddDefaultsToMap( aTmp );
+ return aTmp;
+ }();
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( StaticUpDownBarWrapperInfoHelper().getHandleByName( rPropertyName ) ) );
+ if( aFound == aStaticDefaults.end() )
return uno::Any();
return (*aFound).second;
}
@@ -308,7 +261,7 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const OUString& rPropert
//getPropertyStates() already declared in XPropertyState
void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( )
{
- const Sequence< beans::Property >& rPropSeq = *StaticUpDownBarWrapperPropertyArray::get();
+ const Sequence< beans::Property >& rPropSeq = StaticUpDownBarWrapperPropertyArray();
for(beans::Property const & prop : rPropSeq)
{
setPropertyToDefault( prop.Name );
@@ -327,10 +280,11 @@ uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyDefaults( const
if( rNameSeq.hasElements() )
{
aRetSeq.realloc( rNameSeq.getLength() );
+ auto pRetSeq = aRetSeq.getArray();
for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
{
OUString aPropertyName( rNameSeq[nN] );
- aRetSeq[nN] = getPropertyDefault( aPropertyName );
+ pRetSeq[nN] = getPropertyDefault( aPropertyName );
}
}
return aRetSeq;
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
index 1211ff735d9b..517a2406fe2c 100644
--- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
@@ -18,8 +18,7 @@
*/
#pragma once
-#include <MutexContainer.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
@@ -36,8 +35,7 @@ namespace chart::wrapper
class Chart2ModelContact;
-class UpDownBarWrapper : public MutexContainer
- , public ::cppu::WeakImplHelper
+class UpDownBarWrapper : public ::cppu::WeakImplHelper
< css::lang::XComponent
, css::lang::XServiceInfo
, css::beans::XPropertySet
@@ -47,7 +45,7 @@ class UpDownBarWrapper : public MutexContainer
>
{
public:
- UpDownBarWrapper(bool bUp, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ UpDownBarWrapper(bool bUp, std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~UpDownBarWrapper() override;
/// XServiceInfo declarations
@@ -94,8 +92,9 @@ public:
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override;
private: //member
+ std::mutex m_aMutex;
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
OUString m_aPropertySetName;
};
diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
index daa0f1de4f20..9c8a6f61afb0 100644
--- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
@@ -21,7 +21,6 @@
#include "Chart2ModelContact.hxx"
#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <com/sun/star/chart2/XDiagram.hpp>
#include <FillProperties.hxx>
#include <LinePropertiesHelper.hxx>
@@ -29,54 +28,20 @@
#include <WrappedDirectStateProperty.hxx>
#include <algorithm>
+#include <utility>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using ::com::sun::star::beans::Property;
-using ::osl::MutexGuard;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
-namespace
-{
-
-struct StaticWallFloorWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
- return &aPropSeq;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticWallFloorWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticWallFloorWrapperPropertyArray_Initializer >
-{
-};
-
-} // anonymous namespace
-
namespace chart::wrapper
{
WallFloorWrapper::WallFloorWrapper( bool bWall,
- const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact ) :
- m_spChart2ModelContact( spChart2ModelContact ),
- m_aEventListenerContainer( m_aMutex ),
+ std::shared_ptr<Chart2ModelContact> spChart2ModelContact ) :
+ m_spChart2ModelContact(std::move( spChart2ModelContact )),
m_bWall( bWall )
{
@@ -89,23 +54,25 @@ WallFloorWrapper::~WallFloorWrapper()
// ____ XComponent ____
void SAL_CALL WallFloorWrapper::dispose()
{
+ std::unique_lock g(m_aMutex);
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
- MutexGuard aGuard( m_aMutex);
clearWrappedPropertySet();
}
void SAL_CALL WallFloorWrapper::addEventListener(
const Reference< lang::XEventListener >& xListener )
{
- m_aEventListenerContainer.addInterface( xListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.addInterface( g, xListener );
}
void SAL_CALL WallFloorWrapper::removeEventListener(
const Reference< lang::XEventListener >& aListener )
{
- m_aEventListenerContainer.removeInterface( aListener );
+ std::unique_lock g(m_aMutex);
+ m_aEventListenerContainer.removeInterface( g, aListener );
}
// WrappedPropertySet
@@ -113,7 +80,7 @@ Reference< beans::XPropertySet > WallFloorWrapper::getInnerPropertySet()
{
Reference< beans::XPropertySet > xRet;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
{
if( m_bWall )
@@ -127,7 +94,19 @@ Reference< beans::XPropertySet > WallFloorWrapper::getInnerPropertySet()
const Sequence< beans::Property >& WallFloorWrapper::getPropertySequence()
{
- return *StaticWallFloorWrapperPropertyArray::get();
+ static Sequence< Property > aPropSeq = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropSeq;
}
std::vector< std::unique_ptr<WrappedProperty> > WallFloorWrapper::createWrappedProperties()
diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
index b538d55f1d9d..4a85bd8d5b37 100644
--- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
@@ -20,7 +20,7 @@
#include <WrappedPropertySet.hxx>
#include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -38,7 +38,7 @@ class WallFloorWrapper : public ::cppu::ImplInheritanceHelper<
>
{
public:
- WallFloorWrapper(bool bWall, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ WallFloorWrapper(bool bWall, std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~WallFloorWrapper() override;
/// XServiceInfo declarations
@@ -59,7 +59,7 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
bool m_bWall;
};
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx
index 2bfb5ed42211..b88468c9941e 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx
@@ -23,7 +23,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Any;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
index 5ee50f4dbd73..2b047ebfaf82 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
@@ -23,12 +23,12 @@
#include "WrappedAxisAndGridExistenceProperties.hxx"
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/chart2/XAxis.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <WrappedProperty.hxx>
#include "Chart2ModelContact.hxx"
#include <TitleHelper.hxx>
+#include <utility>
#include <osl/diagnose.h>
using namespace ::com::sun::star;
@@ -44,7 +44,7 @@ class WrappedAxisAndGridExistenceProperty : public WrappedProperty
{
public:
WrappedAxisAndGridExistenceProperty( bool bAxis, bool bMain, sal_Int32 nDimensionIndex
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact );
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -80,9 +80,9 @@ void WrappedAxisAndGridExistenceProperties::addWrappedProperties( std::vector< s
}
WrappedAxisAndGridExistenceProperty::WrappedAxisAndGridExistenceProperty( bool bAxis, bool bMain, sal_Int32 nDimensionIndex
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact )
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact )
: WrappedProperty(OUString(),OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_bAxis( bAxis )
, m_bMain( bMain )
, m_nDimensionIndex( nDimensionIndex )
@@ -157,7 +157,7 @@ void WrappedAxisAndGridExistenceProperty::setPropertyValue( const Any& rOuterVal
if( bOldValue == bNewValue )
return;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( bNewValue )
{
if( m_bAxis )
@@ -177,7 +177,7 @@ void WrappedAxisAndGridExistenceProperty::setPropertyValue( const Any& rOuterVal
Any WrappedAxisAndGridExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
{
Any aRet;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if(m_bAxis)
{
bool bShown = AxisHelper::isAxisShown( m_nDimensionIndex, m_bMain, xDiagram );
@@ -204,7 +204,7 @@ class WrappedAxisTitleExistenceProperty : public WrappedProperty
{
public:
WrappedAxisTitleExistenceProperty( sal_Int32 nTitleIndex
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact );
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -230,9 +230,9 @@ void WrappedAxisTitleExistenceProperties::addWrappedProperties( std::vector< std
}
WrappedAxisTitleExistenceProperty::WrappedAxisTitleExistenceProperty(sal_Int32 nTitleIndex
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty(OUString(),OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_eTitleType( TitleHelper::Y_AXIS_TITLE )
{
switch( nTitleIndex )
@@ -275,11 +275,11 @@ void WrappedAxisTitleExistenceProperty::setPropertyValue( const Any& rOuterValue
if( bNewValue )
{
TitleHelper::createTitle( m_eTitleType, OUString()
- , m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ , m_spChart2ModelContact->getDocumentModel(), m_spChart2ModelContact->m_xContext );
}
else
{
- TitleHelper::removeTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
+ TitleHelper::removeTitle( m_eTitleType, m_spChart2ModelContact->getDocumentModel() );
}
}
@@ -287,7 +287,7 @@ Any WrappedAxisTitleExistenceProperty::getPropertyValue( const Reference< beans:
{
bool bHasTitle = false;
- Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() ) );
+ rtl::Reference< Title > xTitle( TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getDocumentModel() ) );
if( xTitle.is() && !TitleHelper::getCompleteString( xTitle ).isEmpty() )
bHasTitle = true;
@@ -310,7 +310,7 @@ class WrappedAxisLabelExistenceProperty : public WrappedProperty
{
public:
WrappedAxisLabelExistenceProperty( bool bMain, sal_Int32 nDimensionIndex
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact );
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -337,9 +337,9 @@ void WrappedAxisLabelExistenceProperties::addWrappedProperties( std::vector< std
}
WrappedAxisLabelExistenceProperty::WrappedAxisLabelExistenceProperty(bool bMain, sal_Int32 nDimensionIndex
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty(OUString(),OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_bMain( bMain )
, m_nDimensionIndex( nDimensionIndex )
{
@@ -370,12 +370,12 @@ void WrappedAxisLabelExistenceProperty::setPropertyValue( const Any& rOuterValue
if( bOldValue == bNewValue )
return;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- Reference< beans::XPropertySet > xProp( AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram ), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ rtl::Reference< Axis > xProp = AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram );
if( !xProp.is() && bNewValue )
{
//create axis if needed
- xProp.set( AxisHelper::createAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext ), uno::UNO_QUERY );
+ xProp = AxisHelper::createAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
if( xProp.is() )
xProp->setPropertyValue( "Show", uno::Any( false ) );
}
@@ -386,8 +386,8 @@ void WrappedAxisLabelExistenceProperty::setPropertyValue( const Any& rOuterValue
Any WrappedAxisLabelExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
Any aRet;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- Reference< beans::XPropertySet > xProp( AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram ), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ rtl::Reference< Axis > xProp = AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram );
if( xProp.is() )
aRet = xProp->getPropertyValue( "DisplayLabels" );
else
diff --git a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
index 7eee90a2c209..be9457d0ffd7 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
@@ -45,7 +45,7 @@ protected:
virtual css::uno::Any convertInnerToOuterValue( const css::uno::Any& rInnerValue ) const override;
virtual css::uno::Any convertOuterToInnerValue( const css::uno::Any& rOuterValue ) const override;
-protected:
+private:
ReferenceSizePropertyProvider* m_pRefSizePropProvider;
};
diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
index c786c1b3913c..d317210c3608 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
@@ -65,13 +65,15 @@ sal_Int32 lcl_LabelToCaption( const chart2::DataPointLabel& rLabel )
nCaption |= css::chart::ChartDataCaption::TEXT;
if( rLabel.ShowLegendSymbol )
nCaption |= css::chart::ChartDataCaption::SYMBOL;
+ if (rLabel.ShowSeriesName)
+ nCaption |= css::chart::ChartDataCaption::DATA_SERIES;
return nCaption;
}
chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption )
{
- chart2::DataPointLabel aLabel(false,false,false,false,false);
+ chart2::DataPointLabel aLabel(false,false,false,false,false,false);
if( nCaption & css::chart::ChartDataCaption::VALUE )
aLabel.ShowNumber = true;
@@ -83,6 +85,8 @@ chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption )
aLabel.ShowLegendSymbol = true;
if( nCaption & css::chart::ChartDataCaption::CUSTOM )
aLabel.ShowCustomLabel = true;
+ if( nCaption & css::chart::ChartDataCaption::DATA_SERIES )
+ aLabel.ShowSeriesName = true;
return aLabel;
}
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
index b49c5177dc2e..079d25f63bb4 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
@@ -17,10 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstddef>
+
#include "WrappedGapwidthProperty.hxx"
#include "Chart2ModelContact.hxx"
-#include <DiagramHelper.hxx>
+#include <ChartType.hxx>
#include <tools/long.hxx>
+#include <utility>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -35,15 +40,15 @@ const sal_Int32 DEFAULT_OVERLAP = 0;
WrappedBarPositionProperty_Base::WrappedBarPositionProperty_Base(
const OUString& rOuterName
- , const OUString& rInnerSequencePropertyName
+ , OUString aInnerSequencePropertyName
, sal_Int32 nDefaultValue
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact )
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact )
: WrappedDefaultProperty( rOuterName, OUString(), uno::Any( nDefaultValue ) )
, m_nDimensionIndex(0)
, m_nAxisIndex(0)
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_nDefaultValue( nDefaultValue )
- , m_InnerSequencePropertyName( rInnerSequencePropertyName )
+ , m_InnerSequencePropertyName(std::move( aInnerSequencePropertyName ))
{
}
@@ -65,37 +70,32 @@ void WrappedBarPositionProperty_Base::setPropertyValue( const Any& rOuterValue,
m_aOuterValue = rOuterValue;
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( !xDiagram.is() )
return;
if( m_nDimensionIndex!=1 )
return;
- const Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
- for( Reference< chart2::XChartType > const & chartType : aChartTypeList )
+ const std::vector< rtl::Reference< ChartType > > aChartTypeList( xDiagram->getChartTypes() );
+ for( rtl::Reference< ChartType > const & chartType : aChartTypeList )
{
try
{
- Reference< beans::XPropertySet > xProp( chartType, uno::UNO_QUERY );
- if( xProp.is() )
+ Sequence< sal_Int32 > aBarPositionSequence;
+ chartType->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence;
+
+ tools::Long nOldLength = aBarPositionSequence.getLength();
+ if( nOldLength <= m_nAxisIndex )
+ aBarPositionSequence.realloc( m_nAxisIndex+1 );
+ auto pBarPositionSequence = aBarPositionSequence.getArray();
+ for( sal_Int32 i=nOldLength; i<m_nAxisIndex; i++ )
{
- Sequence< sal_Int32 > aBarPositionSequence;
- xProp->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence;
-
- tools::Long nOldLength = aBarPositionSequence.getLength();
- if( nOldLength <= m_nAxisIndex )
- {
- aBarPositionSequence.realloc( m_nAxisIndex+1 );
- for( sal_Int32 i=nOldLength; i<m_nAxisIndex; i++ )
- {
- aBarPositionSequence[i] = m_nDefaultValue;
- }
- }
- aBarPositionSequence[m_nAxisIndex] = nNewValue;
-
- xProp->setPropertyValue( m_InnerSequencePropertyName, uno::Any( aBarPositionSequence ) );
+ pBarPositionSequence[i] = m_nDefaultValue;
}
+ pBarPositionSequence[m_nAxisIndex] = nNewValue;
+
+ chartType->setPropertyValue( m_InnerSequencePropertyName, uno::Any( aBarPositionSequence ) );
}
catch( uno::Exception& e )
{
@@ -108,7 +108,7 @@ void WrappedBarPositionProperty_Base::setPropertyValue( const Any& rOuterValue,
Any WrappedBarPositionProperty_Base::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() )
{
bool bInnerValueDetected = false;
@@ -116,21 +116,17 @@ Any WrappedBarPositionProperty_Base::getPropertyValue( const Reference< beans::X
if( m_nDimensionIndex==1 )
{
- Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
- for( sal_Int32 nN = 0; nN < aChartTypeList.getLength() && !bInnerValueDetected; nN++ )
+ std::vector< rtl::Reference< ChartType > > aChartTypeList = xDiagram->getChartTypes();
+ for( std::size_t nN = 0; nN < aChartTypeList.size() && !bInnerValueDetected; nN++ )
{
try
{
- Reference< beans::XPropertySet > xProp( aChartTypeList[nN], uno::UNO_QUERY );
- if( xProp.is() )
+ Sequence< sal_Int32 > aBarPositionSequence;
+ aChartTypeList[nN]->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence;
+ if( m_nAxisIndex < aBarPositionSequence.getLength() )
{
- Sequence< sal_Int32 > aBarPositionSequence;
- xProp->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence;
- if( m_nAxisIndex < aBarPositionSequence.getLength() )
- {
- nInnerValue = aBarPositionSequence[m_nAxisIndex];
- bInnerValueDetected = true;
- }
+ nInnerValue = aBarPositionSequence[m_nAxisIndex];
+ bInnerValueDetected = true;
}
}
catch( uno::Exception& e )
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
index 550b0ce6ad9d..6ac43e9f7635 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
@@ -32,9 +32,9 @@ class WrappedBarPositionProperty_Base : public WrappedDefaultProperty
public:
WrappedBarPositionProperty_Base(
const OUString& rOuterName
- , const OUString& rInnerSequencePropertyName
+ , OUString aInnerSequencePropertyName
, sal_Int32 nDefaultValue
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact );
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
virtual ~WrappedBarPositionProperty_Base() override;
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -43,7 +43,7 @@ public:
void setDimensionAndAxisIndex( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
-protected:
+private:
sal_Int32 m_nDimensionIndex;
sal_Int32 m_nAxisIndex;
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
index 1ce277c321ba..0598b4fd377f 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
@@ -19,9 +19,10 @@
#include "WrappedNumberFormatProperty.hxx"
#include "Chart2ModelContact.hxx"
-#include <com/sun/star/chart2/XAxis.hpp>
+#include <Axis.hxx>
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <unonames.hxx>
+#include <utility>
#include <osl/diagnose.h>
using namespace ::com::sun::star;
@@ -31,9 +32,9 @@ using ::com::sun::star::uno::Any;
namespace chart::wrapper
{
-WrappedNumberFormatProperty::WrappedNumberFormatProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedNumberFormatProperty::WrappedNumberFormatProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedDirectStateProperty( CHART_UNONAME_NUMFMT, CHART_UNONAME_NUMFMT )
- , m_spChart2ModelContact(spChart2ModelContact)
+ , m_spChart2ModelContact(std::move(spChart2ModelContact))
{
}
@@ -67,7 +68,8 @@ Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XProp
nKey = Chart2ModelContact::getExplicitNumberFormatKeyForSeries( xSeries );
else
{
- Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ rtl::Reference< Axis > xAxis = dynamic_cast<Axis*>(xInnerPropertySet.get());
+ assert(xAxis || !xInnerPropertySet);
nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
}
aRet <<= nKey;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
index fa4042ceaedf..cf2f706c61c7 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
@@ -31,7 +31,7 @@ namespace chart::wrapper
class WrappedNumberFormatProperty : public WrappedDirectStateProperty
{
public:
- explicit WrappedNumberFormatProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedNumberFormatProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~WrappedNumberFormatProperty() override;
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
index d9ad4a3e6bb4..0edbf16bc9fb 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
@@ -20,11 +20,13 @@
#include "WrappedScaleProperty.hxx"
#include "Chart2ModelContact.hxx"
#include <CommonConverters.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart/ChartAxisType.hpp>
#include <chartview/ExplicitScaleValues.hxx>
+#include <utility>
#include <osl/diagnose.h>
using namespace ::com::sun::star;
@@ -38,9 +40,9 @@ namespace chart::wrapper
{
WrappedScaleProperty::WrappedScaleProperty(tScaleProperty eScaleProperty
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: WrappedProperty(OUString(),OUString())
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
, m_eScaleProperty( eScaleProperty )
{
switch( m_eScaleProperty )
@@ -173,6 +175,7 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons
Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
if( !rSubIncrements.hasElements() )
rSubIncrements.realloc( 1 );
+ auto pSubIncrements = rSubIncrements.getArray();
double fStepHelp = 0;
if( rOuterValue >>= fStepHelp )
@@ -181,14 +184,14 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons
if( AxisHelper::isLogarithmic(aScaleData.Scaling) )
{
sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepHelp);
- rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
}
else if( (fStepHelp != 0.0) &&
(aScaleData.IncrementData.Distance >>= fStepMain) )
{
// approximate interval count
sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp);//cppcheck-suppress zerodiv
- rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
}
}
bSetScaleData = true;
@@ -199,11 +202,12 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons
Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
if( !rSubIncrements.hasElements() )
rSubIncrements.realloc( 1 );
+ auto pSubIncrements = rSubIncrements.getArray();
sal_Int32 nIntervalCount=0;
if( rOuterValue>>=nIntervalCount )
- rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
else
- rSubIncrements[ 0 ].IntervalCount = Any();
+ pSubIncrements[ 0 ].IntervalCount = Any();
bSetScaleData = true;
break;
}
@@ -239,11 +243,12 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons
Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
if( !rSubIncrements.hasElements() )
rSubIncrements.realloc( 1 );
+ auto pSubIncrements = rSubIncrements.getArray();
if( (rOuterValue >>= bBool) && bBool )
- rSubIncrements[ 0 ].IntervalCount = Any();
+ pSubIncrements[ 0 ].IntervalCount = Any();
else
- rSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet );
+ pSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet );
bSetScaleData = true;
break;
}
@@ -345,7 +350,7 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const
{
Any aRet( m_aOuterValue );
- Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ rtl::Reference< Axis > xAxis = dynamic_cast<Axis*>(xInnerPropertySet.get());
OSL_ENSURE(xAxis.is(),"need an XAxis");
if(!xAxis.is())
return aRet;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
index 64e8071b5345..eca52953552d 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
@@ -51,7 +51,7 @@ public:
, SCALE_PROP_REVERSEDIRECTION
};
- WrappedScaleProperty(tScaleProperty eScaleProperty, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ WrappedScaleProperty(tScaleProperty eScaleProperty, std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~WrappedScaleProperty() override;
static void addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList, const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact );
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
index 8551915d9c88..6e11fbe021a2 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
@@ -25,7 +25,8 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Any;
@@ -40,7 +41,7 @@ namespace {
class WrappedScaleTextProperty : public WrappedProperty
{
public:
- explicit WrappedScaleTextProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ explicit WrappedScaleTextProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const override;
virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const override;
@@ -52,15 +53,15 @@ private:
}
-WrappedScaleTextProperty::WrappedScaleTextProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact)
+WrappedScaleTextProperty::WrappedScaleTextProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
: ::chart::WrappedProperty( "ScaleText" , OUString() )
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
}
void WrappedScaleTextProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
{
- static constexpr OUStringLiteral aRefSizeName = u"ReferencePageSize";
+ static constexpr OUString aRefSizeName = u"ReferencePageSize"_ustr;
if( !xInnerPropertySet.is() )
return;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
index d3a883429172..5c22750dc17b 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
@@ -19,8 +19,8 @@
#include "WrappedSceneProperty.hxx"
#include "Chart2ModelContact.hxx"
-#include <DiagramHelper.hxx>
#include <BaseGFXHelper.hxx>
+#include <utility>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Any;
@@ -36,9 +36,9 @@ void WrappedSceneProperty::addWrappedProperties( std::vector< std::unique_ptr<Wr
}
WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
- const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact )
+ std::shared_ptr<Chart2ModelContact> spChart2ModelContact )
: WrappedProperty("D3DTransformMatrix","D3DTransformMatrix")
- , m_spChart2ModelContact( spChart2ModelContact )
+ , m_spChart2ModelContact(std::move( spChart2ModelContact ))
{
}
@@ -48,7 +48,7 @@ WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
{
- if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
+ if( m_spChart2ModelContact->getDiagram()->isPieOrDonutChart() )
{
drawing::HomogenMatrix aHM;
if( rOuterValue >>= aHM )
@@ -73,7 +73,7 @@ void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& rOuterValue
Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
{
- if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
+ if( m_spChart2ModelContact->getDiagram()->isPieOrDonutChart() )
{
uno::Any aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet ) );
drawing::HomogenMatrix aHM;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
index 7e6679016537..31ef35abc566 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
@@ -39,7 +39,7 @@ class WrappedD3DTransformMatrixProperty : public WrappedProperty
{
public:
explicit WrappedD3DTransformMatrixProperty(
- const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact);
+ std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
virtual ~WrappedD3DTransformMatrixProperty() override;
virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx
index 88fa72696c03..5b073ca80152 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <utility>
+
#include "WrappedSeriesAreaOrLineProperty.hxx"
#include "DataSeriesPointWrapper.hxx"
@@ -25,13 +27,13 @@ namespace chart::wrapper
WrappedSeriesAreaOrLineProperty::WrappedSeriesAreaOrLineProperty(
const OUString& rOuterName
- , const OUString& rInnerAreaTypeName
- , const OUString& rInnerLineTypeName
+ , OUString aInnerAreaTypeName
+ , OUString aInnerLineTypeName
, DataSeriesPointWrapper* pDataSeriesPointWrapper )
: WrappedProperty( rOuterName, OUString() )
, m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
- , m_aInnerAreaTypeName( rInnerAreaTypeName )
- , m_aInnerLineTypeName( rInnerLineTypeName )
+ , m_aInnerAreaTypeName(std::move( aInnerAreaTypeName ))
+ , m_aInnerLineTypeName(std::move( aInnerLineTypeName ))
{
}
WrappedSeriesAreaOrLineProperty::~WrappedSeriesAreaOrLineProperty()
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
index ba77b6939f34..f3561e7361d4 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
@@ -28,7 +28,7 @@ class WrappedSeriesAreaOrLineProperty : public WrappedProperty
{
public:
WrappedSeriesAreaOrLineProperty( const OUString& rOuterName
- , const OUString& rInnerAreaTypeName, const OUString& rInnerLineTypeName
+ , OUString aInnerAreaTypeName, OUString aInnerLineTypeName
, DataSeriesPointWrapper* pDataSeriesPointWrapper );
virtual ~WrappedSeriesAreaOrLineProperty() override;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
index 7eb90e8b932b..8b0b54db3d7a 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
@@ -20,9 +20,10 @@
#include <WrappedProperty.hxx>
#include "Chart2ModelContact.hxx"
-#include <DiagramHelper.hxx>
+#include <DataSeries.hxx>
#include <memory>
+#include <utility>
#include <vector>
namespace com::sun::star::chart2 { class XDataSeries; }
@@ -46,10 +47,10 @@ public:
virtual void setValueToSeries( const css::uno::Reference< css::beans::XPropertySet >& xSeriesPropertySet, const PROPERTYTYPE & aNewValue ) const =0;
explicit WrappedSeriesOrDiagramProperty( const OUString& rName, const css::uno::Any& rDefaulValue
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact
, tSeriesOrDiagramPropertyType ePropertyType )
: WrappedProperty(rName,OUString())
- , m_spChart2ModelContact(spChart2ModelContact)
+ , m_spChart2ModelContact(std::move(spChart2ModelContact))
, m_aOuterValue(rDefaulValue)
, m_aDefaultValue(rDefaulValue)
, m_ePropertyType( ePropertyType )
@@ -58,30 +59,31 @@ public:
bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const
{
- bool bHasDetectableInnerValue = false;
rHasAmbiguousValue = false;
- if( m_ePropertyType == DIAGRAM &&
- m_spChart2ModelContact )
+ if( m_ePropertyType != DIAGRAM || !m_spChart2ModelContact )
+ return false;
+ bool bHasDetectableInnerValue = false;
+ rtl::Reference<Diagram> xDiagram = m_spChart2ModelContact->getDiagram();
+ if (!xDiagram)
+ return false;
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector =
+ xDiagram->getDataSeries();
+ for (auto const& series : aSeriesVector)
{
- std::vector< css::uno::Reference< css::chart2::XDataSeries > > aSeriesVector(
- ::chart::DiagramHelper::getDataSeriesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
- for (auto const& series : aSeriesVector)
+ PROPERTYTYPE aCurValue = getValueFromSeries( series );
+ if( !bHasDetectableInnerValue )
+ rValue = aCurValue;
+ else
{
- PROPERTYTYPE aCurValue = getValueFromSeries( css::uno::Reference< css::beans::XPropertySet >::query(series) );
- if( !bHasDetectableInnerValue )
- rValue = aCurValue;
- else
+ if( rValue != aCurValue )
{
- if( rValue != aCurValue )
- {
- rHasAmbiguousValue = true;
- break;
- }
- else
- rValue = aCurValue;
+ rHasAmbiguousValue = true;
+ break;
}
- bHasDetectableInnerValue = true;
+ else
+ rValue = aCurValue;
}
+ bHasDetectableInnerValue = true;
}
return bHasDetectableInnerValue;
}
@@ -90,15 +92,11 @@ public:
if( m_ePropertyType == DIAGRAM &&
m_spChart2ModelContact )
{
- std::vector< css::uno::Reference< css::chart2::XDataSeries > > aSeriesVector(
- ::chart::DiagramHelper::getDataSeriesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector =
+ m_spChart2ModelContact->getDiagram()->getDataSeries();
for (auto const& series : aSeriesVector)
{
- css::uno::Reference< css::beans::XPropertySet > xSeriesPropertySet(series, css::uno::UNO_QUERY);
- if( xSeriesPropertySet.is() )
- {
- setValueToSeries( xSeriesPropertySet, aNewValue );
- }
+ setValueToSeries( series, aNewValue );
}
}
}
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
index ad07a98bcd15..53ce90fa24f9 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -20,7 +20,7 @@
#include "WrappedSplineProperties.hxx"
#include "Chart2ModelContact.hxx"
#include <FastPropertyIdRanges.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartType.hxx>
#include <WrappedProperty.hxx>
#include <unonames.hxx>
@@ -29,10 +29,10 @@
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <utility>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Sequence;
using ::com::sun::star::beans::Property;
namespace chart::wrapper
@@ -47,32 +47,30 @@ template< typename PROPERTYTYPE >
class WrappedSplineProperty : public WrappedProperty
{
public:
- explicit WrappedSplineProperty( const OUString& rOuterName, const OUString& rInnerName
+ explicit WrappedSplineProperty( const OUString& rOuterName, OUString aInnerName
, const css::uno::Any& rDefaulValue
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact )
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact )
: WrappedProperty(rOuterName,OUString())
- , m_spChart2ModelContact(spChart2ModelContact)
+ , m_spChart2ModelContact(std::move(spChart2ModelContact))
, m_aOuterValue(rDefaulValue)
, m_aDefaultValue(rDefaulValue)
- , m_aOwnInnerName(rInnerName)
+ , m_aOwnInnerName(std::move(aInnerName))
{
}
bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const
{
- bool bHasDetectableInnerValue = false;
rHasAmbiguousValue = false;
- Sequence< css::uno::Reference< css::chart2::XChartType > > aChartTypes(
- ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
- for( sal_Int32 nN = aChartTypes.getLength(); nN--; )
+ rtl::Reference<Diagram> xDiagram = m_spChart2ModelContact->getDiagram();
+ if (!xDiagram)
+ return false;
+ bool bHasDetectableInnerValue = false;
+ std::vector< rtl::Reference< ChartType > > aChartTypes = xDiagram->getChartTypes();
+ for( sal_Int32 nN = aChartTypes.size(); nN--; )
{
try
{
- uno::Reference<beans::XPropertySet> xChartTypePropertySet(aChartTypes[nN], uno::UNO_QUERY);
- if (!xChartTypePropertySet.is())
- continue;
-
- Any aSingleValue = convertInnerToOuterValue( xChartTypePropertySet->getPropertyValue(m_aOwnInnerName) );
+ Any aSingleValue = convertInnerToOuterValue( aChartTypes[nN]->getPropertyValue(m_aOwnInnerName) );
PROPERTYTYPE aCurValue = PROPERTYTYPE();
aSingleValue >>= aCurValue;
if( !bHasDetectableInnerValue )
@@ -114,17 +112,13 @@ public:
if( !(bHasAmbiguousValue || aNewValue != aOldValue) )
return;
- Sequence< css::uno::Reference< css::chart2::XChartType > > aChartTypes(
- ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
- for( sal_Int32 nN = aChartTypes.getLength(); nN--; )
+ std::vector< rtl::Reference< ChartType > > aChartTypes =
+ m_spChart2ModelContact->getDiagram()->getChartTypes();
+ for( sal_Int32 nN = aChartTypes.size(); nN--; )
{
try
{
- css::uno::Reference< css::beans::XPropertySet > xChartTypePropertySet( aChartTypes[nN], css::uno::UNO_QUERY );
- if( xChartTypePropertySet.is() )
- {
- xChartTypePropertySet->setPropertyValue(m_aOwnInnerName,convertOuterToInnerValue(uno::Any(aNewValue)));
- }
+ aChartTypes[nN]->setPropertyValue(m_aOwnInnerName,convertOuterToInnerValue(uno::Any(aNewValue)));
}
catch( uno::Exception & ex )
{
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
index 6e12bea50e0a..e5278bb5da49 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
@@ -21,6 +21,7 @@
#include "WrappedSeriesOrDiagramProperty.hxx"
#include <FastPropertyIdRanges.hxx>
#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <ErrorBar.hxx>
#include <StatisticsHelper.hxx>
#include <unonames.hxx>
@@ -31,7 +32,6 @@
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
#include <com/sun/star/chart/ChartRegressionCurveType.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <utility>
@@ -126,8 +126,8 @@ uno::Reference< chart2::data::XDataProvider > lcl_getDataProviderFromContact(
uno::Reference< chart2::data::XDataProvider > xResult;
if( spChart2ModelContact)
{
- uno::Reference< chart2::XChartDocument > xChartDoc(
- spChart2ModelContact->getChart2Document());
+ rtl::Reference< ChartModel > xChartDoc(
+ spChart2ModelContact->getDocumentModel());
if( xChartDoc.is())
xResult.set( xChartDoc->getDataProvider());
}
@@ -144,8 +144,7 @@ void lcl_ConvertRangeFromXML(
lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
if( xConverter.is())
{
- OUString aResult = xConverter->convertRangeFromXML( rInOutRange );
- rInOutRange = aResult;
+ rInOutRange = xConverter->convertRangeFromXML( rInOutRange );
}
}
}
@@ -160,8 +159,7 @@ void lcl_ConvertRangeToXML(
lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
if( xConverter.is())
{
- OUString aResult = xConverter->convertRangeToXML( rInOutRange );
- rInOutRange = aResult;
+ rInOutRange = xConverter->convertRangeToXML( rInOutRange );
}
}
}
@@ -840,9 +838,10 @@ css::chart::ChartRegressionCurveType WrappedRegressionCurvesProperty::getValueFr
void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const css::chart::ChartRegressionCurveType& aNewValue ) const
{
uno::Reference< chart2::XRegressionCurveContainer > xRegressionCurveContainer( xSeriesPropertySet, uno::UNO_QUERY );
- uno::Reference< chart2::XRegressionCurve > xRegressionCurve( xSeriesPropertySet, uno::UNO_QUERY );
-
- if( xRegressionCurveContainer.is() && xRegressionCurve.is() )
+ if (!xRegressionCurveContainer)
+ return;
+ rtl::Reference< ::chart::RegressionCurveModel> xRegressionCurve = RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegressionCurveContainer );
+ if( xRegressionCurve.is() )
{
SvxChartRegress eNewRegressionType = lcl_getRegressionType( aNewValue );
@@ -906,7 +905,7 @@ Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFr
{
case PROPERTY_SET_TYPE_REGRESSION:
if( xRegCnt.is() )
- xResult.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ), uno::UNO_QUERY );
+ xResult = RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt );
break;
case PROPERTY_SET_TYPE_ERROR_BAR:
if( xSeriesPropertySet.is())
@@ -914,7 +913,7 @@ Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFr
break;
case PROPERTY_SET_TYPE_MEAN_VALUE:
if( xRegCnt.is() )
- xResult.set( RegressionCurveHelper::getMeanValueLine( xRegCnt ), uno::UNO_QUERY );
+ xResult = RegressionCurveHelper::getMeanValueLine( xRegCnt );
break;
}
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
index 5e7a2808f832..093321843018 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
@@ -20,13 +20,14 @@
#include "WrappedStockProperties.hxx"
#include "Chart2ModelContact.hxx"
#include <FastPropertyIdRanges.hxx>
-#include <DiagramHelper.hxx>
+#include <DataSeries.hxx>
#include <ControllerLockGuard.hxx>
#include <WrappedProperty.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <ChartTypeManager.hxx>
+#include <ChartTypeTemplate.hxx>
+#include <utility>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -41,14 +42,14 @@ class WrappedStockProperty : public WrappedProperty
{
public:
explicit WrappedStockProperty( const OUString& rOuterName
- , const css::uno::Any& rDefaulValue
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact );
+ , css::uno::Any aDefaultValue
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override;
- virtual uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const = 0;
+ virtual rtl::Reference< ::chart::ChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const rtl::Reference< ::chart::ChartTypeManager >& xFactory ) const = 0;
protected:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
@@ -59,12 +60,11 @@ protected:
}
WrappedStockProperty::WrappedStockProperty( const OUString& rOuterName
- , const css::uno::Any& rDefaulValue
- , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact )
+ , css::uno::Any aDefaultValue
+ , std::shared_ptr<Chart2ModelContact> spChart2ModelContact )
: WrappedProperty(rOuterName,OUString())
- , m_spChart2ModelContact(spChart2ModelContact)
- , m_aOuterValue()
- , m_aDefaultValue(rDefaulValue)
+ , m_spChart2ModelContact(std::move(spChart2ModelContact))
+ , m_aDefaultValue(std::move(aDefaultValue))
{
}
@@ -76,18 +76,20 @@ void WrappedStockProperty::setPropertyValue( const css::uno::Any& rOuterValue, c
m_aOuterValue = rOuterValue;
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram );
- if( !(xChartDoc.is() && xDiagram.is() && nDimension==2) )
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ if( !xChartDoc || !xDiagram )
+ return;
+ sal_Int32 nDimension = xDiagram->getDimension();
+ if( nDimension != 2 )
return;
- Reference< lang::XMultiServiceFactory > xFactory( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram( xDiagram, xFactory );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager();
+ Diagram::tTemplateWithServiceName aTemplateAndService =
+ xDiagram->getTemplate( xChartTypeManager );
- uno::Reference< chart2::XChartTypeTemplate > xTemplate =
- getNewTemplate( bNewValue, aTemplateAndService.second, xFactory );
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate =
+ getNewTemplate( bNewValue, aTemplateAndService.sServiceName, xChartTypeManager );
if(!xTemplate.is())
return;
@@ -95,7 +97,7 @@ void WrappedStockProperty::setPropertyValue( const css::uno::Any& rOuterValue, c
try
{
// locked controllers
- ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
xTemplate->changeDiagram( xDiagram );
}
catch( const uno::Exception & )
@@ -118,7 +120,7 @@ public:
css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
- uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const override;
+ rtl::Reference< ::chart::ChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const rtl::Reference< ::chart::ChartTypeManager >& xFactory ) const override;
};
}
@@ -130,22 +132,22 @@ WrappedVolumeProperty::WrappedVolumeProperty(const std::shared_ptr<Chart2ModelCo
css::uno::Any WrappedVolumeProperty::getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() && xChartDoc.is() )
{
- std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector =
+ xDiagram->getDataSeries();
if( !aSeriesVector.empty() )
{
- Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager();
+ Diagram::tTemplateWithServiceName aTemplateAndService =
+ xDiagram->getTemplate( xChartTypeManager );
- if( aTemplateAndService.second == "com.sun.star.chart2.template.StockVolumeLowHighClose"
- || aTemplateAndService.second == "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" )
+ if( aTemplateAndService.sServiceName == "com.sun.star.chart2.template.StockVolumeLowHighClose"
+ || aTemplateAndService.sServiceName == "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" )
m_aOuterValue <<= true;
- else if( !aTemplateAndService.second.isEmpty() || !m_aOuterValue.hasValue() )
+ else if( !aTemplateAndService.sServiceName.isEmpty() || !m_aOuterValue.hasValue() )
m_aOuterValue <<= false;
}
else if(!m_aOuterValue.hasValue())
@@ -154,9 +156,9 @@ css::uno::Any WrappedVolumeProperty::getPropertyValue( const css::uno::Reference
return m_aOuterValue;
}
-uno::Reference< chart2::XChartTypeTemplate > WrappedVolumeProperty::getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const
+rtl::Reference< ::chart::ChartTypeTemplate > WrappedVolumeProperty::getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const rtl::Reference< ::chart::ChartTypeManager >& xFactory ) const
{
- uno::Reference< chart2::XChartTypeTemplate > xTemplate;
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate;
if(!xFactory.is())
return xTemplate;
@@ -164,16 +166,16 @@ uno::Reference< chart2::XChartTypeTemplate > WrappedVolumeProperty::getNewTempla
if( bNewValue ) //add volume
{
if( rCurrentTemplate == "com.sun.star.chart2.template.StockLowHighClose" )
- xTemplate.set( xFactory->createInstance( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), uno::UNO_QUERY );
+ xTemplate = xFactory->createTemplate( "com.sun.star.chart2.template.StockVolumeLowHighClose" );
else if( rCurrentTemplate == "com.sun.star.chart2.template.StockOpenLowHighClose" )
- xTemplate.set( xFactory->createInstance( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ), uno::UNO_QUERY );
+ xTemplate = xFactory->createTemplate( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" );
}
else //remove volume
{
if( rCurrentTemplate == "com.sun.star.chart2.template.StockVolumeLowHighClose" )
- xTemplate.set( xFactory->createInstance( "com.sun.star.chart2.template.StockLowHighClose" ), uno::UNO_QUERY );
+ xTemplate = xFactory->createTemplate( "com.sun.star.chart2.template.StockLowHighClose" );
else if( rCurrentTemplate == "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" )
- xTemplate.set( xFactory->createInstance( "com.sun.star.chart2.template.StockOpenLowHighClose" ), uno::UNO_QUERY );
+ xTemplate = xFactory->createTemplate( "com.sun.star.chart2.template.StockOpenLowHighClose" );
}
return xTemplate;
}
@@ -187,7 +189,7 @@ public:
css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
- uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const override;
+ rtl::Reference< ::chart::ChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const rtl::Reference< ChartTypeManager >& xFactory ) const override;
};
}
@@ -199,22 +201,22 @@ WrappedUpDownProperty::WrappedUpDownProperty(const std::shared_ptr<Chart2ModelCo
css::uno::Any WrappedUpDownProperty::getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
{
- Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
if( xDiagram.is() && xChartDoc.is() )
{
- std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector =
+ xDiagram->getDataSeries();
if( !aSeriesVector.empty() )
{
- Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager();
+ Diagram::tTemplateWithServiceName aTemplateAndService =
+ xDiagram->getTemplate( xChartTypeManager );
- if( aTemplateAndService.second == "com.sun.star.chart2.template.StockOpenLowHighClose"
- || aTemplateAndService.second == "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" )
+ if( aTemplateAndService.sServiceName == "com.sun.star.chart2.template.StockOpenLowHighClose"
+ || aTemplateAndService.sServiceName == "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" )
m_aOuterValue <<= true;
- else if( !aTemplateAndService.second.isEmpty() || !m_aOuterValue.hasValue() )
+ else if( !aTemplateAndService.sServiceName.isEmpty() || !m_aOuterValue.hasValue() )
m_aOuterValue <<= false;
}
else if(!m_aOuterValue.hasValue())
@@ -222,22 +224,22 @@ css::uno::Any WrappedUpDownProperty::getPropertyValue( const css::uno::Reference
}
return m_aOuterValue;
}
-uno::Reference< chart2::XChartTypeTemplate > WrappedUpDownProperty::getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const
+rtl::Reference< ::chart::ChartTypeTemplate > WrappedUpDownProperty::getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const rtl::Reference< ChartTypeManager >& xFactory ) const
{
- uno::Reference< chart2::XChartTypeTemplate > xTemplate;
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate;
if( bNewValue ) //add open series
{
if( rCurrentTemplate == "com.sun.star.chart2.template.StockLowHighClose" )
- xTemplate.set( xFactory->createInstance( "com.sun.star.chart2.template.StockOpenLowHighClose" ), uno::UNO_QUERY );
+ xTemplate = xFactory->createTemplate( "com.sun.star.chart2.template.StockOpenLowHighClose" );
else if( rCurrentTemplate == "com.sun.star.chart2.template.StockVolumeLowHighClose" )
- xTemplate.set( xFactory->createInstance( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ), uno::UNO_QUERY );
+ xTemplate = xFactory->createTemplate( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" );
}
else //remove open series
{
if( rCurrentTemplate == "com.sun.star.chart2.template.StockOpenLowHighClose" )
- xTemplate.set( xFactory->createInstance( "com.sun.star.chart2.template.StockLowHighClose" ), uno::UNO_QUERY );
+ xTemplate = xFactory->createTemplate( "com.sun.star.chart2.template.StockLowHighClose" );
else if( rCurrentTemplate == "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" )
- xTemplate.set( xFactory->createInstance( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), uno::UNO_QUERY );
+ xTemplate = xFactory->createTemplate( "com.sun.star.chart2.template.StockVolumeLowHighClose" );
}
return xTemplate;
}
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
index 4dfabee4836f..79c45ea1d888 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
@@ -20,6 +20,7 @@
#include "WrappedSymbolProperties.hxx"
#include "WrappedSeriesOrDiagramProperty.hxx"
#include <FastPropertyIdRanges.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart2/SymbolStyle.hpp>
@@ -31,8 +32,7 @@
#include <vcl/GraphicLoader.hxx>
#include <vcl/graph.hxx>
-#include <vcl/outdev.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Any;
@@ -285,9 +285,9 @@ beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Referenc
if( m_ePropertyType == DATA_SERIES && //single series or point
m_spChart2ModelContact)
{
- Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
- Reference< chart2::XDataSeries > xSeries( xInnerPropertyState, uno::UNO_QUERY );
- Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
+ rtl::Reference< ::chart::DataSeries > xSeries( dynamic_cast<DataSeries*>(xInnerPropertyState.get()) );
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) );
if( ChartTypeHelper::isSupportingSymbolProperties( xChartType, 2 ) )
return beans::PropertyState_DIRECT_VALUE;
}
@@ -408,7 +408,8 @@ void lcl_correctSymbolSizeForBitmaps( chart2::Symbol& rSymbol )
if( xProp->getPropertyValue( "SizePixel" ) >>= aAWTPixelSize )
{
Size aPixelSize(aAWTPixelSize.Width,aAWTPixelSize.Height);
- Size aNewSize = OutputDevice::LogicToLogic(aPixelSize, MapMode(MapUnit::MapPixel), MapMode(MapUnit::Map100thMM));
+ Size aNewSize = o3tl::convert(aPixelSize, o3tl::Length::pt, o3tl::Length::mm100);
+
aSize = awt::Size( aNewSize.Width(), aNewSize.Height() );
if( aSize.Width == 0 && aSize.Height == 0 )
diff --git a/chart2/source/controller/chartcontroller.component b/chart2/source/controller/chartcontroller.component
index 01201cbb2494..ef8e748242e8 100644
--- a/chart2/source/controller/chartcontroller.component
+++ b/chart2/source/controller/chartcontroller.component
@@ -23,11 +23,6 @@
constructor="com_sun_star_comp_chart_ElementSelectorToolbarController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
- <implementation name="com.sun.star.comp.chart2.ChartController"
- constructor="com_sun_star_comp_chart2_ChartController_get_implementation">
- <service name="com.sun.star.chart2.ChartController"/>
- <service name="com.sun.star.frame.Controller"/>
- </implementation>
<implementation name="com.sun.star.comp.chart2.ChartDocumentWrapper"
constructor="com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation">
<service name="com.sun.star.beans.PropertySet"/>
diff --git a/chart2/source/controller/dialogs/ChartResourceGroups.cxx b/chart2/source/controller/dialogs/ChartResourceGroups.cxx
index 199606abef69..e1550d2766c7 100644
--- a/chart2/source/controller/dialogs/ChartResourceGroups.cxx
+++ b/chart2/source/controller/dialogs/ChartResourceGroups.cxx
@@ -29,8 +29,7 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
Dim3DLookResourceGroup::Dim3DLookResourceGroup(weld::Builder* pBuilder)
- : ChangingResource()
- , m_xCB_3DLook(pBuilder->weld_check_button("3dlook"))
+ : m_xCB_3DLook(pBuilder->weld_check_button("3dlook"))
, m_xLB_Scheme(pBuilder->weld_combo_box("3dscheme"))
{
m_xCB_3DLook->connect_toggled(LINK(this, Dim3DLookResourceGroup, Dim3DLookCheckHdl));
@@ -48,27 +47,34 @@ void Dim3DLookResourceGroup::fillControls(const ChartTypeParameter& rParameter)
m_xCB_3DLook->set_active(rParameter.b3DLook);
m_xLB_Scheme->set_sensitive(rParameter.b3DLook);
- if (rParameter.eThreeDLookScheme == ThreeDLookScheme_Simple)
- m_xLB_Scheme->set_active(POS_3DSCHEME_SIMPLE);
- else if (rParameter.eThreeDLookScheme == ThreeDLookScheme_Realistic)
- m_xLB_Scheme->set_active(POS_3DSCHEME_REALISTIC);
- else
- m_xLB_Scheme->set_active(-1);
+ // tdf#124295 - select always a 3D scheme
+ switch (rParameter.eThreeDLookScheme)
+ {
+ case ThreeDLookScheme::ThreeDLookScheme_Simple:
+ m_xLB_Scheme->set_active(POS_3DSCHEME_SIMPLE);
+ break;
+ case ThreeDLookScheme::ThreeDLookScheme_Realistic:
+ case ThreeDLookScheme::ThreeDLookScheme_Unknown:
+ m_xLB_Scheme->set_active(POS_3DSCHEME_REALISTIC);
+ break;
+ }
}
void Dim3DLookResourceGroup::fillParameter(ChartTypeParameter& rParameter)
{
rParameter.b3DLook = m_xCB_3DLook->get_active();
- const int nPos = m_xLB_Scheme->get_active();
- if (nPos == POS_3DSCHEME_SIMPLE)
- rParameter.eThreeDLookScheme = ThreeDLookScheme_Simple;
- else if (nPos == POS_3DSCHEME_REALISTIC)
- rParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
- else
- rParameter.eThreeDLookScheme = ThreeDLookScheme_Unknown;
+ // tdf#124295 - select always a 3D scheme
+ switch (m_xLB_Scheme->get_active())
+ {
+ case POS_3DSCHEME_SIMPLE:
+ rParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Simple;
+ break;
+ default:
+ rParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
+ }
}
-IMPL_LINK_NOARG(Dim3DLookResourceGroup, Dim3DLookCheckHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(Dim3DLookResourceGroup, Dim3DLookCheckHdl, weld::Toggleable&, void)
{
if (m_pChangeListener)
m_pChangeListener->stateChanged();
@@ -81,8 +87,7 @@ IMPL_LINK_NOARG(Dim3DLookResourceGroup, SelectSchemeHdl, weld::ComboBox&, void)
}
SortByXValuesResourceGroup::SortByXValuesResourceGroup(weld::Builder* pBuilder)
- : ChangingResource()
- , m_xCB_XValueSorting(pBuilder->weld_check_button("sort"))
+ : m_xCB_XValueSorting(pBuilder->weld_check_button("sort"))
{
m_xCB_XValueSorting->connect_toggled(
LINK(this, SortByXValuesResourceGroup, SortByXValuesCheckHdl));
@@ -103,15 +108,14 @@ void SortByXValuesResourceGroup::fillParameter(ChartTypeParameter& rParameter)
rParameter.bSortByXValues = m_xCB_XValueSorting->get_active();
}
-IMPL_LINK_NOARG(SortByXValuesResourceGroup, SortByXValuesCheckHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SortByXValuesResourceGroup, SortByXValuesCheckHdl, weld::Toggleable&, void)
{
if (m_pChangeListener)
m_pChangeListener->stateChanged();
}
StackingResourceGroup::StackingResourceGroup(weld::Builder* pBuilder)
- : ChangingResource()
- , m_xCB_Stacked(pBuilder->weld_check_button("stack"))
+ : m_xCB_Stacked(pBuilder->weld_check_button("stack"))
, m_xRB_Stack_Y(pBuilder->weld_radio_button("ontop"))
, m_xRB_Stack_Y_Percent(pBuilder->weld_radio_button("percent"))
, m_xRB_Stack_Z(pBuilder->weld_radio_button("deep"))
@@ -177,7 +181,7 @@ void StackingResourceGroup::fillParameter(ChartTypeParameter& rParameter)
rParameter.eStackMode = GlobalStackMode_STACK_Z;
}
-IMPL_LINK(StackingResourceGroup, StackingChangeHdl, weld::ToggleButton&, rRadio, void)
+IMPL_LINK(StackingResourceGroup, StackingChangeHdl, weld::Toggleable&, rRadio, void)
{
//for each radio click there are coming two change events
//first uncheck of previous button -> ignore that call
@@ -186,15 +190,14 @@ IMPL_LINK(StackingResourceGroup, StackingChangeHdl, weld::ToggleButton&, rRadio,
m_pChangeListener->stateChanged();
}
-IMPL_LINK_NOARG(StackingResourceGroup, StackingEnableHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(StackingResourceGroup, StackingEnableHdl, weld::Toggleable&, void)
{
if (m_pChangeListener)
m_pChangeListener->stateChanged();
}
SplineResourceGroup::SplineResourceGroup(weld::Builder* pBuilder, weld::Window* pParent)
- : ChangingResource()
- , m_pParent(pParent)
+ : m_pParent(pParent)
, m_xFT_LineType(pBuilder->weld_label("linetypeft"))
, m_xLB_LineType(pBuilder->weld_combo_box("linetype"))
, m_xPB_DetailsDialog(pBuilder->weld_button("properties"))
@@ -202,22 +205,22 @@ SplineResourceGroup::SplineResourceGroup(weld::Builder* pBuilder, weld::Window*
m_xLB_LineType->connect_changed(LINK(this, SplineResourceGroup, LineTypeChangeHdl));
}
-SplinePropertiesDialog& SplineResourceGroup::getSplinePropertiesDialog()
+std::shared_ptr<SplinePropertiesDialog> SplineResourceGroup::getSplinePropertiesDialog()
{
if (!m_xSplinePropertiesDialog)
{
m_xSplinePropertiesDialog.reset(new SplinePropertiesDialog(m_pParent));
}
- return *m_xSplinePropertiesDialog;
+ return m_xSplinePropertiesDialog;
}
-SteppedPropertiesDialog& SplineResourceGroup::getSteppedPropertiesDialog()
+std::shared_ptr<SteppedPropertiesDialog> SplineResourceGroup::getSteppedPropertiesDialog()
{
if (!m_xSteppedPropertiesDialog)
{
m_xSteppedPropertiesDialog.reset(new SteppedPropertiesDialog(m_pParent));
}
- return *m_xSteppedPropertiesDialog;
+ return m_xSteppedPropertiesDialog;
}
void SplineResourceGroup::showControls(bool bShow)
@@ -242,7 +245,7 @@ void SplineResourceGroup::fillControls(const ChartTypeParameter& rParameter)
m_xPB_DetailsDialog->connect_clicked(
LINK(this, SplineResourceGroup, SplineDetailsDialogHdl));
m_xPB_DetailsDialog->set_tooltip_text(SchResId(STR_DLG_SMOOTH_LINE_PROPERTIES));
- getSplinePropertiesDialog().fillControls(rParameter);
+ getSplinePropertiesDialog()->fillControls(rParameter);
break;
case CurveStyle_STEP_START:
case CurveStyle_STEP_END:
@@ -253,7 +256,7 @@ void SplineResourceGroup::fillControls(const ChartTypeParameter& rParameter)
m_xPB_DetailsDialog->connect_clicked(
LINK(this, SplineResourceGroup, SteppedDetailsDialogHdl));
m_xPB_DetailsDialog->set_tooltip_text(SchResId(STR_DLG_STEPPED_LINE_PROPERTIES));
- getSteppedPropertiesDialog().fillControls(rParameter);
+ getSteppedPropertiesDialog()->fillControls(rParameter);
break;
default:
m_xLB_LineType->set_active(-1);
@@ -265,10 +268,10 @@ void SplineResourceGroup::fillParameter(ChartTypeParameter& rParameter)
switch (m_xLB_LineType->get_active())
{
case POS_LINETYPE_SMOOTH:
- getSplinePropertiesDialog().fillParameter(rParameter, true);
+ getSplinePropertiesDialog()->fillParameter(rParameter, true);
break;
case POS_LINETYPE_STEPPED:
- getSteppedPropertiesDialog().fillParameter(rParameter, true);
+ getSteppedPropertiesDialog()->fillParameter(rParameter, true);
break;
default: // includes POS_LINETYPE_STRAIGHT
rParameter.eCurveStyle = CurveStyle_LINES;
@@ -285,48 +288,69 @@ IMPL_LINK_NOARG(SplineResourceGroup, LineTypeChangeHdl, weld::ComboBox&, void)
IMPL_LINK_NOARG(SplineResourceGroup, SplineDetailsDialogHdl, weld::Button&, void)
{
ChartTypeParameter aOldParameter;
- getSplinePropertiesDialog().fillParameter(aOldParameter,
- m_xLB_LineType->get_active() == POS_LINETYPE_SMOOTH);
+ std::shared_ptr<SplinePropertiesDialog> xDlg = getSplinePropertiesDialog();
+ xDlg->fillParameter(aOldParameter, m_xLB_LineType->get_active() == POS_LINETYPE_SMOOTH);
const sal_Int32 iOldLineTypePos = m_xLB_LineType->get_active();
m_xLB_LineType->set_active(POS_LINETYPE_SMOOTH);
- if (getSplinePropertiesDialog().run() == RET_OK)
- {
- if (m_pChangeListener)
- m_pChangeListener->stateChanged();
- }
- else
- {
- //restore old state:
- m_xLB_LineType->set_active(iOldLineTypePos);
- getSplinePropertiesDialog().fillControls(aOldParameter);
- }
+ weld::GenericDialogController::runAsync(xDlg, [this, xDlg, aOldParameter,
+ iOldLineTypePos](sal_Int32 nResult) {
+ m_xSplinePropertiesDialog = nullptr;
+ auto xNewDlg = getSplinePropertiesDialog();
+
+ if (nResult == RET_OK)
+ {
+ ChartTypeParameter aNewParameter;
+ xDlg->fillParameter(aNewParameter, m_xLB_LineType->get_active() == POS_LINETYPE_SMOOTH);
+ xNewDlg->fillControls(aNewParameter);
+
+ if (m_pChangeListener)
+ m_pChangeListener->stateChanged();
+ }
+ else
+ {
+ //restore old state:
+ m_xLB_LineType->set_active(iOldLineTypePos);
+ xNewDlg->fillControls(aOldParameter);
+ }
+ });
}
IMPL_LINK_NOARG(SplineResourceGroup, SteppedDetailsDialogHdl, weld::Button&, void)
{
ChartTypeParameter aOldParameter;
- getSteppedPropertiesDialog().fillParameter(aOldParameter, m_xLB_LineType->get_active()
- == POS_LINETYPE_STEPPED);
+ std::shared_ptr<SteppedPropertiesDialog> xDlg = getSteppedPropertiesDialog();
+ xDlg->fillParameter(aOldParameter, m_xLB_LineType->get_active() == POS_LINETYPE_STEPPED);
const sal_Int32 iOldLineTypePos = m_xLB_LineType->get_active();
m_xLB_LineType->set_active(POS_LINETYPE_STEPPED);
- if (getSteppedPropertiesDialog().run() == RET_OK)
- {
- if (m_pChangeListener)
- m_pChangeListener->stateChanged();
- }
- else
- {
- //restore old state:
- m_xLB_LineType->set_active(iOldLineTypePos);
- getSteppedPropertiesDialog().fillControls(aOldParameter);
- }
+
+ weld::GenericDialogController::runAsync(
+ xDlg, [this, xDlg, aOldParameter, iOldLineTypePos](sal_Int32 nResult) {
+ m_xSteppedPropertiesDialog = nullptr;
+ auto xNewDlg = getSteppedPropertiesDialog();
+
+ if (nResult == RET_OK)
+ {
+ ChartTypeParameter aNewParameter;
+ xDlg->fillParameter(aNewParameter,
+ m_xLB_LineType->get_active() == POS_LINETYPE_STEPPED);
+ xNewDlg->fillControls(aNewParameter);
+
+ if (m_pChangeListener)
+ m_pChangeListener->stateChanged();
+ }
+ else
+ {
+ //restore old state:
+ m_xLB_LineType->set_active(iOldLineTypePos);
+ xDlg->fillControls(aOldParameter);
+ }
+ });
}
GeometryResourceGroup::GeometryResourceGroup(weld::Builder* pBuilder)
- : ChangingResource()
- , m_aGeometryResources(pBuilder)
+ : m_aGeometryResources(pBuilder)
{
m_aGeometryResources.connect_changed(LINK(this, GeometryResourceGroup, GeometryChangeHdl));
}
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 748df3e1b40e..35284fbb6bfc 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -18,24 +18,27 @@
*/
#include <ChartTypeDialogController.hxx>
+#include <ChartTypeManager.hxx>
+#include <ChartTypeTemplate.hxx>
#include <ResId.hxx>
#include <strings.hrc>
#include <bitmaps.hlst>
#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <DataSeries.hxx>
+#include <Diagram.hxx>
#include <ControllerLockGuard.hxx>
#include <AxisHelper.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <ChartModel.hxx>
#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <svtools/valueset.hxx>
#include <vcl/image.hxx>
#include <vcl/settings.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -53,7 +56,7 @@ ChartTypeParameter::ChartTypeParameter()
, nCurveResolution(20)
, nSplineOrder(3)
, nGeometry3D(DataPointGeometry3D::CUBOID)
- , eThreeDLookScheme(ThreeDLookScheme_Realistic)
+ , eThreeDLookScheme(ThreeDLookScheme::ThreeDLookScheme_Realistic)
, bSortByXValues(false)
, mbRoundedEdge(false)
{
@@ -73,7 +76,7 @@ ChartTypeParameter::ChartTypeParameter( sal_Int32 SubTypeIndex, bool HasXAxisWit
, nCurveResolution(20)
, nSplineOrder(3)
, nGeometry3D(DataPointGeometry3D::CUBOID)
- , eThreeDLookScheme(ThreeDLookScheme_Realistic)
+ , eThreeDLookScheme(ThreeDLookScheme::ThreeDLookScheme_Realistic)
, bSortByXValues(false)
, mbRoundedEdge(false)
{
@@ -250,19 +253,19 @@ OUString ChartTypeDialogController::getServiceNameForParameter( const ChartTypeP
}
return OUString();
}
-uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTemplate(
+rtl::Reference< ChartTypeTemplate > ChartTypeDialogController::getCurrentTemplate(
const ChartTypeParameter& rParameter
- , const uno::Reference< lang::XMultiServiceFactory >& xTemplateManager ) const
+ , const rtl::Reference< ChartTypeManager >& xTemplateManager ) const
{
- uno::Reference< XChartTypeTemplate > xTemplate;
+ rtl::Reference< ChartTypeTemplate > xTemplate;
OUString aServiceName( getServiceNameForParameter( rParameter ) );
if(!aServiceName.isEmpty())
{
- xTemplate.set( xTemplateManager->createInstance( aServiceName ), uno::UNO_QUERY );
+ xTemplate = xTemplateManager->createTemplate( aServiceName );
if(xTemplate.is())
{
- uno::Reference< beans::XPropertySet > xTemplateProps( xTemplate, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xTemplateProps( static_cast<cppu::OWeakObject*>(xTemplate.get()), uno::UNO_QUERY );
if(xTemplateProps.is())
{
try
@@ -301,30 +304,30 @@ uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTempla
}
void ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParameter
- , const uno::Reference< XChartDocument >& xChartModel )
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- uno::Reference< lang::XMultiServiceFactory > xTemplateManager( xChartModel->getChartTypeManager(), uno::UNO_QUERY );
- uno::Reference< XChartTypeTemplate > xTemplate( getCurrentTemplate( rParameter, xTemplateManager ) );
+ rtl::Reference< ::chart::ChartTypeManager > xTemplateManager = xChartModel->getTypeManager();
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate( getCurrentTemplate( rParameter, xTemplateManager ) );
if(!xTemplate.is())
return;
// locked controllers
ControllerLockGuardUNO aCtrlLockGuard( xChartModel );
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartModel );
- DiagramHelper::tTemplateWithServiceName aTemplateWithService(
- DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ));
- if( aTemplateWithService.first.is())
- aTemplateWithService.first->resetStyles( xDiagram );
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
+ Diagram::tTemplateWithServiceName aTemplateWithService;
+ if (xDiagram)
+ aTemplateWithService = xDiagram->getTemplate( xTemplateManager );
+ if( aTemplateWithService.xChartTypeTemplate.is())
+ aTemplateWithService.xChartTypeTemplate->resetStyles2( xDiagram );
xTemplate->changeDiagram( xDiagram );
if( AllSettings::GetMathLayoutRTL() )
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
if( rParameter.b3DLook )
- ThreeDHelper::setScheme( xDiagram, rParameter.eThreeDLookScheme );
+ xDiagram->setScheme( rParameter.eThreeDLookScheme );
- uno::Reference<beans::XPropertySet> xDiaProp(xDiagram, uno::UNO_QUERY);
- if (xDiaProp.is())
+ if (xDiagram.is())
{
- xDiaProp->setPropertyValue(CHART_UNONAME_SORT_BY_XVALUES, uno::Any(rParameter.bSortByXValues));
+ xDiagram->setPropertyValue(CHART_UNONAME_SORT_BY_XVALUES, uno::Any(rParameter.bSortByXValues));
}
}
void ChartTypeDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ )
@@ -358,7 +361,7 @@ void ChartTypeDialogController::showExtraControls(weld::Builder* /*pBuilder*/)
void ChartTypeDialogController::hideExtraControls() const
{
}
-void ChartTypeDialogController::fillExtraControls( const uno::Reference< XChartDocument >& /*xChartModel*/
+void ChartTypeDialogController::fillExtraControls( const rtl::Reference<::chart::ChartModel>& /*xChartModel*/
, const uno::Reference< beans::XPropertySet >& /*xTemplateProps*/ ) const
{
}
@@ -367,7 +370,6 @@ void ChartTypeDialogController::setTemplateProperties( const uno::Reference< bea
}
ColumnOrBarChartDialogController_Base::ColumnOrBarChartDialogController_Base()
- : ChartTypeDialogController()
{
}
ColumnOrBarChartDialogController_Base::~ColumnOrBarChartDialogController_Base()
@@ -564,6 +566,8 @@ const tTemplateServiceChartTypeParameterMap& PieChartDialogController::getTempla
{"com.sun.star.chart2.template.PieAllExploded" , ChartTypeParameter(2,false,false)},
{"com.sun.star.chart2.template.Donut" , ChartTypeParameter(3,false,false)},
{"com.sun.star.chart2.template.DonutAllExploded" , ChartTypeParameter(4,false,false)},
+ {"com.sun.star.chart2.template.BarOfPie" , ChartTypeParameter(5,false,false)},
+ {"com.sun.star.chart2.template.PieOfPie" , ChartTypeParameter(6,false,false)},
{"com.sun.star.chart2.template.ThreeDPie" , ChartTypeParameter(1,false,true)},
{"com.sun.star.chart2.template.ThreeDPieAllExploded" , ChartTypeParameter(2,false,true)},
{"com.sun.star.chart2.template.ThreeDDonut" , ChartTypeParameter(3,false,true)},
@@ -587,11 +591,15 @@ void PieChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const Ch
rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_CIRCLES_2D_EXPLODED));
rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_DONUT_2D));
rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_DONUT_2D_EXPLODED));
+ rSubTypeList.InsertItem(5, Image(StockImage::Yes, BMP_BAR_OF_PIE));
+ rSubTypeList.InsertItem(6, Image(StockImage::Yes, BMP_PIE_OF_PIE));
}
rSubTypeList.SetItemText( 1, SchResId( STR_NORMAL ) );
rSubTypeList.SetItemText( 2, SchResId( STR_PIE_EXPLODED ) );
rSubTypeList.SetItemText( 3, SchResId( STR_DONUT ) );
rSubTypeList.SetItemText( 4, SchResId( STR_DONUT_EXPLODED ) );
+ rSubTypeList.SetItemText( 5, SchResId( STR_BAR_OF_PIE ) );
+ rSubTypeList.SetItemText( 6, SchResId( STR_PIE_OF_PIE ) );
}
bool PieChartDialogController::shouldShow_3DLookControl() const
@@ -1147,15 +1155,13 @@ void CombiColumnLineChartDialogController::hideExtraControls() const
}
void CombiColumnLineChartDialogController::fillExtraControls(
- const uno::Reference< XChartDocument >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, const uno::Reference< beans::XPropertySet >& xTemplateProps ) const
{
if (!m_xMF_NumberOfLines)
return;
- uno::Reference< frame::XModel > xModel = xChartModel;
-
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
if(!xDiagram.is())
return;
@@ -1176,7 +1182,7 @@ void CombiColumnLineChartDialogController::fillExtraControls(
nNumLines = 0;
m_xMF_NumberOfLines->set_value(nNumLines);
- sal_Int32 nMaxLines = ChartModelHelper::getDataSeries( xModel ).size() - 1;
+ sal_Int32 nMaxLines = ChartModelHelper::getDataSeries( xChartModel ).size() - 1;
if( nMaxLines < 0 )
nMaxLines = 0;
m_xMF_NumberOfLines->set_max(nMaxLines);
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index a5df0dcc03e4..30182b95eeb8 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -22,6 +22,7 @@
#include "DataBrowser.hxx"
#include "DataBrowserModel.hxx"
#include <strings.hrc>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <DiagramHelper.hxx>
#include <CommonConverters.hxx>
@@ -30,21 +31,22 @@
#include <ResId.hxx>
#include <bitmaps.hlst>
#include <helpids.h>
+#include <ChartModel.hxx>
+#include <ChartType.hxx>
#include <vcl/weld.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
-#include <rtl/math.hxx>
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
+#include <svl/numformat.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XChartType.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
#include <algorithm>
+#include <limits>
using namespace ::com::sun::star;
@@ -168,7 +170,7 @@ public:
void SetColor( const Color & rCol );
void SetPos();
void SetWidth( sal_Int32 nWidth );
- void SetChartType( const Reference< chart2::XChartType > & xChartType,
+ void SetChartType( const rtl::Reference< ::chart::ChartType > & xChartType,
bool bSwapXAndYAxis );
void SetSeriesName( const OUString & rName );
void SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol );
@@ -220,7 +222,7 @@ private:
DECL_LINK( SeriesNameEdited, SeriesHeaderEdit&, void );
static OUString GetChartTypeImage(
- const Reference< chart2::XChartType > & xChartType,
+ const rtl::Reference< ::chart::ChartType > & xChartType,
bool bSwapXAndYAxis
);
@@ -230,7 +232,7 @@ private:
};
SeriesHeader::SeriesHeader(weld::Container* pParent, weld::Container* pColorParent)
- : m_aUpdateDataTimer("UpdateDataTimer")
+ : m_aUpdateDataTimer( "SeriesHeader UpdateDataTimer" )
, m_xBuilder1(Application::CreateBuilder(pParent, "modules/schart/ui/columnfragment.ui"))
, m_xBuilder2(Application::CreateBuilder(pColorParent, "modules/schart/ui/imagefragment.ui"))
, m_pParent(pParent)
@@ -247,7 +249,6 @@ SeriesHeader::SeriesHeader(weld::Container* pParent, weld::Container* pColorPare
, m_bSeriesNameChangePending( false )
{
m_aUpdateDataTimer.SetInvokeHandler(LINK(this, SeriesHeader, ImplUpdateDataHdl));
- m_aUpdateDataTimer.SetDebugName( "SeriesHeader UpdateDataTimer" );
m_aUpdateDataTimer.SetTimeout(4 * EDIT_UPDATEDATA_TIMEOUT);
m_spSeriesName->SetModifyHdl(LINK(this, SeriesHeader, SeriesNameEdited));
@@ -290,20 +291,15 @@ void SeriesHeader::SetPos()
// series name edit field
m_spSeriesName->set_margin_start(2);
- aSize.setWidth(nSymbolHeight);
- aSize.setHeight(12);
- aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
- aSize.setWidth(m_nWidth - aSize.Width() - 2);
- m_spSeriesName->set_size_request(aSize.Width(), aSize.Height());
+ sal_Int32 nHeightPx = m_xDevice->LogicToPixel(Size(0, 12), MapMode(MapUnit::MapAppFont)).Height();
+ m_spSeriesName->set_size_request(m_nWidth - aSize.Width() - 2, nHeightPx);
// color bar
- aSize.setHeight(3);
- aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
- aSize.setWidth(m_nWidth);
- m_spColorBar->set_size_request(aSize.Width(), aSize.Height());
+ nHeightPx = m_xDevice->LogicToPixel(Size(0, 3), MapMode(MapUnit::MapAppFont)).Height();
+ m_spColorBar->set_size_request(m_nWidth, nHeightPx);
- auto xVirDev(m_spColorBar->create_virtual_device());
- xVirDev->SetOutputSizePixel(aSize);
+ ScopedVclPtr<VirtualDevice> xVirDev(m_spColorBar->create_virtual_device());
+ xVirDev->SetOutputSizePixel(Size(m_nWidth, nHeightPx));
xVirDev->SetFillColor(m_aColor);
xVirDev->SetLineColor(m_aColor);
xVirDev->DrawRect(tools::Rectangle(Point(0, 0), aSize));
@@ -322,7 +318,7 @@ void SeriesHeader::SetPixelWidth( sal_Int32 nWidth )
}
void SeriesHeader::SetChartType(
- const Reference< chart2::XChartType > & xChartType,
+ const rtl::Reference< ChartType > & xChartType,
bool bSwapXAndYAxis
)
{
@@ -380,7 +376,7 @@ bool SeriesHeader::HasFocus() const
}
OUString SeriesHeader::GetChartTypeImage(
- const Reference< chart2::XChartType > & xChartType,
+ const rtl::Reference< ChartType > & xChartType,
bool bSwapXAndYAxis
)
{
@@ -489,10 +485,8 @@ DataBrowser::DataBrowser(const css::uno::Reference<css::awt::XWindow> &rParent,
m_rNumberEditController( new ::svt::FormattedFieldCellController( m_aNumberEditField.get() )),
m_rTextEditController( new ::svt::EditCellController( m_aTextEditField.get() ))
{
- double fNan;
- ::rtl::math::setNan( & fNan );
Formatter& rFormatter = m_aNumberEditField->get_formatter();
- rFormatter.SetDefaultValue( fNan );
+ rFormatter.SetDefaultValue( std::numeric_limits<double>::quiet_NaN() );
rFormatter.TreatAsNumber( true );
RenewTable();
}
@@ -621,7 +615,7 @@ void DataBrowser::RenewTable()
GetDataWindow().LogicToPixel( Size( 42, 0 )).getWidth() ));
OUString aDefaultSeriesName(SchResId(STR_COLUMN_LABEL));
- replaceParamterInString( aDefaultSeriesName, "%COLUMNNUMBER", OUString::number( 24 ) );
+ replaceParamterInString( aDefaultSeriesName, u"%COLUMNNUMBER", OUString::number( 24 ) );
sal_Int32 nColumnWidth = GetDataWindow().GetTextWidth( aDefaultSeriesName )
+ GetDataWindow().LogicToPixel(Point(8 + impl::SeriesHeader::GetRelativeAppFontXPosForNameField(), 0), MapMode(MapUnit::MapAppFont)).X();
sal_Int32 nColumnCount = m_apDataBrowserModel->getColumnCount();
@@ -645,19 +639,17 @@ void DataBrowser::RenewTable()
for (auto const& elemHeader : aHeaders)
{
auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, m_pColorsWin );
- Reference< beans::XPropertySet > xSeriesProp( elemHeader.m_xDataSeries, uno::UNO_QUERY );
Color nColor;
// @todo: Set "DraftColor", i.e. interpolated colors for gradients, bitmaps, etc.
- if( xSeriesProp.is() &&
- ( xSeriesProp->getPropertyValue( "Color" ) >>= nColor ))
+ if( elemHeader.m_xDataSeries.is() &&
+ ( elemHeader.m_xDataSeries->getPropertyValue( "Color" ) >>= nColor ))
spHeader->SetColor( nColor );
spHeader->SetChartType( elemHeader.m_xChartType, elemHeader.m_bSwapXAndYAxis );
spHeader->SetSeriesName(
- DataSeriesHelper::getDataSeriesLabel(
- elemHeader.m_xDataSeries,
- (elemHeader.m_xChartType.is() ?
+ elemHeader.m_xDataSeries->getLabelForRole(
+ elemHeader.m_xChartType.is() ?
elemHeader.m_xChartType->getRoleOfSequenceForSeriesLabel() :
- OUString("values-y"))));
+ OUString("values-y")));
// index is 1-based, as 0 is for the column that contains the row-numbers
spHeader->SetRange( elemHeader.m_nStartColumn + 1, elemHeader.m_nEndColumn + 1 );
spHeader->SetGetFocusHdl( aFocusLink );
@@ -721,7 +713,7 @@ OUString DataBrowser::GetCellText( sal_Int32 nRow, sal_uInt16 nColumnId ) const
// getDateTimeInputNumberFormat() instead of doing the
// guess work.
sal_Int32 nNumberFormat = DiagramHelper::getDateTimeInputNumberFormat(
- Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY), fDouble );
+ m_xChartDoc, fDouble );
Color nLabelColor;
bool bColorChanged = false;
aResult = m_spNumberFormatterWrapper->getFormattedString(
@@ -741,16 +733,13 @@ OUString DataBrowser::GetCellText( sal_Int32 nRow, sal_uInt16 nColumnId ) const
double DataBrowser::GetCellNumber( sal_Int32 nRow, sal_uInt16 nColumnId ) const
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
if(( nColumnId >= 1 ) && ( nRow >= 0 ) && m_apDataBrowserModel)
{
- fResult = m_apDataBrowserModel->getCellNumber(
+ return m_apDataBrowserModel->getCellNumber(
static_cast< sal_Int32 >( nColumnId ) - 1, nRow );
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
void DataBrowser::Resize()
@@ -836,15 +825,13 @@ void DataBrowser::CellModified()
}
void DataBrowser::SetDataFromModel(
- const Reference< chart2::XChartDocument > & xChartDoc,
- const Reference< uno::XComponentContext > & xContext )
+ const rtl::Reference<::chart::ChartModel> & xChartDoc )
{
- m_xChartDoc.set( xChartDoc );
+ m_xChartDoc = xChartDoc;
- m_apDataBrowserModel.reset( new DataBrowserModel( m_xChartDoc, xContext ));
+ m_apDataBrowserModel.reset( new DataBrowserModel( m_xChartDoc ));
m_spNumberFormatterWrapper =
- std::make_shared<NumberFormatterWrapper>(
- Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ));
+ std::make_shared<NumberFormatterWrapper>(m_xChartDoc);
Formatter& rFormatter = m_aNumberEditField->get_formatter();
rFormatter.SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() );
@@ -908,9 +895,9 @@ void DataBrowser::RemoveColumn()
void DataBrowser::InsertRow()
{
- sal_Int32 nRowIdx = GetCurRow();
+ sal_Int32 nRowIdx = GetCurRow();
- if( nRowIdx >= 0 && m_apDataBrowserModel)
+ if( nRowIdx >= 0 && m_apDataBrowserModel)
{
// save changes made to edit-field
if( IsModified() )
@@ -923,9 +910,9 @@ void DataBrowser::InsertRow()
void DataBrowser::RemoveRow()
{
- sal_Int32 nRowIdx = GetCurRow();
+ sal_Int32 nRowIdx = GetCurRow();
- if( nRowIdx >= 0 && m_apDataBrowserModel)
+ if( nRowIdx >= 0 && m_apDataBrowserModel)
{
// save changes made to edit-field
if( IsModified() )
@@ -1277,18 +1264,16 @@ void DataBrowser::RenewSeriesHeaders()
for (auto const& elemHeader : aHeaders)
{
auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, m_pColorsWin );
- Reference< beans::XPropertySet > xSeriesProp(elemHeader.m_xDataSeries, uno::UNO_QUERY);
Color nColor;
- if( xSeriesProp.is() &&
- ( xSeriesProp->getPropertyValue( "Color" ) >>= nColor ))
+ if( elemHeader.m_xDataSeries.is() &&
+ ( elemHeader.m_xDataSeries->getPropertyValue( "Color" ) >>= nColor ))
spHeader->SetColor( nColor );
spHeader->SetChartType( elemHeader.m_xChartType, elemHeader.m_bSwapXAndYAxis );
spHeader->SetSeriesName(
- DataSeriesHelper::getDataSeriesLabel(
- elemHeader.m_xDataSeries,
- (elemHeader.m_xChartType.is() ?
+ elemHeader.m_xDataSeries->getLabelForRole(
+ elemHeader.m_xChartType.is() ?
elemHeader.m_xChartType->getRoleOfSequenceForSeriesLabel() :
- OUString( "values-y"))));
+ OUString( "values-y")));
spHeader->SetRange( elemHeader.m_nStartColumn + 1, elemHeader.m_nEndColumn + 1 );
spHeader->SetGetFocusHdl( aFocusLink );
spHeader->SetEditChangedHdl( aSeriesHeaderChangedLink );
@@ -1365,18 +1350,17 @@ IMPL_LINK( DataBrowser, SeriesHeaderGotFocus, impl::SeriesHeaderEdit&, rEdit, vo
IMPL_LINK( DataBrowser, SeriesHeaderChanged, impl::SeriesHeaderEdit&, rEdit, void )
{
- Reference< chart2::XDataSeries > xSeries(
- m_apDataBrowserModel->getDataSeriesByColumn( rEdit.getStartColumn() - 1 ));
- Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
- if( !xSource.is())
+ rtl::Reference< DataSeries > xSeries =
+ m_apDataBrowserModel->getDataSeriesByColumn( rEdit.getStartColumn() - 1 );
+ if( !xSeries.is())
return;
- Reference< chart2::XChartType > xChartType(
+ rtl::Reference< ChartType > xChartType(
m_apDataBrowserModel->getHeaderForSeries( xSeries ).m_xChartType );
if( xChartType.is())
{
- Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
- DataSeriesHelper::getDataSequenceByRole( xSource, xChartType->getRoleOfSequenceForSeriesLabel()));
+ uno::Reference< chart2::data::XLabeledDataSequence > xLabeledSeq =
+ DataSeriesHelper::getDataSequenceByRole( xSeries, xChartType->getRoleOfSequenceForSeriesLabel());
if( xLabeledSeq.is())
{
Reference< container::XIndexReplace > xIndexReplace( xLabeledSeq->getLabel(), uno::UNO_QUERY );
diff --git a/chart2/source/controller/dialogs/DataBrowser.hxx b/chart2/source/controller/dialogs/DataBrowser.hxx
index e0699a60d1b4..c1d6a72e6cf8 100644
--- a/chart2/source/controller/dialogs/DataBrowser.hxx
+++ b/chart2/source/controller/dialogs/DataBrowser.hxx
@@ -43,6 +43,7 @@ namespace chart
class DataBrowserModel;
class NumberFormatterWrapper;
+class ChartModel;
namespace impl
{
@@ -97,8 +98,7 @@ public:
void SetReadOnly( bool bNewState );
bool IsReadOnly() const { return m_bIsReadOnly;}
- void SetDataFromModel( const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc,
- const css::uno::Reference< css::uno::XComponentContext > & xContext );
+ void SetDataFromModel( const rtl::Reference<::chart::ChartModel> & xChartDoc );
// predicates to determine what actions are possible at the current cursor
// position. This depends on the implementation of the according mutators
@@ -145,7 +145,7 @@ public:
void RenewSeriesHeaders();
private:
- css::uno::Reference< css::chart2::XChartDocument > m_xChartDoc;
+ rtl::Reference<::chart::ChartModel> m_xChartDoc;
std::unique_ptr< DataBrowserModel > m_apDataBrowserModel;
typedef std::vector< std::shared_ptr< impl::SeriesHeader > > tSeriesHeaderContainer;
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index c8359f74ab23..938da978dd07 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -20,34 +20,34 @@
#include "DataBrowserModel.hxx"
#include "DialogModel.hxx"
#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartType.hxx>
+#include <ChartTypeManager.hxx>
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <ControllerLockGuard.hxx>
#include <StatisticsHelper.hxx>
#include <ChartTypeHelper.hxx>
#include <chartview/ExplicitValueProvider.hxx>
#include <ExplicitCategoriesProvider.hxx>
-
+#include <BaseCoordinateSystem.hxx>
#include <ChartModel.hxx>
#include <unonames.hxx>
#include <com/sun/star/container/XIndexReplace.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/XInternalDataProvider.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
#include <o3tl/safeint.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/property.hxx>
-#include <rtl/math.hxx>
-
#include <algorithm>
+#include <cstddef>
+#include <limits>
+#include <utility>
using namespace ::com::sun::star;
@@ -96,7 +96,7 @@ void lcl_copyDataSequenceProperties(
}
bool lcl_SequenceOfSeriesIsShared(
- const Reference< chart2::XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
const Reference< chart2::data::XDataSequence > & xValues )
{
bool bResult = false;
@@ -106,9 +106,8 @@ bool lcl_SequenceOfSeriesIsShared(
{
OUString aValuesRole( lcl_getRole( xValues ));
OUString aValuesRep( xValues->getSourceRangeRepresentation());
- Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY_THROW );
- const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences());
- for( Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : aLSeq )
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aLSeq( xSeries->getDataSequences2());
+ for( uno::Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : aLSeq )
if (labeledDataSeq.is() && DataSeriesHelper::getRole(labeledDataSeq) == aValuesRole)
{
// getValues().is(), because lcl_getRole checked that already
@@ -124,24 +123,22 @@ bool lcl_SequenceOfSeriesIsShared(
return bResult;
}
-typedef std::vector< Reference< chart2::data::XLabeledDataSequence > > lcl_tSharedSeqVec;
+typedef std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > lcl_tSharedSeqVec;
-lcl_tSharedSeqVec lcl_getSharedSequences( const Sequence< Reference< chart2::XDataSeries > > & rSeries )
+lcl_tSharedSeqVec lcl_getSharedSequences( const std::vector< rtl::Reference< DataSeries > > & rSeries )
{
// @todo: if only some series share a sequence, those have to be duplicated
// and made unshared for all series
lcl_tSharedSeqVec aResult;
// if we have only one series, we don't want any shared sequences
- if( rSeries.getLength() <= 1 )
+ if( rSeries.size() <= 1 )
return aResult;
- Reference< chart2::data::XDataSource > xSource( rSeries[0], uno::UNO_QUERY );
- const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences());
- for( Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : aLSeq )
+ for( uno::Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : rSeries[0]->getDataSequences2() )
{
Reference< chart2::data::XDataSequence > xValues( labeledDataSeq->getValues());
bool bShared = true;
- for( sal_Int32 nSeriesIdx=1; nSeriesIdx<rSeries.getLength(); ++nSeriesIdx )
+ for( std::size_t nSeriesIdx=1; nSeriesIdx<rSeries.size(); ++nSeriesIdx )
{
bShared = lcl_SequenceOfSeriesIsShared( rSeries[nSeriesIdx], xValues );
if( !bShared )
@@ -190,10 +187,10 @@ private:
struct lcl_RolesOfLSeqMatch
{
- explicit lcl_RolesOfLSeqMatch( const Reference< chart2::data::XLabeledDataSequence > & xLSeq ) :
+ explicit lcl_RolesOfLSeqMatch( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq ) :
m_aRole(DataSeriesHelper::getRole(xLSeq)) {}
- bool operator() ( const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+ bool operator() ( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq )
{
return DataSeriesHelper::getRole(xLSeq) == m_aRole;
}
@@ -201,16 +198,16 @@ private:
OUString m_aRole;
};
-bool lcl_ShowCategoriesAsDataLabel( const Reference< chart2::XDiagram > & xDiagram )
+bool lcl_ShowCategoriesAsDataLabel( const rtl::Reference< ::chart::Diagram > & xDiagram )
{
- return !DiagramHelper::isCategoryDiagram(xDiagram);
+ return !xDiagram->isCategory();
}
} // anonymous namespace
struct DataBrowserModel::tDataColumn
{
- uno::Reference<chart2::XDataSeries> m_xDataSeries;
+ rtl::Reference<DataSeries> m_xDataSeries;
OUString m_aUIRoleName;
uno::Reference<chart2::data::XLabeledDataSequence> m_xLabeledDataSequence;
eCellType m_eCellType;
@@ -220,14 +217,14 @@ struct DataBrowserModel::tDataColumn
tDataColumn() : m_eCellType( TEXT ), m_nNumberFormatKey( 0 ) {}
// "full" CTOR
tDataColumn(
- const uno::Reference<chart2::XDataSeries> & xDataSeries,
- const OUString& aUIRoleName,
- const uno::Reference<chart2::data::XLabeledDataSequence>& xLabeledDataSequence,
+ rtl::Reference<DataSeries> xDataSeries,
+ OUString aUIRoleName,
+ uno::Reference<chart2::data::XLabeledDataSequence> xLabeledDataSequence,
eCellType aCellType,
sal_Int32 nNumberFormatKey ) :
- m_xDataSeries( xDataSeries ),
- m_aUIRoleName( aUIRoleName ),
- m_xLabeledDataSequence( xLabeledDataSequence ),
+ m_xDataSeries(std::move( xDataSeries )),
+ m_aUIRoleName(std::move( aUIRoleName )),
+ m_xLabeledDataSequence(std::move( xLabeledDataSequence )),
m_eCellType( aCellType ),
m_nNumberFormatKey( nNumberFormatKey )
{}
@@ -247,10 +244,9 @@ struct DataBrowserModel::implColumnLess
};
DataBrowserModel::DataBrowserModel(
- const Reference< chart2::XChartDocument > & xChartDoc,
- const Reference< uno::XComponentContext > & xContext ) :
+ const rtl::Reference<::chart::ChartModel> & xChartDoc ) :
m_xChartDocument( xChartDoc ),
- m_apDialogModel( new DialogModel( xChartDoc, xContext ))
+ m_apDialogModel( new DialogModel( xChartDoc ))
{
updateFromModel();
}
@@ -263,15 +259,15 @@ namespace
struct lcl_DataSeriesOfHeaderMatches
{
explicit lcl_DataSeriesOfHeaderMatches(
- const Reference< chart2::XDataSeries > & xSeriesToCompareWith ) :
- m_xSeries( xSeriesToCompareWith )
+ rtl::Reference< ::chart::DataSeries > xSeriesToCompareWith ) :
+ m_xSeries(std::move( xSeriesToCompareWith ))
{}
bool operator() ( const ::chart::DataBrowserModel::tDataHeader & rHeader )
{
return (m_xSeries == rHeader.m_xDataSeries);
}
private:
- Reference< chart2::XDataSeries > m_xSeries;
+ rtl::Reference< ::chart::DataSeries > m_xSeries;
};
}
@@ -289,18 +285,18 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
nAfterColumnIndex = getCategoryColumnCount()-1;
sal_Int32 nStartCol = 0;
- Reference<chart2::XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartDocument);
- Reference<chart2::XChartType> xChartType;
- Reference<chart2::XDataSeries> xSeries;
+ rtl::Reference< Diagram > xDiagram = m_xChartDocument->getFirstChartDiagram();
+ rtl::Reference<ChartType> xChartType;
+ rtl::Reference<DataSeries> xSeries;
if (o3tl::make_unsigned(nAfterColumnIndex) < m_aColumns.size())
// Get the data series at specific column position (if available).
- xSeries.set( m_aColumns[nAfterColumnIndex].m_xDataSeries );
+ xSeries = m_aColumns[nAfterColumnIndex].m_xDataSeries;
sal_Int32 nSeriesNumberFormat = 0;
if( xSeries.is())
{
// Use the chart type of the currently selected data series.
- xChartType.set( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ));
+ xChartType = xDiagram->getChartTypeOfSeries( xSeries );
// Find the corresponding header and determine the last column of this
// data series.
@@ -311,14 +307,13 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
nStartCol = aIt->m_nEndColumn;
// Get the number format too.
- Reference< beans::XPropertySet > xSeriesProps( xSeries, uno::UNO_QUERY );
- if( xSeriesProps.is() )
- xSeriesProps->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nSeriesNumberFormat;
+ if( xSeries.is() )
+ xSeries->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nSeriesNumberFormat;
}
else
{
// No data series at specified column position. Use the first chart type.
- xChartType.set( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ));
+ xChartType = xDiagram->getChartTypeByIndex( 0 );
nStartCol = nAfterColumnIndex;
}
@@ -327,68 +322,59 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
// Get shared sequences of current series. Normally multiple data series
// only share "values-x" sequences. (TODO: simplify this logic).
- Reference< chart2::XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY );
- lcl_tSharedSeqVec aSharedSequences;
- if( xSeriesCnt.is())
- aSharedSequences = lcl_getSharedSequences( xSeriesCnt->getDataSeries());
+ lcl_tSharedSeqVec aSharedSequences = lcl_getSharedSequences( xChartType->getDataSeries2());
- Reference<chart2::XDataSeries> xNewSeries =
+ rtl::Reference<::chart::DataSeries> xNewSeries =
m_apDialogModel->insertSeriesAfter(xSeries, xChartType, true);
if (!xNewSeries.is())
// Failed to insert new data series to the model. Bail out.
return;
- Reference< chart2::data::XDataSource > xSource( xNewSeries, uno::UNO_QUERY );
- if (xSource.is())
+ const std::vector<uno::Reference<chart2::data::XLabeledDataSequence> > & aLSequences = xNewSeries->getDataSequences2();
+ sal_Int32 nSeqIdx = 0;
+ sal_Int32 nSeqSize = aLSequences.size();
+ for (sal_Int32 nIndex = nStartCol; nSeqIdx < nSeqSize; ++nSeqIdx)
{
- Sequence<Reference<chart2::data::XLabeledDataSequence> > aLSequences = xSource->getDataSequences();
- sal_Int32 nSeqIdx = 0;
- sal_Int32 nSeqSize = aLSequences.getLength();
- for (sal_Int32 nIndex = nStartCol; nSeqIdx < nSeqSize; ++nSeqIdx)
- {
- lcl_tSharedSeqVec::const_iterator aSharedIt(
- std::find_if( aSharedSequences.begin(), aSharedSequences.end(),
- lcl_RolesOfLSeqMatch( aLSequences[nSeqIdx] )));
+ lcl_tSharedSeqVec::const_iterator aSharedIt(
+ std::find_if( aSharedSequences.begin(), aSharedSequences.end(),
+ lcl_RolesOfLSeqMatch( aLSequences[nSeqIdx] )));
- if( aSharedIt != aSharedSequences.end())
- {
- // Shared sequence. Most likely "values-x" sequence. Copy it from existing sequence.
- aLSequences[nSeqIdx]->setValues( (*aSharedIt)->getValues());
- aLSequences[nSeqIdx]->setLabel( (*aSharedIt)->getLabel());
- }
- else
- {
- // Insert a new column in the internal data for the new sequence.
- xDataProvider->insertSequence( nIndex - 1 );
-
- // values
- Reference< chart2::data::XDataSequence > xNewSeq(
- xDataProvider->createDataSequenceByRangeRepresentation(
- OUString::number( nIndex )));
- lcl_copyDataSequenceProperties(
- aLSequences[nSeqIdx]->getValues(), xNewSeq );
- aLSequences[nSeqIdx]->setValues( xNewSeq );
-
- // labels
- Reference< chart2::data::XDataSequence > xNewLabelSeq(
- xDataProvider->createDataSequenceByRangeRepresentation(
- "label " +
- OUString::number( nIndex )));
- lcl_copyDataSequenceProperties(
- aLSequences[nSeqIdx]->getLabel(), xNewLabelSeq );
- aLSequences[nSeqIdx]->setLabel( xNewLabelSeq );
- ++nIndex;
- }
+ if( aSharedIt != aSharedSequences.end())
+ {
+ // Shared sequence. Most likely "values-x" sequence. Copy it from existing sequence.
+ aLSequences[nSeqIdx]->setValues( (*aSharedIt)->getValues());
+ aLSequences[nSeqIdx]->setLabel( (*aSharedIt)->getLabel());
+ }
+ else
+ {
+ // Insert a new column in the internal data for the new sequence.
+ xDataProvider->insertSequence( nIndex - 1 );
+
+ // values
+ Reference< chart2::data::XDataSequence > xNewSeq(
+ xDataProvider->createDataSequenceByRangeRepresentation(
+ OUString::number( nIndex )));
+ lcl_copyDataSequenceProperties(
+ aLSequences[nSeqIdx]->getValues(), xNewSeq );
+ aLSequences[nSeqIdx]->setValues( xNewSeq );
+
+ // labels
+ Reference< chart2::data::XDataSequence > xNewLabelSeq(
+ xDataProvider->createDataSequenceByRangeRepresentation(
+ "label " +
+ OUString::number( nIndex )));
+ lcl_copyDataSequenceProperties(
+ aLSequences[nSeqIdx]->getLabel(), xNewLabelSeq );
+ aLSequences[nSeqIdx]->setLabel( xNewLabelSeq );
+ ++nIndex;
}
}
if( nSeriesNumberFormat != 0 )
{
//give the new series the same number format as the former series especially for bubble charts thus the bubble size values can be edited with same format immediately
- Reference< beans::XPropertySet > xNewSeriesProps( xNewSeries, uno::UNO_QUERY );
- if( xNewSeriesProps.is() )
- xNewSeriesProps->setPropertyValue(CHART_UNONAME_NUMFMT , uno::Any(nSeriesNumberFormat));
+ xNewSeries->setPropertyValue(CHART_UNONAME_NUMFMT , uno::Any(nSeriesNumberFormat));
}
updateFromModel();
@@ -447,7 +433,7 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
return;
}
- const Reference<chart2::XDataSeries>& xSeries = m_aColumns[nAtColumnIndex].m_xDataSeries;
+ const rtl::Reference<DataSeries>& xSeries = m_aColumns[nAtColumnIndex].m_xDataSeries;
m_apDialogModel->deleteSeries(xSeries, getHeaderForSeries(xSeries).m_xChartType);
@@ -455,16 +441,14 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
//but do not delete sequences that are still in use by the remaining series
Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
- Reference< chart2::data::XDataSource > xSourceOfDeleted( xSeries, uno::UNO_QUERY );
- if (!xDataProvider.is() || !xSourceOfDeleted.is())
+ if (!xDataProvider.is() || !xSeries.is())
{
// Something went wrong. Bail out.
updateFromModel();
return;
}
- Reference<chart2::XDataSeriesContainer> xSeriesCnt(
- getHeaderForSeries(xSeries).m_xChartType, uno::UNO_QUERY);
+ rtl::Reference<ChartType> xSeriesCnt(getHeaderForSeries(xSeries).m_xChartType);
if (!xSeriesCnt.is())
{
// Unexpected happened. Bail out.
@@ -474,13 +458,13 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
// Collect all the remaining data sequences in the same chart type. The
// deleted data series is already gone by this point.
- std::vector<Reference<chart2::data::XLabeledDataSequence> > aAllDataSeqs =
- DataSeriesHelper::getAllDataSequences(xSeriesCnt->getDataSeries());
+ std::vector<uno::Reference<chart2::data::XLabeledDataSequence> > aAllDataSeqs =
+ DataSeriesHelper::getAllDataSequences(xSeriesCnt->getDataSeries2());
// Check if the sequences to be deleted are still referenced by any of
// the other data series. If not, mark them for deletion.
std::vector<sal_Int32> aSequenceIndexesToDelete;
- const Sequence<Reference<chart2::data::XLabeledDataSequence> > aSequencesOfDeleted = xSourceOfDeleted->getDataSequences();
+ const std::vector<uno::Reference<chart2::data::XLabeledDataSequence> > & aSequencesOfDeleted = xSeries->getDataSequences2();
for (auto const & labeledDataSeq : aSequencesOfDeleted)
{
// if not used by the remaining series this sequence can be deleted
@@ -508,7 +492,7 @@ void DataBrowserModel::swapDataSeries( sal_Int32 nFirstColumnIndex )
OSL_ASSERT(m_apDialogModel);
if( o3tl::make_unsigned( nFirstColumnIndex ) < m_aColumns.size() - 1 )
{
- Reference< chart2::XDataSeries > xSeries( m_aColumns[nFirstColumnIndex].m_xDataSeries );
+ rtl::Reference< DataSeries > xSeries( m_aColumns[nFirstColumnIndex].m_xDataSeries );
if( xSeries.is())
{
m_apDialogModel->moveSeries( xSeries, DialogModel::MoveDirection::Down );
@@ -554,15 +538,17 @@ void DataBrowserModel::removeDataPointForAllSeries( sal_Int32 nAtIndex )
DataBrowserModel::tDataHeader DataBrowserModel::getHeaderForSeries(
const Reference< chart2::XDataSeries > & xSeries ) const
{
+ rtl::Reference<DataSeries> pSeries = dynamic_cast<DataSeries*>(xSeries.get());
+ assert(!xSeries || pSeries);
for (auto const& elemHeader : m_aHeaders)
{
- if( elemHeader.m_xDataSeries == xSeries )
+ if( elemHeader.m_xDataSeries == pSeries )
return elemHeader;
}
return tDataHeader();
}
-Reference< chart2::XDataSeries >
+rtl::Reference< DataSeries >
DataBrowserModel::getDataSeriesByColumn( sal_Int32 nColumn ) const
{
tDataColumnVector::size_type nIndex( nColumn );
@@ -582,9 +568,6 @@ DataBrowserModel::eCellType DataBrowserModel::getCellType( sal_Int32 nAtColumn )
double DataBrowserModel::getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
tDataColumnVector::size_type nIndex( nAtColumn );
if( nIndex < m_aColumns.size() &&
m_aColumns[ nIndex ].m_xLabeledDataSequence.is())
@@ -595,10 +578,10 @@ double DataBrowserModel::getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow )
{
Sequence< double > aValues( xData->getNumericalData());
if( nAtRow < aValues.getLength())
- fResult = aValues[nAtRow];
+ return aValues[nAtRow];
}
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Any DataBrowserModel::getCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow )
@@ -677,9 +660,8 @@ bool DataBrowserModel::setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const
m_apDialogModel->startControllerLockTimer();
//notify change directly to the model (this is necessary here as sequences for complex categories not known directly to the chart model so they do not notify their changes) (for complex categories see issue #i82971#)
- Reference< util::XModifiable > xModifiable( m_xChartDocument, uno::UNO_QUERY );
- if( xModifiable.is() )
- xModifiable->setModified(true);
+ if( m_xChartDocument.is() )
+ m_xChartDocument->setModified(true);
}
catch( const uno::Exception & )
{
@@ -766,28 +748,24 @@ void DataBrowserModel::updateFromModel()
m_aColumns.clear();
m_aHeaders.clear();
- Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDocument ));
+ rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram());
if( !xDiagram.is())
return;
// set template at DialogModel
- uno::Reference< lang::XMultiServiceFactory > xFact( m_xChartDocument->getChartTypeManager(), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
- if( aTemplateAndService.first.is())
- m_apDialogModel->setTemplate( aTemplateAndService.first );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = m_xChartDocument->getTypeManager();
+ Diagram::tTemplateWithServiceName aTemplateAndService =
+ xDiagram->getTemplate( xChartTypeManager );
+ if( aTemplateAndService.xChartTypeTemplate.is())
+ m_apDialogModel->setTemplate( aTemplateAndService.xChartTypeTemplate );
sal_Int32 nHeaderStart = 0;
sal_Int32 nHeaderEnd = 0;
{
- Reference< frame::XModel > xChartModel = m_xChartDocument;
- ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
- if (!pModel)
- return;
- ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), *pModel );
-
- const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
- sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(m_xChartDocument), *m_xChartDocument );
+
+ const std::vector< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList = aExplicitCategoriesProvider.getSplitCategoriesList();
+ sal_Int32 nLevelCount = rSplitCategoriesList.size();
for( sal_Int32 nL = 0; nL<nLevelCount; nL++ )
{
Reference< chart2::data::XLabeledDataSequence > xCategories( rSplitCategoriesList[nL] );
@@ -795,7 +773,7 @@ void DataBrowserModel::updateFromModel()
continue;
tDataColumn aCategories;
- aCategories.m_xLabeledDataSequence.set( xCategories );
+ aCategories.m_xLabeledDataSequence = xCategories;
if( lcl_ShowCategoriesAsDataLabel( xDiagram ))
aCategories.m_aUIRoleName = DialogModel::GetRoleDataLabel();
else
@@ -806,109 +784,102 @@ void DataBrowserModel::updateFromModel()
}
}
- Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY );
- if( !xCooSysCnt.is())
+ if( !xDiagram.is())
return;
- const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
- for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq )
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq( xDiagram->getBaseCoordinateSystems());
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysSeq )
{
- Reference< chart2::XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW );
- const Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ const std::vector< rtl::Reference< ChartType > > aChartTypes( coords->getChartTypes2());
sal_Int32 nXAxisNumberFormat = DataSeriesHelper::getNumberFormatKeyFromAxis( nullptr, coords, 0, 0 );
- for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ for( auto const & CT: aChartTypes )
{
- Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY );
- if( xSeriesCnt.is())
- {
- OUString aRoleForDataLabelNumberFormat = ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( aChartTypes[nCTIdx] );
+ rtl::Reference< ChartType > xSeriesCnt( CT );
+ OUString aRoleForDataLabelNumberFormat = ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( CT );
- const Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries());
- lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( aSeries ));
- for (auto const& sharedSequence : aSharedSequences)
- {
- tDataColumn aSharedSequence;
- aSharedSequence.m_xLabeledDataSequence = sharedSequence;
- aSharedSequence.m_aUIRoleName = lcl_getUIRoleName(sharedSequence);
- aSharedSequence.m_eCellType = NUMBER;
- // as the sequences are shared it should be ok to take the first series
- // @todo: dimension index 0 for x-values used here. This is just a guess.
- // Also, the axis index is 0, as there is usually only one x-axis
- aSharedSequence.m_nNumberFormatKey = nXAxisNumberFormat;
- m_aColumns.push_back( aSharedSequence );
- ++nHeaderStart;
- }
- for( Reference< chart2::XDataSeries > const & dataSeries : aSeries )
+ const std::vector< rtl::Reference< DataSeries > > & aSeries( xSeriesCnt->getDataSeries2());
+ lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( aSeries ));
+ for (auto const& sharedSequence : aSharedSequences)
+ {
+ tDataColumn aSharedSequence;
+ aSharedSequence.m_xLabeledDataSequence = sharedSequence;
+ aSharedSequence.m_aUIRoleName = lcl_getUIRoleName(sharedSequence);
+ aSharedSequence.m_eCellType = NUMBER;
+ // as the sequences are shared it should be ok to take the first series
+ // @todo: dimension index 0 for x-values used here. This is just a guess.
+ // Also, the axis index is 0, as there is usually only one x-axis
+ aSharedSequence.m_nNumberFormatKey = nXAxisNumberFormat;
+ m_aColumns.push_back( aSharedSequence );
+ ++nHeaderStart;
+ }
+ for( rtl::Reference< DataSeries > const & dataSeries : aSeries )
+ {
+ tDataColumnVector::size_type nStartColIndex = m_aColumns.size();
+ rtl::Reference< DataSeries > xSeries( dataSeries );
+ if( xSeries.is())
{
- tDataColumnVector::size_type nStartColIndex = m_aColumns.size();
- Reference< chart2::XDataSeries > xSeries( dataSeries );
- Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
- if( xSource.is())
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aLSeqs( xSeries->getDataSequences2());
+ if( aLSeqs.empty() )
+ continue;
+ nHeaderEnd = nHeaderStart;
+
+ // @todo: dimension index 1 for y-values used here. This is just a guess
+ sal_Int32 nYAxisNumberFormatKey =
+ DataSeriesHelper::getNumberFormatKeyFromAxis(
+ dataSeries, coords, 1 );
+
+ sal_Int32 nSeqIdx=0;
+ for( ; nSeqIdx<static_cast<sal_Int32>(aLSeqs.size()); ++nSeqIdx )
{
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqs( xSource->getDataSequences());
- if( !aLSeqs.hasElements() )
- continue;
- nHeaderEnd = nHeaderStart;
-
- // @todo: dimension index 1 for y-values used here. This is just a guess
- sal_Int32 nYAxisNumberFormatKey =
- DataSeriesHelper::getNumberFormatKeyFromAxis(
- dataSeries, coords, 1 );
-
- sal_Int32 nSeqIdx=0;
- for( ; nSeqIdx<aLSeqs.getLength(); ++nSeqIdx )
+ sal_Int32 nSequenceNumberFormatKey = nYAxisNumberFormatKey;
+ OUString aRole = DataSeriesHelper::getRole(aLSeqs[nSeqIdx]);
+
+ if( aRole == aRoleForDataLabelNumberFormat )
{
- sal_Int32 nSequenceNumberFormatKey = nYAxisNumberFormatKey;
- OUString aRole = DataSeriesHelper::getRole(aLSeqs[nSeqIdx]);
-
- if( aRole == aRoleForDataLabelNumberFormat )
- {
- nSequenceNumberFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
- Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ));
- }
- else if( aRole == "values-x" )
- nSequenceNumberFormatKey = nXAxisNumberFormat;
-
- if( std::none_of( aSharedSequences.begin(), aSharedSequences.end(),
- lcl_RepresentationsOfLSeqMatch( aLSeqs[nSeqIdx] )) )
- {
- // no shared sequence
- m_aColumns.emplace_back(
- dataSeries,
- lcl_getUIRoleName( aLSeqs[nSeqIdx] ),
- aLSeqs[nSeqIdx],
- NUMBER,
- nSequenceNumberFormatKey );
- ++nHeaderEnd;
- }
- // else skip
+ nSequenceNumberFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ xSeries);
}
- bool bSwapXAndYAxis = false;
- try
+ else if( aRole == "values-x" )
+ nSequenceNumberFormatKey = nXAxisNumberFormat;
+
+ if( std::none_of( aSharedSequences.begin(), aSharedSequences.end(),
+ lcl_RepresentationsOfLSeqMatch( aLSeqs[nSeqIdx] )) )
{
- Reference< beans::XPropertySet > xProp( coords, uno::UNO_QUERY );
- xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndYAxis;
+ // no shared sequence
+ m_aColumns.emplace_back(
+ dataSeries,
+ lcl_getUIRoleName( aLSeqs[nSeqIdx] ),
+ aLSeqs[nSeqIdx],
+ NUMBER,
+ nSequenceNumberFormatKey );
+ ++nHeaderEnd;
}
- catch( const beans::UnknownPropertyException & ) {}
+ // else skip
+ }
+ bool bSwapXAndYAxis = false;
+ try
+ {
+ coords->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndYAxis;
+ }
+ catch( const beans::UnknownPropertyException & ) {}
- // add ranges for error bars if present for a series
- if( StatisticsHelper::usesErrorBarRanges( dataSeries ))
- addErrorBarRanges( dataSeries, nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, true );
+ // add ranges for error bars if present for a series
+ if( StatisticsHelper::usesErrorBarRanges( dataSeries ))
+ addErrorBarRanges( dataSeries, nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, true );
- if( StatisticsHelper::usesErrorBarRanges( dataSeries, /* bYError = */ false ))
- addErrorBarRanges( dataSeries, nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, false );
+ if( StatisticsHelper::usesErrorBarRanges( dataSeries, /* bYError = */ false ))
+ addErrorBarRanges( dataSeries, nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, false );
- m_aHeaders.emplace_back(
- dataSeries,
- aChartTypes[nCTIdx],
- bSwapXAndYAxis,
- nHeaderStart,
- nHeaderEnd - 1 );
+ m_aHeaders.emplace_back(
+ dataSeries,
+ CT,
+ bSwapXAndYAxis,
+ nHeaderStart,
+ nHeaderEnd - 1 );
- nHeaderStart = nHeaderEnd;
+ nHeaderStart = nHeaderEnd;
- std::sort( m_aColumns.begin() + nStartColIndex, m_aColumns.end(), implColumnLess() );
- }
+ std::sort( m_aColumns.begin() + nStartColIndex, m_aColumns.end(), implColumnLess() );
}
}
}
@@ -916,35 +887,35 @@ void DataBrowserModel::updateFromModel()
}
void DataBrowserModel::addErrorBarRanges(
- const Reference< chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference< DataSeries > & xDataSeries,
sal_Int32 nNumberFormatKey,
sal_Int32 & rInOutSequenceIndex,
sal_Int32 & rInOutHeaderEnd, bool bYError )
{
try
{
- std::vector< Reference< chart2::data::XLabeledDataSequence > > aSequences;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences;
Reference< chart2::data::XDataSource > xErrorSource(
StatisticsHelper::getErrorBars( xDataSeries, bYError ), uno::UNO_QUERY );
- Reference< chart2::data::XLabeledDataSequence > xErrorLSequence(
+ uno::Reference< chart2::data::XLabeledDataSequence > xErrorLSequence =
StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
xErrorSource,
/* bPositiveValue = */ true,
- bYError ));
+ bYError );
if( xErrorLSequence.is())
aSequences.push_back( xErrorLSequence );
- xErrorLSequence.set(
+ xErrorLSequence =
StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
xErrorSource,
/* bPositiveValue = */ false,
- bYError ));
+ bYError );
if( xErrorLSequence.is())
aSequences.push_back( xErrorLSequence );
- for (Reference<chart2::data::XLabeledDataSequence> const & rDataSequence : aSequences)
+ for (uno::Reference<chart2::data::XLabeledDataSequence> const & rDataSequence : aSequences)
{
m_aColumns.emplace_back(xDataSeries, lcl_getUIRoleName(rDataSequence),
rDataSequence, NUMBER, nNumberFormatKey);
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx b/chart2/source/controller/dialogs/DataBrowserModel.hxx
index b538e01de271..e3254851d002 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.hxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx
@@ -18,9 +18,14 @@
*/
#pragma once
+#include <DataSeries.hxx>
+#include <ChartType.hxx>
+
#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
#include <memory>
+#include <utility>
#include <vector>
namespace com::sun::star::chart2 { class XChartDocument; }
@@ -35,13 +40,15 @@ namespace chart
{
class DialogModel;
+class ChartModel;
+class ChartType;
+class DataSeries;
class DataBrowserModel final
{
public:
explicit DataBrowserModel(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc,
- const css::uno::Reference< css::uno::XComponentContext > & xContext );
+ const rtl::Reference<::chart::ChartModel> & xChartDoc );
~DataBrowserModel();
/** Inserts a new data series after the data series to which the data column
@@ -96,8 +103,8 @@ public:
struct tDataHeader
{
- css::uno::Reference< css::chart2::XDataSeries > m_xDataSeries;
- css::uno::Reference< css::chart2::XChartType > m_xChartType;
+ rtl::Reference< ::chart::DataSeries > m_xDataSeries;
+ rtl::Reference< ::chart::ChartType > m_xChartType;
bool m_bSwapXAndYAxis;
sal_Int32 m_nStartColumn;
sal_Int32 m_nEndColumn;
@@ -110,13 +117,13 @@ public:
{}
// "full" CTOR
tDataHeader(
- css::uno::Reference< css::chart2::XDataSeries > const & xDataSeries,
- css::uno::Reference< css::chart2::XChartType > const &xChartType,
+ rtl::Reference< ::chart::DataSeries > xDataSeries,
+ rtl::Reference< ::chart::ChartType > xChartType,
bool bSwapXAndYAxis,
sal_Int32 nStartColumn,
sal_Int32 nEndColumn ) :
- m_xDataSeries( xDataSeries ),
- m_xChartType( xChartType ),
+ m_xDataSeries(std::move( xDataSeries )),
+ m_xChartType(std::move( xChartType )),
m_bSwapXAndYAxis( bSwapXAndYAxis ),
m_nStartColumn( nStartColumn ),
m_nEndColumn( nEndColumn )
@@ -130,7 +137,7 @@ public:
tDataHeader getHeaderForSeries(
const css::uno::Reference< css::chart2::XDataSeries > &xSeries ) const;
- css::uno::Reference< css::chart2::XDataSeries >
+ rtl::Reference< ::chart::DataSeries >
getDataSeriesByColumn( sal_Int32 nColumn ) const;
private:
@@ -139,14 +146,14 @@ private:
void removeComplexCategoryLevel( sal_Int32 nAtColumnIndex );
void addErrorBarRanges(
- const css::uno::Reference<css::chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference<::chart::DataSeries > & xDataSeries,
sal_Int32 nNumberFormatKey,
sal_Int32 & rInOutSequenceIndex,
sal_Int32 & rInOutHeaderEnd, bool bYError );
sal_Int32 getCategoryColumnCount();
- css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument;
+ rtl::Reference<::chart::ChartModel> m_xChartDocument;
std::unique_ptr< DialogModel > m_apDialogModel;
struct tDataColumn;
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 7e7d10896d03..4c888e8ed5b6 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -19,30 +19,31 @@
#include "DialogModel.hxx"
#include <RangeSelectionHelper.hxx>
+#include <DataInterpreter.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <DataSourceHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <strings.hrc>
#include <ResId.hxx>
#include <ControllerLockGuard.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
+#include <ChartTypeTemplate.hxx>
#include <ThreeDHelper.hxx>
#include <ChartModel.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <LabeledDataSequence.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/data/XDataSink.hpp>
-#include <comphelper/sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <rtl/ustring.hxx>
#include <utility>
#include <algorithm>
+#include <cstddef>
#include <iterator>
#include <numeric>
@@ -54,16 +55,8 @@ using ::com::sun::star::uno::Sequence;
namespace
{
-constexpr OUStringLiteral lcl_aLabelRole( u"label" );
+constexpr OUString lcl_aLabelRole( u"label"_ustr );
-struct lcl_ChartTypeToSeriesCnt
-{
- Reference< XDataSeriesContainer > operator() (
- const Reference< XChartType > & xChartType )
- {
- return Reference< XDataSeriesContainer >::query( xChartType );
- }
-};
OUString lcl_ConvertRole( const OUString & rRoleString )
{
@@ -125,53 +118,6 @@ lcl_tRoleIndexMap lcl_createRoleIndexMap()
return aMap;
}
-struct lcl_DataSeriesContainerAppend
-{
- typedef Reference< XDataSeriesContainer > value_type;
- typedef std::vector< ::chart::DialogModel::tSeriesWithChartTypeByName > tContainerType;
-
- explicit lcl_DataSeriesContainerAppend( tContainerType * rCnt )
- : m_rDestCnt( rCnt )
- {}
-
- lcl_DataSeriesContainerAppend & operator= ( const value_type & xVal )
- {
- try
- {
- if( xVal.is())
- {
- const Sequence< Reference< XDataSeries > > aSeq( xVal->getDataSeries());
- OUString aRole( "values-y" );
- Reference< XChartType > xCT( xVal, uno::UNO_QUERY );
- if( xCT.is())
- aRole = xCT->getRoleOfSequenceForSeriesLabel();
- for( Reference< XDataSeries > const & dataSeries : aSeq )
- {
- m_rDestCnt->push_back(
- ::chart::DialogModel::tSeriesWithChartTypeByName(
- ::chart::DataSeriesHelper::getDataSeriesLabel( dataSeries, aRole ),
- std::make_pair( dataSeries, xCT )));
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- return *this;
- }
-
- // Implement output operator requirements as required by std::copy (and
- // implement prefix increment in terms of postfix increment to avoid unused
- // member function warnings for the latter in the common case where
- // std::copy would not actually need it):
- lcl_DataSeriesContainerAppend & operator* () { return *this; }
- lcl_DataSeriesContainerAppend & operator++ () { return operator++(0); }
- lcl_DataSeriesContainerAppend & operator++ (int) { return *this; }
-
-private:
- tContainerType * m_rDestCnt;
-};
struct lcl_RolesWithRangeAppend
{
@@ -179,9 +125,9 @@ struct lcl_RolesWithRangeAppend
typedef ::chart::DialogModel::tRolesWithRanges tContainerType;
explicit lcl_RolesWithRangeAppend( tContainerType * rCnt,
- const OUString & aLabelRole )
+ OUString aLabelRole )
: m_rDestCnt( rCnt ),
- m_aRoleForLabelSeq( aLabelRole )
+ m_aRoleForLabelSeq(std::move( aLabelRole ))
{}
lcl_RolesWithRangeAppend & operator= ( const value_type & xVal )
@@ -237,16 +183,11 @@ private:
namespace std
{
- template<> struct iterator_traits<lcl_DataSeriesContainerAppend>
- {
- typedef std::output_iterator_tag iterator_category;
- typedef Reference< XDataSeriesContainer > value_type;
- };
-
template<> struct iterator_traits<lcl_RolesWithRangeAppend>
{
typedef std::output_iterator_tag iterator_category;
typedef Reference< data::XLabeledDataSequence > value_type;
+ typedef value_type& reference;
};
}
@@ -261,56 +202,90 @@ void lcl_SetSequenceRole(
xProp->setPropertyValue( "Role" , uno::Any( rRole ));
}
-Reference< XDataSeries > lcl_CreateNewSeries(
- const Reference< uno::XComponentContext > & xContext,
- const Reference< XChartType > & xChartType,
+Sequence< OUString > lcl_CopyExcludingValuesFirst(
+ Sequence< OUString > const & i_aInput )
+{
+ Sequence< OUString > aOutput( i_aInput.getLength());
+ auto pOutput = aOutput.getArray();
+ int nSourceIndex, nDestIndex;
+ for( nSourceIndex = nDestIndex = 0; nSourceIndex < i_aInput.getLength(); nSourceIndex++ )
+ {
+ if( i_aInput[nSourceIndex] == "values-first" )
+ {
+ aOutput.realloc( aOutput.getLength() - 1 );
+ pOutput = aOutput.getArray();
+ }
+ else
+ {
+ pOutput[nDestIndex] = i_aInput[nSourceIndex];
+ nDestIndex++;
+ }
+ }
+ return aOutput;
+}
+
+rtl::Reference< ::chart::DataSeries > lcl_CreateNewSeries(
+ const rtl::Reference< ::chart::ChartType > & xChartType,
sal_Int32 nNewSeriesIndex,
sal_Int32 nTotalNumberOfSeriesInCTGroup,
- const Reference< XDiagram > & xDiagram,
- const Reference< XChartTypeTemplate > & xTemplate,
+ const rtl::Reference< ::chart::Diagram > & xDiagram,
+ const rtl::Reference< ::chart::ChartTypeTemplate > & xTemplate,
bool bCreateDataCachedSequences )
{
// create plain series
- Reference< XDataSeries > xResult(
- xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.DataSeries" ,
- xContext ), uno::UNO_QUERY );
+ rtl::Reference< ::chart::DataSeries > xResult = new ::chart::DataSeries();
if( xTemplate.is())
{
- Reference< beans::XPropertySet > xResultProp( xResult, uno::UNO_QUERY );
- if( xResultProp.is())
- {
- // @deprecated: correct default color should be found by view
- // without setting it as hard attribute
- Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
- if( xColorScheme.is())
- xResultProp->setPropertyValue( "Color" , uno::Any( xColorScheme->getColorByIndex( nNewSeriesIndex )));
- }
- sal_Int32 nGroupIndex=0;
+ // @deprecated: correct default color should be found by view
+ // without setting it as hard attribute
+ Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
+ if( xColorScheme.is())
+ xResult->setPropertyValue( "Color" , uno::Any( xColorScheme->getColorByIndex( nNewSeriesIndex )));
+ std::size_t nGroupIndex=0;
if( xChartType.is())
{
- Sequence< Reference< XChartType > > aCTs(
- ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ));
- for( ; nGroupIndex<aCTs.getLength(); ++nGroupIndex)
+ std::vector< rtl::Reference< ::chart::ChartType > > aCTs =
+ xDiagram->getChartTypes();
+ for( ; nGroupIndex < aCTs.size(); ++nGroupIndex)
if( aCTs[nGroupIndex] == xChartType )
break;
- if( nGroupIndex == aCTs.getLength())
+ if( nGroupIndex == aCTs.size())
nGroupIndex = 0;
}
- xTemplate->applyStyle( xResult, nGroupIndex, nNewSeriesIndex, nTotalNumberOfSeriesInCTGroup );
+ xTemplate->applyStyle2( xResult, nGroupIndex, nNewSeriesIndex, nTotalNumberOfSeriesInCTGroup );
}
if( bCreateDataCachedSequences )
{
// set chart type specific roles
- Reference< data::XDataSink > xSink( xResult, uno::UNO_QUERY );
- if( xChartType.is() && xSink.is())
+ if( xChartType.is() )
{
- std::vector< Reference< data::XLabeledDataSequence > > aNewSequences;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aNewSequences;
const OUString aRoleOfSeqForSeriesLabel = xChartType->getRoleOfSequenceForSeriesLabel();
const OUString aLabel(::chart::SchResId(STR_DATA_UNNAMED_SERIES));
- const Sequence< OUString > aRoles( xChartType->getSupportedMandatoryRoles());
- const Sequence< OUString > aOptRoles( xChartType->getSupportedOptionalRoles());
+ Sequence< OUString > aPossibleRoles( xChartType->getSupportedMandatoryRoles());
+ Sequence< OUString > aPossibleOptRoles( xChartType->getSupportedOptionalRoles());
+
+ //special handling for candlestick type
+ if( xTemplate.is())
+ {
+ rtl::Reference< ::chart::DataInterpreter > xInterpreter( xTemplate->getDataInterpreter2());
+ if( xInterpreter.is())
+ {
+ sal_Int32 nStockVariant;
+ if( xInterpreter->getChartTypeSpecificData("stock variant") >>= nStockVariant )
+ {
+ if( nStockVariant == 0 || nStockVariant == 2) {
+ //delete "values-first" role
+ aPossibleRoles = lcl_CopyExcludingValuesFirst(aPossibleRoles);
+ aPossibleOptRoles = lcl_CopyExcludingValuesFirst(aPossibleOptRoles);
+ }
+ }
+ }
+ }
+
+ const Sequence< OUString > aRoles( aPossibleRoles );
+ const Sequence< OUString > aOptRoles( aPossibleOptRoles );
for(OUString const & role : aRoles)
{
@@ -338,7 +313,7 @@ Reference< XDataSeries > lcl_CreateNewSeries(
aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq ));
}
- xSink->setData( comphelper::containerToSequence( aNewSequences ));
+ xResult->setData( aNewSequences );
}
}
@@ -368,10 +343,8 @@ DialogModelTimeBasedInfo::DialogModelTimeBasedInfo():
}
DialogModel::DialogModel(
- const Reference< XChartDocument > & xChartDocument,
- const Reference< uno::XComponentContext > & xContext ) :
- m_xChartDocument( xChartDocument ),
- m_xContext( xContext ),
+ rtl::Reference<::chart::ChartModel> xChartDocument ) :
+ m_xChartDocument(std::move( xChartDocument )),
m_aTimerTriggeredControllerLock( m_xChartDocument )
{
}
@@ -385,7 +358,7 @@ DialogModel::~DialogModel()
}
void DialogModel::setTemplate(
- const Reference< XChartTypeTemplate > & xTemplate )
+ const rtl::Reference< ChartTypeTemplate > & xTemplate )
{
m_xTemplate = xTemplate;
}
@@ -400,7 +373,7 @@ std::shared_ptr< RangeSelectionHelper > const &
return m_spRangeSelectionHelper;
}
-Reference< frame::XModel > DialogModel::getChartModel() const
+const rtl::Reference<::chart::ChartModel> & DialogModel::getChartModel() const
{
return m_xChartDocument;
}
@@ -413,30 +386,25 @@ Reference< data::XDataProvider > DialogModel::getDataProvider() const
return xResult;
}
-std::vector< Reference< XDataSeriesContainer > >
+std::vector< rtl::Reference< ChartType > >
DialogModel::getAllDataSeriesContainers() const
{
- std::vector< Reference< XDataSeriesContainer > > aResult;
+ std::vector< rtl::Reference< ChartType > > aResult;
try
{
- Reference< XDiagram > xDiagram;
- if( m_xChartDocument.is())
- xDiagram.set( m_xChartDocument->getFirstDiagram());
+ if( !m_xChartDocument )
+ return {};
+ rtl::Reference< Diagram > xDiagram = m_xChartDocument->getFirstChartDiagram();
if( xDiagram.is())
{
- Reference< XCoordinateSystemContainer > xCooSysCnt(
- xDiagram, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( Reference< XCoordinateSystem > const & coords : aCooSysSeq )
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysSeq(
+ xDiagram->getBaseCoordinateSystems());
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysSeq )
{
- Reference< XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW );
- Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
- std::transform(
- aChartTypeSeq.begin(), aChartTypeSeq.end(),
- std::back_inserter( aResult ),
- lcl_ChartTypeToSeriesCnt() );
+
+ for (const auto & rxChartType : coords->getChartTypes2())
+ aResult.push_back(rxChartType);
}
}
}
@@ -452,11 +420,29 @@ std::vector< DialogModel::tSeriesWithChartTypeByName >
DialogModel::getAllDataSeriesWithLabel() const
{
std::vector< tSeriesWithChartTypeByName > aResult;
- std::vector< Reference< XDataSeriesContainer > > aContainers(
+ std::vector< rtl::Reference< ChartType > > aContainers(
getAllDataSeriesContainers());
- std::copy( aContainers.begin(), aContainers.end(),
- lcl_DataSeriesContainerAppend( &aResult ));
+ for (const auto & rxChartType : aContainers )
+ {
+ try
+ {
+ const std::vector< rtl::Reference< DataSeries > > & aSeq = rxChartType->getDataSeries2();
+ OUString aRole = rxChartType->getRoleOfSequenceForSeriesLabel();
+ for( rtl::Reference< DataSeries > const & dataSeries : aSeq )
+ {
+ aResult.push_back(
+ ::chart::DialogModel::tSeriesWithChartTypeByName(
+ dataSeries->getLabelForRole( aRole ),
+ std::make_pair( dataSeries, rxChartType )));
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+
return aResult;
}
@@ -481,15 +467,13 @@ void addMissingRoles(DialogModel::tRolesWithRanges& rResult, const uno::Sequence
* @param xNewSeries new data series to insert.
*/
void addNewSeriesToContainer(
- const Reference<XChartType>& xChartType,
- const Reference<XDataSeries>& xSeries,
- const Reference<XDataSeries>& xNewSeries )
+ const rtl::Reference<ChartType>& xChartType,
+ const rtl::Reference<DataSeries>& xSeries,
+ const rtl::Reference<DataSeries>& xNewSeries )
{
- Reference<XDataSeriesContainer> xSeriesCnt(xChartType, uno::UNO_QUERY_THROW);
- auto aSeries = comphelper::sequenceToContainer<std::vector<Reference<XDataSeries> >>(xSeriesCnt->getDataSeries());
+ auto aSeries = xChartType->getDataSeries2();
- std::vector<Reference<XDataSeries> >::iterator aIt =
- std::find( aSeries.begin(), aSeries.end(), xSeries);
+ auto aIt = std::find( aSeries.begin(), aSeries.end(), xSeries);
if( aIt == aSeries.end())
// if we have no series we insert at the first position.
@@ -499,7 +483,7 @@ void addNewSeriesToContainer(
++aIt;
aSeries.insert(aIt, xNewSeries);
- xSeriesCnt->setDataSeries(comphelper::containerToSequence(aSeries));
+ xChartType->setDataSeries(aSeries);
}
}
@@ -507,7 +491,7 @@ void addNewSeriesToContainer(
DialogModel::tRolesWithRanges DialogModel::getRolesWithRanges(
const Reference< XDataSeries > & xSeries,
const OUString & aRoleOfSequenceForLabel,
- const Reference< chart2::XChartType > & xChartType )
+ const rtl::Reference< ::chart::ChartType > & xChartType )
{
DialogModel::tRolesWithRanges aResult;
try
@@ -539,54 +523,54 @@ DialogModel::tRolesWithRanges DialogModel::getRolesWithRanges(
}
void DialogModel::moveSeries(
- const Reference< XDataSeries > & xSeries,
+ const rtl::Reference< DataSeries > & xSeries,
MoveDirection eDirection )
{
m_aTimerTriggeredControllerLock.startTimer();
ControllerLockGuardUNO aLockedControllers( m_xChartDocument );
- Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
- DiagramHelper::moveSeries( xDiagram, xSeries, eDirection==MoveDirection::Down );
+ rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram());
+ xDiagram->moveSeries( xSeries, eDirection==MoveDirection::Down );
}
-Reference< chart2::XDataSeries > DialogModel::insertSeriesAfter(
- const Reference< XDataSeries > & xSeries,
- const Reference< XChartType > & xChartType,
+rtl::Reference< ::chart::DataSeries > DialogModel::insertSeriesAfter(
+ const Reference< XDataSeries > & xUnoSeries,
+ const rtl::Reference< ::chart::ChartType > & xChartType,
bool bCreateDataCachedSequences /* = false */ )
{
m_aTimerTriggeredControllerLock.startTimer();
ControllerLockGuardUNO aLockedControllers( m_xChartDocument );
- Reference< XDataSeries > xNewSeries;
+ rtl::Reference< ::chart::DataSeries > xNewSeries;
+ rtl::Reference<DataSeries> xSeries = dynamic_cast<DataSeries*>(xUnoSeries.get());
+ assert(xSeries || !xUnoSeries);
try
{
- Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() );
- ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram );
+ rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram() );
+ ThreeDLookScheme e3DScheme = xDiagram->detectScheme();
sal_Int32 nSeriesInChartType = 0;
const sal_Int32 nTotalSeries = countSeries();
if( xChartType.is())
{
- Reference< XDataSeriesContainer > xCnt( xChartType, uno::UNO_QUERY_THROW );
- nSeriesInChartType = xCnt->getDataSeries().getLength();
+ nSeriesInChartType = xChartType->getDataSeries().getLength();
}
// create new series
- xNewSeries.set(
+ xNewSeries =
lcl_CreateNewSeries(
- m_xContext,
xChartType,
nTotalSeries, // new series' index
nSeriesInChartType,
xDiagram,
m_xTemplate,
- bCreateDataCachedSequences ));
+ bCreateDataCachedSequences );
// add new series to container
if( xNewSeries.is())
addNewSeriesToContainer(xChartType, xSeries, xNewSeries);
- ThreeDHelper::setScheme( xDiagram, e3DScheme );
+ xDiagram->setScheme( e3DScheme );
}
catch( const uno::Exception & )
{
@@ -596,8 +580,8 @@ Reference< chart2::XDataSeries > DialogModel::insertSeriesAfter(
}
void DialogModel::deleteSeries(
- const Reference< XDataSeries > & xSeries,
- const Reference< XChartType > & xChartType )
+ const rtl::Reference< DataSeries > & xSeries,
+ const rtl::Reference< ChartType > & xChartType )
{
m_aTimerTriggeredControllerLock.startTimer();
ControllerLockGuardUNO aLockedControllers( m_xChartDocument );
@@ -605,15 +589,16 @@ void DialogModel::deleteSeries(
DataSeriesHelper::deleteSeries( xSeries, xChartType );
}
-Reference< data::XLabeledDataSequence > DialogModel::getCategories() const
+uno::Reference< chart2::data::XLabeledDataSequence > DialogModel::getCategories() const
{
- Reference< data::XLabeledDataSequence > xResult;
+ uno::Reference< chart2::data::XLabeledDataSequence > xResult;
try
{
if( m_xChartDocument.is())
{
- Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
- xResult.set( DiagramHelper::getCategoriesFromDiagram( xDiagram ));
+ rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram());
+ if (xDiagram.is())
+ xResult = xDiagram->getCategories();
}
}
catch( const uno::Exception & )
@@ -628,31 +613,38 @@ void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequ
if( !m_xChartDocument.is())
return;
- Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram());
if( !xDiagram.is())
return;
// categories
bool bSupportsCategories = true;
- Reference< XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ rtl::Reference< ChartType > xFirstChartType( xDiagram->getChartTypeByIndex( 0 ) );
if( xFirstChartType.is() )
{
sal_Int32 nAxisType = ChartTypeHelper::getAxisType( xFirstChartType, 0 ); // x-axis
bSupportsCategories = (nAxisType == AxisType::CATEGORY);
}
- DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram, true, bSupportsCategories );
+ xDiagram->setCategories( xCategories, true, bSupportsCategories );
}
OUString DialogModel::getCategoriesRange() const
{
- Reference< data::XLabeledDataSequence > xLSeq( getCategories());
OUString aRange;
- if( xLSeq.is())
+ try
{
- Reference< data::XDataSequence > xSeq( xLSeq->getValues());
- if( xSeq.is())
- aRange = xSeq->getSourceRangeRepresentation();
+ uno::Reference< chart2::data::XLabeledDataSequence > xLSeq( getCategories());
+ if( xLSeq.is())
+ {
+ Reference< data::XDataSequence > xSeq( xLSeq->getValues());
+ if( xSeq.is())
+ aRange = xSeq->getSourceRangeRepresentation();
+ }
+ }
+ catch (const lang::DisposedException&)
+ {
+ TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" );
}
return aRange;
}
@@ -660,8 +652,8 @@ OUString DialogModel::getCategoriesRange() const
bool DialogModel::isCategoryDiagram() const
{
bool bRet = false;
- if( m_xChartDocument.is())
- bRet = DiagramHelper::isCategoryDiagram( m_xChartDocument->getFirstDiagram() );
+ if( m_xChartDocument.is() && m_xChartDocument->getFirstChartDiagram())
+ bRet = m_xChartDocument->getFirstChartDiagram()->isCategory();
return bRet;
}
@@ -679,7 +671,7 @@ void DialogModel::detectArguments(
if( m_xChartDocument.is())
{
(void)DataSourceHelper::detectRangeSegmentation(
- Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY_THROW ),
+ m_xChartDocument,
rOutRangeString, aSequenceMapping, rOutUseColumns, rOutFirstCellAsLabel, rOutHasCategories );
}
}
@@ -718,22 +710,22 @@ void DialogModel::setData(
Reference< chart2::data::XDataSource > xDataSource(
xDataProvider->createDataSource( rArguments ) );
- Reference< chart2::XDataInterpreter > xInterpreter(
- m_xTemplate->getDataInterpreter());
+ rtl::Reference< ::chart::DataInterpreter > xInterpreter(
+ m_xTemplate->getDataInterpreter2());
if( xInterpreter.is())
{
- Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() );
- ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram );
+ rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram() );
+ ThreeDLookScheme e3DScheme = xDiagram->detectScheme();
- std::vector< Reference< XDataSeries > > aSeriesToReUse(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesToReUse =
+ xDiagram->getDataSeries();
applyInterpretedData(
xInterpreter->interpretDataSource(
xDataSource, rArguments,
- comphelper::containerToSequence( aSeriesToReUse )),
+ aSeriesToReUse ),
aSeriesToReUse);
- ThreeDHelper::setScheme( xDiagram, e3DScheme );
+ xDiagram->setScheme( e3DScheme );
}
}
catch( const uno::Exception & )
@@ -774,13 +766,13 @@ sal_Int32 DialogModel::GetRoleIndexForSorting( const OUString & rInternalRoleStr
void DialogModel::applyInterpretedData(
const InterpretedData & rNewData,
- const std::vector< Reference< XDataSeries > > & rSeriesToReUse )
+ const std::vector< rtl::Reference< DataSeries > > & rSeriesToReUse )
{
if( ! m_xChartDocument.is())
return;
m_aTimerTriggeredControllerLock.startTimer();
- Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram());
if( !xDiagram.is())
return;
@@ -790,43 +782,40 @@ void DialogModel::applyInterpretedData(
sal_Int32 nGroup = 0;
sal_Int32 nSeriesCounter = 0;
sal_Int32 nNewSeriesIndex = static_cast< sal_Int32 >( rSeriesToReUse.size());
- const sal_Int32 nOuterSize=rNewData.Series.getLength();
+ const sal_Int32 nOuterSize=rNewData.Series.size();
for(; nGroup < nOuterSize; ++nGroup)
{
- Sequence< Reference< XDataSeries > > aSeries( rNewData.Series[ nGroup ] );
- const sal_Int32 nSeriesInGroup = aSeries.getLength();
+ const std::vector< rtl::Reference< DataSeries > > & aSeries( rNewData.Series[ nGroup ] );
+ const sal_Int32 nSeriesInGroup = aSeries.size();
for( sal_Int32 nSeries=0; nSeries<nSeriesInGroup; ++nSeries, ++nSeriesCounter )
{
if( std::find( rSeriesToReUse.begin(), rSeriesToReUse.end(), aSeries[nSeries] )
== rSeriesToReUse.end())
{
- Reference< beans::XPropertySet > xSeriesProp( aSeries[nSeries], uno::UNO_QUERY );
- if( xSeriesProp.is())
+ if( aSeries[nSeries].is())
{
// @deprecated: correct default color should be found by view
// without setting it as hard attribute
Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
if( xColorScheme.is())
- xSeriesProp->setPropertyValue( "Color" ,
+ aSeries[nSeries]->setPropertyValue( "Color" ,
uno::Any( xColorScheme->getColorByIndex( nSeriesCounter )));
}
- m_xTemplate->applyStyle( aSeries[nSeries], nGroup, nNewSeriesIndex++, nSeriesInGroup );
+ m_xTemplate->applyStyle2( aSeries[nSeries], nGroup, nNewSeriesIndex++, nSeriesInGroup );
}
}
}
}
// data series
- std::vector< Reference< XDataSeriesContainer > > aSeriesCnt( getAllDataSeriesContainers());
- auto aNewSeries(
- comphelper::sequenceToContainer<std::vector< Sequence< Reference< XDataSeries > > >>( rNewData.Series ));
+ std::vector< rtl::Reference< ChartType > > aSeriesCnt = getAllDataSeriesContainers();
- OSL_ASSERT( aSeriesCnt.size() == aNewSeries.size());
+ OSL_ASSERT( aSeriesCnt.size() == rNewData.Series.size());
- std::vector< Sequence< Reference< XDataSeries > > >::const_iterator aSrcIt( aNewSeries.begin());
- std::vector< Reference< XDataSeriesContainer > >::iterator aDestIt( aSeriesCnt.begin());
- for(; aSrcIt != aNewSeries.end() && aDestIt != aSeriesCnt.end();
+ auto aSrcIt = rNewData.Series.begin();
+ auto aDestIt = aSeriesCnt.begin();
+ for(; aSrcIt != rNewData.Series.end() && aDestIt != aSeriesCnt.end();
++aSrcIt, ++aDestIt )
{
try
@@ -845,16 +834,13 @@ void DialogModel::applyInterpretedData(
sal_Int32 DialogModel::countSeries() const
{
- std::vector< Reference< XDataSeriesContainer > > aCnt( getAllDataSeriesContainers());
+ std::vector< rtl::Reference< ChartType > > aCnt( getAllDataSeriesContainers());
return std::accumulate( aCnt.begin(), aCnt.end(), 0, lcl_addSeriesNumber());
}
ChartModel& DialogModel::getModel() const
{
- uno::Reference< frame::XModel > xModel = getChartModel();
- ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
- assert(pModel);
- return *pModel;
+ return *m_xChartDocument;
}
} // namespace chart
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx
index 99ce73949cd0..24b74d6fab3a 100644
--- a/chart2/source/controller/dialogs/DialogModel.hxx
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -20,6 +20,8 @@
#include <TimerTriggeredControllerLock.hxx>
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <ChartTypeTemplate.hxx>
#include <map>
#include <memory>
@@ -36,8 +38,6 @@ namespace com::sun::star::chart2 {
class XDataSeriesContainer;
class XDataSeries;
class XChartType;
- class XChartTypeTemplate;
- struct InterpretedData;
namespace data {
class XDataProvider;
class XLabeledDataSequence;
@@ -46,7 +46,10 @@ namespace com::sun::star::chart2 {
namespace chart
{
-
+class ChartType;
+class DataSeries;
+struct InterpretedData;
+class LabeledDataSequence;
class RangeSelectionHelper;
struct DialogModelTimeBasedInfo
@@ -61,33 +64,31 @@ struct DialogModelTimeBasedInfo
class DialogModel
{
public:
- explicit DialogModel(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument,
- const css::uno::Reference< css::uno::XComponentContext > & xContext );
+ explicit DialogModel( rtl::Reference<::chart::ChartModel> xChartDocument );
~DialogModel();
typedef std::pair<
OUString,
- std::pair< css::uno::Reference< css::chart2::XDataSeries >,
- css::uno::Reference< css::chart2::XChartType > > >
+ std::pair< rtl::Reference< ::chart::DataSeries >,
+ rtl::Reference< ::chart::ChartType > > >
tSeriesWithChartTypeByName;
typedef std::map< OUString, OUString >
tRolesWithRanges;
void setTemplate(
- const css::uno::Reference< css::chart2::XChartTypeTemplate > & xTemplate );
+ const rtl::Reference< ::chart::ChartTypeTemplate > & xTemplate );
std::shared_ptr< RangeSelectionHelper > const &
getRangeSelectionHelper() const;
- css::uno::Reference< css::frame::XModel >
+ const rtl::Reference<::chart::ChartModel> &
getChartModel() const;
css::uno::Reference< css::chart2::data::XDataProvider >
getDataProvider() const;
- std::vector< css::uno::Reference< css::chart2::XDataSeriesContainer > >
+ std::vector< rtl::Reference< ::chart::ChartType > >
getAllDataSeriesContainers() const;
std::vector< tSeriesWithChartTypeByName >
@@ -96,26 +97,26 @@ public:
static tRolesWithRanges getRolesWithRanges(
const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
const OUString & aRoleOfSequenceForLabel,
- const css::uno::Reference< css::chart2::XChartType > & xChartType );
+ const rtl::Reference< ::chart::ChartType > & xChartType );
enum class MoveDirection
{
Down, Up
};
- void moveSeries( const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
+ void moveSeries( const rtl::Reference< DataSeries > & xSeries,
MoveDirection eDirection );
/// @return the newly inserted series
- css::uno::Reference<
- css::chart2::XDataSeries > insertSeriesAfter(
+ rtl::Reference<
+ ::chart::DataSeries > insertSeriesAfter(
const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
- const css::uno::Reference< css::chart2::XChartType > & xChartType,
+ const rtl::Reference< ::chart::ChartType > & xChartType,
bool bCreateDataCachedSequences = false );
void deleteSeries(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
- const css::uno::Reference< css::chart2::XChartType > & xChartType );
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
+ const rtl::Reference< ::chart::ChartType > & xChartType );
css::uno::Reference< css::chart2::data::XLabeledDataSequence >
getCategories() const;
@@ -150,14 +151,10 @@ public:
ChartModel& getModel() const;
private:
- css::uno::Reference< css::chart2::XChartDocument >
+ rtl::Reference<::chart::ChartModel>
m_xChartDocument;
- css::uno::Reference< css::chart2::XChartTypeTemplate >
- m_xTemplate;
-
- css::uno::Reference< css::uno::XComponentContext >
- m_xContext;
+ rtl::Reference< ::chart::ChartTypeTemplate > m_xTemplate;
mutable std::shared_ptr< RangeSelectionHelper >
m_spRangeSelectionHelper;
@@ -166,8 +163,8 @@ private:
private:
void applyInterpretedData(
- const css::chart2::InterpretedData & rNewData,
- const std::vector< css::uno::Reference< css::chart2::XDataSeries > > & rSeriesToReUse );
+ const InterpretedData & rNewData,
+ const std::vector< rtl::Reference< ::chart::DataSeries > > & rSeriesToReUse );
sal_Int32 countSeries() const;
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 56dca8dde908..f06c7af5e777 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -24,25 +24,29 @@
#include <ObjectNameProvider.hxx>
#include <ResId.hxx>
#include <strings.hrc>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <ChartModel.hxx>
-#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartType.hxx>
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <TitleHelper.hxx>
#include <ExplicitCategoriesProvider.hxx>
#include <CommonConverters.hxx>
#include <NumberFormatterWrapper.hxx>
#include <RegressionCurveHelper.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <RegressionCurveModel.hxx>
#include <rtl/math.hxx>
#include <rtl/ustring.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <unotools/localedatawrapper.hxx>
-#include <com/sun/star/chart2/XTitle.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
-#include <tools/diagnose_ex.h>
+#include <com/sun/star/chart2/MovingAverageType.hpp>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/string_view.hxx>
namespace chart
{
@@ -55,26 +59,26 @@ using ::com::sun::star::uno::Any;
namespace
{
-OUString lcl_getDataSeriesName( const OUString& rObjectCID, const Reference< frame::XModel >& xChartModel )
+OUString lcl_getDataSeriesName( std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel )
{
OUString aRet;
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel );
if( xDiagram.is() && xSeries.is() )
{
- Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) );
if( xChartType.is() )
{
- aRet = ::chart::DataSeriesHelper::getDataSeriesLabel(
- xSeries, xChartType->getRoleOfSequenceForSeriesLabel() ) ;
+ aRet = xSeries->getLabelForRole(
+ xChartType->getRoleOfSequenceForSeriesLabel() ) ;
}
}
return aRet;
}
-OUString lcl_getFullSeriesName( const OUString& rObjectCID, const Reference< frame::XModel >& xChartModel )
+OUString lcl_getFullSeriesName( std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel )
{
OUString aRet(SchResId(STR_TIP_DATASERIES));
OUString aWildcard( "%SERIESNAME" );
@@ -92,19 +96,17 @@ void lcl_addText( OUString& rOut, std::u16string_view rSeparator, std::u16string
rOut+=rNext;
}
-OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal_Int32 nPointIndex,
- const Reference< XCoordinateSystem >& xCooSys,
+OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries, sal_Int32 nPointIndex,
+ const rtl::Reference< BaseCoordinateSystem >& xCooSys,
const Reference< frame::XModel >& xChartModel )
{
OUString aRet;
- Reference<data::XDataSource> xDataSource(
- uno::Reference<data::XDataSource>( xSeries, uno::UNO_QUERY ) );
- if(!xDataSource.is())
+ if(!xSeries.is())
return aRet;
- Sequence< Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSequences = xSeries->getDataSequences2();
OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last, a_Size;
double fValue = 0;
@@ -114,18 +116,20 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
Color nLabelColor;//dummy
bool bColorChanged;//dummy
- for(sal_Int32 nN = aDataSequences.getLength();nN--;)
+ for(sal_Int32 nN = aDataSequences.size();nN--;)
{
uno::Reference<data::XDataSequence> xDataSequence( aDataSequences[nN]->getValues());
if( !xDataSequence.is() )
continue;
- Sequence< Any > aData( xDataSequence->getData() );
- if( nPointIndex >= aData.getLength() )
- continue;
- uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY );
- if( xProp.is())
+
+ try
{
- try
+ Sequence< Any > aData( xDataSequence->getData() );
+
+ if( nPointIndex >= aData.getLength() )
+ continue;
+ uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY );
+ if( xProp.is())
{
uno::Any aARole = xProp->getPropertyValue( "Role" );
OUString aRole;
@@ -174,10 +178,14 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
a_Size = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
}
}
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ }
+ catch (const lang::DisposedException&)
+ {
+ TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
}
@@ -309,24 +317,27 @@ OUString ObjectNameProvider::getName( ObjectType eObjectType, bool bPlural )
case OBJECTTYPE_DATA_CURVE_EQUATION:
aRet=SchResId(STR_OBJECT_CURVE_EQUATION);
break;
+ case OBJECTTYPE_DATA_TABLE:
+ aRet=SchResId(STR_DATA_TABLE);
+ break;
default: //OBJECTTYPE_UNKNOWN
;
}
return aRet;
}
-OUString ObjectNameProvider::getAxisName( const OUString& rObjectCID
- , const uno::Reference< frame::XModel >& xChartModel )
+OUString ObjectNameProvider::getAxisName( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
OUString aRet;
- Reference< XAxis > xAxis(
- ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Axis > xAxis =
+ dynamic_cast<::chart::Axis*>(ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ).get());
sal_Int32 nCooSysIndex = 0;
sal_Int32 nDimensionIndex = 0;
sal_Int32 nAxisIndex = 0;
- AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ), nCooSysIndex, nDimensionIndex, nAxisIndex );
+ AxisHelper::getIndicesForAxis( xAxis, xChartModel->getFirstChartDiagram(), nCooSysIndex, nDimensionIndex, nAxisIndex );
switch(nDimensionIndex)
{
@@ -391,14 +402,14 @@ OUString ObjectNameProvider::getTitleNameByType( TitleHelper::eTitleType eType )
return aRet;
}
-OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel )
+OUString ObjectNameProvider::getTitleName( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
OUString aRet;
- Reference< XTitle > xTitle(
- ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY );
- if( xTitle.is() )
+ rtl::Reference<Title> xTitle =
+ dynamic_cast<Title*>(ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ).get());
+ if( xTitle )
{
TitleHelper::eTitleType eType;
if( TitleHelper::getTitleType( eType, xTitle, xChartModel ) )
@@ -410,16 +421,16 @@ OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID
return aRet;
}
-OUString ObjectNameProvider::getGridName( const OUString& rObjectCID
- , const uno::Reference< frame::XModel >& xChartModel )
+OUString ObjectNameProvider::getGridName( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
OUString aRet;
sal_Int32 nCooSysIndex = -1;
sal_Int32 nDimensionIndex = -1;
sal_Int32 nAxisIndex = -1;
- Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( rObjectCID , xChartModel ) );
- AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram( xChartModel )
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( rObjectCID , xChartModel );
+ AxisHelper::getIndicesForAxis( xAxis, xChartModel->getFirstChartDiagram()
, nCooSysIndex , nDimensionIndex, nAxisIndex );
bool bMainGrid = (ObjectIdentifier::getObjectType( rObjectCID ) == OBJECTTYPE_GRID);
@@ -463,12 +474,7 @@ OUString ObjectNameProvider::getGridName( const OUString& rObjectCID
return aRet;
}
-OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Reference< chart2::XChartDocument >& xChartDocument )
-{
- return getHelpText( rObjectCID, Reference< frame::XModel >( xChartDocument ) );
-}
-
-OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Reference< frame::XModel >& xChartModel, bool bVerbose )
+OUString ObjectNameProvider::getHelpText( std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel, bool bVerbose )
{
OUString aRet;
ObjectType eObjectType( ObjectIdentifier::getObjectType(rObjectCID) );
@@ -500,11 +506,11 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
else
aRet=SchResId(STR_TIP_DATAPOINT);
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel );
if( xDiagram.is() && xSeries.is() )
{
- sal_Int32 nPointIndex( ObjectIdentifier::getParticleID(rObjectCID).toInt32() );
+ sal_Int32 nPointIndex = o3tl::toInt32(ObjectIdentifier::getParticleID(rObjectCID));
//replace data point index
OUString aWildcard( "%POINTNUMBER" );
@@ -519,8 +525,8 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
nIndex = aRet.indexOf( aWildcard );
if( nIndex != -1 )
{
- std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector =
+ xDiagram->getDataSeries();
sal_Int32 nSeriesIndex = -1;
for( nSeriesIndex=aSeriesVector.size();nSeriesIndex--;)
{
@@ -553,13 +559,12 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
if( bVerbose )
{
aRet = SchResId( STR_OBJECT_CURVE_WITH_PARAMETERS );
- Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ));
- Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ));
- if( xCurveCnt.is())
+ if( xSeries.is())
{
sal_Int32 nCurveIndex = ObjectIdentifier::getIndexFromParticleOrCID( rObjectCID );
- Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getRegressionCurveAtIndex(xCurveCnt, nCurveIndex) );
+ rtl::Reference< RegressionCurveModel > xCurve = RegressionCurveHelper::getRegressionCurveAtIndex(xSeries, nCurveIndex);
if( xCurve.is())
{
try
@@ -567,6 +572,7 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
Reference< chart2::XRegressionCurveCalculator > xCalculator( xCurve->getCalculator(), uno::UNO_SET_THROW );
sal_Int32 aDegree = 2;
sal_Int32 aPeriod = 2;
+ sal_Int32 aMovingType = css::chart2::MovingAverageType::Prior;
bool bForceIntercept = false;
double aInterceptValue = 0.0;
OUString aXName ("x"), aYName ("f(x)");
@@ -574,59 +580,55 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
const OUString& aNumDecimalSep = rLocaleDataWrapper.getNumDecimalSep();
sal_Unicode cDecSeparator = aNumDecimalSep[0];
- uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
- if ( xProperties.is())
+ xCurve->getPropertyValue( "PolynomialDegree") >>= aDegree;
+ xCurve->getPropertyValue( "MovingAveragePeriod") >>= aPeriod;
+ xCurve->getPropertyValue( "MovingAverageType") >>= aMovingType;
+ xCurve->getPropertyValue( "ForceIntercept") >>= bForceIntercept;
+ if (bForceIntercept)
+ xCurve->getPropertyValue( "InterceptValue") >>= aInterceptValue;
+ uno::Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties());
+ if( xEqProp.is())
{
- xProperties->getPropertyValue( "PolynomialDegree") >>= aDegree;
- xProperties->getPropertyValue( "MovingAveragePeriod") >>= aPeriod;
- xProperties->getPropertyValue( "ForceIntercept") >>= bForceIntercept;
- if (bForceIntercept)
- xProperties->getPropertyValue( "InterceptValue") >>= aInterceptValue;
- uno::Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties());
- if( xEqProp.is())
- {
- if ( !(xEqProp->getPropertyValue( "XName") >>= aXName) )
- aXName = "x";
- if ( !(xEqProp->getPropertyValue( "YName") >>= aYName) )
- aYName = "f(x)";
- }
+ if ( !(xEqProp->getPropertyValue( "XName") >>= aXName) )
+ aXName = "x";
+ if ( !(xEqProp->getPropertyValue( "YName") >>= aYName) )
+ aYName = "f(x)";
}
- xCalculator->setRegressionProperties(aDegree, bForceIntercept, aInterceptValue, 2);
+ xCalculator->setRegressionProperties(aDegree, bForceIntercept, aInterceptValue, aPeriod, aMovingType);
xCalculator->setXYNames ( aXName, aYName );
RegressionCurveHelper::initializeCurveCalculator( xCalculator, xSeries, xChartModel );
// change text for Moving Average
- OUString aWildcard( "%PERIOD" );
- sal_Int32 nIndex = xCalculator->getRepresentation().indexOf( aWildcard );
- if( nIndex != -1 )
- { // replace period
- aRet = xCalculator->getRepresentation();
- aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), OUString::number(aPeriod) );
+ if ( RegressionCurveHelper::getRegressionType( xCurve ) == SvxChartRegress::MovingAverage )
+ {
+ aRet = xCalculator->getRepresentation();
}
-
- // replace formula
- aWildcard = "%FORMULA";
- nIndex = aRet.indexOf( aWildcard );
- if( nIndex != -1 )
+ else
{
- OUString aFormula ( xCalculator->getRepresentation() );
- if ( cDecSeparator != '.' )
+ // replace formula
+ OUString aWildcard = "%FORMULA";
+ sal_Int32 nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
{
- aFormula = aFormula.replace( '.', cDecSeparator );
+ OUString aFormula ( xCalculator->getRepresentation() );
+ if ( cDecSeparator != '.' )
+ {
+ aFormula = aFormula.replace( '.', cDecSeparator );
+ }
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), aFormula );
}
- aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), aFormula );
- }
- // replace r^2
- aWildcard = "%RSQUARED";
- nIndex = aRet.indexOf( aWildcard );
- if( nIndex != -1 )
- {
- double fR( xCalculator->getCorrelationCoefficient());
- aRet = aRet.replaceAt(
- nIndex, aWildcard.getLength(),
- ::rtl::math::doubleToUString(
- fR*fR, rtl_math_StringFormat_G, 4, cDecSeparator, true ));
+ // replace r^2
+ aWildcard = "%RSQUARED";
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ double fR( xCalculator->getCorrelationCoefficient());
+ aRet = aRet.replaceAt(
+ nIndex, aWildcard.getLength(),
+ ::rtl::math::doubleToUString(
+ fR*fR, rtl_math_StringFormat_G, 4, cDecSeparator, true ));
+ }
}
}
catch( const uno::Exception & )
@@ -638,14 +640,13 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
}
else
{
- Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(rObjectCID , xChartModel));
- Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(rObjectCID , xChartModel));
aRet += getName(eObjectType);
- if( xCurveCnt.is())
+ if( xSeries.is())
{
sal_Int32 nCurveIndex = ObjectIdentifier::getIndexFromParticleOrCID( rObjectCID );
- Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getRegressionCurveAtIndex(xCurveCnt, nCurveIndex) );
+ rtl::Reference< RegressionCurveModel > xCurve( RegressionCurveHelper::getRegressionCurveAtIndex(xSeries, nCurveIndex) );
if( xCurve.is())
{
aRet += " (" + RegressionCurveHelper::getRegressionCurveName(xCurve) + " )";
@@ -658,11 +659,10 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
if( bVerbose )
{
aRet = SchResId(STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS);
- Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ));
- Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
- if( xCurveCnt.is())
+ rtl::Reference< DataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ));
+ if( xSeries.is())
{
- Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getMeanValueLine( xCurveCnt ));
+ rtl::Reference< RegressionCurveModel > xCurve( RegressionCurveHelper::getMeanValueLine( xSeries ));
if( xCurve.is())
{
try
@@ -718,52 +718,51 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
return aRet;
}
-OUString ObjectNameProvider::getSelectedObjectText( const OUString & rObjectCID, const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument )
+OUString ObjectNameProvider::getSelectedObjectText( std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartDocument )
{
OUString aRet;
ObjectType eObjectType( ObjectIdentifier::getObjectType(rObjectCID) );
- Reference< frame::XModel > xChartModel = xChartDocument;
if( eObjectType == OBJECTTYPE_DATA_POINT )
{
aRet = SchResId( STR_STATUS_DATAPOINT_MARKED );
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel );
+ rtl::Reference< Diagram > xDiagram( xChartDocument->getFirstChartDiagram() );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartDocument );
if( xDiagram.is() && xSeries.is() )
{
- sal_Int32 nPointIndex( ObjectIdentifier::getParticleID(rObjectCID).toInt32() );
+ sal_Int32 nPointIndex = o3tl::toInt32( ObjectIdentifier::getParticleID(rObjectCID) );
// replace data point index
- replaceParamterInString( aRet, "%POINTNUMBER", OUString::number( nPointIndex + 1 ));
+ replaceParamterInString( aRet, u"%POINTNUMBER", OUString::number( nPointIndex + 1 ));
// replace data series index
{
- std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector(
+ xDiagram->getDataSeries() );
sal_Int32 nSeriesIndex = -1;
for( nSeriesIndex=aSeriesVector.size();nSeriesIndex--;)
{
if( aSeriesVector[nSeriesIndex] == xSeries )
break;
}
- replaceParamterInString( aRet, "%SERIESNUMBER", OUString::number( nSeriesIndex + 1 ) );
+ replaceParamterInString( aRet, u"%SERIESNUMBER", OUString::number( nSeriesIndex + 1 ) );
}
// replace point value
- replaceParamterInString( aRet, "%POINTVALUES", lcl_getDataPointValueText(
- xSeries, nPointIndex, DataSeriesHelper::getCoordinateSystemOfSeries(xSeries, xDiagram), xChartModel ) );
+ replaceParamterInString( aRet, u"%POINTVALUES", lcl_getDataPointValueText(
+ xSeries, nPointIndex, DataSeriesHelper::getCoordinateSystemOfSeries(xSeries, xDiagram), xChartDocument ) );
}
}
else
{
// use the verbose text including the formula for trend lines
const bool bVerbose( eObjectType == OBJECTTYPE_DATA_CURVE || eObjectType == OBJECTTYPE_DATA_AVERAGE_LINE );
- const OUString aHelpText( getHelpText( rObjectCID, xChartModel, bVerbose ));
+ const OUString aHelpText( getHelpText( rObjectCID, xChartDocument, bVerbose ));
if( !aHelpText.isEmpty())
{
aRet = SchResId( STR_STATUS_OBJECT_MARKED );
- replaceParamterInString( aRet, "%OBJECTNAME", aHelpText );
+ replaceParamterInString( aRet, u"%OBJECTNAME", aHelpText );
}
}
@@ -771,23 +770,22 @@ OUString ObjectNameProvider::getSelectedObjectText( const OUString & rObjectCID,
}
OUString ObjectNameProvider::getNameForCID(
- const OUString& rObjectCID,
- const uno::Reference< chart2::XChartDocument >& xChartDocument )
+ std::u16string_view rObjectCID,
+ const rtl::Reference<::chart::ChartModel>& xChartDocument )
{
ObjectType eType( ObjectIdentifier::getObjectType( rObjectCID ));
- Reference< frame::XModel > xModel = xChartDocument;
switch( eType )
{
case OBJECTTYPE_AXIS:
- return getAxisName( rObjectCID, xModel );
+ return getAxisName( rObjectCID, xChartDocument );
case OBJECTTYPE_TITLE:
- return getTitleName( rObjectCID, xModel );
+ return getTitleName( rObjectCID, xChartDocument );
case OBJECTTYPE_GRID:
case OBJECTTYPE_SUBGRID:
- return getGridName( rObjectCID, xModel );
+ return getGridName( rObjectCID, xChartDocument );
case OBJECTTYPE_DATA_SERIES:
- return lcl_getFullSeriesName( rObjectCID, xModel );
+ return lcl_getFullSeriesName( rObjectCID, xChartDocument );
case OBJECTTYPE_DATA_POINT:
case OBJECTTYPE_DATA_LABELS:
case OBJECTTYPE_DATA_LABEL:
@@ -798,7 +796,7 @@ OUString ObjectNameProvider::getNameForCID(
case OBJECTTYPE_DATA_CURVE:
case OBJECTTYPE_DATA_CURVE_EQUATION:
{
- OUString aRet = lcl_getFullSeriesName( rObjectCID, xModel ) + " ";
+ OUString aRet = lcl_getFullSeriesName( rObjectCID, xChartDocument ) + " ";
if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL )
{
aRet += getName( OBJECTTYPE_DATA_POINT );
@@ -811,15 +809,14 @@ OUString ObjectNameProvider::getNameForCID(
}
else if (eType == OBJECTTYPE_DATA_CURVE || eType == OBJECTTYPE_DATA_CURVE_EQUATION)
{
- Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xModel ));
- Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartDocument ));
aRet += " " + getName(eType);
- if( xCurveCnt.is())
+ if( xSeries.is())
{
sal_Int32 nCurveIndex = ObjectIdentifier::getIndexFromParticleOrCID( rObjectCID );
- Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getRegressionCurveAtIndex(xCurveCnt, nCurveIndex) );
+ rtl::Reference< RegressionCurveModel > xCurve( RegressionCurveHelper::getRegressionCurveAtIndex(xSeries, nCurveIndex) );
if( xCurve.is())
{
aRet += " (" + RegressionCurveHelper::getRegressionCurveName(xCurve) + ")";
@@ -841,16 +838,15 @@ OUString ObjectNameProvider::getNameForCID(
OUString ObjectNameProvider::getName_ObjectForSeries(
ObjectType eObjectType,
- const OUString& rSeriesCID,
- const uno::Reference< chart2::XChartDocument >& xChartDocument )
+ std::u16string_view rSeriesCID,
+ const rtl::Reference<::chart::ChartModel>& xChartDocument )
{
- uno::Reference< frame::XModel> xChartModel = xChartDocument;
- Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSeriesCID , xChartModel );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSeriesCID , xChartDocument );
if( xSeries.is() )
{
OUString aRet = SchResId(STR_OBJECT_FOR_SERIES);
- replaceParamterInString( aRet, "%OBJECTNAME", getName( eObjectType ) );
- replaceParamterInString( aRet, "%SERIESNAME", lcl_getDataSeriesName( rSeriesCID, xChartModel ) );
+ replaceParamterInString( aRet, u"%OBJECTNAME", getName( eObjectType ) );
+ replaceParamterInString( aRet, u"%SERIESNAME", lcl_getDataSeriesName( rSeriesCID, xChartDocument ) );
return aRet;
}
else
@@ -860,7 +856,7 @@ OUString ObjectNameProvider::getName_ObjectForSeries(
OUString ObjectNameProvider::getName_ObjectForAllSeries( ObjectType eObjectType )
{
OUString aRet = SchResId(STR_OBJECT_FOR_ALL_SERIES);
- replaceParamterInString( aRet, "%OBJECTNAME", getName( eObjectType, true /*bPlural*/ ) );
+ replaceParamterInString( aRet, u"%OBJECTNAME", getName( eObjectType, true /*bPlural*/ ) );
return aRet;
}
diff --git a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
index 8cd8f64c8383..00e9a3cc8a8c 100644
--- a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
+++ b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
@@ -20,9 +20,10 @@
#include <RangeSelectionHelper.hxx>
#include <RangeSelectionListener.hxx>
#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <ChartModel.hxx>
+#include <utility>
using namespace ::com::sun::star;
@@ -33,8 +34,8 @@ namespace chart
{
RangeSelectionHelper::RangeSelectionHelper(
- const Reference< chart2::XChartDocument > & xChartDocument ) :
- m_xChartDocument( xChartDocument )
+ rtl::Reference<::chart::ChartModel> xChartDocument ) :
+ m_xChartDocument(std::move( xChartDocument ))
{}
RangeSelectionHelper::~RangeSelectionHelper()
@@ -109,21 +110,21 @@ bool RangeSelectionHelper::chooseRange(
Reference< sheet::XRangeSelection > xRangeSel( getRangeSelection());
if( xRangeSel.is())
{
- Sequence< beans::PropertyValue > aArgs( 4 );
- aArgs[0] = beans::PropertyValue(
- "InitialValue", -1, uno::Any( aCurrentRange ),
- beans::PropertyState_DIRECT_VALUE );
- aArgs[1] = beans::PropertyValue(
- "Title", -1,
- uno::Any( aUIString ),
- beans::PropertyState_DIRECT_VALUE );
- aArgs[2] = beans::PropertyValue(
- "CloseOnMouseRelease", -1, uno::Any( true ),
- beans::PropertyState_DIRECT_VALUE );
- aArgs[3] = beans::PropertyValue(
- "MultiSelectionMode", -1, uno::Any( true ),
- beans::PropertyState_DIRECT_VALUE );
-
+ Sequence< beans::PropertyValue > aArgs{
+ beans::PropertyValue(
+ "InitialValue", -1, uno::Any( aCurrentRange ),
+ beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "Title", -1,
+ uno::Any( aUIString ),
+ beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "CloseOnMouseRelease", -1, uno::Any( true ),
+ beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "MultiSelectionMode", -1, uno::Any( true ),
+ beans::PropertyState_DIRECT_VALUE )
+ };
if( m_xRangeSelectionListener.is() )
stopRangeListening();
m_xRangeSelectionListener.set( Reference< sheet::XRangeSelectionListener >(
diff --git a/chart2/source/controller/dialogs/RangeSelectionListener.cxx b/chart2/source/controller/dialogs/RangeSelectionListener.cxx
index ca0d9ae2cd48..e4974ab30de0 100644
--- a/chart2/source/controller/dialogs/RangeSelectionListener.cxx
+++ b/chart2/source/controller/dialogs/RangeSelectionListener.cxx
@@ -18,20 +18,20 @@
*/
#include <RangeSelectionListener.hxx>
+#include <ChartModel.hxx>
+#include <utility>
using namespace ::com::sun::star;
-using ::com::sun::star::uno::Reference;
-
namespace chart
{
RangeSelectionListener::RangeSelectionListener(
RangeSelectionListenerParent & rParent,
- const OUString & rInitialRange,
- const Reference< frame::XModel >& xModelToLockController ) :
+ OUString aInitialRange,
+ const rtl::Reference<::chart::ChartModel>& xModelToLockController ) :
m_rParent( rParent ),
- m_aRange( rInitialRange ),
+ m_aRange(std::move( aInitialRange )),
m_aControllerLockGuard( xModelToLockController )
{}
diff --git a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
index 1215e7b40cdf..cee4af1fb013 100644
--- a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
+++ b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
@@ -17,19 +17,19 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/frame/XModel.hpp>
#include <TimerTriggeredControllerLock.hxx>
#include <ControllerLockGuard.hxx>
+#include <ChartModel.hxx>
+#include <utility>
namespace chart
{
using namespace ::com::sun::star;
TimerTriggeredControllerLock::TimerTriggeredControllerLock(
- const uno::Reference<frame::XModel>& xModel)
- : m_xModel(xModel)
- , m_apControllerLockGuard()
- , m_aTimer()
+ rtl::Reference<::chart::ChartModel> xModel)
+ : m_xModel(std::move(xModel))
+ , m_aTimer("chart2 TimerTriggeredControllerLock")
{
m_aTimer.SetTimeout(4 * EDIT_UPDATEDATA_TIMEOUT);
m_aTimer.SetInvokeHandler(LINK(this, TimerTriggeredControllerLock, TimerTimeout));
diff --git a/chart2/source/controller/dialogs/TitleDialogData.cxx b/chart2/source/controller/dialogs/TitleDialogData.cxx
index e4e9099011a6..75d59bbb43b4 100644
--- a/chart2/source/controller/dialogs/TitleDialogData.cxx
+++ b/chart2/source/controller/dialogs/TitleDialogData.cxx
@@ -19,65 +19,61 @@
#include <sal/config.h>
-#include <com/sun/star/frame/XModel.hpp>
-
#include <TitleDialogData.hxx>
#include <TitleHelper.hxx>
-#include <ChartModelHelper.hxx>
+#include <Diagram.hxx>
#include <AxisHelper.hxx>
+#include <ChartModel.hxx>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
-TitleDialogData::TitleDialogData( std::unique_ptr<ReferenceSizeProvider> pRefSizeProvider )
- : aPossibilityList(7)
- , aExistenceList(7)
+TitleDialogData::TitleDialogData( std::optional<ReferenceSizeProvider> pRefSizeProvider )
+ : aPossibilityList{ true, true, true, true, true, true, true }
+ , aExistenceList{ false, false, false, false, false, false, false }
, aTextList(7)
, apReferenceSizeProvider( std::move(pRefSizeProvider) )
{
- for (sal_Int32 i = 0; i < 7; i++)
- {
- aPossibilityList[i] = true;
- aExistenceList[i] = false;
- }
}
-void TitleDialogData::readFromModel( const uno::Reference< frame::XModel>& xChartModel )
+void TitleDialogData::readFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(xChartModel);
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
//get possibilities
uno::Sequence< sal_Bool > aAxisPossibilityList;
AxisHelper::getAxisOrGridPossibilities( aAxisPossibilityList, xDiagram );
- aPossibilityList[2]=aAxisPossibilityList[0];//x axis title
- aPossibilityList[3]=aAxisPossibilityList[1];//y axis title
- aPossibilityList[4]=aAxisPossibilityList[2];//z axis title
- aPossibilityList[5]=aAxisPossibilityList[3];//secondary x axis title
- aPossibilityList[6]=aAxisPossibilityList[4];//secondary y axis title
+ sal_Bool* pPossibilityList = aPossibilityList.getArray();
+ pPossibilityList[2]=aAxisPossibilityList[0];//x axis title
+ pPossibilityList[3]=aAxisPossibilityList[1];//y axis title
+ pPossibilityList[4]=aAxisPossibilityList[2];//z axis title
+ pPossibilityList[5]=aAxisPossibilityList[3];//secondary x axis title
+ pPossibilityList[6]=aAxisPossibilityList[4];//secondary y axis title
+ sal_Bool* pExistenceList = aExistenceList.getArray();
+ auto pTextList = aTextList.getArray();
//find out which title exists and get their text
//main title:
- for( sal_Int32 nTitleIndex = static_cast< sal_Int32 >( TitleHelper::TITLE_BEGIN);
- nTitleIndex < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END );
+ for( auto nTitleIndex = +TitleHelper::TITLE_BEGIN;
+ nTitleIndex < +TitleHelper::NORMAL_TITLE_END;
nTitleIndex++)
{
- uno::Reference< XTitle > xTitle = TitleHelper::getTitle(
+ rtl::Reference< Title > xTitle = TitleHelper::getTitle(
static_cast< TitleHelper::eTitleType >( nTitleIndex ), xChartModel );
- aExistenceList[nTitleIndex] = xTitle.is();
- aTextList[nTitleIndex]=TitleHelper::getCompleteString( xTitle );
+ pExistenceList[nTitleIndex] = xTitle.is();
+ pTextList[nTitleIndex]=TitleHelper::getCompleteString( xTitle );
}
}
bool TitleDialogData::writeDifferenceToModel(
- const uno::Reference< frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, const uno::Reference< uno::XComponentContext >& xContext
- , TitleDialogData* pOldState )
+ , const TitleDialogData* pOldState )
{
bool bChanged = false;
- for( sal_Int32 nN = static_cast< sal_Int32 >( TitleHelper::TITLE_BEGIN );
- nN < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END );
+ for( auto nN = +TitleHelper::TITLE_BEGIN;
+ nN < +TitleHelper::NORMAL_TITLE_END;
nN++)
{
if( !pOldState || ( pOldState->aExistenceList[nN] != aExistenceList[nN] ) )
@@ -86,7 +82,7 @@ bool TitleDialogData::writeDifferenceToModel(
{
TitleHelper::createTitle(
static_cast< TitleHelper::eTitleType >( nN ), aTextList[nN], xChartModel, xContext,
- apReferenceSizeProvider.get() );
+ apReferenceSizeProvider.has_value() ? &*apReferenceSizeProvider : nullptr );
bChanged = true;
}
else
@@ -98,11 +94,11 @@ bool TitleDialogData::writeDifferenceToModel(
else if( !pOldState || ( pOldState->aTextList[nN] != aTextList[nN] ) )
{
//change content
- uno::Reference< XTitle > xTitle(
+ rtl::Reference< Title > xTitle(
TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel ) );
if(xTitle.is())
{
- TitleHelper::setCompleteString( aTextList[nN], xTitle, xContext );
+ TitleHelper::setCompleteString( aTextList[nN], xTitle, xContext, nullptr, true );
bChanged = true;
}
}
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx
index 324eb06c8373..a1f52f5169a5 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx
@@ -19,22 +19,21 @@
#include <dlg_ChartType.hxx>
#include "tp_ChartType.hxx"
-#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <ChartModel.hxx>
+#include <utility>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
ChartTypeDialog::ChartTypeDialog(weld::Window* pParent,
- const uno::Reference<frame::XModel>& xChartModel)
+ rtl::Reference<::chart::ChartModel> xChartModel)
: GenericDialogController(pParent, "modules/schart/ui/charttypedialog.ui", "ChartTypeDialog")
- , m_xChartModel(xChartModel)
- , m_xContentArea(m_xDialog->weld_content_area())
+ , m_xChartModel(std::move(xChartModel))
+ , m_xContentArea(m_xBuilder->weld_container("content"))
{
m_xChartTypeTabPage = std::make_unique<ChartTypeTabPage>(
- m_xContentArea.get(), this, uno::Reference<XChartDocument>::query(m_xChartModel),
- false /*don't show title description*/);
+ m_xContentArea.get(), this, m_xChartModel, false /*don't show title description*/);
m_xChartTypeTabPage->initializePage();
}
diff --git a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
index 1a34d47b4f9c..0e95cd75c48e 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
@@ -19,10 +19,10 @@
#include <dlg_ChartType_UNO.hxx>
#include <dlg_ChartType.hxx>
+#include <ChartModel.hxx>
#include <servicenames.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
-#include <com/sun/star/frame/XModel.hpp>
namespace com::sun::star::awt { class XWindow; }
@@ -64,7 +64,12 @@ void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue)
if (_rValue >>= aProperty)
{
if (aProperty.Name == "ChartModel")
- m_xChartModel.set(aProperty.Value,uno::UNO_QUERY);
+ {
+ uno::Reference<XInterface> xInt;
+ aProperty.Value >>= xInt;
+ assert(dynamic_cast<::chart::ChartModel*>(xInt.get()));
+ m_xChartModel = dynamic_cast<::chart::ChartModel*>(xInt.get());
+ }
else
ChartTypeUnoDlg_BASE::implInitialize(_rValue);
}
@@ -74,7 +79,9 @@ void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue)
std::unique_ptr<weld::DialogController> ChartTypeUnoDlg::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
{
- return std::make_unique<ChartTypeDialog>(Application::GetFrameWeld(rParent), m_xChartModel);
+ ChartModel* pChartModel = dynamic_cast<ChartModel*>(rParent.get());
+ assert(pChartModel);
+ return std::make_unique<ChartTypeDialog>(Application::GetFrameWeld(rParent), pChartModel);
}
uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo()
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index da073c2f9956..12d22805790f 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -28,6 +28,8 @@
#include "tp_Wizard_TitlesAndObjects.hxx"
#include "tp_DataSource.hxx"
#include <ChartTypeTemplateProvider.hxx>
+#include <ChartTypeTemplate.hxx>
+#include <utility>
#include "DialogModel.hxx"
using namespace css;
@@ -44,16 +46,16 @@ namespace chart
#define STATE_OBJECTS 3
#define STATE_LAST STATE_OBJECTS
-CreationWizard::CreationWizard(weld::Window* pParent, const uno::Reference<frame::XModel>& xChartModel,
- const uno::Reference<uno::XComponentContext>& xContext)
+CreationWizard::CreationWizard(weld::Window* pParent, const rtl::Reference<::chart::ChartModel>& xChartModel,
+ uno::Reference<uno::XComponentContext> xContext)
: vcl::RoadmapWizardMachine(pParent)
, m_xChartModel(xChartModel,uno::UNO_QUERY)
- , m_xComponentContext(xContext)
+ , m_xComponentContext(std::move(xContext))
, m_pTemplateProvider(nullptr)
, m_aTimerTriggeredControllerLock(xChartModel)
, m_bCanTravel(true)
{
- m_pDialogModel.reset(new DialogModel(m_xChartModel, m_xComponentContext));
+ m_pDialogModel.reset(new DialogModel(m_xChartModel));
defaultButton(WizardButtonFlags::FINISH);
setTitleBase(SchResId(STR_DLG_CHART_WIZARD));
@@ -72,7 +74,8 @@ CreationWizard::CreationWizard(weld::Window* pParent, const uno::Reference<frame
declarePath(PATH_FULL, aPath);
- SetRoadmapHelpId(HID_SCH_WIZARD_ROADMAP);
+ // tdf#135935 ensure help ID is set when no element is clicked in the dialog
+ m_xAssistant->set_help_id(HID_SCH_WIZARD_ROADMAP);
if (!m_pDialogModel->getModel().isDataFromSpreadsheet())
{
@@ -92,7 +95,7 @@ std::unique_ptr<BuilderPage> CreationWizard::createPage(WizardState nState)
{
std::unique_ptr<vcl::OWizardPage> xRet;
- OString sIdent(OString::number(nState));
+ OUString sIdent(OUString::number(nState));
weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
switch( nState )
@@ -171,7 +174,7 @@ void CreationWizard::setValidPage(BuilderPage* pTabPage)
OUString CreationWizard::getStateDisplayName( WizardState nState ) const
{
- const char* pResId = nullptr;
+ TranslateId pResId;
switch( nState )
{
case STATE_CHARTTYPE:
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
index 1b8c50d385f1..3a1fa1386f7a 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -19,24 +19,28 @@
#include <dlg_CreationWizard_UNO.hxx>
#include <dlg_CreationWizard.hxx>
+#include <ChartModel.hxx>
#include <servicenames.hxx>
#include <TimerTriggeredControllerLock.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
+#include <vcl/weldutils.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/Desktop.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sfx2/viewsh.hxx>
+
namespace chart
{
using namespace ::com::sun::star;
-CreationWizardUnoDlg::CreationWizardUnoDlg(const uno::Reference<uno::XComponentContext>& xContext)
+CreationWizardUnoDlg::CreationWizardUnoDlg(uno::Reference<uno::XComponentContext> xContext)
: OComponentHelper(m_aMutex)
- , m_xCC(xContext)
+ , m_xCC(std::move(xContext))
, m_bUnlockControllersOnExecute(false)
{
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xCC);
@@ -71,11 +75,11 @@ uno::Any SAL_CALL CreationWizardUnoDlg::queryInterface( const uno::Type& aType )
{
return OComponentHelper::queryInterface( aType );
}
-void SAL_CALL CreationWizardUnoDlg::acquire() throw ()
+void SAL_CALL CreationWizardUnoDlg::acquire() noexcept
{
OComponentHelper::acquire();
}
-void SAL_CALL CreationWizardUnoDlg::release() throw ()
+void SAL_CALL CreationWizardUnoDlg::release() noexcept
{
OComponentHelper::release();
}
@@ -165,10 +169,18 @@ void CreationWizardUnoDlg::createDialogOnDemand()
m_xParentWindow = xFrame->getContainerWindow();
}
}
+
+ weld::Window* pParent(Application::GetFrameWeld(m_xParentWindow));
+ if (!pParent)
+ {
+ if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(m_xParentWindow.get()))
+ pParent = dynamic_cast<weld::Window*>(pTunnel->getWidget());
+ }
+
uno::Reference< XComponent > xKeepAlive( this );
if( m_xChartModel.is() )
{
- m_xDialog = std::make_shared<CreationWizard>(Application::GetFrameWeld(m_xParentWindow), m_xChartModel, m_xCC);
+ m_xDialog = std::make_shared<CreationWizard>(pParent, m_xChartModel, m_xCC);
}
}
@@ -218,7 +230,10 @@ void SAL_CALL CreationWizardUnoDlg::initialize( const uno::Sequence< uno::Any >&
}
else if( aProperty.Name == "ChartModel" )
{
- aProperty.Value >>= m_xChartModel;
+ uno::Reference<XInterface> xInt;
+ aProperty.Value >>= xInt;
+ m_xChartModel = dynamic_cast<::chart::ChartModel*>(xInt.get());
+ assert(m_xChartModel);
}
}
}
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
index 3cb9598cb2e9..ee120df76fe7 100644
--- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
@@ -19,11 +19,10 @@
#include <dlg_DataEditor.hxx>
#include "DataBrowser.hxx"
-#include <comphelper/stl_types.hxx>
+#include <ChartModel.hxx>
#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
+#include <utility>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -32,11 +31,11 @@ namespace chart
{
DataEditor::DataEditor(weld::Window* pParent,
- const Reference< chart2::XChartDocument > & xChartDoc,
+ rtl::Reference<::chart::ChartModel> xChartDoc,
const Reference< uno::XComponentContext > & xContext)
: GenericDialogController(pParent, "modules/schart/ui/chartdatadialog.ui", "ChartDataDialog")
, m_bReadOnly(false)
- , m_xChartDoc(xChartDoc)
+ , m_xChartDoc(std::move(xChartDoc))
, m_xContext(xContext)
, m_xTbxData(m_xBuilder->weld_toolbar("toolbar"))
, m_xCloseBtn(m_xBuilder->weld_button("close"))
@@ -57,13 +56,12 @@ DataEditor::DataEditor(weld::Window* pParent,
m_xBrwData->SetCursorMovedHdl( LINK( this, DataEditor, BrowserCursorMovedHdl ));
- m_xBrwData->SetDataFromModel( m_xChartDoc, m_xContext );
+ m_xBrwData->SetDataFromModel( m_xChartDoc );
m_xBrwData->GrabFocus();
bool bReadOnly = true;
- Reference< frame::XStorable > xStor( m_xChartDoc, uno::UNO_QUERY );
- if( xStor.is())
- bReadOnly = xStor->isReadonly();
+ if( m_xChartDoc.is())
+ bReadOnly = m_xChartDoc->isReadonly();
SetReadOnly( bReadOnly );
}
@@ -75,7 +73,7 @@ DataEditor::~DataEditor()
}
// react on click (or keypress) on toolbar icon
-IMPL_LINK(DataEditor, ToolboxHdl, const OString&, rId, void)
+IMPL_LINK(DataEditor, ToolboxHdl, const OUString&, rId, void)
{
if (rId == "InsertRow")
m_xBrwData->InsertRow();
@@ -113,8 +111,8 @@ IMPL_LINK_NOARG(DataEditor, BrowserCursorMovedHdl, DataBrowser*, void)
m_xTbxData->set_item_sensitive("MoveLeftColumn", bIsDataValid && m_xBrwData->MayMoveLeftColumns() );
m_xTbxData->set_item_sensitive("MoveRightColumn", bIsDataValid && m_xBrwData->MayMoveRightColumns() );
- m_xTbxData->set_item_sensitive("MoveUpRow", bIsDataValid && m_xBrwData->MayMoveDownRows() );
- m_xTbxData->set_item_sensitive("MoveDownRow", bIsDataValid && m_xBrwData->MayMoveUpRows() );
+ m_xTbxData->set_item_sensitive("MoveDownRow", bIsDataValid && m_xBrwData->MayMoveDownRows() );
+ m_xTbxData->set_item_sensitive("MoveUpRow", bIsDataValid && m_xBrwData->MayMoveUpRows() );
}
// disable all modifying controls
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index b196b24d98d8..25b0367f8885 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -18,22 +18,20 @@
*/
#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <dlg_DataSource.hxx>
#include <ChartTypeTemplateProvider.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartTypeTemplate.hxx>
+#include <Diagram.hxx>
#include "DialogModel.hxx"
+#include <ChartModel.hxx>
#include "tp_RangeChooser.hxx"
#include "tp_DataSource.hxx"
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using namespace ::chart;
-using ::com::sun::star::uno::Reference;
-
namespace chart
{
@@ -43,36 +41,33 @@ class DocumentChartTypeTemplateProvider : public ChartTypeTemplateProvider
{
public:
explicit DocumentChartTypeTemplateProvider(
- const Reference< chart2::XChartDocument > & xDoc );
+ const rtl::Reference<::chart::ChartModel> & xDoc );
// ____ ChartTypeTemplateProvider ____
- virtual Reference< chart2::XChartTypeTemplate > getCurrentTemplate() const override;
+ virtual rtl::Reference< ::chart::ChartTypeTemplate > getCurrentTemplate() const override;
private:
- Reference< chart2::XChartTypeTemplate > m_xTemplate;
+ rtl::Reference< ::chart::ChartTypeTemplate > m_xTemplate;
};
}
DocumentChartTypeTemplateProvider::DocumentChartTypeTemplateProvider(
- const Reference< chart2::XChartDocument > & xDoc )
+ const rtl::Reference<::chart::ChartModel> & xDoc )
{
if( !xDoc.is())
return;
- Reference< chart2::XDiagram > xDia( xDoc->getFirstDiagram());
+ rtl::Reference< Diagram > xDia( xDoc->getFirstChartDiagram());
if( xDia.is())
{
- DiagramHelper::tTemplateWithServiceName aResult(
- DiagramHelper::getTemplateForDiagram(
- xDia,
- Reference< lang::XMultiServiceFactory >(
- xDoc->getChartTypeManager(), uno::UNO_QUERY ) ));
- m_xTemplate.set( aResult.first );
+ Diagram::tTemplateWithServiceName aResult(
+ xDia->getTemplate( xDoc->getTypeManager() ));
+ m_xTemplate = aResult.xChartTypeTemplate;
}
}
-Reference< chart2::XChartTypeTemplate > DocumentChartTypeTemplateProvider::getCurrentTemplate() const
+rtl::Reference< ::chart::ChartTypeTemplate > DocumentChartTypeTemplateProvider::getCurrentTemplate() const
{
return m_xTemplate;
}
@@ -80,12 +75,11 @@ Reference< chart2::XChartTypeTemplate > DocumentChartTypeTemplateProvider::getCu
sal_uInt16 DataSourceDialog::m_nLastPageId = 0;
DataSourceDialog::DataSourceDialog(weld::Window * pParent,
- const Reference< XChartDocument > & xChartDocument,
- const Reference< uno::XComponentContext > & xContext)
+ const rtl::Reference<::chart::ChartModel> & xChartDocument)
: GenericDialogController(pParent, "modules/schart/ui/datarangedialog.ui",
"DataRangeDialog")
, m_apDocTemplateProvider(new DocumentChartTypeTemplateProvider(xChartDocument))
- , m_apDialogModel(new DialogModel(xChartDocument, xContext))
+ , m_apDialogModel(new DialogModel(xChartDocument))
, m_bRangeChooserTabIsValid(true)
, m_bDataSourceTabIsValid(true)
, m_bTogglingEnabled(true)
@@ -128,7 +122,7 @@ short DataSourceDialog::run()
return nResult;
}
-IMPL_LINK(DataSourceDialog, ActivatePageHdl, const OString&, rPage, void)
+IMPL_LINK(DataSourceDialog, ActivatePageHdl, const OUString&, rPage, void)
{
if (rPage == "range")
m_xRangeChooserTabPage->Activate();
@@ -137,7 +131,7 @@ IMPL_LINK(DataSourceDialog, ActivatePageHdl, const OString&, rPage, void)
}
// allow/disallow user to leave page
-IMPL_LINK_NOARG(DataSourceDialog, DeactivatePageHdl, const OString&, bool)
+IMPL_LINK_NOARG(DataSourceDialog, DeactivatePageHdl, const OUString&, bool)
{
return m_bTogglingEnabled;
}
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
index 3843263ad664..6a79bac4a414 100644
--- a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
@@ -23,14 +23,9 @@ namespace chart
{
InsertAxisOrGridDialogData::InsertAxisOrGridDialogData()
- : aPossibilityList(6)
- , aExistenceList(6)
+ : aPossibilityList{ true, true, true, true, true, true }
+ , aExistenceList{ false, false, false, false, false, false }
{
- sal_Int32 nN = 0;
- for(nN=6;nN--;)
- aPossibilityList[nN]=true;
- for(nN=6;nN--;)
- aExistenceList[nN]=false;
}
// SchAxisDlg
@@ -42,8 +37,8 @@ SchAxisDlg::SchAxisDlg(weld::Window* pWindow,
OUString("modules/schart/ui/insertaxisdlg.ui") :
OUString("modules/schart/ui/insertgriddlg.ui"),
bAxisDlg ?
- OString("InsertAxisDialog") :
- OString("InsertGridDialog"))
+ OUString("InsertAxisDialog") :
+ OUString("InsertGridDialog"))
, m_xCbPrimaryX(m_xBuilder->weld_check_button("primaryX"))
, m_xCbPrimaryY(m_xBuilder->weld_check_button("primaryY"))
, m_xCbPrimaryZ(m_xBuilder->weld_check_button("primaryZ"))
@@ -74,12 +69,13 @@ SchAxisDlg::SchAxisDlg(weld::Window* pWindow,
void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput )
{
- rOutput.aExistenceList[0]=m_xCbPrimaryX->get_active();
- rOutput.aExistenceList[1]=m_xCbPrimaryY->get_active();
- rOutput.aExistenceList[2]=m_xCbPrimaryZ->get_active();
- rOutput.aExistenceList[3]=m_xCbSecondaryX->get_active();
- rOutput.aExistenceList[4]=m_xCbSecondaryY->get_active();
- rOutput.aExistenceList[5]=m_xCbSecondaryZ->get_active();
+ sal_Bool* pExistenceList = rOutput.aExistenceList.getArray();
+ pExistenceList[0]=m_xCbPrimaryX->get_active();
+ pExistenceList[1]=m_xCbPrimaryY->get_active();
+ pExistenceList[2]=m_xCbPrimaryZ->get_active();
+ pExistenceList[3]=m_xCbSecondaryX->get_active();
+ pExistenceList[4]=m_xCbSecondaryY->get_active();
+ pExistenceList[5]=m_xCbSecondaryZ->get_active();
}
SchGridDlg::SchGridDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput)
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataTable.cxx b/chart2/source/controller/dialogs/dlg_InsertDataTable.cxx
new file mode 100644
index 000000000000..4b5e928db057
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertDataTable.cxx
@@ -0,0 +1,61 @@
+/* -*- 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 <dlg_InsertDataTable.hxx>
+
+namespace chart
+{
+InsertDataTableDialog::InsertDataTableDialog(weld::Window* pWindow)
+ : GenericDialogController(pWindow, "modules/schart/ui/dlg_InsertDataTable.ui",
+ "InsertDataTableDialog")
+ , m_aDataTablePropertiesResources(*m_xBuilder)
+ , m_xCbShowDataTable(m_xBuilder->weld_check_button("showDataTable"))
+{
+ m_xCbShowDataTable->connect_toggled(LINK(this, InsertDataTableDialog, ShowDataTableToggle));
+ init(m_aData);
+}
+
+IMPL_LINK_NOARG(InsertDataTableDialog, ShowDataTableToggle, weld::Toggleable&, void)
+{
+ changeEnabled();
+}
+
+void InsertDataTableDialog::changeEnabled()
+{
+ bool bEnable = m_xCbShowDataTable->get_active();
+ m_aDataTablePropertiesResources.setChecksSensitive(bEnable);
+ m_aData.mbShow = bEnable;
+}
+
+void InsertDataTableDialog::init(DataTableDialogData const& rData)
+{
+ m_aData = rData;
+ m_aDataTablePropertiesResources.setHorizontalBorder(m_aData.mbHorizontalBorders);
+ m_aDataTablePropertiesResources.setVerticalBorder(m_aData.mbVerticalBorders);
+ m_aDataTablePropertiesResources.setOutline(m_aData.mbOutline);
+ m_aDataTablePropertiesResources.setKeys(m_aData.mbKeys);
+ m_xCbShowDataTable->set_active(m_aData.mbShow);
+ changeEnabled();
+}
+
+DataTableDialogData& InsertDataTableDialog::getDataTableDialogData()
+{
+ m_aData.mbShow = m_xCbShowDataTable->get_active();
+
+ m_aData.mbHorizontalBorders = m_aDataTablePropertiesResources.getHorizontalBorder();
+ m_aData.mbVerticalBorders = m_aDataTablePropertiesResources.getVerticalBorder();
+ m_aData.mbOutline = m_aDataTablePropertiesResources.getOutline();
+ m_aData.mbKeys = m_aDataTablePropertiesResources.getKeys();
+
+ return m_aData;
+}
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
index a7aeb35d72d6..8ed2c1d7d650 100644
--- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
@@ -21,16 +21,15 @@
#include <res_ErrorBar.hxx>
#include <chartview/ExplicitScaleValues.hxx>
#include <chartview/ExplicitValueProvider.hxx>
-#include <ChartModelHelper.hxx>
+#include <ChartModel.hxx>
+#include <ChartView.hxx>
#include <ObjectIdentifier.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <ObjectNameProvider.hxx>
+#include <DataSeries.hxx>
-#include <com/sun/star/frame/XModel.hpp>
-#include <comphelper/servicehelper.hxx>
-
-using ::com::sun::star::uno::Reference;
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -39,7 +38,7 @@ namespace chart
InsertErrorBarsDialog::InsertErrorBarsDialog(
weld::Window* pParent, const SfxItemSet& rMyAttrs,
- const uno::Reference< chart2::XChartDocument > & xChartDocument,
+ const rtl::Reference<::chart::ChartModel> & xChartDocument,
ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ )
: GenericDialogController(pParent, "modules/schart/ui/dlg_InsertErrorBars.ui", "dlg_InsertErrorBars")
, m_apErrorBarResources( new ErrorBarResources(
@@ -64,19 +63,18 @@ void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMi
}
double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals(
- const Reference< frame::XModel >& xChartModel,
- const Reference< uno::XInterface >& xChartView,
- const OUString& rSelectedObjectCID )
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
+ const rtl::Reference<::chart::ChartView>& xChartView,
+ std::u16string_view rSelectedObjectCID )
{
double fStepWidth = 0.001;
- ExplicitValueProvider* pExplicitValueProvider( comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(xChartView) );
+ ExplicitValueProvider* pExplicitValueProvider( xChartView.get() );
if( pExplicitValueProvider )
{
- Reference< XAxis > xAxis;
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedObjectCID, xChartModel );
- xAxis = DiagramHelper::getAttachedAxis( xSeries, xDiagram );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedObjectCID, xChartModel );
+ rtl::Reference< Axis > xAxis = xDiagram->getAttachedAxis( xSeries );
if(!xAxis.is())
xAxis = AxisHelper::getAxis( 1/*nDimensionIndex*/, true/*bMainAxis*/, xDiagram );
if(xAxis.is())
diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
index f718366d7c8b..c55ecc3e88d6 100644
--- a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
@@ -30,12 +30,12 @@ SchLegendDlg::SchLegendDlg(weld::Window* pWindow, const uno::Reference<uno::XCom
{
}
-void SchLegendDlg::init(const uno::Reference<frame::XModel>& xChartModel)
+void SchLegendDlg::init(const rtl::Reference<::chart::ChartModel>& xChartModel)
{
m_xLegendPositionResources->writeToResources(xChartModel);
}
-void SchLegendDlg::writeToModel(const uno::Reference<frame::XModel>& xChartModel) const
+void SchLegendDlg::writeToModel(const rtl::Reference<::chart::ChartModel>& xChartModel) const
{
m_xLegendPositionResources->writeToModel(xChartModel);
}
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
index d91b545cd027..f5cfe8e3bda4 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -29,14 +29,15 @@ namespace chart
{
using namespace ::com::sun::star;
-NumberFormatDialog::NumberFormatDialog(weld::Window* pParent, SfxItemSet& rSet)
+NumberFormatDialog::NumberFormatDialog(weld::Window* pParent, const SfxItemSet& rSet)
: SfxSingleTabDialogController(pParent, &rSet, "cui/ui/formatnumberdialog.ui", "FormatNumberDialog")
+ , m_xContent( m_xBuilder->weld_container("content") )
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );
if (fnCreatePage)
{
- std::unique_ptr<SfxTabPage> xTabPage = (*fnCreatePage)(get_content_area(), this, &rSet);
+ std::unique_ptr<SfxTabPage> xTabPage = (*fnCreatePage)(m_xContent.get(), this, &rSet);
xTabPage->PageCreated(rSet);
SetTabPage(std::move(xTabPage));
}
@@ -44,15 +45,11 @@ NumberFormatDialog::NumberFormatDialog(weld::Window* pParent, SfxItemSet& rSet)
SfxItemSet NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool )
{
- static const sal_uInt16 nWhichPairs[] =
- {
+ return SfxItemSet( rItemPool, svl::Items<
SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
- SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
- SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE,
- 0
- };
- return SfxItemSet( rItemPool, nWhichPairs );
+ SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
+ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE> );
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
index 3cb5107158b8..be02edeb6257 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
@@ -23,6 +23,7 @@
namespace weld
{
class Window;
+class Container;
}
class SfxItemSet;
class SfxItemPool;
@@ -31,8 +32,10 @@ namespace chart
{
class NumberFormatDialog : public SfxSingleTabDialogController
{
+ std::unique_ptr<weld::Container> m_xContent;
+
public:
- NumberFormatDialog(weld::Window* pParent, SfxItemSet& rSet);
+ NumberFormatDialog(weld::Window* pParent, const SfxItemSet& rSet);
static SfxItemSet CreateEmptyItemSetForNumberFormatDialog(SfxItemPool& rItemPool);
};
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index a356c1ac4185..e885fdaef32e 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstddef>
+
#include <dlg_ObjectProperties.hxx>
#include <strings.hrc>
#include "tp_AxisLabel.hxx"
@@ -31,23 +35,29 @@
#include "tp_TitleRotation.hxx"
#include "tp_PolarOptions.hxx"
#include "tp_DataPointOption.hxx"
+#include "tp_DataTable.hxx"
#include <ResId.hxx>
#include <ViewElementListProvider.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <ObjectNameProvider.hxx>
+#include <DataSeries.hxx>
#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <NumberFormatterWrapper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <ExplicitCategoriesProvider.hxx>
#include <ChartModel.hxx>
#include <CommonConverters.hxx>
#include <RegressionCalculationHelper.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <svl/intitem.hxx>
-#include <svl/languageoptions.hxx>
+#include <svl/ctloptions.hxx>
#include <svx/svxids.hrc>
@@ -62,7 +72,8 @@
#include <svx/numinf.hxx>
#include <svl/cjkoptions.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
namespace com::sun::star::chart2 { class XChartType; }
namespace com::sun::star::chart2 { class XDataSeries; }
@@ -77,11 +88,10 @@ using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::beans::XPropertySet;
-ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const OUString& rObjectCID )
- : m_aObjectCID( rObjectCID )
+ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( OUString aObjectCID )
+ : m_aObjectCID(std::move( aObjectCID ))
, m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
, m_bAffectsMultipleObjects(false)
- , m_aLocalizedName()
, m_bHasGeometryProperties(false)
, m_bHasStatisticProperties(false)
, m_bProvidesSecondaryYAxis(false)
@@ -99,24 +109,25 @@ ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const OUString
, m_bShowAxisOrigin(false)
, m_bIsCrossingAxisIsCategoryAxis(false)
, m_bSupportingCategoryPositioning(false)
- , m_aCategories()
, m_bComplexCategoriesAxis( false )
, m_nNbPoints( 0 )
{
- OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
- m_bAffectsMultipleObjects = (aParticleID == "ALLELEMENTS");
+ std::u16string_view aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
+ m_bAffectsMultipleObjects = (aParticleID == u"ALLELEMENTS");
}
ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
{
}
-void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel )
+void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- m_xChartDocument.set( xChartModel, uno::UNO_QUERY );
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
- uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ 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 );
+ sal_Int32 nDimensionCount = 0;
+ if (xDiagram)
+ nDimensionCount = xDiagram->getDimension();
bool bHasSeriesProperties = (m_eObjectType==OBJECTTYPE_DATA_SERIES);
bool bHasDataPointproperties = (m_eObjectType==OBJECTTYPE_DATA_POINT);
@@ -153,7 +164,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
if( m_bHasScaleProperties )
{
- uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel );
if( xAxis.is() )
{
//no scale page for series axis
@@ -164,7 +175,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
m_bHasNumberProperties = true;
//is the crossing main axis a category axes?:
- uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
if( xCrossingMainAxis.is() )
{
@@ -172,9 +183,8 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
m_bIsCrossingAxisIsCategoryAxis = ( aScale.AxisType == chart2::AxisType::CATEGORY );
if( m_bIsCrossingAxisIsCategoryAxis )
{
- ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
- if (pModel)
- m_aCategories = DiagramHelper::getExplicitSimpleCategories( *pModel );
+ if (xChartModel)
+ m_aCategories = DiagramHelper::getExplicitSimpleCategories( *xChartModel );
}
}
@@ -193,10 +203,9 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
if ( nDimensionIndex == 0 && ( aData.AxisType == chart2::AxisType::CATEGORY || aData.AxisType == chart2::AxisType::DATE ) )
{
- ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
- if (pModel)
+ if (xChartModel)
{
- ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *pModel );
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *xChartModel );
m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
}
@@ -213,14 +222,12 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
if( m_eObjectType == OBJECTTYPE_DATA_CURVE )
{
- uno::Reference< data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
- Sequence< Reference< data::XLabeledDataSequence > > aDataSeqs( xSource->getDataSequences());
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSeqs( xSeries->getDataSequences2());
Sequence< double > aXValues, aYValues;
bool bXValuesFound = false, bYValuesFound = false;
m_nNbPoints = 0;
- sal_Int32 i = 0;
- for( i=0;
- ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.getLength();
+ for( std::size_t i=0;
+ ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.size();
++i )
{
try
@@ -252,8 +259,9 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
// initialize with 1, 2, ...
//first category (index 0) matches with real number 1.0
aXValues.realloc( aYValues.getLength() );
- for( i=0; i<aXValues.getLength(); ++i )
- aXValues[i] = i+1;
+ auto pXValues = aXValues.getArray();
+ for( sal_Int32 i=0; i<aXValues.getLength(); ++i )
+ pXValues[i] = i+1;
bXValuesFound = true;
}
@@ -309,11 +317,11 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
const sal_uInt16 nNoArrowNoShadowDlg = 1101;
-void SchAttribTabDlg::setSymbolInformation( std::unique_ptr<SfxItemSet> pSymbolShapeProperties,
- std::unique_ptr<Graphic> pAutoSymbolGraphic )
+void SchAttribTabDlg::setSymbolInformation( SfxItemSet&& rSymbolShapeProperties,
+ std::optional<Graphic> oAutoSymbolGraphic )
{
- m_pSymbolShapeProperties = std::move(pSymbolShapeProperties);
- m_pAutoSymbolGraphic = std::move(pAutoSymbolGraphic);
+ m_oSymbolShapeProperties.emplace(std::move(rSymbolShapeProperties));
+ m_oAutoSymbolGraphic = std::move(oAutoSymbolGraphic);
}
void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
@@ -338,8 +346,6 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
m_xDialog->set_title(pDialogParameter->getLocalizedName());
- SvtCJKOptions aCJKOptions;
-
switch (pDialogParameter->getObjectType())
{
case OBJECTTYPE_TITLE:
@@ -349,7 +355,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
AddTabPage("alignment", SchResId(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::Create);
- if( aCJKOptions.IsAsianTypographyEnabled() )
+ if( SvtCJKOptions::IsAsianTypographyEnabled() )
AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
break;
@@ -360,7 +366,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
AddTabPage("legendpos", SchResId(STR_PAGE_POSITION), SchLegendPosTabPage::Create);
- if (aCJKOptions.IsAsianTypographyEnabled())
+ if (SvtCJKOptions::IsAsianTypographyEnabled())
AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
break;
@@ -390,7 +396,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
AddTabPage("datalabels", SchResId(STR_OBJECT_DATALABELS), DataLabelsTabPage::Create);
AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
- if( aCJKOptions.IsAsianTypographyEnabled() )
+ if( SvtCJKOptions::IsAsianTypographyEnabled() )
AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
break;
@@ -409,7 +415,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
AddTabPage("numberformat", SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT);
AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
- if( aCJKOptions.IsAsianTypographyEnabled() )
+ if( SvtCJKOptions::IsAsianTypographyEnabled() )
AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
break;
}
@@ -455,6 +461,13 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
case OBJECTTYPE_UNKNOWN:
// nothing
break;
+ case OBJECTTYPE_DATA_TABLE:
+ AddTabPage("datatable", SchResId(STR_DATA_TABLE), DataTableTabPage::Create);
+ AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
+ AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
+ AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
+ AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
+ break;
case OBJECTTYPE_DATA_CURVE_EQUATION:
AddTabPage("border", SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
@@ -462,7 +475,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
AddTabPage("numberformat", SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT);
- if (SvtLanguageOptions().IsCTLFontEnabled())
+ if (SvtCTLOptions::IsCTLFontEnabled())
{
/* When rotation is supported for equation text boxes, use
SchAlignmentTabPage::Create here. The special
@@ -484,7 +497,7 @@ SchAttribTabDlg::~SchAttribTabDlg()
{
}
-void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
+void SchAttribTabDlg::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
if (rId == "border")
@@ -498,10 +511,10 @@ void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
if( m_pParameter->HasSymbolProperties() )
{
aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
- if( m_pSymbolShapeProperties )
- aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
- if( m_pAutoSymbolGraphic )
- aSet.Put(SvxGraphicItem(*m_pAutoSymbolGraphic));
+ if( m_oSymbolShapeProperties )
+ aSet.Put(SfxTabDialogItem(SID_ATTR_SET, *m_oSymbolShapeProperties));
+ if( m_oAutoSymbolGraphic )
+ aSet.Put(SvxGraphicItem(*m_oAutoSymbolGraphic));
}
rPage.PageCreated(aSet);
}
@@ -535,8 +548,9 @@ void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
else if (rId == "axislabel")
{
bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
- static_cast<SchAxisLabelTabPage&>(rPage).ShowStaggeringControls( bShowStaggeringControls );
- dynamic_cast< SchAxisLabelTabPage& >( rPage ).SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() );
+ auto & rLabelPage = static_cast<SchAxisLabelTabPage&>(rPage);
+ rLabelPage.ShowStaggeringControls( bShowStaggeringControls );
+ rLabelPage.SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() );
}
else if (rId == "axispos")
{
@@ -570,7 +584,7 @@ void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
}
else if (rId == "numberformat")
{
- aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO)));
+ aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, SID_ATTR_NUMBERFORMAT_INFO));
rPage.PageCreated(aSet);
}
else if (rId == "xerrorbar")
diff --git a/chart2/source/controller/dialogs/dlg_ShapeFont.cxx b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx
index f5fc702a2a76..b742e8a22eda 100644
--- a/chart2/source/controller/dialogs/dlg_ShapeFont.cxx
+++ b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx
@@ -41,7 +41,7 @@ ShapeFontDialog::ShapeFontDialog(weld::Window* pParent, const SfxItemSet* pAttr,
AddTabPage("position", RID_SVXPAGE_CHAR_POSITION );
}
-void ShapeFontDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
+void ShapeFontDialog::PageCreated(const OUString& rId, SfxTabPage& rPage)
{
SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) );
if (rId == "font")
diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
index c990161cf6c8..4c72d4d8126b 100644
--- a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
+++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
@@ -34,11 +34,9 @@ ShapeParagraphDialog::ShapeParagraphDialog(weld::Window* pParent,
const SfxItemSet* pAttr)
: SfxTabDialogController(pParent, "modules/schart/ui/paradialog.ui", "ParagraphDialog", pAttr)
{
- SvtCJKOptions aCJKOptions;
-
AddTabPage("labelTP_PARA_STD", RID_SVXPAGE_STD_PARAGRAPH);
AddTabPage("labelTP_PARA_ALIGN", RID_SVXPAGE_ALIGN_PARAGRAPH );
- if (aCJKOptions.IsAsianTypographyEnabled())
+ if (SvtCJKOptions::IsAsianTypographyEnabled())
{
AddTabPage("labelTP_PARA_ASIAN", RID_SVXPAGE_PARA_ASIAN);
}
@@ -49,7 +47,7 @@ ShapeParagraphDialog::ShapeParagraphDialog(weld::Window* pParent,
AddTabPage("labelTP_TABULATOR", RID_SVXPAGE_TABULATOR);
}
-void ShapeParagraphDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
+void ShapeParagraphDialog::PageCreated(const OUString& rId, SfxTabPage& rPage)
{
if (rId == "labelTP_TABULATOR")
{
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
index b81b7ecacbf1..08a783df5e45 100644
--- a/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -24,24 +24,22 @@
#include "tp_3D_SceneAppearance.hxx"
#include "tp_3D_SceneIllumination.hxx"
#include <ChartModelHelper.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
-#include <com/sun/star/frame/XModel.hpp>
+#include <ChartModel.hxx>
+#include <Diagram.hxx>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
sal_uInt16 View3DDialog::m_nLastPageId = 0;
-View3DDialog::View3DDialog(weld::Window* pParent, const uno::Reference< frame::XModel > & xChartModel)
+View3DDialog::View3DDialog(weld::Window* pParent, const rtl::Reference<::chart::ChartModel> & xChartModel)
: GenericDialogController(pParent, "modules/schart/ui/3dviewdialog.ui", "3DViewDialog")
, m_aControllerLocker(xChartModel)
, m_xTabControl(m_xBuilder->weld_notebook("tabcontrol"))
{
- uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
+ rtl::Reference< Diagram > xSceneProperties = xChartModel->getFirstChartDiagram();
m_xTabControl->append_page("geometry", SchResId(STR_PAGE_PERSPECTIVE));
m_xGeometry.reset(new ThreeD_SceneGeometry_TabPage(m_xTabControl->get_page("geometry"), xSceneProperties, m_aControllerLocker));
@@ -58,7 +56,7 @@ View3DDialog::View3DDialog(weld::Window* pParent, const uno::Reference< frame::X
m_xTabControl->set_current_page(m_nLastPageId);
}
-IMPL_LINK(View3DDialog, ActivatePageHdl, const OString&, rPage, void)
+IMPL_LINK(View3DDialog, ActivatePageHdl, const OUString&, rPage, void)
{
if (rPage == "appearance")
m_xAppearance->ActivatePage();
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.cxx b/chart2/source/controller/dialogs/res_BarGeometry.cxx
index da48f4ca608a..81d933b208bc 100644
--- a/chart2/source/controller/dialogs/res_BarGeometry.cxx
+++ b/chart2/source/controller/dialogs/res_BarGeometry.cxx
@@ -27,9 +27,9 @@ BarGeometryResources::BarGeometryResources(weld::Builder* pBuilder)
: m_xFT_Geometry(pBuilder->weld_label("shapeft"))
, m_xLB_Geometry(pBuilder->weld_tree_view("shape"))
{
- for (size_t i = 0; i < SAL_N_ELEMENTS(CHART_TYPE); ++i)
+ for (size_t i = 0; i < std::size(CHART_TYPE); ++i)
m_xLB_Geometry->append_text(SchResId(CHART_TYPE[i]));
- m_xLB_Geometry->set_size_request(-1, m_xLB_Geometry->get_height_rows(4));
+ m_xLB_Geometry->set_size_request(-1, m_xLB_Geometry->get_height_rows(std::size(CHART_TYPE)));
}
void BarGeometryResources::connect_changed(const Link<weld::TreeView&, void>& rLink)
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index 7934e90871dc..c3d755cf92d6 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -46,41 +46,36 @@ namespace
const std::u16string_view our_aLBEntryMap[] = {u" ", u", ", u"; ", u"\n", u". "};
-bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, sal_uInt16 nValueWhich, sal_uInt16 nSourceFormatWhich, sal_uLong& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
+bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, TypedWhichId<SfxUInt32Item> nValueWhich, TypedWhichId<SfxBoolItem> nSourceFormatWhich, sal_uInt32& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
{
bool bSet = false;
- const SfxPoolItem *pItem1 = nullptr;
- if( rSet.GetItemState( nValueWhich, true, &pItem1 ) == SfxItemState::SET )
+ if( const SfxUInt32Item* pNumItem = rSet.GetItemIfSet( nValueWhich ) )
{
- const SfxUInt32Item * pNumItem = dynamic_cast< const SfxUInt32Item * >( pItem1 );
- if( pNumItem )
- {
- rnFormatKeyOut = pNumItem->GetValue();
- bSet = true;
- }
+ rnFormatKeyOut = pNumItem->GetValue();
+ bSet = true;
}
rbSourceFormatMixedStateOut=true;
- const SfxPoolItem *pItem2 = nullptr;
- if( rSet.GetItemState( nSourceFormatWhich, true, &pItem2 ) == SfxItemState::SET )
+ if( const SfxBoolItem * pBoolItem = rSet.GetItemIfSet( nSourceFormatWhich ) )
{
- const SfxBoolItem * pBoolItem = dynamic_cast< const SfxBoolItem * >( pItem2 );
- if( pBoolItem )
- {
- rbSourceFormatOut = pBoolItem->GetValue();
- rbSourceFormatMixedStateOut=false;
- }
+ rbSourceFormatOut = pBoolItem->GetValue();
+ rbSourceFormatMixedStateOut=false;
}
return bSet;
}
-void lcl_setBoolItemToCheckBox(const SfxItemSet& rInAttrs, sal_uInt16 nWhichId, weld::CheckButton& rCheckbox)
+void lcl_setBoolItemToCheckBox(const SfxItemSet& rInAttrs, TypedWhichId<SfxBoolItem> nWhichId, weld::CheckButton& rCheckbox, weld::TriStateEnabled& rTriState)
{
- const SfxPoolItem *pPoolItem = nullptr;
- if( rInAttrs.GetItemState(nWhichId, true, &pPoolItem) == SfxItemState::SET )
- rCheckbox.set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ if( const SfxBoolItem* pPoolItem = rInAttrs.GetItemIfSet(nWhichId) )
+ {
+ rCheckbox.set_active(pPoolItem->GetValue());
+ rTriState.bTriStateEnabled = false;
+ }
else
+ {
rCheckbox.set_state(TRISTATE_INDET);
+ rTriState.bTriStateEnabled = true;
+ }
}
}//end anonymous namespace
@@ -104,16 +99,15 @@ DataLabelResources::DataLabelResources(weld::Builder* pBuilder, weld::Window* pP
, m_xFT_NumberFormatForPercent(pBuilder->weld_label("STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE"))
, m_xCBCategory(pBuilder->weld_check_button("CB_CATEGORY"))
, m_xCBSymbol(pBuilder->weld_check_button("CB_SYMBOL"))
+ , m_xCBDataSeries(pBuilder->weld_check_button("CB_DATA_SERIES_NAME"))
, m_xCBWrapText(pBuilder->weld_check_button("CB_WRAP_TEXT"))
- , m_xSeparatorResources(pBuilder->weld_widget("boxSEPARATOR"))
, m_xLB_Separator(pBuilder->weld_combo_box("LB_TEXT_SEPARATOR"))
- , m_xBxLabelPlacement(pBuilder->weld_widget("boxPLACEMENT"))
, m_xLB_LabelPlacement(pBuilder->weld_combo_box("LB_LABEL_PLACEMENT"))
, m_xBxOrientation(pBuilder->weld_widget("boxORIENTATION"))
, m_xFT_Dial(pBuilder->weld_label("CT_LABEL_DIAL"))
, m_xNF_Degrees(pBuilder->weld_metric_spin_button("NF_LABEL_DEGREES", FieldUnit::DEGREE))
, m_xBxTextDirection(pBuilder->weld_widget("boxTXT_DIRECTION"))
- , m_xLB_TextDirection(new TextDirectionListBox(pBuilder->weld_combo_box("LB_LABEL_TEXTDIR")))
+ , m_aLB_TextDirection(pBuilder->weld_combo_box("LB_LABEL_TEXTDIR"))
, m_xDC_Dial(new svx::DialControl)
, m_xDC_DialWin(new weld::CustomWeld(*pBuilder, "CT_DIAL", *m_xDC_Dial))
, m_xCBCustomLeaderLines(pBuilder->weld_check_button("CB_CUSTOM_LEADER_LINES"))
@@ -127,9 +121,8 @@ DataLabelResources::DataLabelResources(weld::Builder* pBuilder, weld::Window* pP
std::vector< sal_Int32 > aAvailablePlacementList;
- const SfxPoolItem *pPoolItem = nullptr;
- if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, true, &pPoolItem) == SfxItemState::SET )
- aAvailablePlacementList = static_cast<const SfxIntegerListItem*>(pPoolItem)->GetList();
+ if( const SfxIntegerListItem* pPlacementsItem = rInAttrs.GetItemIfSet(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS) )
+ aAvailablePlacementList = pPlacementsItem->GetList();
m_xLB_LabelPlacement->clear();
for( size_t nN=0; nN<aAvailablePlacementList.size(); ++nN )
@@ -148,15 +141,16 @@ DataLabelResources::DataLabelResources(weld::Builder* pBuilder, weld::Window* pP
m_xCBPercent->connect_toggled( LINK( this, DataLabelResources, CheckHdl ));
m_xCBCategory->connect_toggled( LINK( this, DataLabelResources, CheckHdl ));
m_xCBSymbol->connect_toggled( LINK( this, DataLabelResources, CheckHdl ));
+ m_xCBDataSeries->connect_toggled( LINK( this, DataLabelResources, CheckHdl ));
m_xCBWrapText->connect_toggled( LINK( this, DataLabelResources, CheckHdl ));
m_xCBCustomLeaderLines->connect_toggled( LINK( this, DataLabelResources, CheckHdl ));
m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
- if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, true, &pPoolItem) == SfxItemState::SET )
+ if( const SfxBoolItem* pNoPercentValueItem = rInAttrs.GetItemIfSet(SCHATTR_DATADESCR_NO_PERCENTVALUE) )
{
- bool bForbidPercentValue = rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE ).GetValue();
+ bool bForbidPercentValue = pNoPercentValueItem->GetValue();
if( bForbidPercentValue )
m_xCBPercent->set_sensitive(false);
}
@@ -182,16 +176,22 @@ IMPL_LINK(DataLabelResources, NumberFormatDialogHdl, weld::Button&, rButton, voi
}
if (&rButton == m_xPB_NumberFormatForValue.get() && !m_xCBNumber->get_active())
+ {
m_xCBNumber->set_active(true);
+ m_aNumberState.bTriStateEnabled = false;
+ }
else if (&rButton == m_xPB_NumberFormatForPercent.get() && !m_xCBPercent->get_active())
+ {
m_xCBPercent->set_active(true);
+ m_aPercentState.bTriStateEnabled = false;
+ }
SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool );
- aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO)));
+ aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, SID_ATTR_NUMBERFORMAT_INFO));
bool bPercent = (&rButton == m_xPB_NumberFormatForPercent.get());
- sal_uLong& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue;
+ sal_uInt32& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue;
bool& rUseSourceFormat = bPercent ? m_bSourceFormatForPercent : m_bSourceFormatForValue;
bool& rbMixedState = bPercent ? m_bPercentFormatMixedState : m_bNumberFormatMixedState;
bool& rbSourceMixedState = bPercent ? m_bPercentSourceMixedState : m_bSourceFormatMixedState;
@@ -210,7 +210,7 @@ IMPL_LINK(DataLabelResources, NumberFormatDialogHdl, weld::Button&, rButton, voi
if( pResult )
{
bool bOldSource = rUseSourceFormat;
- sal_uLong nOldFormat = rnFormatKey;
+ sal_uInt32 nOldFormat = rnFormatKey;
bool bOldMixedState = rbMixedState || rbSourceMixedState;
rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState );
@@ -221,18 +221,32 @@ IMPL_LINK(DataLabelResources, NumberFormatDialogHdl, weld::Button&, rButton, voi
}
}
-IMPL_LINK_NOARG(DataLabelResources, CheckHdl, weld::ToggleButton&, void)
+IMPL_LINK(DataLabelResources, CheckHdl, weld::Toggleable&, rToggle, void)
{
+ if (&rToggle == m_xCBNumber.get())
+ m_aNumberState.ButtonToggled(rToggle);
+ else if (&rToggle == m_xCBPercent.get())
+ m_aPercentState.ButtonToggled(rToggle);
+ else if (&rToggle == m_xCBCategory.get())
+ m_aCategoryState.ButtonToggled(rToggle);
+ else if (&rToggle == m_xCBSymbol.get())
+ m_aSymbolState.ButtonToggled(rToggle);
+ else if (&rToggle == m_xCBDataSeries.get())
+ m_aDataSeriesState.ButtonToggled(rToggle);
+ else if (&rToggle == m_xCBWrapText.get())
+ m_aWrapTextState.ButtonToggled(rToggle);
+ else if (&rToggle == m_xCBCustomLeaderLines.get())
+ m_aCustomLeaderLinesState.ButtonToggled(rToggle);
EnableControls();
}
void DataLabelResources::EnableControls()
{
m_xCBSymbol->set_sensitive( m_xCBNumber->get_active() || (m_xCBPercent->get_active() && m_xCBPercent->get_sensitive())
- || m_xCBCategory->get_active() );
+ || m_xCBCategory->get_active() || m_xCBDataSeries->get_active());
m_xCBWrapText->set_sensitive( m_xCBNumber->get_active() || (m_xCBPercent->get_active() && m_xCBPercent->get_sensitive())
- || m_xCBCategory->get_active() );
+ || m_xCBCategory->get_active() || m_xCBDataSeries->get_active() );
// Enable or disable separator, placement and direction based on the check
// box states. Note that the check boxes are tri-state.
@@ -244,20 +258,23 @@ void DataLabelResources::EnableControls()
++nNumberOfCheckedLabelParts;
if (m_xCBCategory->get_state() != TRISTATE_FALSE)
++nNumberOfCheckedLabelParts;
+ if (m_xCBDataSeries->get_state() != TRISTATE_FALSE)
+ ++nNumberOfCheckedLabelParts;
- m_xSeparatorResources->set_sensitive( nNumberOfCheckedLabelParts > 1 );
+ m_xLB_Separator->set_sensitive( nNumberOfCheckedLabelParts > 1 );
bool bEnableTextDir = nNumberOfCheckedLabelParts > 0;
m_xBxTextDirection->set_sensitive( bEnableTextDir );
bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_xLB_LabelPlacement->get_count()>1;
- m_xBxLabelPlacement->set_sensitive( bEnablePlacement );
+ m_xLB_LabelPlacement->set_sensitive( bEnablePlacement );
}
m_xPB_NumberFormatForValue->set_sensitive( m_pNumberFormatter && m_xCBNumber->get_active() );
m_xPB_NumberFormatForPercent->set_sensitive( m_pNumberFormatter && m_xCBPercent->get_active() && m_xCBPercent->get_sensitive() );
- bool bEnableRotation = ( m_xCBNumber->get_active() || m_xCBPercent->get_active() || m_xCBCategory->get_active() );
- m_xBxOrientation->set_sensitive( bEnableRotation );
+ bool bEnableRotation = (m_xCBNumber->get_active() || m_xCBPercent->get_active()
+ || m_xCBCategory->get_active() || m_xCBDataSeries->get_active());
+ m_xBxOrientation->set_sensitive(bEnableRotation);
}
void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const
@@ -285,6 +302,8 @@ void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const
rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_xCBCategory->get_active() ) );
if( m_xCBSymbol->get_state()!= TRISTATE_INDET )
rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_xCBSymbol->get_active()) );
+ if( m_xCBDataSeries->get_state()!= TRISTATE_INDET )
+ rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME, m_xCBDataSeries->get_active()) );
if( m_xCBWrapText->get_state()!= TRISTATE_INDET )
rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_WRAP_TEXT, m_xCBWrapText->get_active()) );
if( m_xCBCustomLeaderLines->get_state() != TRISTATE_INDET )
@@ -300,8 +319,8 @@ void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const
rOutAttrs->Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) );
}
- if (m_xLB_TextDirection->get_active() != -1)
- rOutAttrs->Put( SvxFrameDirectionItem( m_xLB_TextDirection->get_active_id(), EE_PARA_WRITINGDIR ) );
+ if (m_aLB_TextDirection.get_active() != -1)
+ rOutAttrs->Put( SvxFrameDirectionItem( m_aLB_TextDirection.get_active_id(), EE_PARA_WRITINGDIR ) );
if( m_xDC_Dial->IsVisible() )
{
@@ -315,29 +334,29 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
// default state
m_xCBSymbol->set_sensitive( false );
- lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, *m_xCBNumber );
- lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, *m_xCBPercent );
- lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, *m_xCBCategory );
- lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, *m_xCBSymbol );
- lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_WRAP_TEXT, *m_xCBWrapText );
- lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, *m_xCBCustomLeaderLines );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, *m_xCBNumber, m_aNumberState );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, *m_xCBPercent, m_aPercentState );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, *m_xCBCategory, m_aCategoryState );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, *m_xCBSymbol, m_aSymbolState );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME, *m_xCBDataSeries, m_aDataSeriesState );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_WRAP_TEXT, *m_xCBWrapText, m_aWrapTextState );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, *m_xCBCustomLeaderLines, m_aCustomLeaderLinesState );
m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
- const SfxPoolItem *pPoolItem = nullptr;
- if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, true, &pPoolItem) == SfxItemState::SET )
- for(size_t i=0; i < SAL_N_ELEMENTS(our_aLBEntryMap); ++i )
+ if( const SfxStringItem* pSeparatorItem = rInAttrs.GetItemIfSet(SCHATTR_DATADESCR_SEPARATOR) )
+ for(size_t i=0; i < std::size(our_aLBEntryMap); ++i )
{
- if( our_aLBEntryMap[i] == static_cast<const SfxStringItem*>(pPoolItem)->GetValue())
+ if( our_aLBEntryMap[i] == pSeparatorItem->GetValue())
m_xLB_Separator->set_active( i );
}
else
m_xLB_Separator->set_active( 0 );
- if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, true, &pPoolItem) == SfxItemState::SET )
+ if( const SfxInt32Item* pPlacementItem = rInAttrs.GetItemIfSet(SCHATTR_DATADESCR_PLACEMENT) )
{
- sal_Int32 nPlacement = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ sal_Int32 nPlacement = pPlacementItem->GetValue();
std::map< sal_Int32, sal_uInt16 >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) );
if(aIt!=m_aPlacementToListBoxMap.end())
{
@@ -350,12 +369,12 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
else
m_xLB_LabelPlacement->set_active(-1);
- if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET )
- m_xLB_TextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() );
+ if( const SvxFrameDirectionItem* pDirectionItem = rInAttrs.GetItemIfSet(EE_PARA_WRITINGDIR) )
+ m_aLB_TextDirection.set_active_id( pDirectionItem->GetValue() );
- if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SdrAngleItem* pAngleItem = rInAttrs.GetItemIfSet( SCHATTR_TEXT_DEGREES ) )
{
- Degree100 nDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue();
+ Degree100 nDegrees = pAngleItem->GetValue();
m_xDC_Dial->SetRotation( nDegrees );
}
else
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
index 5358c0345495..66a062d2ca24 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.hxx
@@ -20,11 +20,11 @@
#include <svl/itemset.hxx>
#include <svx/dialcontrol.hxx>
+#include <TextDirectionListBox.hxx>
#include <map>
class SvNumberFormatter;
-namespace chart { class TextDirectionListBox; }
namespace chart
{
@@ -47,8 +47,8 @@ private:
SvNumberFormatter* m_pNumberFormatter;
bool m_bNumberFormatMixedState;
bool m_bPercentFormatMixedState;
- sal_uLong m_nNumberFormatForValue;
- sal_uLong m_nNumberFormatForPercent;
+ sal_uInt32 m_nNumberFormatForValue;
+ sal_uInt32 m_nNumberFormatForPercent;
bool m_bSourceFormatMixedState;
bool m_bPercentSourceMixedState;
@@ -58,6 +58,14 @@ private:
weld::Window* m_pWindow;
SfxItemPool* m_pPool;
+ weld::TriStateEnabled m_aNumberState;
+ weld::TriStateEnabled m_aPercentState;
+ weld::TriStateEnabled m_aCategoryState;
+ weld::TriStateEnabled m_aSymbolState;
+ weld::TriStateEnabled m_aDataSeriesState;
+ weld::TriStateEnabled m_aWrapTextState;
+ weld::TriStateEnabled m_aCustomLeaderLinesState;
+
std::unique_ptr<weld::CheckButton> m_xCBNumber;
std::unique_ptr<weld::Button> m_xPB_NumberFormatForValue;
std::unique_ptr<weld::CheckButton> m_xCBPercent;
@@ -65,12 +73,10 @@ private:
std::unique_ptr<weld::Label> m_xFT_NumberFormatForPercent;
std::unique_ptr<weld::CheckButton> m_xCBCategory;
std::unique_ptr<weld::CheckButton> m_xCBSymbol;
+ std::unique_ptr<weld::CheckButton> m_xCBDataSeries;
std::unique_ptr<weld::CheckButton> m_xCBWrapText;
- std::unique_ptr<weld::Widget> m_xSeparatorResources;
std::unique_ptr<weld::ComboBox> m_xLB_Separator;
-
- std::unique_ptr<weld::Widget> m_xBxLabelPlacement;
std::unique_ptr<weld::ComboBox> m_xLB_LabelPlacement;
std::unique_ptr<weld::Widget> m_xBxOrientation;
@@ -79,14 +85,14 @@ private:
std::unique_ptr<weld::Widget> m_xBxTextDirection;
- std::unique_ptr<TextDirectionListBox> m_xLB_TextDirection;
+ TextDirectionListBox m_aLB_TextDirection;
std::unique_ptr<svx::DialControl> m_xDC_Dial;
std::unique_ptr<weld::CustomWeld> m_xDC_DialWin;
std::unique_ptr<weld::CheckButton> m_xCBCustomLeaderLines;
DECL_LINK(NumberFormatDialogHdl, weld::Button&, void );
- DECL_LINK(CheckHdl, weld::ToggleButton&, void );
+ DECL_LINK(CheckHdl, weld::Toggleable&, void );
void EnableControls();
};
diff --git a/chart2/source/controller/dialogs/res_DataTableProperties.cxx b/chart2/source/controller/dialogs/res_DataTableProperties.cxx
new file mode 100644
index 000000000000..327298e312d9
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataTableProperties.cxx
@@ -0,0 +1,111 @@
+/* -*- 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 <res_DataTableProperties.hxx>
+
+#include <chartview/ChartSfxItemIds.hxx>
+#include <svl/eitem.hxx>
+
+using namespace css;
+
+namespace chart
+{
+DataTablePropertiesResources::DataTablePropertiesResources(weld::Builder& rBuilder)
+ : m_xCbHorizontalBorder(rBuilder.weld_check_button("horizontalBorderCB"))
+ , m_xCbVerticalBorder(rBuilder.weld_check_button("verticalBorderCB"))
+ , m_xCbOutilne(rBuilder.weld_check_button("outlineCB"))
+ , m_xCbKeys(rBuilder.weld_check_button("keysCB"))
+{
+}
+
+void DataTablePropertiesResources::setChecksSensitive(bool bSensitive)
+{
+ m_xCbHorizontalBorder->set_sensitive(bSensitive);
+ m_xCbVerticalBorder->set_sensitive(bSensitive);
+ m_xCbOutilne->set_sensitive(bSensitive);
+ m_xCbKeys->set_sensitive(bSensitive);
+}
+
+void DataTablePropertiesResources::initFromItemSet(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem* pPoolItem = nullptr;
+ SfxItemState aState;
+
+ aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false, &pPoolItem);
+ if (aState == SfxItemState::INVALID)
+ {
+ m_xCbHorizontalBorder->set_state(TRISTATE_INDET);
+ }
+ else
+ {
+ if (aState == SfxItemState::SET)
+ m_xCbHorizontalBorder->set_active(
+ static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ }
+
+ aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false, &pPoolItem);
+ if (aState == SfxItemState::INVALID)
+ {
+ m_xCbVerticalBorder->set_state(TRISTATE_INDET);
+ }
+ else
+ {
+ if (aState == SfxItemState::SET)
+ m_xCbVerticalBorder->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ }
+
+ aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_OUTLINE, false, &pPoolItem);
+ if (aState == SfxItemState::INVALID)
+ {
+ m_xCbOutilne->set_state(TRISTATE_INDET);
+ }
+ else
+ {
+ if (aState == SfxItemState::SET)
+ m_xCbOutilne->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ }
+
+ aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_KEYS, false, &pPoolItem);
+ if (aState == SfxItemState::INVALID)
+ {
+ m_xCbKeys->set_state(TRISTATE_INDET);
+ }
+ else
+ {
+ if (aState == SfxItemState::SET)
+ m_xCbKeys->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ }
+}
+
+bool DataTablePropertiesResources::writeToItemSet(SfxItemSet& rOutAttrs) const
+{
+ if (m_xCbHorizontalBorder->get_state() != TRISTATE_INDET)
+ {
+ rOutAttrs.Put(
+ SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, m_xCbHorizontalBorder->get_active()));
+ }
+ if (m_xCbVerticalBorder->get_state() != TRISTATE_INDET)
+ {
+ rOutAttrs.Put(
+ SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, m_xCbVerticalBorder->get_active()));
+ }
+ if (m_xCbOutilne->get_state() != TRISTATE_INDET)
+ {
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, m_xCbOutilne->get_active()));
+ }
+ if (m_xCbKeys->get_state() != TRISTATE_INDET)
+ {
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, m_xCbKeys->get_active()));
+ }
+ return true;
+}
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx
index aaa1c6eedb8b..ae8e7cd28e2e 100644
--- a/chart2/source/controller/dialogs/res_ErrorBar.cxx
+++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx
@@ -22,11 +22,11 @@
#include <RangeSelectionHelper.hxx>
#include <helpids.h>
#include <chartview/ChartSfxItemIds.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <vcl/weld.hxx>
+#include <ChartModel.hxx>
#include <rtl/math.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <svl/stritem.hxx>
@@ -165,12 +165,12 @@ void ErrorBarResources::SetErrorBarType( tErrorBarType eNewType )
}
void ErrorBarResources::SetChartDocumentForRangeChoosing(
- const uno::Reference< chart2::XChartDocument > & xChartDocument )
+ const rtl::Reference<::chart::ChartModel> & xChartDocument )
{
if( xChartDocument.is())
{
m_bHasInternalDataProvider = xChartDocument->hasInternalDataProvider();
- uno::Reference< beans::XPropertySet > xProps( xChartDocument, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProps( static_cast<cppu::OWeakObject*>(xChartDocument.get()), uno::UNO_QUERY );
if ( xProps.is() )
{
try
@@ -339,7 +339,7 @@ IMPL_LINK_NOARG( ErrorBarResources, CategoryChosen2, weld::ComboBox&, void )
CategoryChosen(*m_xRbConst);
}
-IMPL_LINK_NOARG( ErrorBarResources, CategoryChosen, weld::ToggleButton&, void )
+IMPL_LINK_NOARG( ErrorBarResources, CategoryChosen, weld::Toggleable&, void )
{
m_bErrorKindUnique = true;
SvxChartKindError eOldError = m_eErrorKind;
@@ -392,7 +392,7 @@ IMPL_LINK_NOARG( ErrorBarResources, CategoryChosen, weld::ToggleButton&, void )
UpdateControlStates();
}
-IMPL_LINK_NOARG(ErrorBarResources, SynchronizePosAndNeg, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ErrorBarResources, SynchronizePosAndNeg, weld::Toggleable&, void)
{
UpdateControlStates();
PosValueChanged( *m_xMfPositive );
@@ -412,7 +412,7 @@ IMPL_LINK_NOARG(ErrorBarResources, PosValueChanged, weld::MetricSpinButton&, voi
}
}
-IMPL_LINK_NOARG(ErrorBarResources, IndicatorChanged, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ErrorBarResources, IndicatorChanged, weld::Toggleable&, void)
{
m_bIndicatorUnique = true;
if( m_xRbBoth->get_active())
@@ -475,7 +475,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
// category
m_eErrorKind = SvxChartKindError::NONE;
SfxItemState aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, true, &pPoolItem );
- m_bErrorKindUnique = ( aState != SfxItemState::DONTCARE );
+ m_bErrorKindUnique = ( aState != SfxItemState::INVALID );
if( aState == SfxItemState::SET )
m_eErrorKind = static_cast<const SvxChartKindErrorItem*>(pPoolItem)->GetValue();
@@ -515,16 +515,14 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
}
// parameters
- aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, true, &pPoolItem );
- if( aState == SfxItemState::SET )
+ if( const SvxDoubleItem* pDoubleItem = rInAttrs.GetItemIfSet( SCHATTR_STAT_CONSTPLUS ) )
{
- m_fPlusValue = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
+ m_fPlusValue = pDoubleItem->GetValue();
}
- aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, true, &pPoolItem );
- if( aState == SfxItemState::SET )
+ if( const SvxDoubleItem* pStatItem = rInAttrs.GetItemIfSet( SCHATTR_STAT_CONSTMINUS ) )
{
- m_fMinusValue = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
+ m_fMinusValue = pStatItem->GetValue();
if( m_eErrorKind != SvxChartKindError::Range &&
m_fPlusValue == m_fMinusValue )
@@ -533,7 +531,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
// indicator
aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, true, &pPoolItem );
- m_bIndicatorUnique = ( aState != SfxItemState::DONTCARE );
+ m_bIndicatorUnique = ( aState != SfxItemState::INVALID );
if( aState == SfxItemState::SET)
m_eIndicate = static_cast<const SvxChartIndicateItem *>(pPoolItem)->GetValue();
@@ -562,7 +560,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
// ranges
aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, true, &pPoolItem );
- m_bRangePosUnique = ( aState != SfxItemState::DONTCARE );
+ m_bRangePosUnique = ( aState != SfxItemState::INVALID );
if( aState == SfxItemState::SET )
{
OUString sRangePositive = static_cast< const SfxStringItem * >( pPoolItem )->GetValue();
@@ -570,7 +568,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
}
aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, true, &pPoolItem );
- m_bRangeNegUnique = ( aState != SfxItemState::DONTCARE );
+ m_bRangeNegUnique = ( aState != SfxItemState::INVALID );
if( aState == SfxItemState::SET )
{
OUString sRangeNegative = static_cast< const SfxStringItem * >( pPoolItem )->GetValue();
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx
index 50ac0602baef..92cb4399e563 100644
--- a/chart2/source/controller/dialogs/res_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx
@@ -18,9 +18,10 @@
*/
#include <res_LegendPosition.hxx>
-#include <ChartModelHelper.hxx>
+#include <Legend.hxx>
#include <LegendHelper.hxx>
#include <ChartModel.hxx>
+#include <Diagram.hxx>
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/chart/ChartLegendExpansion.hpp>
@@ -29,7 +30,8 @@
#include <chartview/ChartSfxItemIds.hxx>
#include <svl/intitem.hxx>
#include <svl/eitem.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <utility>
#include <vcl/weld.hxx>
namespace chart
@@ -48,8 +50,8 @@ LegendPositionResources::LegendPositionResources(weld::Builder& rBuilder)
}
LegendPositionResources::LegendPositionResources(weld::Builder& rBuilder,
- const uno::Reference< uno::XComponentContext >& xCC)
- : m_xCC(xCC)
+ uno::Reference< uno::XComponentContext > xCC)
+ : m_xCC(std::move(xCC))
, m_xCbxShow(rBuilder.weld_check_button("show"))
, m_xRbtLeft(rBuilder.weld_radio_button("left"))
, m_xRbtRight(rBuilder.weld_radio_button("right"))
@@ -72,24 +74,24 @@ LegendPositionResources::~LegendPositionResources()
{
}
-void LegendPositionResources::writeToResources( const uno::Reference< frame::XModel >& xChartModel )
+void LegendPositionResources::writeToResources( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
try
{
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartModel );
- uno::Reference< beans::XPropertySet > xProp( xDiagram->getLegend(), uno::UNO_QUERY );
- if( xProp.is() )
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
+ rtl::Reference< Legend > xLegend = xDiagram->getLegend2();
+ if( xLegend.is() )
{
//show
bool bShowLegend = false;
- xProp->getPropertyValue( "Show" ) >>= bShowLegend;
+ xLegend->getPropertyValue( "Show" ) >>= bShowLegend;
if (m_xCbxShow)
m_xCbxShow->set_active( bShowLegend );
- PositionEnableHdl(*m_xCbxShow);
+ PositionEnable();
//position
chart2::LegendPosition ePos;
- xProp->getPropertyValue( "AnchorPosition" ) >>= ePos;
+ xLegend->getPropertyValue( "AnchorPosition" ) >>= ePos;
switch( ePos )
{
case chart2::LegendPosition_LINE_START:
@@ -114,13 +116,13 @@ void LegendPositionResources::writeToResources( const uno::Reference< frame::XMo
}
}
-void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XModel >& xChartModel ) const
+void LegendPositionResources::writeToModel( const rtl::Reference<::chart::ChartModel>& xChartModel ) const
{
try
{
bool bShowLegend = m_xCbxShow && m_xCbxShow->get_active();
- ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartModel);
- uno::Reference< beans::XPropertySet > xProp(LegendHelper::getLegend(rModel, m_xCC, bShowLegend), uno::UNO_QUERY);
+ ChartModel& rModel = *xChartModel;
+ rtl::Reference< Legend > xProp = LegendHelper::getLegend(rModel, m_xCC, bShowLegend);
if( xProp.is() )
{
//show
@@ -158,7 +160,12 @@ void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XM
}
}
-IMPL_LINK_NOARG(LegendPositionResources, PositionEnableHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(LegendPositionResources, PositionEnableHdl, weld::Toggleable&, void)
+{
+ PositionEnable();
+}
+
+void LegendPositionResources::PositionEnable()
{
bool bEnable = !m_xCbxShow || m_xCbxShow->get_active();
@@ -172,10 +179,9 @@ IMPL_LINK_NOARG(LegendPositionResources, PositionEnableHdl, weld::ToggleButton&,
void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
{
- const SfxPoolItem* pPoolItem = nullptr;
- if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxInt32Item* pPosItem = rInAttrs.GetItemIfSet( SCHATTR_LEGEND_POS ) )
{
- chart2::LegendPosition nLegendPosition = static_cast<chart2::LegendPosition>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
+ chart2::LegendPosition nLegendPosition = static_cast<chart2::LegendPosition>(pPosItem->GetValue());
switch( nLegendPosition )
{
case chart2::LegendPosition_LINE_START:
@@ -195,10 +201,10 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
}
}
- if( m_xCbxShow && rInAttrs.GetItemState( SCHATTR_LEGEND_SHOW, true, &pPoolItem ) == SfxItemState::SET )
+ const SfxBoolItem* pShowItem;
+ if( m_xCbxShow && (pShowItem = rInAttrs.GetItemIfSet( SCHATTR_LEGEND_SHOW )) )
{
- bool bShow = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
- m_xCbxShow->set_active(bShow);
+ m_xCbxShow->set_active(pShowItem->GetValue());
}
}
@@ -218,7 +224,7 @@ void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, !m_xCbxShow || m_xCbxShow->get_active()) );
}
-IMPL_LINK (LegendPositionResources, PositionChangeHdl, weld::ToggleButton&, rRadio, void)
+IMPL_LINK (LegendPositionResources, PositionChangeHdl, weld::Toggleable&, rRadio, void)
{
//for each radio click there are coming two change events
//first uncheck of previous button -> ignore that call
diff --git a/chart2/source/controller/dialogs/res_Titles.cxx b/chart2/source/controller/dialogs/res_Titles.cxx
index 7665e9ae4a5b..59b0f00b9b37 100644
--- a/chart2/source/controller/dialogs/res_Titles.cxx
+++ b/chart2/source/controller/dialogs/res_Titles.cxx
@@ -108,21 +108,23 @@ void TitleResources::writeToResources(const TitleDialogData& rInput)
void TitleResources::readFromResources(TitleDialogData& rOutput)
{
- rOutput.aExistenceList[0] = !m_xEd_Main->get_text().isEmpty();
- rOutput.aExistenceList[1] = !m_xEd_Sub->get_text().isEmpty();
- rOutput.aExistenceList[2] = !m_xEd_XAxis->get_text().isEmpty();
- rOutput.aExistenceList[3] = !m_xEd_YAxis->get_text().isEmpty();
- rOutput.aExistenceList[4] = !m_xEd_ZAxis->get_text().isEmpty();
- rOutput.aExistenceList[5] = !m_xEd_SecondaryXAxis->get_text().isEmpty();
- rOutput.aExistenceList[6] = !m_xEd_SecondaryYAxis->get_text().isEmpty();
+ sal_Bool* pExistenceList = rOutput.aExistenceList.getArray();
+ pExistenceList[0] = !m_xEd_Main->get_text().isEmpty();
+ pExistenceList[1] = !m_xEd_Sub->get_text().isEmpty();
+ pExistenceList[2] = !m_xEd_XAxis->get_text().isEmpty();
+ pExistenceList[3] = !m_xEd_YAxis->get_text().isEmpty();
+ pExistenceList[4] = !m_xEd_ZAxis->get_text().isEmpty();
+ pExistenceList[5] = !m_xEd_SecondaryXAxis->get_text().isEmpty();
+ pExistenceList[6] = !m_xEd_SecondaryYAxis->get_text().isEmpty();
- rOutput.aTextList[0] = m_xEd_Main->get_text();
- rOutput.aTextList[1] = m_xEd_Sub->get_text();
- rOutput.aTextList[2] = m_xEd_XAxis->get_text();
- rOutput.aTextList[3] = m_xEd_YAxis->get_text();
- rOutput.aTextList[4] = m_xEd_ZAxis->get_text();
- rOutput.aTextList[5] = m_xEd_SecondaryXAxis->get_text();
- rOutput.aTextList[6] = m_xEd_SecondaryYAxis->get_text();
+ auto pTextList = rOutput.aTextList.getArray();
+ pTextList[0] = m_xEd_Main->get_text();
+ pTextList[1] = m_xEd_Sub->get_text();
+ pTextList[2] = m_xEd_XAxis->get_text();
+ pTextList[3] = m_xEd_YAxis->get_text();
+ pTextList[4] = m_xEd_ZAxis->get_text();
+ pTextList[5] = m_xEd_SecondaryXAxis->get_text();
+ pTextList[6] = m_xEd_SecondaryYAxis->get_text();
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx
index 11514a19a84a..3cbba1e59a28 100644
--- a/chart2/source/controller/dialogs/res_Trendline.cxx
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -21,12 +21,16 @@
#include <bitmaps.hlst>
#include <chartview/ChartSfxItemIds.hxx>
+#include <com/sun/star/chart2/MovingAverageType.hpp>
+
#include <svl/intitem.hxx>
+#include <svl/numformat.hxx>
#include <svl/stritem.hxx>
-#include <svl/zforlist.hxx>
#include <vcl/formatter.hxx>
#include <vcl/weld.hxx>
+using namespace css::chart2;
+
namespace chart
{
@@ -65,6 +69,7 @@ TrendlineResources::TrendlineResources(weld::Builder& rBuilder, const SfxItemSet
, m_xEE_XName(rBuilder.weld_entry("entry_Xname"))
, m_xEE_YName(rBuilder.weld_entry("entry_Yname"))
, m_xCB_ShowCorrelationCoeff(rBuilder.weld_check_button("showCorrelationCoefficient"))
+ , m_xCB_RegressionMovingType(rBuilder.weld_combo_box("combo_moving_type"))
{
FillValueSets();
@@ -78,7 +83,7 @@ TrendlineResources::TrendlineResources(weld::Builder& rBuilder, const SfxItemSet
rInterceptFormatter.ClearMinValue();
rInterceptFormatter.ClearMaxValue();
- Link<weld::ToggleButton&,void> aLink = LINK(this, TrendlineResources, SelectTrendLine);
+ Link<weld::Toggleable&,void> aLink = LINK(this, TrendlineResources, SelectTrendLine);
m_xRB_Linear->connect_toggled( aLink );
m_xRB_Logarithmic->connect_toggled( aLink );
m_xRB_Exponential->connect_toggled( aLink );
@@ -100,7 +105,7 @@ TrendlineResources::TrendlineResources(weld::Builder& rBuilder, const SfxItemSet
TrendlineResources::~TrendlineResources()
{}
-IMPL_LINK_NOARG(TrendlineResources, SelectTrendLine, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(TrendlineResources, SelectTrendLine, weld::Toggleable&, void)
{
if (m_xRB_Linear->get_active())
m_eTrendLineType = SvxChartRegress::Linear;
@@ -121,29 +126,27 @@ IMPL_LINK_NOARG(TrendlineResources, SelectTrendLine, weld::ToggleButton&, void)
void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
{
- const SfxPoolItem *pPoolItem = nullptr;
-
- if( rInAttrs.GetItemState( SCHATTR_REGRESSION_CURVE_NAME, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxStringItem* pCurveNameItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_CURVE_NAME ) )
{
- OUString aName = static_cast< const SfxStringItem* >(pPoolItem)->GetValue();
+ OUString aName = pCurveNameItem->GetValue();
m_xEE_Name->set_text(aName);
}
else
{
m_xEE_Name->set_text("");
}
- if( rInAttrs.GetItemState( SCHATTR_REGRESSION_XNAME, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxStringItem* pRegressionXNameItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_XNAME ) )
{
- OUString aName = static_cast< const SfxStringItem* >(pPoolItem)->GetValue();
+ OUString aName = pRegressionXNameItem->GetValue();
m_xEE_XName->set_text(aName);
}
else
{
m_xEE_XName->set_text("x");
}
- if( rInAttrs.GetItemState( SCHATTR_REGRESSION_YNAME, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxStringItem* pRegressionYNameItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_YNAME ) )
{
- OUString aName = static_cast< const SfxStringItem* >(pPoolItem)->GetValue();
+ OUString aName = pRegressionYNameItem->GetValue();
m_xEE_YName->set_text(aName);
}
else
@@ -151,8 +154,9 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
m_xEE_YName->set_text("f(x)");
}
+ const SfxPoolItem* pPoolItem = nullptr;
SfxItemState aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_TYPE, true, &pPoolItem );
- m_bTrendLineUnique = ( aState != SfxItemState::DONTCARE );
+ m_bTrendLineUnique = ( aState != SfxItemState::INVALID );
if( aState == SfxItemState::SET )
{
const SvxChartRegressItem * pItem = dynamic_cast< const SvxChartRegressItem * >( pPoolItem );
@@ -162,9 +166,9 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
}
}
- if( rInAttrs.GetItemState( SCHATTR_REGRESSION_DEGREE, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxInt32Item* pDegreeItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_DEGREE ) )
{
- sal_Int32 nDegree = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ sal_Int32 nDegree = pDegreeItem->GetValue();
m_xNF_Degree->set_value( nDegree );
}
else
@@ -174,9 +178,9 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
m_xNF_Degree->save_value();
- if( rInAttrs.GetItemState( SCHATTR_REGRESSION_PERIOD, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxInt32Item* pPeriodItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_PERIOD ) )
{
- sal_Int32 nPeriod = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ sal_Int32 nPeriod = pPeriodItem->GetValue();
m_xNF_Period->set_value( nPeriod );
}
else
@@ -187,28 +191,28 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
m_xNF_Period->save_value();
double nValue = 0.0;
- if( rInAttrs.GetItemState( SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SvxDoubleItem* pForwardItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD ) )
{
- nValue = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue() ;
+ nValue = pForwardItem->GetValue() ;
}
lcl_setValue(*m_xFmtFld_ExtrapolateForward, nValue);
nValue = 0.0;
- if( rInAttrs.GetItemState( SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SvxDoubleItem* pBackwardItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD ) )
{
- nValue = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue() ;
+ nValue = pBackwardItem->GetValue() ;
}
lcl_setValue(*m_xFmtFld_ExtrapolateBackward, nValue);
nValue = 0.0;
- if( rInAttrs.GetItemState( SCHATTR_REGRESSION_INTERCEPT_VALUE, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SvxDoubleItem* pValueItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_INTERCEPT_VALUE ) )
{
- nValue = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue() ;
+ nValue = pValueItem->GetValue() ;
}
lcl_setValue(*m_xFmtFld_InterceptValue, nValue);
aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SET_INTERCEPT, true, &pPoolItem );
- if( aState == SfxItemState::DONTCARE )
+ if( aState == SfxItemState::INVALID )
{
m_xCB_SetIntercept->set_state(TRISTATE_INDET);
}
@@ -219,7 +223,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
}
aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_EQUATION, true, &pPoolItem );
- if( aState == SfxItemState::DONTCARE )
+ if( aState == SfxItemState::INVALID )
{
m_xCB_ShowEquation->set_state(TRISTATE_INDET);
}
@@ -230,7 +234,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
}
aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_COEFF, true, &pPoolItem );
- if( aState == SfxItemState::DONTCARE )
+ if( aState == SfxItemState::INVALID )
{
m_xCB_ShowCorrelationCoeff->set_state(TRISTATE_INDET);
}
@@ -240,6 +244,21 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
m_xCB_ShowCorrelationCoeff->set_active( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue());
}
+ if( const SfxInt32Item* pMovingTypeItem = rInAttrs.GetItemIfSet( SCHATTR_REGRESSION_MOVING_TYPE ) )
+ {
+ sal_Int32 nMovingType = pMovingTypeItem->GetValue();
+ if (nMovingType == MovingAverageType::Prior)
+ m_xCB_RegressionMovingType->set_active(0);
+ else if (nMovingType == MovingAverageType::Central)
+ m_xCB_RegressionMovingType->set_active(1);
+ else if (nMovingType == MovingAverageType::AveragedAbscissa)
+ m_xCB_RegressionMovingType->set_active(2);
+ }
+ else
+ {
+ m_xCB_RegressionMovingType->set_active(0);
+ }
+
if( !m_bTrendLineUnique )
return;
@@ -273,6 +292,17 @@ void TrendlineResources::FillItemSet(SfxItemSet* rOutAttrs) const
if( m_bTrendLineUnique )
rOutAttrs->Put( SvxChartRegressItem( m_eTrendLineType, SCHATTR_REGRESSION_TYPE ));
+ if (m_eTrendLineType == SvxChartRegress::MovingAverage)
+ {
+ sal_Int32 nType = MovingAverageType::Prior;
+ if (m_xCB_RegressionMovingType->get_active() == 1)
+ nType = MovingAverageType::Central;
+ else if (m_xCB_RegressionMovingType->get_active() == 2)
+ nType = MovingAverageType::AveragedAbscissa;
+
+ rOutAttrs->Put(SfxInt32Item(SCHATTR_REGRESSION_MOVING_TYPE, nType));
+ }
+
if( m_xCB_ShowEquation->get_state() != TRISTATE_INDET )
rOutAttrs->Put( SfxBoolItem( SCHATTR_REGRESSION_SHOW_EQUATION, m_xCB_ShowEquation->get_active() ));
@@ -332,6 +362,7 @@ void TrendlineResources::UpdateControlStates()
m_xNF_Period->set_max(m_nNbPoints - 1);
}
bool bMovingAverage = ( m_eTrendLineType == SvxChartRegress::MovingAverage );
+ bool bPolynomial = ( m_eTrendLineType == SvxChartRegress::Polynomial );
bool bInterceptAvailable = ( m_eTrendLineType == SvxChartRegress::Linear )
|| ( m_eTrendLineType == SvxChartRegress::Polynomial )
|| ( m_eTrendLineType == SvxChartRegress::Exp );
@@ -341,11 +372,12 @@ void TrendlineResources::UpdateControlStates()
m_xFmtFld_InterceptValue->set_sensitive( bInterceptAvailable );
if( bMovingAverage )
{
- m_xCB_ShowEquation->set_state(TRISTATE_FALSE);
m_xCB_ShowCorrelationCoeff->set_state(TRISTATE_FALSE);
}
- m_xCB_ShowEquation->set_sensitive( !bMovingAverage );
m_xCB_ShowCorrelationCoeff->set_sensitive( !bMovingAverage );
+ m_xCB_RegressionMovingType->set_sensitive(bMovingAverage);
+ m_xNF_Period->set_sensitive(bMovingAverage);
+ m_xNF_Degree->set_sensitive(bPolynomial);
m_xEE_XName->set_sensitive( !bMovingAverage && m_xCB_ShowEquation->get_active() );
m_xEE_YName->set_sensitive( !bMovingAverage && m_xCB_ShowEquation->get_active() );
}
@@ -392,10 +424,8 @@ void TrendlineResources::SetNbPoints( sal_Int32 nNbPoints )
UpdateControlStates();
}
-IMPL_LINK_NOARG(TrendlineResources, ShowEquation, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(TrendlineResources, ShowEquation, weld::Toggleable&, void)
{
- m_xEE_XName->set_sensitive(m_xCB_ShowEquation->get_active());
- m_xEE_YName->set_sensitive(m_xCB_ShowEquation->get_active());
UpdateControlStates();
}
diff --git a/chart2/source/controller/dialogs/res_Trendline.hxx b/chart2/source/controller/dialogs/res_Trendline.hxx
index 29d916fe068f..e520d6da3bc8 100644
--- a/chart2/source/controller/dialogs/res_Trendline.hxx
+++ b/chart2/source/controller/dialogs/res_Trendline.hxx
@@ -24,12 +24,13 @@
namespace weld { class Builder; }
namespace weld { class CheckButton; }
+namespace weld { class ComboBox; }
namespace weld { class Entry; }
namespace weld { class FormattedSpinButton; }
namespace weld { class Image; }
namespace weld { class RadioButton; }
namespace weld { class SpinButton; }
-namespace weld { class ToggleButton; }
+namespace weld { class Toggleable; }
class SvNumberFormatter;
@@ -83,12 +84,13 @@ private:
std::unique_ptr<weld::Entry> m_xEE_XName;
std::unique_ptr<weld::Entry> m_xEE_YName;
std::unique_ptr<weld::CheckButton> m_xCB_ShowCorrelationCoeff;
+ std::unique_ptr<weld::ComboBox> m_xCB_RegressionMovingType;
void UpdateControlStates();
- DECL_LINK(SelectTrendLine, weld::ToggleButton&, void);
+ DECL_LINK(SelectTrendLine, weld::Toggleable&, void);
DECL_LINK(ChangeSpinValue, weld::SpinButton&, void);
DECL_LINK(ChangeFormattedValue, weld::FormattedSpinButton&, void);
- DECL_LINK(ShowEquation, weld::ToggleButton&, void);
+ DECL_LINK(ShowEquation, weld::Toggleable&, void);
};
} // namespace chart
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
index c24cf6fab0d9..adeb27a02501 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
@@ -18,14 +18,13 @@
*/
#include "tp_3D_SceneAppearance.hxx"
-#include <ChartModelHelper.hxx>
+#include <ChartModel.hxx>
#include <ThreeDHelper.hxx>
#include <ControllerLockGuard.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
+#include <Diagram.hxx>
#include <com/sun/star/drawing/ShadeMode.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
@@ -44,20 +43,19 @@ struct lcl_ModelProperties
: m_aShadeMode(drawing::ShadeMode_FLAT)
, m_nRoundedEdges(-1)
, m_nObjectLines(-1)
- , m_eScheme(::chart::ThreeDLookScheme_Unknown)
+ , m_eScheme(::chart::ThreeDLookScheme::ThreeDLookScheme_Unknown)
{}
};
-lcl_ModelProperties lcl_getPropertiesFromModel( uno::Reference< frame::XModel > const & xModel )
+lcl_ModelProperties lcl_getPropertiesFromModel( rtl::Reference<::chart::ChartModel> const & xModel )
{
lcl_ModelProperties aProps;
try
{
- uno::Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( xModel ) );
- uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY_THROW );
- xDiaProp->getPropertyValue( "D3DSceneShadeMode" ) >>= aProps.m_aShadeMode;
+ rtl::Reference< ::chart::Diagram > xDiagram( xModel->getFirstChartDiagram() );
+ xDiagram->getPropertyValue( "D3DSceneShadeMode" ) >>= aProps.m_aShadeMode;
::chart::ThreeDHelper::getRoundedEdgesAndObjectLines( xDiagram, aProps.m_nRoundedEdges, aProps.m_nObjectLines );
- aProps.m_eScheme = ::chart::ThreeDHelper::detectScheme( xDiagram );
+ aProps.m_eScheme = xDiagram->detectScheme();
}
catch( const uno::Exception & )
{
@@ -66,12 +64,11 @@ lcl_ModelProperties lcl_getPropertiesFromModel( uno::Reference< frame::XModel >
return aProps;
}
-void lcl_setShadeModeAtModel( uno::Reference< frame::XModel > const & xModel, drawing::ShadeMode aShadeMode )
+void lcl_setShadeModeAtModel( rtl::Reference<::chart::ChartModel> const & xModel, drawing::ShadeMode aShadeMode )
{
try
{
- uno::Reference< beans::XPropertySet > xDiaProp(
- ::chart::ChartModelHelper::findDiagram( xModel ), uno::UNO_QUERY_THROW );
+ rtl::Reference< ::chart::Diagram > xDiaProp = xModel->getFirstChartDiagram();
xDiaProp->setPropertyValue( "D3DSceneShadeMode" , uno::Any( aShadeMode ));
}
catch( const uno::Exception & )
@@ -90,9 +87,9 @@ namespace chart
#define POS_3DSCHEME_CUSTOM 2
ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(weld::Container* pParent,
- const uno::Reference<frame::XModel>& xChartModel,
+ rtl::Reference<::chart::ChartModel> xChartModel,
ControllerLockHelper& rControllerLockHelper)
- : m_xChartModel(xChartModel)
+ : m_xChartModel(std::move(xChartModel))
, m_bUpdateOtherControls(true)
, m_bCommitToModel(true)
, m_rControllerLockHelper(rControllerLockHelper)
@@ -161,7 +158,7 @@ void ThreeD_SceneAppearance_TabPage::applyRoundedEdgeAndObjectLinesToModel()
// locked controllers
ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
ThreeDHelper::setRoundedEdgesAndObjectLines(
- ::chart::ChartModelHelper::findDiagram( m_xChartModel ), nCurrentRoundedEdges, nObjectLines );
+ m_xChartModel->getFirstChartDiagram(), nCurrentRoundedEdges, nObjectLines );
}
void ThreeD_SceneAppearance_TabPage::applyShadeModeToModel()
@@ -248,13 +245,13 @@ void ThreeD_SceneAppearance_TabPage::updateScheme()
m_xLB_Scheme->remove(POS_3DSCHEME_CUSTOM);
switch( aProps.m_eScheme )
{
- case ThreeDLookScheme_Simple:
+ case ThreeDLookScheme::ThreeDLookScheme_Simple:
m_xLB_Scheme->set_active( POS_3DSCHEME_SIMPLE );
break;
- case ThreeDLookScheme_Realistic:
+ case ThreeDLookScheme::ThreeDLookScheme_Realistic:
m_xLB_Scheme->set_active( POS_3DSCHEME_REALISTIC );
break;
- case ThreeDLookScheme_Unknown:
+ case ThreeDLookScheme::ThreeDLookScheme_Unknown:
{
m_xLB_Scheme->insert_text(POS_3DSCHEME_CUSTOM, m_aCustom);
m_xLB_Scheme->set_active(POS_3DSCHEME_CUSTOM);
@@ -272,12 +269,12 @@ IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, weld::ComboBox&
// locked controllers
ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
- uno::Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( m_xChartModel ) );
+ rtl::Reference< Diagram > xDiagram = m_xChartModel->getFirstChartDiagram();
if( m_xLB_Scheme->get_active() == POS_3DSCHEME_REALISTIC )
- ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
+ xDiagram->setScheme( ThreeDLookScheme::ThreeDLookScheme_Realistic );
else if( m_xLB_Scheme->get_active() == POS_3DSCHEME_SIMPLE )
- ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Simple );
+ xDiagram->setScheme( ThreeDLookScheme::ThreeDLookScheme_Simple );
else
{
OSL_FAIL( "Invalid Entry selected" );
@@ -288,7 +285,7 @@ IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, weld::ComboBox&
initControlsFromModel();
}
-IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectShading, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectShading, weld::Toggleable&, void)
{
if( !m_bUpdateOtherControls )
return;
@@ -297,7 +294,7 @@ IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectShading, weld::ToggleButto
updateScheme();
}
-IMPL_LINK(ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines, weld::ToggleButton&, rCheckBox, void)
+IMPL_LINK(ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines, weld::Toggleable&, rCheckBox, void)
{
if( !m_bUpdateOtherControls )
return;
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
index 305c895c0e46..41366251729f 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
@@ -25,21 +25,22 @@ namespace com::sun::star::frame { class XModel; }
namespace chart
{
+class ChartModel;
class ThreeD_SceneAppearance_TabPage
{
public:
ThreeD_SceneAppearance_TabPage(
weld::Container* pParent,
- const css::uno::Reference< css::frame::XModel > & xChartModel,
+ rtl::Reference<::chart::ChartModel> xChartModel,
ControllerLockHelper & rControllerLockHelper );
void ActivatePage();
~ThreeD_SceneAppearance_TabPage();
private:
DECL_LINK( SelectSchemeHdl, weld::ComboBox&, void );
- DECL_LINK( SelectShading, weld::ToggleButton&, void );
- DECL_LINK( SelectRoundedEdgeOrObjectLines, weld::ToggleButton&, void );
+ DECL_LINK( SelectShading, weld::Toggleable&, void );
+ DECL_LINK( SelectRoundedEdgeOrObjectLines, weld::Toggleable&, void );
void initControlsFromModel();
void applyShadeModeToModel();
@@ -47,7 +48,7 @@ private:
void updateScheme();
private:
- css::uno::Reference<css::frame::XModel> m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
bool m_bUpdateOtherControls;
bool m_bCommitToModel;
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
index 238df9a00787..f368a8193a58 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
@@ -19,13 +19,15 @@
#include "tp_3D_SceneGeometry.hxx"
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <ThreeDHelper.hxx>
#include <ControllerLockGuard.hxx>
#include <com/sun/star/drawing/ProjectionMode.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/helpers.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
namespace chart
@@ -44,9 +46,11 @@ void lcl_SetMetricFieldLimits(weld::MetricSpinButton& rField, sal_Int64 nLimit)
}
ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pParent,
- const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ rtl::Reference< ::chart::Diagram > xDiagram,
ControllerLockHelper & rControllerLockHelper)
- : m_xSceneProperties( xSceneProperties )
+ : m_xDiagram(std::move( xDiagram ))
+ , m_aAngleTimer("chart2 ThreeD_SceneGeometry_TabPage m_aAngleTimer")
+ , m_aPerspectiveTimer("chart2 ThreeD_SceneGeometry_TabPage m_aPerspectiveTimer")
, m_nXRotation(0)
, m_nYRotation(0)
, m_nZRotation(0)
@@ -64,7 +68,7 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pPar
, m_xMFPerspective(m_xBuilder->weld_metric_spin_button("MTR_FLD_PERSPECTIVE", FieldUnit::PERCENT))
{
double fXAngle, fYAngle, fZAngle;
- ThreeDHelper::getRotationAngleFromDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle );
+ m_xDiagram->getRotationAngle( fXAngle, fYAngle, fZAngle );
fXAngle = basegfx::rad2deg(fXAngle);
fYAngle = basegfx::rad2deg(fYAngle);
@@ -95,12 +99,12 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pPar
m_xMFZRotation->connect_value_changed( aAngleEditedLink );
drawing::ProjectionMode aProjectionMode = drawing::ProjectionMode_PERSPECTIVE;
- m_xSceneProperties->getPropertyValue( "D3DScenePerspective" ) >>= aProjectionMode;
+ m_xDiagram->getPropertyValue( "D3DScenePerspective" ) >>= aProjectionMode;
m_xCbxPerspective->set_active( aProjectionMode == drawing::ProjectionMode_PERSPECTIVE );
m_xCbxPerspective->connect_toggled( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveToggled ));
sal_Int32 nPerspectivePercentage = 20;
- m_xSceneProperties->getPropertyValue( "Perspective" ) >>= nPerspectivePercentage;
+ m_xDiagram->getPropertyValue( "Perspective" ) >>= nPerspectivePercentage;
m_xMFPerspective->set_value(nPerspectivePercentage, FieldUnit::PERCENT);
m_aPerspectiveTimer.SetTimeout(nTimeout);
@@ -109,11 +113,10 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pPar
m_xMFPerspective->set_sensitive( m_xCbxPerspective->get_active() );
//RightAngledAxes
- uno::Reference< chart2::XDiagram > xDiagram( m_xSceneProperties, uno::UNO_QUERY );
- if (ChartTypeHelper::isSupportingRightAngledAxes(DiagramHelper::getChartTypeByIndex(xDiagram, 0)))
+ if (ChartTypeHelper::isSupportingRightAngledAxes(m_xDiagram->getChartTypeByIndex(0)))
{
bool bRightAngledAxes = false;
- m_xSceneProperties->getPropertyValue( "RightAngledAxes" ) >>= bRightAngledAxes;
+ m_xDiagram->getPropertyValue( "RightAngledAxes" ) >>= bRightAngledAxes;
m_xCbxRightAngledAxes->connect_toggled( LINK( this, ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled ));
m_xCbxRightAngledAxes->set_active( bRightAngledAxes );
RightAngledAxesToggled(*m_xCbxRightAngledAxes);
@@ -155,7 +158,7 @@ void ThreeD_SceneGeometry_TabPage::applyAnglesToModel()
fYAngle = basegfx::deg2rad(fYAngle);
fZAngle = basegfx::deg2rad(fZAngle);
- ThreeDHelper::setRotationAngleToDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle );
+ m_xDiagram->setRotationAngle( fXAngle, fYAngle, fZAngle );
m_bAngleChangePending = false;
m_aAngleTimer.Stop();
@@ -186,8 +189,8 @@ void ThreeD_SceneGeometry_TabPage::applyPerspectiveToModel()
try
{
- m_xSceneProperties->setPropertyValue( "D3DScenePerspective" , uno::Any( aMode ));
- m_xSceneProperties->setPropertyValue( "Perspective" , uno::Any( static_cast<sal_Int32>(m_xMFPerspective->get_value(FieldUnit::PERCENT)) ));
+ m_xDiagram->setPropertyValue( "D3DScenePerspective" , uno::Any( aMode ));
+ m_xDiagram->setPropertyValue( "Perspective" , uno::Any( static_cast<sal_Int32>(m_xMFPerspective->get_value(FieldUnit::PERCENT)) ));
}
catch( const uno::Exception & )
{
@@ -209,13 +212,13 @@ IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveChanged, Timer *, void)
applyPerspectiveToModel();
}
-IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveToggled, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveToggled, weld::Toggleable&, void)
{
m_xMFPerspective->set_sensitive(m_xCbxPerspective->get_active());
applyPerspectiveToModel();
}
-IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled, weld::Toggleable&, void)
{
ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
@@ -245,7 +248,8 @@ IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled, weld::Togg
m_xMFZRotation->set_value(m_nZRotation, FieldUnit::DEGREE);
}
- ThreeDHelper::switchRightAngledAxes( m_xSceneProperties, m_xCbxRightAngledAxes->get_active() );
+ if (m_xDiagram)
+ m_xDiagram->switchRightAngledAxes( m_xCbxRightAngledAxes->get_active() );
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
index e0ccfd4f8fd3..d0fc8a69d667 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
@@ -20,18 +20,20 @@
#include <vcl/timer.hxx>
#include <vcl/weld.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star::beans { class XPropertySet; }
namespace chart { class ControllerLockHelper; }
namespace chart
{
+class Diagram;
class ThreeD_SceneGeometry_TabPage
{
public:
ThreeD_SceneGeometry_TabPage(weld::Container* pWindow,
- const css::uno::Reference< css::beans::XPropertySet > & xSceneProperties,
+ rtl::Reference< ::chart::Diagram > xDiagram,
ControllerLockHelper & rControllerLockHelper);
~ThreeD_SceneGeometry_TabPage();
@@ -47,14 +49,14 @@ public:
DECL_LINK( PerspectiveChanged, Timer *, void);
// is called immediately when a field changes
DECL_LINK( PerspectiveEdited, weld::MetricSpinButton&, void );
- DECL_LINK( PerspectiveToggled, weld::ToggleButton&, void );
- DECL_LINK( RightAngledAxesToggled, weld::ToggleButton&, void );
+ DECL_LINK( PerspectiveToggled, weld::Toggleable&, void );
+ DECL_LINK( RightAngledAxesToggled, weld::Toggleable&, void );
private:
void applyAnglesToModel();
void applyPerspectiveToModel();
- css::uno::Reference< css::beans::XPropertySet > m_xSceneProperties;
+ rtl::Reference< ::chart::Diagram > m_xDiagram;
Timer m_aAngleTimer;
Timer m_aPerspectiveTimer;
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 16fd2d2c9f56..2650e56fe8a4 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -20,6 +20,7 @@
#include "tp_3D_SceneIllumination.hxx"
#include <CommonConverters.hxx>
#include <ControllerLockGuard.hxx>
+#include <ChartModel.hxx>
#include <svx/colorbox.hxx>
#include <svx/float3d.hxx>
@@ -28,8 +29,9 @@
#include <svtools/colrdlg.hxx>
#include <svx/svx3ditems.hxx>
#include <svx/svddef.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -67,7 +69,6 @@ struct LightSourceInfo
LightSourceInfo::LightSourceInfo()
: pButton(nullptr)
- , aLightSource()
{
aLightSource.nDiffuseColor = Color(0xffffff); // white
aLightSource.aDirection = drawing::Direction3D(1,1,1);
@@ -99,7 +100,7 @@ namespace
void lcl_selectColor(ColorListBox& rListBox, const Color& rColor)
{
rListBox.SetNoSelection();
- rListBox.SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor)));
+ rListBox.SelectEntry({rColor, lcl_makeColorName(rColor)});
}
::chart::LightSource lcl_getLightSourceFromProperties(
@@ -138,7 +139,7 @@ namespace
try
{
xSceneProperties->setPropertyValue( "D3DSceneLightColor" + aIndex,
- uno::makeAny( rLightSource.nDiffuseColor ));
+ uno::Any( rLightSource.nDiffuseColor ));
xSceneProperties->setPropertyValue( "D3DSceneLightDirection" + aIndex,
uno::Any( rLightSource.aDirection ));
xSceneProperties->setPropertyValue( "D3DSceneLightOn" + aIndex,
@@ -172,7 +173,7 @@ namespace
try
{
xSceneProperties->setPropertyValue("D3DSceneAmbientColor",
- uno::makeAny( rColor ));
+ uno::Any( rColor ));
}
catch( const uno::Exception & )
{
@@ -183,9 +184,9 @@ namespace
ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Container* pParent,
weld::Window* pTopLevel,
- const uno::Reference< beans::XPropertySet > & xSceneProperties,
- const uno::Reference< frame::XModel >& xChartModel)
- : m_xSceneProperties( xSceneProperties )
+ uno::Reference< beans::XPropertySet > xSceneProperties,
+ const rtl::Reference<::chart::ChartModel>& xChartModel)
+ : m_xSceneProperties(std::move( xSceneProperties ))
, m_aTimerTriggeredControllerLock( xChartModel )
, m_bInCommitToModel( false )
, m_aModelChangeListener( LINK( this, ThreeD_SceneIllumination_TabPage, fillControlsFromModel ) )
@@ -193,17 +194,17 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Contain
, m_pTopLevel(pTopLevel)
, m_xBuilder(Application::CreateBuilder(pParent, "modules/schart/ui/tp_3D_SceneIllumination.ui"))
, m_xContainer(m_xBuilder->weld_container("tp_3D_SceneIllumination"))
- , m_xBtn_Light1(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_1")))
- , m_xBtn_Light2(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_2")))
- , m_xBtn_Light3(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_3")))
- , m_xBtn_Light4(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_4")))
- , m_xBtn_Light5(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_5")))
- , m_xBtn_Light6(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_6")))
- , m_xBtn_Light7(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_7")))
- , m_xBtn_Light8(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_8")))
- , m_xLB_LightSource(new ColorListBox(m_xBuilder->weld_menu_button("LB_LIGHTSOURCE"), pTopLevel))
+ , m_aBtn_Light1(m_xBuilder->weld_toggle_button("BTN_LIGHT_1"))
+ , m_aBtn_Light2(m_xBuilder->weld_toggle_button("BTN_LIGHT_2"))
+ , m_aBtn_Light3(m_xBuilder->weld_toggle_button("BTN_LIGHT_3"))
+ , m_aBtn_Light4(m_xBuilder->weld_toggle_button("BTN_LIGHT_4"))
+ , m_aBtn_Light5(m_xBuilder->weld_toggle_button("BTN_LIGHT_5"))
+ , m_aBtn_Light6(m_xBuilder->weld_toggle_button("BTN_LIGHT_6"))
+ , m_aBtn_Light7(m_xBuilder->weld_toggle_button("BTN_LIGHT_7"))
+ , m_aBtn_Light8(m_xBuilder->weld_toggle_button("BTN_LIGHT_8"))
+ , m_xLB_LightSource(new ColorListBox(m_xBuilder->weld_menu_button("LB_LIGHTSOURCE"), [this]{ return m_pTopLevel; }))
, m_xBtn_LightSource_Color(m_xBuilder->weld_button("BTN_LIGHTSOURCE_COLOR"))
- , m_xLB_AmbientLight(new ColorListBox(m_xBuilder->weld_menu_button("LB_AMBIENTLIGHT"), pTopLevel))
+ , m_xLB_AmbientLight(new ColorListBox(m_xBuilder->weld_menu_button("LB_AMBIENTLIGHT"), [this]{ return m_pTopLevel; }))
, m_xBtn_AmbientLight_Color(m_xBuilder->weld_button("BTN_AMBIENT_COLOR"))
, m_xHoriScale(m_xBuilder->weld_scale("hori"))
, m_xVertScale(m_xBuilder->weld_scale("vert"))
@@ -213,25 +214,25 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Contain
, m_xCtl_Preview(new SvxLightCtl3D(*m_xPreview, *m_xHoriScale, *m_xVertScale, *m_xBtn_Corner))
{
m_pLightSourceInfoList.reset(new LightSourceInfo[8]);
- m_pLightSourceInfoList[0].pButton = m_xBtn_Light1.get();
- m_pLightSourceInfoList[1].pButton = m_xBtn_Light2.get();
- m_pLightSourceInfoList[2].pButton = m_xBtn_Light3.get();
- m_pLightSourceInfoList[3].pButton = m_xBtn_Light4.get();
- m_pLightSourceInfoList[4].pButton = m_xBtn_Light5.get();
- m_pLightSourceInfoList[5].pButton = m_xBtn_Light6.get();
- m_pLightSourceInfoList[6].pButton = m_xBtn_Light7.get();
- m_pLightSourceInfoList[7].pButton = m_xBtn_Light8.get();
+ m_pLightSourceInfoList[0].pButton = &m_aBtn_Light1;
+ m_pLightSourceInfoList[1].pButton = &m_aBtn_Light2;
+ m_pLightSourceInfoList[2].pButton = &m_aBtn_Light3;
+ m_pLightSourceInfoList[3].pButton = &m_aBtn_Light4;
+ m_pLightSourceInfoList[4].pButton = &m_aBtn_Light5;
+ m_pLightSourceInfoList[5].pButton = &m_aBtn_Light6;
+ m_pLightSourceInfoList[6].pButton = &m_aBtn_Light7;
+ m_pLightSourceInfoList[7].pButton = &m_aBtn_Light8;
fillControlsFromModel(nullptr);
- m_xBtn_Light1->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_xBtn_Light2->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_xBtn_Light3->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_xBtn_Light4->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_xBtn_Light5->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_xBtn_Light6->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_xBtn_Light7->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_xBtn_Light8->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light1.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light2.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light3.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light4.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light5.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light6.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light7.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light8.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
m_xLB_AmbientLight->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
m_xLB_LightSource->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
@@ -242,13 +243,15 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Contain
m_xCtl_Preview->SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewChangeHdl ) );
m_xCtl_Preview->SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewSelectHdl ) );
- ClickLightSourceButtonHdl(*m_xBtn_Light2->get_widget());
+ ClickLightSourceButtonHdl(*m_aBtn_Light2.get_widget());
m_aModelChangeListener.startListening( uno::Reference< util::XModifyBroadcaster >(m_xSceneProperties, uno::UNO_QUERY) );
}
ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
{
+ // drop page view before the widget it paints to is destroyed
+ m_xPreview->ClearPageView();
}
IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void*, void)
@@ -434,20 +437,20 @@ IMPL_LINK(ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, weld::But
bool bIsChecked = pInfo->pButton->get_prev_active();
ControllerLockGuardUNO aGuard( m_xChartModel );
- for( nL=0; nL<8; nL++)
+ for (sal_Int32 i = 0; i < 8; ++i)
{
- LightButton* pLightButton = m_pLightSourceInfoList[nL].pButton;
+ LightButton* pLightButton = m_pLightSourceInfoList[i].pButton;
if (pLightButton == pButton)
{
pLightButton->set_active(true);
if (!pLightButton->get_widget()->has_focus())
pLightButton->get_widget()->grab_focus();
- m_pLightSourceInfoList[nL].pButton->set_prev_active(true);
+ m_pLightSourceInfoList[i].pButton->set_prev_active(true);
}
else
{
pLightButton->set_active(false);
- m_pLightSourceInfoList[nL].pButton->set_prev_active(false);
+ m_pLightSourceInfoList[i].pButton->set_prev_active(false);
}
}
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
index 29cc518631ad..98a1f3273620 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
@@ -22,6 +22,7 @@
#include <TimerTriggeredControllerLock.hxx>
#include <vcl/weld.hxx>
#include <svx/dlgctl3d.hxx>
+#include <svx/float3d.hxx>
namespace com::sun::star::beans
{
@@ -29,19 +30,18 @@ class XPropertySet;
}
class ColorListBox;
-class LightButton;
namespace chart
{
struct LightSourceInfo;
+class ChartModel;
class ThreeD_SceneIllumination_TabPage
{
public:
- ThreeD_SceneIllumination_TabPage(
- weld::Container* pParent, weld::Window* pTopLevel,
- const css::uno::Reference<css::beans::XPropertySet>& xSceneProperties,
- const css::uno::Reference<css::frame::XModel>& xChartModel);
+ ThreeD_SceneIllumination_TabPage(weld::Container* pParent, weld::Window* pTopLevel,
+ css::uno::Reference<css::beans::XPropertySet> xSceneProperties,
+ const rtl::Reference<::chart::ChartModel>& xChartModel);
~ThreeD_SceneIllumination_TabPage();
private:
@@ -68,19 +68,19 @@ private:
bool m_bInCommitToModel;
ModifyListenerCallBack m_aModelChangeListener;
- css::uno::Reference<css::frame::XModel> m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
weld::Window* m_pTopLevel;
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
- std::unique_ptr<LightButton> m_xBtn_Light1;
- std::unique_ptr<LightButton> m_xBtn_Light2;
- std::unique_ptr<LightButton> m_xBtn_Light3;
- std::unique_ptr<LightButton> m_xBtn_Light4;
- std::unique_ptr<LightButton> m_xBtn_Light5;
- std::unique_ptr<LightButton> m_xBtn_Light6;
- std::unique_ptr<LightButton> m_xBtn_Light7;
- std::unique_ptr<LightButton> m_xBtn_Light8;
+ LightButton m_aBtn_Light1;
+ LightButton m_aBtn_Light2;
+ LightButton m_aBtn_Light3;
+ LightButton m_aBtn_Light4;
+ LightButton m_aBtn_Light5;
+ LightButton m_aBtn_Light6;
+ LightButton m_aBtn_Light7;
+ LightButton m_aBtn_Light8;
std::unique_ptr<ColorListBox> m_xLB_LightSource;
std::unique_ptr<weld::Button> m_xBtn_LightSource_Color;
std::unique_ptr<ColorListBox> m_xLB_AmbientLight;
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
index de028152e386..79976618341c 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -24,7 +24,6 @@
#include <svx/chrtitem.hxx>
#include <svx/sdangitm.hxx>
-#include <svl/intitem.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/frmdiritem.hxx>
@@ -49,12 +48,11 @@ SchAxisLabelTabPage::SchAxisLabelTabPage(weld::Container* pPage, weld::DialogCon
, m_xCbTextOverlap(m_xBuilder->weld_check_button("overlapCB"))
, m_xCbTextBreak(m_xBuilder->weld_check_button("breakCB"))
, m_xFtABCD(m_xBuilder->weld_label("labelABCD"))
- , m_xFlOrient(m_xBuilder->weld_label("labelTextOrient"))
, m_xFtRotate(m_xBuilder->weld_label("degreeL"))
, m_xNfRotate(m_xBuilder->weld_metric_spin_button("OrientDegree", FieldUnit::DEGREE))
, m_xCbStacked(m_xBuilder->weld_check_button("stackedCB"))
, m_xFtTextDirection(m_xBuilder->weld_label("textdirL"))
- , m_xLbTextDirection(new TextDirectionListBox(m_xBuilder->weld_combo_box("textdirLB")))
+ , m_aLbTextDirection(m_xBuilder->weld_combo_box("textdirLB"))
, m_xCtrlDial(new svx::DialControl)
, m_xCtrlDialWin(new weld::CustomWeld(*m_xBuilder, "dialCtrl", *m_xCtrlDial))
{
@@ -73,7 +71,6 @@ SchAxisLabelTabPage::~SchAxisLabelTabPage()
{
m_xCtrlDialWin.reset();
m_xCtrlDial.reset();
- m_xLbTextDirection.reset();
}
std::unique_ptr<SfxTabPage> SchAxisLabelTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrs)
@@ -125,8 +122,8 @@ bool SchAxisLabelTabPage::FillItemSet( SfxItemSet* rOutAttrs )
if( m_xCbShowDescription->get_state() != TRISTATE_INDET )
rOutAttrs->Put( SfxBoolItem( SCHATTR_AXIS_SHOWDESCR, m_xCbShowDescription->get_active() ) );
- if (m_xLbTextDirection->get_active() != -1)
- rOutAttrs->Put( SvxFrameDirectionItem( m_xLbTextDirection->get_active_id(), EE_PARA_WRITINGDIR ) );
+ if (m_aLbTextDirection.get_active() != -1)
+ rOutAttrs->Put( SvxFrameDirectionItem( m_aLbTextDirection.get_active_id(), EE_PARA_WRITINGDIR ) );
return true;
}
@@ -137,7 +134,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs )
// show description
SfxItemState aState = rInAttrs->GetItemState( SCHATTR_AXIS_SHOWDESCR, false, &pPoolItem );
- if( aState == SfxItemState::DONTCARE )
+ if( aState == SfxItemState::INVALID )
{
m_xCbShowDescription->set_state( TRISTATE_INDET );
}
@@ -160,7 +157,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs )
if( aState == SfxItemState::SET )
m_nInitialDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue();
- m_bHasInitialDegrees = aState != SfxItemState::DONTCARE;
+ m_bHasInitialDegrees = aState != SfxItemState::INVALID;
if( m_bHasInitialDegrees )
m_xCtrlDial->SetRotation( m_nInitialDegrees );
else
@@ -172,19 +169,19 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs )
if( aState == SfxItemState::SET )
m_bInitialStacking = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
- m_bHasInitialStacking = aState != SfxItemState::DONTCARE;
+ m_bHasInitialStacking = aState != SfxItemState::INVALID;
if( m_bHasInitialDegrees )
m_xCbStacked->set_state(m_bInitialStacking ? TRISTATE_TRUE : TRISTATE_FALSE);
else
m_xCbStacked->set_state(TRISTATE_INDET);
StackedToggleHdl(*m_xCbStacked);
- if( rInAttrs->GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET )
- m_xLbTextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() );
+ if( const SvxFrameDirectionItem* pDirectionItem = rInAttrs->GetItemIfSet( EE_PARA_WRITINGDIR ) )
+ m_aLbTextDirection.set_active_id( pDirectionItem->GetValue() );
// Text overlap ----------
aState = rInAttrs->GetItemState( SCHATTR_AXIS_LABEL_OVERLAP, false, &pPoolItem );
- if( aState == SfxItemState::DONTCARE )
+ if( aState == SfxItemState::INVALID )
{
m_xCbTextOverlap->set_state( TRISTATE_INDET );
}
@@ -201,7 +198,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs )
// text break ----------
aState = rInAttrs->GetItemState( SCHATTR_AXIS_LABEL_BREAK, false, &pPoolItem );
- if( aState == SfxItemState::DONTCARE )
+ if( aState == SfxItemState::INVALID )
{
m_xCbTextBreak->set_state( TRISTATE_INDET );
}
@@ -223,10 +220,9 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs )
// text order ----------
if( m_bShowStaggeringControls )
{
- aState = rInAttrs->GetItemState( SCHATTR_AXIS_LABEL_ORDER, false, &pPoolItem );
- if( aState == SfxItemState::SET )
+ if( const SvxChartTextOrderItem* pOrderItem = rInAttrs->GetItemIfSet( SCHATTR_AXIS_LABEL_ORDER, false ) )
{
- SvxChartTextOrder eOrder = static_cast< const SvxChartTextOrderItem * >( pPoolItem )->GetValue();
+ SvxChartTextOrder eOrder = pOrderItem->GetValue();
switch( eOrder )
{
@@ -270,7 +266,7 @@ void SchAxisLabelTabPage::SetComplexCategories( bool bComplexCategories )
// event handling routines
-IMPL_LINK_NOARG(SchAxisLabelTabPage, StackedToggleHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SchAxisLabelTabPage, StackedToggleHdl, weld::Toggleable&, void)
{
bool bActive = m_xCbStacked->get_active() && m_xCbStacked->get_sensitive();
m_xNfRotate->set_sensitive(!bActive);
@@ -279,7 +275,7 @@ IMPL_LINK_NOARG(SchAxisLabelTabPage, StackedToggleHdl, weld::ToggleButton&, void
m_xFtRotate->set_sensitive(!bActive);
}
-IMPL_LINK_NOARG(SchAxisLabelTabPage, ToggleShowLabel, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SchAxisLabelTabPage, ToggleShowLabel, weld::Toggleable&, void)
{
bool bEnable = ( m_xCbShowDescription->get_state() != TRISTATE_FALSE );
@@ -297,7 +293,7 @@ IMPL_LINK_NOARG(SchAxisLabelTabPage, ToggleShowLabel, weld::ToggleButton&, void)
m_xCbTextBreak->set_sensitive( bEnable );
m_xFtTextDirection->set_sensitive( bEnable );
- m_xLbTextDirection->set_sensitive( bEnable );
+ m_aLbTextDirection.set_sensitive( bEnable );
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
index 0923c91118d5..75704ec4e4d5 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -21,8 +21,8 @@
#include <sfx2/tabdlg.hxx>
#include <svx/dialcontrol.hxx>
#include <tools/degree.hxx>
+#include <TextDirectionListBox.hxx>
-namespace chart { class TextDirectionListBox; }
namespace weld {
class CheckButton;
class CustomWeld;
@@ -56,17 +56,16 @@ private:
std::unique_ptr<weld::CheckButton> m_xCbTextOverlap;
std::unique_ptr<weld::CheckButton> m_xCbTextBreak;
std::unique_ptr<weld::Label> m_xFtABCD;
- std::unique_ptr<weld::Label> m_xFlOrient;
std::unique_ptr<weld::Label> m_xFtRotate;
std::unique_ptr<weld::MetricSpinButton> m_xNfRotate;
std::unique_ptr<weld::CheckButton> m_xCbStacked;
std::unique_ptr<weld::Label> m_xFtTextDirection;
- std::unique_ptr<TextDirectionListBox> m_xLbTextDirection;
+ TextDirectionListBox m_aLbTextDirection;
std::unique_ptr<svx::DialControl> m_xCtrlDial;
std::unique_ptr<weld::CustomWeld> m_xCtrlDialWin;
- DECL_LINK(StackedToggleHdl, weld::ToggleButton&, void);
- DECL_LINK(ToggleShowLabel, weld::ToggleButton&, void);
+ DECL_LINK(StackedToggleHdl, weld::Toggleable&, void);
+ DECL_LINK(ToggleShowLabel, weld::Toggleable&, void);
public:
SchAxisLabelTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
index d4e7fa218023..2e3988267c77 100644
--- a/chart2/source/controller/dialogs/tp_AxisPositions.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
@@ -36,20 +36,17 @@ AxisPositionsTabPage::AxisPositionsTabPage(weld::Container* pPage, weld::DialogC
: SfxTabPage(pPage, pController, "modules/schart/ui/tp_AxisPositions.ui", "tp_AxisPositions", &rInAttrs)
, m_pNumFormatter(nullptr)
, m_bCrossingAxisIsCategoryAxis(false)
- , m_aCategories()
, m_bSupportAxisPositioning(false)
, m_bSupportCategoryPositioning(false)
, m_xFL_AxisLine(m_xBuilder->weld_frame("FL_AXIS_LINE"))
, m_xLB_CrossesAt(m_xBuilder->weld_combo_box("LB_CROSSES_OTHER_AXIS_AT"))
, m_xED_CrossesAt(m_xBuilder->weld_formatted_spin_button("EDT_CROSSES_OTHER_AXIS_AT"))
, m_xED_CrossesAtCategory(m_xBuilder->weld_combo_box( "EDT_CROSSES_OTHER_AXIS_AT_CATEGORY"))
- , m_xCB_AxisBetweenCategories(m_xBuilder->weld_check_button("CB_AXIS_BETWEEN_CATEGORIES"))
, m_xFL_Position(m_xBuilder->weld_frame("FL_POSITION"))
, m_xRB_On(m_xBuilder->weld_radio_button("RB_ON"))
, m_xRB_Between(m_xBuilder->weld_radio_button("RB_BETWEEN"))
, m_xFL_Labels(m_xBuilder->weld_frame("FL_LABELS"))
, m_xLB_PlaceLabels(m_xBuilder->weld_combo_box("LB_PLACE_LABELS"))
- , m_xED_LabelDistance(m_xBuilder->weld_formatted_spin_button("EDT_AXIS_LABEL_DISTANCE"))
, m_xCB_TicksInner(m_xBuilder->weld_check_button("CB_TICKS_INNER"))
, m_xCB_TicksOuter(m_xBuilder->weld_check_button("CB_TICKS_OUTER"))
, m_xCB_MinorInner(m_xBuilder->weld_check_button("CB_MINOR_INNER"))
@@ -101,8 +98,8 @@ bool AxisPositionsTabPage::FillItemSet(SfxItemSet* rOutAttrs)
rOutAttrs->Put( SfxInt32Item( SCHATTR_AXIS_LABEL_POSITION, nLabelPos ));
// tick marks
- tools::Long nTicks=0;
- tools::Long nMinorTicks=0;
+ sal_Int32 nTicks=0;
+ sal_Int32 nMinorTicks=0;
if(m_xCB_MinorInner->get_active())
nMinorTicks|=CHAXIS_MARK_INNER;
@@ -130,7 +127,7 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs)
m_xED_CrossesAtCategory->set_visible( m_bCrossingAxisIsCategoryAxis );
if (m_bCrossingAxisIsCategoryAxis)
{
- for( auto const & cat : std::as_const(m_aCategories) )
+ for (auto const& cat : m_aCategories)
m_xED_CrossesAtCategory->append_text(cat);
}
@@ -143,13 +140,12 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs)
}
//fill controls
- const SfxPoolItem *pPoolItem = nullptr;
//axis line
- if(rInAttrs->GetItemState(SCHATTR_AXIS_POSITION,true, &pPoolItem)== SfxItemState::SET)
+ if(SfxInt32Item const * pPositionItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_POSITION))
{
bool bZero = false;
- sal_Int32 nPos = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ sal_Int32 nPos = pPositionItem->GetValue();
if(nPos==0)
{
//switch to value
@@ -163,11 +159,12 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs)
m_xLB_CrossesAt->set_active( nPos );
CrossesAtSelectHdl( *m_xLB_CrossesAt );
- if( rInAttrs->GetItemState(SCHATTR_AXIS_POSITION_VALUE,true, &pPoolItem)== SfxItemState::SET || bZero )
+ const SvxDoubleItem* pPosValueItem;
+ if( (pPosValueItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_POSITION_VALUE)) || bZero )
{
double fCrossover = 0.0;
if( !bZero )
- fCrossover = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
+ fCrossover = pPosValueItem->GetValue();
if( m_bCrossingAxisIsCategoryAxis )
m_xED_CrossesAtCategory->set_active( static_cast<sal_uInt16>(::rtl::math::round(fCrossover-1.0)) );
else
@@ -189,9 +186,10 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs)
}
// shifted category position
- if (m_bSupportCategoryPositioning && rInAttrs->GetItemState(SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION, true, &pPoolItem) == SfxItemState::SET)
+ const SfxBoolItem* pCatPosItem;
+ if (m_bSupportCategoryPositioning && (pCatPosItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION)))
{
- if (static_cast<const SfxBoolItem*>(pPoolItem)->GetValue())
+ if (pCatPosItem->GetValue())
m_xRB_Between->set_active(true);
else
m_xRB_On->set_active(true);
@@ -200,9 +198,9 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs)
m_xFL_Position->hide();
// Labels
- if( rInAttrs->GetItemState( SCHATTR_AXIS_LABEL_POSITION, false, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxInt32Item* pLabelPosItem = rInAttrs->GetItemIfSet( SCHATTR_AXIS_LABEL_POSITION, false) )
{
- sal_Int32 nPos = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ sal_Int32 nPos = pLabelPosItem->GetValue();
if( nPos < m_xLB_PlaceLabels->get_count() )
m_xLB_PlaceLabels->set_active( nPos );
}
@@ -212,10 +210,10 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs)
// Tick marks
tools::Long nTicks = 0, nMinorTicks = 0;
- if (rInAttrs->GetItemState(SCHATTR_AXIS_TICKS,true, &pPoolItem)== SfxItemState::SET)
- nTicks = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
- if (rInAttrs->GetItemState(SCHATTR_AXIS_HELPTICKS,true, &pPoolItem)== SfxItemState::SET)
- nMinorTicks = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ if (const SfxInt32Item* pTicksItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_TICKS))
+ nTicks = pTicksItem->GetValue();
+ if (const SfxInt32Item* pHelpTicksItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_HELPTICKS))
+ nMinorTicks = pHelpTicksItem->GetValue();
m_xCB_TicksInner->set_active(bool(nTicks&CHAXIS_MARK_INNER));
m_xCB_TicksOuter->set_active(bool(nTicks&CHAXIS_MARK_OUTER));
@@ -223,9 +221,9 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs)
m_xCB_MinorOuter->set_active(bool(nMinorTicks&CHAXIS_MARK_OUTER));
// Tick position
- if( rInAttrs->GetItemState( SCHATTR_AXIS_MARK_POSITION, false, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxInt32Item* pMarkPosItem = rInAttrs->GetItemIfSet( SCHATTR_AXIS_MARK_POSITION, false) )
{
- sal_Int32 nPos = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ sal_Int32 nPos = pMarkPosItem->GetValue();
if( nPos < m_xLB_PlaceTicks->get_count() )
m_xLB_PlaceTicks->set_active( nPos );
}
@@ -262,10 +260,9 @@ void AxisPositionsTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
rCrossFormatter.SetFormatter(m_pNumFormatter);
rCrossFormatter.UseInputStringForFormatting();
- const SfxPoolItem *pPoolItem = nullptr;
- if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxUInt32Item* pNumFormatItem = GetItemSet().GetItemIfSet(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT) )
{
- sal_uLong nFmt = static_cast<const SfxUInt32Item*>(pPoolItem)->GetValue();
+ sal_uInt32 nFmt = pNumFormatItem->GetValue();
rCrossFormatter.SetFormatKey(nFmt);
}
}
@@ -298,7 +295,7 @@ IMPL_LINK_NOARG(AxisPositionsTabPage, CrossesAtSelectHdl, weld::ComboBox&, void)
if (m_xED_CrossesAt->get_text().isEmpty())
m_xED_CrossesAt->GetFormatter().SetValue(0.0);
- if (m_xED_CrossesAtCategory->get_active() == -1)
+ if (m_xED_CrossesAtCategory->get_active() == -1 && m_xED_CrossesAtCategory->get_count())
m_xED_CrossesAtCategory->set_active(0);
PlaceLabelsSelectHdl(*m_xLB_PlaceLabels);
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.hxx b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
index d7f18242dd42..86f749a26850 100644
--- a/chart2/source/controller/dialogs/tp_AxisPositions.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
@@ -60,7 +60,6 @@ private: //member:
std::unique_ptr<weld::ComboBox> m_xLB_CrossesAt;
std::unique_ptr<weld::FormattedSpinButton> m_xED_CrossesAt;
std::unique_ptr<weld::ComboBox> m_xED_CrossesAtCategory;
- std::unique_ptr<weld::CheckButton> m_xCB_AxisBetweenCategories;
std::unique_ptr<weld::Frame> m_xFL_Position;
std::unique_ptr<weld::RadioButton> m_xRB_On;
@@ -68,7 +67,6 @@ private: //member:
std::unique_ptr<weld::Frame> m_xFL_Labels;
std::unique_ptr<weld::ComboBox> m_xLB_PlaceLabels;
- std::unique_ptr<weld::FormattedSpinButton> m_xED_LabelDistance;
std::unique_ptr<weld::CheckButton> m_xCB_TicksInner;
std::unique_ptr<weld::CheckButton> m_xCB_TicksOuter;
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index e209f508e3cc..b301a9794d5d 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -19,26 +19,27 @@
#include "tp_ChartType.hxx"
#include <ChartResourceGroups.hxx>
+#include <ChartTypeManager.hxx>
#include <strings.hrc>
#include <ResId.hxx>
-#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartModel.hxx>
+#include <ChartTypeTemplate.hxx>
+#include <Diagram.hxx>
#include <unonames.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <svtools/valueset.hxx>
+#include <utility>
#include <vcl/weld.hxx>
#include <vcl/outdev.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogController* pController, const uno::Reference< XChartDocument >& xChartModel,
+ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogController* pController, rtl::Reference<::chart::ChartModel> xChartModel,
bool bShowDescription)
: OWizardPage(pPage, pController, "modules/schart/ui/tp_ChartType.ui", "tp_ChartType")
, m_pDim3DLookResourceGroup( new Dim3DLookResourceGroup(m_xBuilder.get()) )
@@ -46,7 +47,7 @@ ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogControlle
, m_pSplineResourceGroup( new SplineResourceGroup(m_xBuilder.get(), pController->getDialog()) )
, m_pGeometryResourceGroup( new GeometryResourceGroup(m_xBuilder.get()) )
, m_pSortByXValuesResourceGroup( new SortByXValuesResourceGroup(m_xBuilder.get()) )
- , m_xChartModel( xChartModel )
+ , m_xChartModel(std::move( xChartModel ))
, m_aChartTypeDialogControllerList(0)
, m_pCurrentMainType(nullptr)
, m_nChangingCalls(0)
@@ -75,11 +76,11 @@ ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogControlle
m_xSubTypeList->SetStyle(m_xSubTypeList->GetStyle() |
WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK );
- m_xSubTypeList->SetColCount(4);
+ m_xSubTypeList->SetColCount(6);
m_xSubTypeList->SetLineCount(1);
bool bEnableComplexChartTypes = true;
- uno::Reference< beans::XPropertySet > xProps( m_xChartModel, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProps( static_cast<cppu::OWeakObject*>(m_xChartModel.get()), uno::UNO_QUERY );
if ( xProps.is() )
{
try
@@ -177,12 +178,15 @@ void ChartTypeTabPage::stateChanged()
commitToModel( aParameter );
//detect the new ThreeDLookScheme
- uno::Reference<XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
- aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
+ rtl::Reference< Diagram > xDiagram = m_xChartModel->getFirstChartDiagram();
+ // tdf#124295 - select always a 3D scheme
+ if (ThreeDLookScheme aThreeDLookScheme = xDiagram->detectScheme();
+ aThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Unknown)
+ aParameter.eThreeDLookScheme = aThreeDLookScheme;
+
try
{
- uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
}
catch ( const uno::Exception& )
{
@@ -239,15 +243,18 @@ void ChartTypeTabPage::selectMainType()
m_pCurrentMainType->adjustParameterToMainType( aParameter );
commitToModel( aParameter );
//detect the new ThreeDLookScheme
- aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( ChartModelHelper::findDiagram( m_xChartModel ) );
- if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
- aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Unknown;
+ rtl::Reference< Diagram > xDiagram = m_xChartModel->getFirstChartDiagram();
+ if (xDiagram)
+ aParameter.eThreeDLookScheme = m_xChartModel->getFirstChartDiagram()->detectScheme();
+ if (!aParameter.b3DLook
+ && aParameter.eThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
- uno::Reference<XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
try
{
- uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ if (xDiagram)
+ xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
}
catch ( const uno::Exception& )
{
@@ -255,7 +262,7 @@ void ChartTypeTabPage::selectMainType()
}
fillAllControls( aParameter );
- uno::Reference< beans::XPropertySet > xTemplateProps( getCurrentTemplate(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xTemplateProps( static_cast<cppu::OWeakObject*>(getCurrentTemplate().get()), uno::UNO_QUERY );
m_pCurrentMainType->fillExtraControls(m_xChartModel,xTemplateProps);
}
@@ -297,11 +304,12 @@ void ChartTypeTabPage::initializePage()
{
if( !m_xChartModel.is() )
return;
- uno::Reference< lang::XMultiServiceFactory > xTemplateManager( m_xChartModel->getChartTypeManager(), uno::UNO_QUERY );
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
- DiagramHelper::tTemplateWithServiceName aTemplate =
- DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager );
- OUString aServiceName( aTemplate.second );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = m_xChartModel->getTypeManager();
+ rtl::Reference< Diagram > xDiagram = m_xChartModel->getFirstChartDiagram();
+ Diagram::tTemplateWithServiceName aTemplate;
+ if (xDiagram)
+ aTemplate = xDiagram->getTemplate( xChartTypeManager );
+ OUString aServiceName( aTemplate.sServiceName );
bool bFound = false;
@@ -314,19 +322,19 @@ void ChartTypeTabPage::initializePage()
m_xMainTypeList->select(nM);
showAllControls(*elem);
- uno::Reference< beans::XPropertySet > xTemplateProps( aTemplate.first, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xTemplateProps( static_cast<cppu::OWeakObject*>(aTemplate.xChartTypeTemplate.get()), uno::UNO_QUERY );
ChartTypeParameter aParameter = elem->getChartTypeParameterForService( aServiceName, xTemplateProps );
m_pCurrentMainType = getSelectedMainType();
//set ThreeDLookScheme
- aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( xDiagram );
- if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
- aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
+ aParameter.eThreeDLookScheme = xDiagram->detectScheme();
+ if (!aParameter.b3DLook
+ && aParameter.eThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
try
{
- uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
}
catch (const uno::Exception&)
{
@@ -343,7 +351,8 @@ void ChartTypeTabPage::initializePage()
if( !bFound )
{
- m_xSubTypeList->Hide();
+ m_xMainTypeList->show();
+ m_xSubTypeList->Show();
m_pDim3DLookResourceGroup->showControls( false );
m_pStackingResourceGroup->showControls( false );
m_pSplineResourceGroup->showControls( false );
@@ -357,14 +366,14 @@ bool ChartTypeTabPage::commitPage( ::vcl::WizardTypes::CommitPageReason /*eReaso
return true; // return false if this page should not be left
}
-uno::Reference< XChartTypeTemplate > ChartTypeTabPage::getCurrentTemplate() const
+rtl::Reference< ChartTypeTemplate > ChartTypeTabPage::getCurrentTemplate() const
{
if( m_pCurrentMainType && m_xChartModel.is() )
{
ChartTypeParameter aParameter( getCurrentParamter() );
m_pCurrentMainType->adjustParameterToSubType( aParameter );
- uno::Reference< lang::XMultiServiceFactory > xTemplateManager( m_xChartModel->getChartTypeManager(), uno::UNO_QUERY );
- return m_pCurrentMainType->getCurrentTemplate( aParameter, xTemplateManager );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = m_xChartModel->getTypeManager();
+ return m_pCurrentMainType->getCurrentTemplate( aParameter, xChartTypeManager );
}
return nullptr;
}
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx
index e7f8e1980bd8..c01b599f58d5 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.hxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.hxx
@@ -45,14 +45,14 @@ class ChartTypeTabPage final : public ResourceChangeListener, public vcl::OWizar
{
public:
ChartTypeTabPage( weld::Container* pPage, weld::DialogController* pController
- , const css::uno::Reference< css::chart2::XChartDocument >& xChartModel
+ , rtl::Reference<::chart::ChartModel> xChartModel
, bool bShowDescription = true );
virtual ~ChartTypeTabPage() override;
virtual void initializePage() override;
virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason eReason ) override;
- virtual css::uno::Reference< css::chart2::XChartTypeTemplate > getCurrentTemplate() const override;
+ virtual rtl::Reference< ::chart::ChartTypeTemplate > getCurrentTemplate() const override;
private:
ChartTypeDialogController* getSelectedMainType();
@@ -74,7 +74,7 @@ private:
std::unique_ptr<GeometryResourceGroup> m_pGeometryResourceGroup;
std::unique_ptr<SortByXValuesResourceGroup> m_pSortByXValuesResourceGroup;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
std::vector< std::unique_ptr<ChartTypeDialogController> > m_aChartTypeDialogControllerList;
ChartTypeDialogController* m_pCurrentMainType;
diff --git a/chart2/source/controller/dialogs/tp_DataPointOption.cxx b/chart2/source/controller/dialogs/tp_DataPointOption.cxx
index 7fb9f230ed7e..4c824287206c 100644
--- a/chart2/source/controller/dialogs/tp_DataPointOption.cxx
+++ b/chart2/source/controller/dialogs/tp_DataPointOption.cxx
@@ -53,12 +53,10 @@ bool DataPointOptionTabPage::FillItemSet(SfxItemSet* rOutAttrs)
void DataPointOptionTabPage::Reset(const SfxItemSet* rInAttrs)
{
- const SfxPoolItem* pPoolItem = nullptr;
-
- if (rInAttrs->GetItemState(SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, true, &pPoolItem)
- == SfxItemState::SET)
+ if (const SfxBoolItem* pEntryItem
+ = rInAttrs->GetItemIfSet(SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY))
{
- bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ bool bVal = pEntryItem->GetValue();
m_xCBHideLegendEntry->set_active(bVal);
}
}
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 90eb974ca0d5..fe4ba0981599 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -20,33 +20,32 @@
#include "tp_DataSource.hxx"
#include <strings.hrc>
#include <ResId.hxx>
+#include <ChartType.hxx>
#include <ChartTypeTemplateProvider.hxx>
+#include <ChartTypeTemplate.hxx>
+#include <ChartModel.hxx>
#include <RangeSelectionHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <ControllerLockGuard.hxx>
#include <DataSourceHelper.hxx>
+#include <LabeledDataSequence.hxx>
#include "DialogModel.hxx"
+#include <o3tl/safeint.hxx>
#include <TabPageNotifiable.hxx>
-#include <com/sun/star/chart2/XChartType.hpp>
-#include <com/sun/star/chart2/XDataSeries.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/chart2/data/XDataSink.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
namespace
{
-constexpr OUStringLiteral lcl_aLabelRole( u"label" );
+constexpr OUString lcl_aLabelRole( u"label"_ustr );
void lcl_UpdateCurrentRange(weld::TreeView& rOutListBox, const OUString & rRole,
const OUString& rRange)
@@ -56,7 +55,7 @@ void lcl_UpdateCurrentRange(weld::TreeView& rOutListBox, const OUString & rRole,
{
rOutListBox.set_text(nEntry, ::chart::DialogModel::ConvertRoleFromInternalToUI(rRole), 0);
rOutListBox.set_text(nEntry, rRange, 1);
- ::chart::SeriesEntry* pEntry = reinterpret_cast<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry).toInt64());
+ ::chart::SeriesEntry* pEntry = weld::fromId<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry));
pEntry->m_sRole = rRole;
}
}
@@ -68,11 +67,10 @@ bool lcl_UpdateCurrentSeriesName(weld::TreeView& rOutListBox)
return false;
bool bResult = false;
- ::chart::SeriesEntry * pEntry = reinterpret_cast<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry).toInt64());
+ ::chart::SeriesEntry * pEntry = weld::fromId<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry));
if (pEntry->m_xDataSeries.is() && pEntry->m_xChartType.is())
{
- OUString aLabel(::chart::DataSeriesHelper::getDataSeriesLabel(
- pEntry->m_xDataSeries,
+ OUString aLabel(pEntry->m_xDataSeries->getLabelForRole(
pEntry->m_xChartType->getRoleOfSequenceForSeriesLabel()));
if (!aLabel.isEmpty())
{
@@ -90,7 +88,7 @@ OUString lcl_GetSelectedRole(const weld::TreeView& rRoleListBox, bool bUITransla
{
if (bUITranslated)
return rRoleListBox.get_text(nEntry);
- ::chart::SeriesEntry* pEntry = reinterpret_cast<::chart::SeriesEntry*>(rRoleListBox.get_id(nEntry).toInt64());
+ ::chart::SeriesEntry* pEntry = weld::fromId<::chart::SeriesEntry*>(rRoleListBox.get_id(nEntry));
return pEntry->m_sRole;
}
return OUString();
@@ -123,32 +121,29 @@ void lcl_enableRangeChoosing(bool bEnable, weld::DialogController* pDialog)
}
void lcl_addLSequenceToDataSource(
- const Reference< chart2::data::XLabeledDataSequence > & xLSequence,
- const Reference< chart2::data::XDataSource > & xSource )
+ const uno::Reference< chart2::data::XLabeledDataSequence > & xLSequence,
+ const Reference< ::chart::DataSeries > & xSource )
{
- Reference< data::XDataSink > xSink( xSource, uno::UNO_QUERY );
- if( xSink.is())
+ if( xSource.is())
{
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( xSource->getDataSequences());
- aData.realloc( aData.getLength() + 1 );
- aData[ aData.getLength() - 1 ] = xLSequence;
- xSink->setData( aData );
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aData = xSource->getDataSequences2();
+ aData.push_back( xLSequence );
+ xSource->setData( aData );
}
}
-Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
- const Reference< chart2::data::XDataSource > & xDataSource )
+uno::Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
+ const rtl::Reference< ::chart::DataSeries > & xDataSource )
{
- Reference< chart2::data::XLabeledDataSequence > xResult;
- const Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences());
+ uno::Reference< chart2::data::XLabeledDataSequence > xResult;
- for( Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : aSequences )
+ for( uno::Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : xDataSource->getDataSequences2() )
{
// no values are set but a label exists
if( ! labeledDataSeq->getValues().is() &&
labeledDataSeq->getLabel().is())
{
- xResult.set( labeledDataSeq );
+ xResult = labeledDataSeq;
break;
}
}
@@ -214,8 +209,7 @@ DataSourceTabPage::DataSourceTabPage(weld::Container* pPage, weld::DialogControl
m_xEDT_CATEGORIES->connect_changed(LINK( this, DataSourceTabPage, RangeModifiedHdl));
// init controls
- std::vector<int> aWidths;
- aWidths.push_back(m_xLB_ROLE->get_approximate_digit_width() * 20);
+ std::vector<int> aWidths { o3tl::narrowing<int>(m_xLB_ROLE->get_approximate_digit_width() * 20) };
m_xLB_ROLE->set_column_fixed_widths(aWidths);
m_xLB_ROLE->show();
@@ -231,7 +225,7 @@ void DataSourceTabPage::InsertRoleLBEntry(const OUString& rRole, const OUString&
m_aEntries.emplace_back(new SeriesEntry);
SeriesEntry* pEntry = m_aEntries.back().get();
pEntry->m_sRole = rRole;
- m_xLB_ROLE->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)),
+ m_xLB_ROLE->append(weld::toId(pEntry),
::chart::DialogModel::ConvertRoleFromInternalToUI(rRole));
m_xLB_ROLE->set_text(m_xLB_ROLE->n_children() - 1, rRange, 1);
}
@@ -325,13 +319,13 @@ void DataSourceTabPage::updateControlsFromDialogModel()
void DataSourceTabPage::fillSeriesListBox()
{
- Reference< XDataSeries > xSelected;
+ rtl::Reference< DataSeries > xSelected;
SeriesEntry* pEntry = nullptr;
int nEntry = m_xLB_SERIES->get_selected_index();
if (nEntry != -1)
{
- pEntry = reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
- xSelected.set(pEntry->m_xDataSeries);
+ pEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
+ xSelected = pEntry->m_xDataSeries;
}
bool bHasSelectedEntry = (pEntry != nullptr);
@@ -355,7 +349,7 @@ void DataSourceTabPage::fillSeriesListBox()
OUString aResString(::chart::SchResId( STR_DATA_UNNAMED_SERIES_WITH_INDEX ));
// replace index of unnamed series
- const OUString aReplacementStr( "%NUMBER" );
+ static constexpr OUString aReplacementStr( u"%NUMBER"_ustr );
sal_Int32 nIndex = aResString.indexOf( aReplacementStr );
if( nIndex != -1 )
aLabel = aResString.replaceAt(
@@ -370,9 +364,9 @@ void DataSourceTabPage::fillSeriesListBox()
m_aEntries.emplace_back(new SeriesEntry);
pEntry = m_aEntries.back().get();
- pEntry->m_xDataSeries.set(series.second.first);
- pEntry->m_xChartType.set(series.second.second);
- m_xLB_SERIES->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), aLabel);
+ pEntry->m_xDataSeries = series.second.first;
+ pEntry->m_xChartType = series.second.second;
+ m_xLB_SERIES->append(weld::toId(pEntry), aLabel);
if (bHasSelectedEntry && series.second.first == xSelected)
nSelectedEntry = nEntry;
++nEntry;
@@ -389,7 +383,7 @@ void DataSourceTabPage::fillRoleListBox()
int nSeriesEntry = m_xLB_SERIES->get_selected_index();
SeriesEntry* pSeriesEntry = nullptr;
if (nSeriesEntry != -1)
- pSeriesEntry = reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nSeriesEntry).toInt64());
+ pSeriesEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nSeriesEntry));
bool bHasSelectedEntry = (pSeriesEntry != nullptr);
int nRoleIndex = m_xLB_ROLE->get_selected_index();
@@ -485,7 +479,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, RoleSelectionChangedHdl, weld::TreeView&, voi
OUString aSelectedRange = lcl_GetSelectedRolesRange( *m_xLB_ROLE );
// replace role in fixed text label
- const OUString aReplacementStr( "%VALUETYPE" );
+ static constexpr OUString aReplacementStr( u"%VALUETYPE"_ustr );
sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr );
if( nIndex != -1 )
{
@@ -557,23 +551,23 @@ IMPL_LINK_NOARG(DataSourceTabPage, AddButtonClickedHdl, weld::Button&, void)
{
m_rDialogModel.startControllerLockTimer();
int nEntry = m_xLB_SERIES->get_selected_index();
- Reference< XDataSeries > xSeriesToInsertAfter;
- Reference< XChartType > xChartTypeForNewSeries;
+ rtl::Reference< DataSeries > xSeriesToInsertAfter;
+ rtl::Reference< ChartType > xChartTypeForNewSeries;
if( m_pTemplateProvider )
m_rDialogModel.setTemplate( m_pTemplateProvider->getCurrentTemplate());
if (nEntry != -1)
{
- ::chart::SeriesEntry* pEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
- xSeriesToInsertAfter.set(pEntry->m_xDataSeries);
- xChartTypeForNewSeries.set(pEntry->m_xChartType);
+ ::chart::SeriesEntry* pEntry = weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
+ xSeriesToInsertAfter = pEntry->m_xDataSeries;
+ xChartTypeForNewSeries = pEntry->m_xChartType;
}
else
{
- std::vector< Reference< XDataSeriesContainer > > aCntVec(
+ std::vector< rtl::Reference< ChartType > > aCntVec(
m_rDialogModel.getAllDataSeriesContainers());
if( ! aCntVec.empty())
- xChartTypeForNewSeries.set( aCntVec.front(), uno::UNO_QUERY );
+ xChartTypeForNewSeries = aCntVec.front();
}
OSL_ENSURE( xChartTypeForNewSeries.is(), "Cannot insert new series" );
@@ -600,15 +594,15 @@ IMPL_LINK_NOARG(DataSourceTabPage, RemoveButtonClickedHdl, weld::Button&, void)
if (nEntry == -1)
return;
- SeriesEntry* pEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
- Reference< XDataSeries > xNewSelSeries;
+ SeriesEntry* pEntry = weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
+ rtl::Reference< DataSeries > xNewSelSeries;
SeriesEntry * pNewSelEntry = nullptr;
if (nEntry + 1 < m_xLB_SERIES->n_children())
- pNewSelEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry + 1).toInt64());
+ pNewSelEntry = weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry + 1));
else if (nEntry > 0)
- pNewSelEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry - 1).toInt64());
+ pNewSelEntry = weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry - 1));
if (pNewSelEntry)
- xNewSelSeries.set(pNewSelEntry->m_xDataSeries);
+ xNewSelSeries = pNewSelEntry->m_xDataSeries;
m_rDialogModel.deleteSeries( pEntry->m_xDataSeries, pEntry->m_xChartType );
setDirty();
@@ -621,7 +615,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, RemoveButtonClickedHdl, weld::Button&, void)
{
for (int i = 0; i < m_xLB_SERIES->n_children(); ++i)
{
- pEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(i).toInt64());
+ pEntry = weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(i));
if (pEntry->m_xDataSeries == xNewSelSeries)
{
m_xLB_SERIES->select(i);
@@ -639,7 +633,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, UpButtonClickedHdl, weld::Button&, void)
int nEntry = m_xLB_SERIES->get_selected_index();
SeriesEntry* pEntry = nullptr;
if (nEntry != -1)
- pEntry = reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
+ pEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
bool bHasSelectedEntry = (pEntry != nullptr);
@@ -659,7 +653,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, DownButtonClickedHdl, weld::Button&, void)
int nEntry = m_xLB_SERIES->get_selected_index();
SeriesEntry* pEntry = nullptr;
if (nEntry != -1)
- pEntry = reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
+ pEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
bool bHasSelectedEntry = (pEntry != nullptr);
@@ -748,7 +742,7 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
if (bAll || (pField == m_xEDT_CATEGORIES.get()))
{
- Reference< data::XLabeledDataSequence > xLabeledSeq( m_rDialogModel.getCategories() );
+ uno::Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( m_rDialogModel.getCategories() );
if( xDataProvider.is())
{
OUString aRange(m_xEDT_CATEGORIES->get_text());
@@ -757,7 +751,7 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
// create or change categories
if( !xLabeledSeq.is())
{
- xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence() );
+ xLabeledSeq = DataSourceHelper::createLabeledDataSequence();
m_rDialogModel.setCategories( xLabeledSeq );
}
try
@@ -773,7 +767,7 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
else if( xLabeledSeq.is())
{
// clear existing categories
- xLabeledSeq.set(nullptr);
+ xLabeledSeq.clear();
m_rDialogModel.setCategories( xLabeledSeq );
}
}
@@ -782,7 +776,7 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
int nSeriesEntry = m_xLB_SERIES->get_selected_index();
SeriesEntry* pSeriesEntry = nullptr;
if (nSeriesEntry != -1)
- pSeriesEntry = reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nSeriesEntry).toInt64());
+ pSeriesEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nSeriesEntry));
bool bHasSelectedEntry = (pSeriesEntry != nullptr);
if( bHasSelectedEntry )
@@ -800,9 +794,8 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
if( bIsLabel )
aSequenceRole = aSequenceNameForLabel;
- Reference< data::XDataSource > xSource( pSeriesEntry->m_xDataSeries, uno::UNO_QUERY_THROW );
- Reference< data::XLabeledDataSequence > xLabeledSeq(
- DataSeriesHelper::getDataSequenceByRole( xSource, aSequenceRole ));
+ uno::Reference< chart2::data::XLabeledDataSequence > xLabeledSeq =
+ DataSeriesHelper::getDataSequenceByRole( pSeriesEntry->m_xDataSeries, aSequenceRole );
if( xDataProvider.is())
{
@@ -811,12 +804,12 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
if( ! xLabeledSeq.is())
{
// check if there is already an "orphan" label sequence
- xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
+ xLabeledSeq = lcl_findLSequenceWithOnlyLabel( pSeriesEntry->m_xDataSeries );
if( ! xLabeledSeq.is())
{
// no corresponding labeled data sequence for label found
- xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence() );
- lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
+ xLabeledSeq = DataSourceHelper::createLabeledDataSequence();
+ lcl_addLSequenceToDataSource( xLabeledSeq, pSeriesEntry->m_xDataSeries );
}
}
if( xLabeledSeq.is())
@@ -840,7 +833,7 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
// "$Sheet1.$A$1"
aRange = xNewSeq->getSourceRangeRepresentation();
Reference< beans::XPropertySet > xProp( xNewSeq, uno::UNO_QUERY_THROW );
- xProp->setPropertyValue( "Role" , uno::Any( OUString(lcl_aLabelRole) ));
+ xProp->setPropertyValue( "Role" , uno::Any( lcl_aLabelRole ));
//Labels should always include hidden cells, regardless of the setting chosen
xProp->setPropertyValue( "IncludeHiddenCells", uno::Any(true));
@@ -879,11 +872,11 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
if( !xLabeledSeq.is())
{
if( aSelectedRole == aSequenceNameForLabel )
- xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
+ xLabeledSeq = lcl_findLSequenceWithOnlyLabel( pSeriesEntry->m_xDataSeries );
if( ! xLabeledSeq.is())
{
- xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence() );
- lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
+ xLabeledSeq = DataSourceHelper::createLabeledDataSequence();
+ lcl_addLSequenceToDataSource( xLabeledSeq, pSeriesEntry->m_xDataSeries );
}
}
xLabeledSeq->setValues( xNewSeq );
@@ -908,9 +901,8 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
{
try
{
- Reference< util::XModifiable > xModifiable( m_rDialogModel.getChartModel(), uno::UNO_QUERY );
- if( xModifiable.is() )
- xModifiable->setModified( true );
+ if( m_rDialogModel.getChartModel() )
+ m_rDialogModel.getChartModel()->setModified( true );
const DialogModelTimeBasedInfo& rInfo = m_rDialogModel.getTimeBasedInfo();
if(rInfo.bTimeBased)
{
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
index 1b6ba9862168..40219d917f9c 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -18,6 +18,9 @@
*/
#pragma once
+#include <DataSeries.hxx>
+#include <ChartType.hxx>
+
#include <vcl/wizardmachine.hxx>
#include <RangeSelectionListener.hxx>
@@ -29,8 +32,9 @@ namespace chart { class TabPageNotifiable; }
namespace chart
{
-
+class ChartType;
class ChartTypeTemplateProvider;
+class DataSeries;
class DialogModel;
class SeriesEntry
@@ -39,10 +43,10 @@ public:
OUString m_sRole;
/// the corresponding data series
- css::uno::Reference< css::chart2::XDataSeries > m_xDataSeries;
+ rtl::Reference< ::chart::DataSeries > m_xDataSeries;
/// the chart type that contains the series (via XDataSeriesContainer)
- css::uno::Reference< css::chart2::XChartType > m_xChartType;
+ rtl::Reference< ::chart::ChartType > m_xChartType;
};
class DataSourceTabPage final :
diff --git a/chart2/source/controller/dialogs/tp_DataTable.cxx b/chart2/source/controller/dialogs/tp_DataTable.cxx
new file mode 100644
index 000000000000..e6982b4a5067
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataTable.cxx
@@ -0,0 +1,43 @@
+/* -*- 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 "tp_DataTable.hxx"
+
+namespace chart
+{
+DataTableTabPage::DataTableTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs)
+ : SfxTabPage(pPage, pController, "modules/schart/ui/tp_DataTable.ui", "DataTableTabPage",
+ &rInAttrs)
+ , m_aDataTablePropertiesResources(*m_xBuilder)
+{
+}
+
+DataTableTabPage::~DataTableTabPage() = default;
+
+std::unique_ptr<SfxTabPage> DataTableTabPage::Create(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet* rAttrs)
+{
+ return std::make_unique<DataTableTabPage>(pPage, pController, *rAttrs);
+}
+
+bool DataTableTabPage::FillItemSet(SfxItemSet* pOutAttrs)
+{
+ return m_aDataTablePropertiesResources.writeToItemSet(*pOutAttrs);
+}
+
+void DataTableTabPage::Reset(const SfxItemSet* pInAttrs)
+{
+ m_aDataTablePropertiesResources.initFromItemSet(*pInAttrs);
+}
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_DataTable.hxx b/chart2/source/controller/dialogs/tp_DataTable.hxx
new file mode 100644
index 000000000000..00ab64cf89ce
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataTable.hxx
@@ -0,0 +1,37 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <sfx2/tabdlg.hxx>
+#include <res_DataTableProperties.hxx>
+
+namespace chart
+{
+/** Tab page for the data table properties */
+class DataTableTabPage : public SfxTabPage
+{
+private:
+ DataTablePropertiesResources m_aDataTablePropertiesResources;
+
+public:
+ DataTableTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs);
+ virtual ~DataTableTabPage() override;
+
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs);
+
+ virtual bool FillItemSet(SfxItemSet* rOutAttrs) override;
+ virtual void Reset(const SfxItemSet* rInAttrs) override;
+};
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.cxx b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
index 94a3d6c77173..927bf1130a43 100644
--- a/chart2/source/controller/dialogs/tp_ErrorBars.cxx
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
@@ -57,7 +57,7 @@ void ErrorBarsTabPage::SetErrorBarType( ErrorBarResources::tErrorBarType eNewTyp
}
void ErrorBarsTabPage::SetChartDocumentForRangeChoosing(
- const uno::Reference< chart2::XChartDocument > & xChartDocument )
+ const rtl::Reference<::chart::ChartModel> & xChartDocument )
{
m_aErrorBarResources.SetChartDocumentForRangeChoosing( xChartDocument );
}
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.hxx b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
index 354006a26889..159de22b0d03 100644
--- a/chart2/source/controller/dialogs/tp_ErrorBars.hxx
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
@@ -21,9 +21,11 @@
#include <res_ErrorBar.hxx>
#include <sfx2/tabdlg.hxx>
+#include <rtl/ref.hxx>
namespace chart
{
+class ChartModel;
class ErrorBarsTabPage : public SfxTabPage
{
@@ -33,7 +35,7 @@ public:
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
void SetErrorBarType( ErrorBarResources::tErrorBarType eNewType );
void SetChartDocumentForRangeChoosing(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument );
+ const rtl::Reference<::chart::ChartModel> & xChartDocument );
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs );
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) override;
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
index 04697e75efc9..21a889bf854f 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
@@ -30,14 +30,13 @@ namespace chart
SchLegendPosTabPage::SchLegendPosTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
: SfxTabPage(pPage, pController, "modules/schart/ui/tp_LegendPosition.ui", "tp_LegendPosition", &rInAttrs)
, m_aLegendPositionResources(*m_xBuilder)
- , m_xLbTextDirection(new TextDirectionListBox(m_xBuilder->weld_combo_box("LB_LEGEND_TEXTDIR")))
+ , m_aLbTextDirection(m_xBuilder->weld_combo_box("LB_LEGEND_TEXTDIR"))
, m_xCBLegendNoOverlay(m_xBuilder->weld_check_button("CB_NO_OVERLAY"))
{
}
SchLegendPosTabPage::~SchLegendPosTabPage()
{
- m_xLbTextDirection.reset();
}
std::unique_ptr<SfxTabPage> SchLegendPosTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rOutAttrs)
@@ -49,8 +48,8 @@ bool SchLegendPosTabPage::FillItemSet(SfxItemSet* rOutAttrs)
{
m_aLegendPositionResources.writeToItemSet(*rOutAttrs);
- if (m_xLbTextDirection->get_active() != -1)
- rOutAttrs->Put(SvxFrameDirectionItem(m_xLbTextDirection->get_active_id(), EE_PARA_WRITINGDIR));
+ if (m_aLbTextDirection.get_active() != -1)
+ rOutAttrs->Put(SvxFrameDirectionItem(m_aLbTextDirection.get_active_id(), EE_PARA_WRITINGDIR));
if (m_xCBLegendNoOverlay->get_visible())
rOutAttrs->Put(SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, m_xCBLegendNoOverlay->get_active()));
@@ -62,13 +61,12 @@ void SchLegendPosTabPage::Reset(const SfxItemSet* rInAttrs)
{
m_aLegendPositionResources.initFromItemSet(*rInAttrs);
- const SfxPoolItem* pPoolItem = nullptr;
- if( rInAttrs->GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET )
- m_xLbTextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() );
+ if( const SvxFrameDirectionItem* pDirectionItem = rInAttrs->GetItemIfSet( EE_PARA_WRITINGDIR ) )
+ m_aLbTextDirection.set_active_id( pDirectionItem->GetValue() );
- if (rInAttrs->GetItemState(SCHATTR_LEGEND_NO_OVERLAY, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pNoOverlayItem = rInAttrs->GetItemIfSet(SCHATTR_LEGEND_NO_OVERLAY))
{
- bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ bool bVal = pNoOverlayItem->GetValue();
m_xCBLegendNoOverlay->set_active(bVal);
}
}
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
index 9e5f32d281a7..4534501b5209 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
@@ -21,8 +21,7 @@
#include <sfx2/tabdlg.hxx>
#include <res_LegendPosition.hxx>
-
-namespace chart { class TextDirectionListBox; }
+#include <TextDirectionListBox.hxx>
namespace chart
{
@@ -32,7 +31,7 @@ class SchLegendPosTabPage : public SfxTabPage
private:
LegendPositionResources m_aLegendPositionResources;
- std::unique_ptr<TextDirectionListBox> m_xLbTextDirection;
+ TextDirectionListBox m_aLbTextDirection;
std::unique_ptr<weld::CheckButton> m_xCBLegendNoOverlay;
public:
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
index 88116ee890e1..7c2c4d942e66 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -62,11 +62,9 @@ bool SchLayoutTabPage::FillItemSet(SfxItemSet* rOutAttrs)
void SchLayoutTabPage::Reset(const SfxItemSet* rInAttrs)
{
- const SfxPoolItem *pPoolItem = nullptr;
-
- if (rInAttrs->GetItemState(SCHATTR_STYLE_SHAPE,true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxInt32Item* pShapeItem = rInAttrs->GetItemIfSet(SCHATTR_STYLE_SHAPE))
{
- tools::Long nVal = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ tools::Long nVal = pShapeItem->GetValue();
if(m_pGeometryResources)
{
m_pGeometryResources->select(static_cast<sal_uInt16>(nVal));
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index 59422b3a613e..ad7b2b6f0f3e 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -21,7 +21,6 @@
#include <chartview/ChartSfxItemIds.hxx>
#include <svl/eitem.hxx>
-#include <svl/intitem.hxx>
#include <svx/sdangitm.hxx>
#include <officecfg/Office/Compatibility.hxx>
@@ -70,11 +69,9 @@ bool PolarOptionsTabPage::FillItemSet( SfxItemSet* rOutAttrs )
void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs)
{
- const SfxPoolItem *pPoolItem = nullptr;
-
- if (rInAttrs->GetItemState(SCHATTR_STARTING_ANGLE, true, &pPoolItem) == SfxItemState::SET)
+ if (const SdrAngleItem* pAngleItem = rInAttrs->GetItemIfSet(SCHATTR_STARTING_ANGLE))
{
- Degree100 nTmp = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ Degree100 nTmp = pAngleItem->GetValue();
m_xAngleDial->SetRotation( nTmp );
}
else
@@ -82,18 +79,20 @@ void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs)
m_xFL_StartingAngle->hide();
}
// tdf#108059 Hide clockwise orientation checkbox in OOXML-heavy environments it would be useless anyways
- if (!officecfg::Office::Compatibility::View::ClockwisePieChartDirection::get() && rInAttrs->GetItemState(SCHATTR_CLOCKWISE, true, &pPoolItem) == SfxItemState::SET)
+ const SfxBoolItem* pClockWiseItem = nullptr;
+ if (!officecfg::Office::Compatibility::View::ClockwisePieChartDirection::get() &&
+ (pClockWiseItem = rInAttrs->GetItemIfSet(SCHATTR_CLOCKWISE)))
{
- bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ bool bCheck = pClockWiseItem->GetValue();
m_xCB_Clockwise->set_active(bCheck);
}
else
{
m_xCB_Clockwise->hide();
}
- if (rInAttrs->GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pHiddenCellsItem = rInAttrs->GetItemIfSet(SCHATTR_INCLUDE_HIDDEN_CELLS))
{
- bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ bool bVal = pHiddenCellsItem->GetValue();
m_xCB_IncludeHiddenCells->set_active(bVal);
}
else
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
index 8821fe6b5ece..a88f6a826e0b 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -20,6 +20,7 @@
#include "tp_RangeChooser.hxx"
#include <DataSourceHelper.hxx>
#include <ChartTypeTemplateProvider.hxx>
+#include <ChartTypeTemplate.hxx>
#include "DialogModel.hxx"
#include <RangeSelectionHelper.hxx>
#include <TabPageNotifiable.hxx>
@@ -64,12 +65,10 @@ RangeChooserTabPage::RangeChooserTabPage(weld::Container* pPage, weld::DialogCon
: OWizardPage(pPage, pController, "modules/schart/ui/tp_RangeChooser.ui", "tp_RangeChooser")
, m_nChangingControlCalls(0)
, m_bIsDirty(false)
- , m_aLastValidRangeString()
, m_pTemplateProvider(pTemplateProvider)
, m_rDialogModel( rDialogModel )
, m_pTabPageNotifiable(dynamic_cast<TabPageNotifiable*>(pController))
, m_xFT_Caption(m_xBuilder->weld_label("FT_CAPTION_FOR_WIZARD"))
- , m_xFT_Range(m_xBuilder->weld_label("FT_RANGE"))
, m_xED_Range(m_xBuilder->weld_entry("ED_RANGE"))
, m_xIB_Range(m_xBuilder->weld_button("IB_RANGE"))
, m_xRB_Rows(m_xBuilder->weld_radio_button("RB_DATAROWS"))
@@ -192,7 +191,7 @@ void RangeChooserTabPage::changeDialogModelAccordingToControls()
if( !m_xCurrentChartTypeTemplate.is() )
{
if(m_pTemplateProvider)
- m_xCurrentChartTypeTemplate.set( m_pTemplateProvider->getCurrentTemplate());
+ m_xCurrentChartTypeTemplate = m_pTemplateProvider->getCurrentTemplate();
if( !m_xCurrentChartTypeTemplate.is())
{
OSL_FAIL( "Need a template to change data source" );
@@ -216,7 +215,7 @@ void RangeChooserTabPage::changeDialogModelAccordingToControls()
if(bTimeBased)
{
aArguments.realloc( aArguments.getLength() + 1 );
- aArguments[aArguments.getLength() - 1] =
+ aArguments.getArray()[aArguments.getLength() - 1] =
beans::PropertyValue( "TimeBased", -1, uno::Any(bTimeBased),
beans::PropertyState_DIRECT_VALUE );
}
@@ -227,7 +226,7 @@ void RangeChooserTabPage::changeDialogModelAccordingToControls()
m_rDialogModel.setTemplate( m_xCurrentChartTypeTemplate );
aArguments.realloc( aArguments.getLength() + 1 );
- aArguments[aArguments.getLength() - 1] =
+ aArguments.getArray()[aArguments.getLength() - 1] =
beans::PropertyValue( "CellRangeRepresentation" , -1,
uno::Any( m_aLastValidRangeString ),
beans::PropertyState_DIRECT_VALUE );
@@ -316,12 +315,12 @@ IMPL_LINK_NOARG(RangeChooserTabPage, ControlEditedHdl, weld::Entry&, void)
isValid();
}
-IMPL_LINK_NOARG(RangeChooserTabPage, ControlChangedRadioHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(RangeChooserTabPage, ControlChangedRadioHdl, weld::Toggleable&, void)
{
ControlChangedHdl(*m_xED_Range);
}
-IMPL_LINK_NOARG(RangeChooserTabPage, ControlChangedCheckBoxHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(RangeChooserTabPage, ControlChangedCheckBoxHdl, weld::Toggleable&, void)
{
ControlChangedHdl(*m_xED_Range);
}
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
index 3af72bf86258..428e8a127dd9 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
@@ -24,11 +24,10 @@
#include <vcl/wizardmachine.hxx>
namespace chart { class TabPageNotifiable; }
-namespace com::sun::star::chart2 { class XChartTypeTemplate; }
namespace chart
{
-
+class ChartTypeTemplate;
class ChartTypeTemplateProvider;
class DialogModel;
@@ -64,22 +63,21 @@ private:
DECL_LINK( ChooseRangeHdl, weld::Button&, void );
DECL_LINK( ControlChangedHdl, weld::Entry&, void );
- DECL_LINK( ControlChangedCheckBoxHdl, weld::ToggleButton&, void );
- DECL_LINK( ControlChangedRadioHdl, weld::ToggleButton&, void );
+ DECL_LINK( ControlChangedCheckBoxHdl, weld::Toggleable&, void );
+ DECL_LINK( ControlChangedRadioHdl, weld::Toggleable&, void );
DECL_LINK( ControlEditedHdl, weld::Entry&, void );
sal_Int32 m_nChangingControlCalls;
bool m_bIsDirty;
OUString m_aLastValidRangeString;
- css::uno::Reference< css::chart2::XChartTypeTemplate > m_xCurrentChartTypeTemplate;
+ rtl::Reference< ::chart::ChartTypeTemplate > m_xCurrentChartTypeTemplate;
ChartTypeTemplateProvider* m_pTemplateProvider;
DialogModel & m_rDialogModel;
TabPageNotifiable * m_pTabPageNotifiable;
std::unique_ptr<weld::Label> m_xFT_Caption;
- std::unique_ptr<weld::Label> m_xFT_Range;
std::unique_ptr<weld::Entry> m_xED_Range;
std::unique_ptr<weld::Button> m_xIB_Range;
std::unique_ptr<weld::RadioButton> m_xRB_Rows;
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index b9b31019803d..b8c9f0598357 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -26,9 +26,11 @@
#include <svx/svxids.hrc>
#include <osl/diagnose.h>
+#include <sfx2/dialoghelper.hxx>
#include <svx/chrtitem.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
+#include <svl/numformat.hxx>
#include <vcl/formatter.hxx>
#include <vcl/weld.hxx>
#include <svl/zformat.hxx>
@@ -168,7 +170,7 @@ void ScaleTabPage::EnableControls()
EnableValueHdl(*m_xCbx_AutoTimeResolution);
}
-IMPL_LINK( ScaleTabPage, EnableValueHdl, weld::ToggleButton&, rCbx, void )
+IMPL_LINK( ScaleTabPage, EnableValueHdl, weld::Toggleable&, rCbx, void )
{
bool bEnable = !rCbx.get_active() && rCbx.get_sensitive();
if (&rCbx == m_xCbxAutoMin.get())
@@ -270,19 +272,18 @@ void ScaleTabPage::Reset(const SfxItemSet* rInAttrs)
if(!pNumFormatter)
return;
- const SfxPoolItem *pPoolItem = nullptr;
- if (rInAttrs->GetItemState(SCHATTR_AXIS_ALLOW_DATEAXIS, true, &pPoolItem) == SfxItemState::SET)
- m_bAllowDateAxis = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ if (const SfxBoolItem* pDateAxisItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_ALLOW_DATEAXIS))
+ m_bAllowDateAxis = pDateAxisItem->GetValue();
m_nAxisType=chart2::AxisType::REALNUMBER;
- if (rInAttrs->GetItemState(SCHATTR_AXISTYPE, true, &pPoolItem) == SfxItemState::SET)
- m_nAxisType = static_cast<int>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
+ if (const SfxInt32Item* pAxisTypeItem = rInAttrs->GetItemIfSet(SCHATTR_AXISTYPE))
+ m_nAxisType = static_cast<int>(pAxisTypeItem->GetValue());
if( m_nAxisType==chart2::AxisType::DATE && !m_bAllowDateAxis )
m_nAxisType=chart2::AxisType::CATEGORY;
if( m_bAllowDateAxis )
{
bool bAutoDateAxis = false;
- if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_DATEAXIS, true, &pPoolItem) == SfxItemState::SET)
- bAutoDateAxis = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ if (const SfxBoolItem* pDateAxisItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_AUTO_DATEAXIS))
+ bAutoDateAxis = pDateAxisItem->GetValue();
sal_uInt16 nPos = 0;
if( m_nAxisType==chart2::AxisType::DATE )
@@ -301,74 +302,74 @@ void ScaleTabPage::Reset(const SfxItemSet* rInAttrs)
m_xCbxAutoOrigin->set_active(true);
m_xCbx_AutoTimeResolution->set_active(true);
- if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_MIN,true,&pPoolItem) == SfxItemState::SET)
- m_xCbxAutoMin->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ if (const SfxBoolItem* pAutoMinItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_AUTO_MIN))
+ m_xCbxAutoMin->set_active(pAutoMinItem->GetValue());
- if (rInAttrs->GetItemState(SCHATTR_AXIS_MIN,true, &pPoolItem) == SfxItemState::SET)
+ if (const SvxDoubleItem* pAxisMinItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_MIN))
{
- fMin = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
+ fMin = pAxisMinItem->GetValue();
lcl_setValue( *m_xFmtFldMin, fMin );
m_xFmtFldMin->save_value();
}
- if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_MAX,true, &pPoolItem) == SfxItemState::SET)
- m_xCbxAutoMax->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ if (const SfxBoolItem* pAutoMaxItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_AUTO_MAX))
+ m_xCbxAutoMax->set_active(pAutoMaxItem->GetValue());
- if (rInAttrs->GetItemState(SCHATTR_AXIS_MAX,true, &pPoolItem) == SfxItemState::SET)
+ if (const SvxDoubleItem* pAxisMaxItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_MAX))
{
- fMax = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
+ fMax = pAxisMaxItem->GetValue();
lcl_setValue( *m_xFmtFldMax, fMax );
m_xFmtFldMax->save_value();
}
- if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,true, &pPoolItem) == SfxItemState::SET)
- m_xCbxAutoStepMain->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ if (const SfxBoolItem* pAutoStepMainItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_AUTO_STEP_MAIN))
+ m_xCbxAutoStepMain->set_active(pAutoStepMainItem->GetValue());
- if (rInAttrs->GetItemState(SCHATTR_AXIS_STEP_MAIN,true, &pPoolItem) == SfxItemState::SET)
+ if (const SvxDoubleItem* pStepMainItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_STEP_MAIN))
{
- fStepMain = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
+ fStepMain = pStepMainItem->GetValue();
lcl_setValue( *m_xFmtFldStepMain, fStepMain );
m_xFmtFldStepMain->save_value();
m_xMt_MainDateStep->set_value( static_cast<sal_Int32>(fStepMain) );
m_xMt_MainDateStep->save_value();
}
- if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,true, &pPoolItem) == SfxItemState::SET)
- m_xCbxAutoStepHelp->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- if (rInAttrs->GetItemState(SCHATTR_AXIS_LOGARITHM,true, &pPoolItem) == SfxItemState::SET)
- m_xCbxLogarithm->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- if (rInAttrs->GetItemState(SCHATTR_AXIS_REVERSE,true, &pPoolItem) == SfxItemState::SET)
- m_xCbxReverse->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- if (rInAttrs->GetItemState(SCHATTR_AXIS_STEP_HELP,true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pAutoStepHelpItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_AUTO_STEP_HELP))
+ m_xCbxAutoStepHelp->set_active(pAutoStepHelpItem->GetValue());
+ if (const SfxBoolItem* pLogItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_LOGARITHM))
+ m_xCbxLogarithm->set_active(pLogItem->GetValue());
+ if (const SfxBoolItem* pReverseItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_REVERSE))
+ m_xCbxReverse->set_active(pReverseItem->GetValue());
+ if (const SfxInt32Item* pStepHelpItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_STEP_HELP))
{
- nStepHelp = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ nStepHelp = pStepHelpItem->GetValue();
m_xMtStepHelp->set_value( nStepHelp );
m_xMtStepHelp->save_value();
}
- if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,true, &pPoolItem) == SfxItemState::SET)
- m_xCbxAutoOrigin->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- if (rInAttrs->GetItemState(SCHATTR_AXIS_ORIGIN,true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pOriginItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_AUTO_ORIGIN))
+ m_xCbxAutoOrigin->set_active(pOriginItem->GetValue());
+ if (const SvxDoubleItem* pOriginItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_ORIGIN))
{
- fOrigin = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
+ fOrigin = pOriginItem->GetValue();
lcl_setValue( *m_xFmtFldOrigin, fOrigin );
m_xFmtFldOrigin->save_value();
}
- if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,true, &pPoolItem) == SfxItemState::SET)
- m_xCbx_AutoTimeResolution->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- if (rInAttrs->GetItemState(SCHATTR_AXIS_TIME_RESOLUTION,true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pAutoTimeResItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_AUTO_TIME_RESOLUTION))
+ m_xCbx_AutoTimeResolution->set_active(pAutoTimeResItem->GetValue());
+ if (const SfxInt32Item* pTimeResItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_TIME_RESOLUTION))
{
- m_nTimeResolution = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ m_nTimeResolution = pTimeResItem->GetValue();
m_xLB_TimeResolution->set_active( m_nTimeResolution );
}
- if (rInAttrs->GetItemState(SCHATTR_AXIS_MAIN_TIME_UNIT,true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxInt32Item* pMainTimeUnitItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_MAIN_TIME_UNIT))
{
- m_nMainTimeUnit = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ m_nMainTimeUnit = pMainTimeUnitItem->GetValue();
m_xLB_MainTimeUnit->set_active( m_nMainTimeUnit );
}
- if (rInAttrs->GetItemState(SCHATTR_AXIS_HELP_TIME_UNIT,true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxInt32Item* pHelpTimeUnitItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_HELP_TIME_UNIT))
{
- m_nHelpTimeUnit = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ m_nHelpTimeUnit = pHelpTimeUnitItem->GetValue();
m_xLB_HelpTimeUnit->set_active( m_nHelpTimeUnit );
}
@@ -395,7 +396,7 @@ DeactivateRC ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
nStepFmt = 0;
weld::Widget* pControl = nullptr;
- const char* pErrStrId = nullptr;
+ TranslateId pErrStrId;
double fDummy;
fMax = m_xFmtFldMax->GetFormatter().GetValue();
@@ -523,12 +524,12 @@ void ScaleTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
void ScaleTabPage::SetNumFormat()
{
- const SfxPoolItem *pPoolItem = nullptr;
+ const SfxUInt32Item *pNumFormatItem = GetItemSet().GetItemIfSet( SID_ATTR_NUMBERFORMAT_VALUE );
- if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, true, &pPoolItem ) != SfxItemState::SET )
+ if( !pNumFormatItem )
return;
- sal_uLong nFmt = static_cast<const SfxUInt32Item*>(pPoolItem)->GetValue();
+ sal_uInt32 nFmt = pNumFormatItem->GetValue();
Formatter& rFmtFldMax = m_xFmtFldMax->GetFormatter();
rFmtFldMax.SetFormatKey(nFmt);
@@ -557,6 +558,12 @@ void ScaleTabPage::SetNumFormat()
nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME, pFormat->GetLanguage() );
else
nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME );
+
+ // tdf#141625 give enough space to see full date+time
+ int nWidestTime(m_xFmtFldMin->get_pixel_size(getWidestDateTime(Application::GetSettings().GetLocaleDataWrapper(), true)).Width());
+ int nWidthChars = std::ceil(nWidestTime / m_xFmtFldMin->get_approximate_digit_width()) + 1;
+ m_xFmtFldMin->set_width_chars(nWidthChars);
+ m_xFmtFldMax->set_width_chars(nWidthChars);
}
if( m_nAxisType == chart2::AxisType::DATE && ( eType != SvNumFormatType::DATE && eType != SvNumFormatType::DATETIME) )
@@ -583,9 +590,9 @@ void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin )
m_bShowAxisOrigin = true;
}
-bool ScaleTabPage::ShowWarning(const char* pResIdMessage, weld::Widget* pControl /* = nullptr */)
+bool ScaleTabPage::ShowWarning(TranslateId pResIdMessage, weld::Widget* pControl /* = nullptr */)
{
- if (pResIdMessage == nullptr)
+ if (!pResIdMessage)
return false;
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx
index 98814e2560c3..b90d3ef20211 100644
--- a/chart2/source/controller/dialogs/tp_Scale.hxx
+++ b/chart2/source/controller/dialogs/tp_Scale.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <sfx2/tabdlg.hxx>
+#include <unotools/resmgr.hxx>
namespace chart
{
@@ -83,7 +84,7 @@ private:
void EnableControls();
DECL_LINK(SelectAxisTypeHdl, weld::ComboBox&, void);
- DECL_LINK(EnableValueHdl, weld::ToggleButton&, void);
+ DECL_LINK(EnableValueHdl, weld::Toggleable&, void);
/** shows a warning window due to an invalid input.
@@ -98,7 +99,7 @@ private:
@return false, if nResIdMessage was 0, true otherwise
*/
- bool ShowWarning(const char* pResIdMessage, weld::Widget* pControl);
+ bool ShowWarning(TranslateId pResIdMessage, weld::Widget* pControl);
void HideAllControls();
};
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index 36d86c4873ef..3ffbc3642e9c 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -60,7 +60,7 @@ SchOptionTabPage::~SchOptionTabPage()
{
}
-IMPL_LINK_NOARG(SchOptionTabPage, EnableHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SchOptionTabPage, EnableHdl, weld::Toggleable&, void)
{
if( m_nAllSeriesAxisIndex == 0 )
m_xCBAxisSideBySide->set_sensitive( m_xRbtAxis2->get_active());
@@ -113,13 +113,11 @@ bool SchOptionTabPage::FillItemSet(SfxItemSet* rOutAttrs)
void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
{
- const SfxPoolItem *pPoolItem = nullptr;
-
m_xRbtAxis1->set_active(true);
m_xRbtAxis2->set_active(false);
- if (rInAttrs->GetItemState(SCHATTR_AXIS,true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxInt32Item* pAxisItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS))
{
- tools::Long nVal=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ tools::Long nVal = pAxisItem->GetValue();
if(nVal==CHART_AXIS_SECONDARY_Y)
{
m_xRbtAxis2->set_active(true);
@@ -128,34 +126,34 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
}
tools::Long nTmp;
- if (rInAttrs->GetItemState(SCHATTR_BAR_GAPWIDTH, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxInt32Item* pGapWidthItem = rInAttrs->GetItemIfSet(SCHATTR_BAR_GAPWIDTH))
{
- nTmp = static_cast<tools::Long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
+ nTmp = static_cast<tools::Long>(pGapWidthItem->GetValue());
m_xMTGap->set_value(nTmp, FieldUnit::PERCENT);
}
- if (rInAttrs->GetItemState(SCHATTR_BAR_OVERLAP, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxInt32Item* pOverlapItem = rInAttrs->GetItemIfSet(SCHATTR_BAR_OVERLAP))
{
- nTmp = static_cast<tools::Long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
+ nTmp = static_cast<tools::Long>(pOverlapItem->GetValue());
m_xMTOverlap->set_value(nTmp, FieldUnit::PERCENT);
}
- if (rInAttrs->GetItemState(SCHATTR_BAR_CONNECT, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pConnectItem = rInAttrs->GetItemIfSet(SCHATTR_BAR_CONNECT))
{
- bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ bool bCheck = pConnectItem->GetValue();
m_xCBConnect->set_active(bCheck);
}
- if (rInAttrs->GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxInt32Item* pAllSeriesItem = rInAttrs->GetItemIfSet(SCHATTR_AXIS_FOR_ALL_SERIES))
{
- m_nAllSeriesAxisIndex = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ m_nAllSeriesAxisIndex = pAllSeriesItem->GetValue();
m_xCBAxisSideBySide->set_sensitive(false);
}
- if (rInAttrs->GetItemState(SCHATTR_GROUP_BARS_PER_AXIS, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pPerAxisItem = rInAttrs->GetItemIfSet(SCHATTR_GROUP_BARS_PER_AXIS))
{
// model property is "group bars per axis", UI feature is the other way
// round: "show bars side by side"
- bool bCheck = ! static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ bool bCheck = ! pPerAxisItem->GetValue();
m_xCBAxisSideBySide->set_active( bCheck );
}
else
@@ -166,10 +164,12 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
//missing value treatment
{
std::vector< sal_Int32 > aMissingValueTreatments;
- if( rInAttrs->GetItemState(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, true, &pPoolItem) == SfxItemState::SET )
- aMissingValueTreatments = static_cast<const SfxIntegerListItem*>(pPoolItem)->GetList();
+ if (const SfxIntegerListItem* pValueTreatmentsItem = rInAttrs->GetItemIfSet(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS))
+ aMissingValueTreatments = pValueTreatmentsItem->GetList();
- if ( aMissingValueTreatments.size()>1 && rInAttrs->GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,true, &pPoolItem) == SfxItemState::SET)
+ const SfxInt32Item* pMissingValueTreatmentItem;
+ if ( aMissingValueTreatments.size()>1 &&
+ (pMissingValueTreatmentItem = rInAttrs->GetItemIfSet(SCHATTR_MISSING_VALUE_TREATMENT)) )
{
m_xRB_DontPaint->set_sensitive(false);
m_xRB_AssumeZero->set_sensitive(false);
@@ -185,7 +185,7 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
m_xRB_ContinueLine->set_sensitive(true);
}
- tools::Long nVal=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ tools::Long nVal=pMissingValueTreatmentItem->GetValue();
if(nVal==css::chart::MissingValueTreatment::LEAVE_GAP)
m_xRB_DontPaint->set_active(true);
else if(nVal==css::chart::MissingValueTreatment::USE_ZERO)
@@ -200,9 +200,9 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
}
// Include hidden cells
- if (rInAttrs->GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pHiddenCellsItem = rInAttrs->GetItemIfSet(SCHATTR_INCLUDE_HIDDEN_CELLS))
{
- bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ bool bVal = pHiddenCellsItem->GetValue();
m_xCBIncludeHiddenCells->set_active(bVal);
}
else
@@ -215,9 +215,9 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
m_xGrpPlotOptions->hide();
}
- if (rInAttrs->GetItemState(SCHATTR_HIDE_LEGEND_ENTRY, true, &pPoolItem) == SfxItemState::SET)
+ if (const SfxBoolItem* pEntryItem = rInAttrs->GetItemIfSet(SCHATTR_HIDE_LEGEND_ENTRY))
{
- bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ bool bVal = pEntryItem->GetValue();
m_xCBHideLegendEntry->set_active(bVal);
}
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
index 011e88a4f045..6b163f3c8815 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -47,7 +47,7 @@ private: //methods
void AdaptControlPositionsAndVisibility();
private: //member
- DECL_LINK(EnableHdl, weld::ToggleButton&, void );
+ DECL_LINK(EnableHdl, weld::Toggleable&, void );
sal_Int32 m_nAllSeriesAxisIndex;
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index ede27edbac9d..f3380042eb13 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -24,7 +24,6 @@
#include <editeng/eeitem.hxx>
#include <editeng/frmdiritem.hxx>
-#include <svl/intitem.hxx>
#include <svx/sdangitm.hxx>
namespace chart
@@ -36,9 +35,8 @@ SchAlignmentTabPage::SchAlignmentTabPage(weld::Container* pPage, weld::DialogCon
, m_xFtRotate(m_xBuilder->weld_label("degreeL"))
, m_xNfRotate(m_xBuilder->weld_metric_spin_button("OrientDegree", FieldUnit::DEGREE))
, m_xCbStacked(m_xBuilder->weld_check_button("stackedCB"))
- , m_xFtTextDirection(m_xBuilder->weld_label("textdirL"))
, m_xFtABCD(m_xBuilder->weld_label("labelABCD"))
- , m_xLbTextDirection(new TextDirectionListBox(m_xBuilder->weld_combo_box("textdirLB")))
+ , m_aLbTextDirection(m_xBuilder->weld_combo_box("textdirLB"))
, m_xCtrlDial(new svx::DialControl)
, m_xCtrlDialWin(new weld::CustomWeld(*m_xBuilder, "dialCtrl", *m_xCtrlDial))
{
@@ -60,7 +58,7 @@ SchAlignmentTabPage::SchAlignmentTabPage(weld::Container* pPage, weld::DialogCon
}
}
-IMPL_LINK_NOARG(SchAlignmentTabPage, StackedToggleHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SchAlignmentTabPage, StackedToggleHdl, weld::Toggleable&, void)
{
bool bActive = m_xCbStacked->get_active();
m_xNfRotate->set_sensitive(!bActive);
@@ -73,7 +71,6 @@ SchAlignmentTabPage::~SchAlignmentTabPage()
{
m_xCtrlDialWin.reset();
m_xCtrlDial.reset();
- m_xLbTextDirection.reset();
}
std::unique_ptr<SfxTabPage> SchAlignmentTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
@@ -97,7 +94,7 @@ bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs)
Degree100 nDegrees = bStacked ? 0_deg100 : m_xCtrlDial->GetRotation();
rOutAttrs->Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) );
- SvxFrameDirection aDirection( m_xLbTextDirection->get_active_id() );
+ SvxFrameDirection aDirection( m_aLbTextDirection.get_active_id() );
rOutAttrs->Put( SvxFrameDirectionItem( aDirection, EE_PARA_WRITINGDIR ) );
return true;
@@ -115,8 +112,8 @@ void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs)
m_xCbStacked->set_active(bStacked);
StackedToggleHdl(*m_xCbStacked);
- if( rInAttrs->GetItemState(EE_PARA_WRITINGDIR, true, &pItem) == SfxItemState::SET)
- m_xLbTextDirection->set_active_id(static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue());
+ if( const SvxFrameDirectionItem* pDirectionItem = rInAttrs->GetItemIfSet(EE_PARA_WRITINGDIR) )
+ m_aLbTextDirection.set_active_id(pDirectionItem->GetValue());
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
index 0ae3c2ddbc26..9d59b693f9a8 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -20,8 +20,8 @@
#include <sfx2/tabdlg.hxx>
#include <svx/dialcontrol.hxx>
+#include <TextDirectionListBox.hxx>
-namespace chart { class TextDirectionListBox; }
namespace weld {
class CheckButton;
class CustomWeld;
@@ -39,13 +39,12 @@ private:
std::unique_ptr<weld::Label> m_xFtRotate;
std::unique_ptr<weld::MetricSpinButton> m_xNfRotate;
std::unique_ptr<weld::CheckButton> m_xCbStacked;
- std::unique_ptr<weld::Label> m_xFtTextDirection;
std::unique_ptr<weld::Label> m_xFtABCD;
- std::unique_ptr<TextDirectionListBox> m_xLbTextDirection;
+ TextDirectionListBox m_aLbTextDirection;
std::unique_ptr<svx::DialControl> m_xCtrlDial;
std::unique_ptr<weld::CustomWeld> m_xCtrlDialWin;
- DECL_LINK(StackedToggleHdl, weld::ToggleButton&, void);
+ DECL_LINK(StackedToggleHdl, weld::Toggleable&, void);
public:
SchAlignmentTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs, bool bWithRotation = true);
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
index 66301e2cd606..4e813b4593fa 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
@@ -20,11 +20,11 @@
#include "tp_Wizard_TitlesAndObjects.hxx"
#include <res_Titles.hxx>
#include <res_LegendPosition.hxx>
-#include <ChartModelHelper.hxx>
+#include <ChartModel.hxx>
+#include <Diagram.hxx>
#include <AxisHelper.hxx>
#include <ControllerLockGuard.hxx>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <utility>
namespace chart
{
@@ -32,12 +32,12 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
TitlesAndObjectsTabPage::TitlesAndObjectsTabPage(weld::Container* pPage, weld::DialogController* pController,
- const uno::Reference< XChartDocument >& xChartModel,
+ rtl::Reference<::chart::ChartModel> xChartModel,
const uno::Reference< uno::XComponentContext >& xContext )
: OWizardPage(pPage, pController, "modules/schart/ui/wizelementspage.ui", "WizElementsPage")
, m_xTitleResources(new TitleResources(*m_xBuilder, false))
, m_xLegendPositionResources(new LegendPositionResources(*m_xBuilder, xContext))
- , m_xChartModel(xChartModel)
+ , m_xChartModel(std::move(xChartModel))
, m_xCC(xContext)
, m_bCommitToModel(true)
, m_aTimerTriggeredControllerLock( m_xChartModel )
@@ -75,7 +75,7 @@ void TitlesAndObjectsTabPage::initializePage()
//init grid checkboxes
{
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_xChartModel );
+ rtl::Reference< Diagram > xDiagram = m_xChartModel->getFirstChartDiagram();
uno::Sequence< sal_Bool > aPossibilityList;
uno::Sequence< sal_Bool > aExistenceList;
AxisHelper::getAxisOrGridPossibilities( aPossibilityList, xDiagram, false );
@@ -101,7 +101,7 @@ bool TitlesAndObjectsTabPage::commitPage( ::vcl::WizardTypes::CommitPageReason /
void TitlesAndObjectsTabPage::commitToModel()
{
m_aTimerTriggeredControllerLock.startTimer();
- uno::Reference< frame::XModel > xModel = m_xChartModel;
+ rtl::Reference<::chart::ChartModel> xModel = m_xChartModel;
ControllerLockGuardUNO aLockedControllers( xModel );
@@ -120,19 +120,20 @@ void TitlesAndObjectsTabPage::commitToModel()
//commit grid changes to model
{
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram();
uno::Sequence< sal_Bool > aOldExistenceList;
AxisHelper::getAxisOrGridExistence( aOldExistenceList, xDiagram, false );
uno::Sequence< sal_Bool > aNewExistenceList(aOldExistenceList);
- aNewExistenceList[0] = m_xCB_Grid_X->get_active();
- aNewExistenceList[1] = m_xCB_Grid_Y->get_active();
- aNewExistenceList[2] = m_xCB_Grid_Z->get_active();
+ sal_Bool* pNewExistenceList = aNewExistenceList.getArray();
+ pNewExistenceList[0] = m_xCB_Grid_X->get_active();
+ pNewExistenceList[1] = m_xCB_Grid_Y->get_active();
+ pNewExistenceList[2] = m_xCB_Grid_Z->get_active();
AxisHelper::changeVisibilityOfGrids( xDiagram
, aOldExistenceList, aNewExistenceList );
}
}
-IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeCheckBoxHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeCheckBoxHdl, weld::Toggleable&, void)
{
ChangeHdl(nullptr);
}
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
index ede45464e9d5..d2c30d8b4363 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
@@ -22,6 +22,7 @@
#include <TimerTriggeredControllerLock.hxx>
#include <vcl/wizardmachine.hxx>
+#include <rtl/ref.hxx>
#include <memory>
@@ -32,12 +33,13 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class ChartModel;
class TitlesAndObjectsTabPage final : public vcl::OWizardPage
{
public:
TitlesAndObjectsTabPage(weld::Container* pPage, weld::DialogController* pController,
- const css::uno::Reference< css::chart2::XChartDocument >& xChartModel,
+ rtl::Reference<::chart::ChartModel> xChartModel,
const css::uno::Reference< css::uno::XComponentContext >& xContext);
virtual ~TitlesAndObjectsTabPage() override;
@@ -49,12 +51,12 @@ private:
void commitToModel();
DECL_LINK( ChangeHdl, LinkParamNone*, void );
DECL_LINK( ChangeEditHdl, weld::Entry&, void );
- DECL_LINK( ChangeCheckBoxHdl, weld::ToggleButton&, void );
+ DECL_LINK( ChangeCheckBoxHdl, weld::Toggleable&, void );
std::unique_ptr< TitleResources > m_xTitleResources;
std::unique_ptr< LegendPositionResources > m_xLegendPositionResources;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
css::uno::Reference< css::uno::XComponentContext> m_xCC;
bool m_bCommitToModel;
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 9d448b4119fe..74be51a5ee11 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -19,9 +19,11 @@
#include <DrawViewWrapper.hxx>
#include <chartview/DrawModelWrapper.hxx>
-#include <ConfigurationAccess.hxx>
#include <unotools/lingucfg.hxx>
+#include <unotools/syslocale.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <editeng/eeitem.hxx>
#include <editeng/langitem.hxx>
#include <svl/intitem.hxx>
#include <svl/itempool.hxx>
@@ -31,13 +33,15 @@
#include <svx/svdetc.hxx>
#include <svx/svdoutl.hxx>
#include <svx/svxids.hrc>
-#include <svx/unoshape.hxx>
#include <editeng/fhgtitem.hxx>
+#include <osl/diagnose.h>
-#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
#include <svx/helperhittest3d.hxx>
+#include <officecfg/Office/Calc.hxx>
using namespace ::com::sun::star;
@@ -77,7 +81,6 @@ DrawViewWrapper::DrawViewWrapper(
{
SetBufferedOutputAllowed(true);
SetBufferedOverlayAllowed(true);
- SetPagePaintingAllowed(true);
// #i12587# support for shapes in chart
SdrOutliner* pOutliner = getOutliner();
@@ -87,12 +90,12 @@ DrawViewWrapper::DrawViewWrapper(
SvtLinguConfig aLinguConfig;
SvtLinguOptions aLinguOptions;
aLinguConfig.GetOptions( aLinguOptions );
- pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage, EE_CHAR_LANGUAGE ) );
- pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK ) );
- pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL ) );
+ pOutlinerPool->SetUserDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage, EE_CHAR_LANGUAGE ) );
+ pOutlinerPool->SetUserDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK ) );
+ pOutlinerPool->SetUserDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL ) );
// set font height without changing SdrEngineDefaults
- pOutlinerPool->SetPoolDefaultItem( SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT ) ); // 12pt
+ pOutlinerPool->SetUserDefaultItem( SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT ) ); // 12pt
}
// #i121463# Use big handles by default
@@ -120,7 +123,7 @@ void DrawViewWrapper::ReInit()
tools::Rectangle aRect(Point(0,0), aOutputSize);
SetWorkArea(aRect);
- ShowSdrPage(GetModel()->GetPage(0));
+ ShowSdrPage(GetModel().GetPage(0));
}
DrawViewWrapper::~DrawViewWrapper()
@@ -166,7 +169,7 @@ SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const
//3d objects need a special treatment
//because the simple PickObj method is not accurate in this case for performance reasons
- E3dObject* pE3d = dynamic_cast< E3dObject* >(pRet);
+ E3dObject* pE3d = DynCastE3dObject(pRet);
if( pE3d )
{
E3dScene* pScene(pE3d->getRootE3dSceneFromE3dObject());
@@ -209,10 +212,23 @@ void DrawViewWrapper::setMarkHandleProvider( MarkHandleProvider* pMarkHandleProv
void DrawViewWrapper::CompleteRedraw(OutputDevice* pOut, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* /* pRedirector */)
{
- svtools::ColorConfig aColorConfig;
- Color aFillColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
+ Color aFillColor;
+ if (const SfxViewShell* pViewShell = SfxViewShell::Current())
+ aFillColor = pViewShell->GetColorConfigColor(svtools::DOCCOLOR);
+ else
+ {
+ svtools::ColorConfig aColorConfig;
+ aFillColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+ }
SetApplicationBackgroundColor(aFillColor);
+
+ SdrOutliner& rOutliner = GetModel().GetDrawOutliner();
+ Color aOldBackColor = rOutliner.GetBackgroundColor();
+ rOutliner.SetBackgroundColor(aFillColor);
+
E3dView::CompleteRedraw( pOut, rReg );
+
+ rOutliner.SetBackgroundColor(aOldBackColor);
}
SdrObject* DrawViewWrapper::getSelectedObject() const
@@ -253,16 +269,24 @@ SdrOutliner* DrawViewWrapper::getOutliner() const
SfxItemSet DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const
{
+ SvtSysLocale aSysLocale;
+ MeasurementSystem eSys = aSysLocale.GetLocaleData().getMeasurementSystemEnum();
+ sal_uInt16 nAttrMetric;
+ if( eSys == MeasurementSystem::Metric )
+ nAttrMetric = officecfg::Office::Calc::Layout::Other::MeasureUnit::Metric::get();
+ else
+ nAttrMetric = officecfg::Office::Calc::Layout::Other::MeasureUnit::NonMetric::get();
+
SfxItemSet aFullSet(
- GetModel()->GetItemPool(),
+ GetModel().GetItemPool(),
svl::Items<
- SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS,
+ SDRATTR_CORNER_RADIUS, SDRATTR_CORNER_RADIUS,
SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE,
SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT,
- SID_ATTR_METRIC, SID_ATTR_METRIC>{});
+ SID_ATTR_METRIC, SID_ATTR_METRIC>);
SfxItemSet aGeoSet( E3dView::GetGeoAttrFromMarked() );
aFullSet.Put( aGeoSet );
- aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC,static_cast< sal_uInt16 >( ConfigurationAccess::getFieldUnit())));
+ aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC, nAttrMetric) );
return aFullSet;
}
@@ -283,7 +307,7 @@ bool DrawViewWrapper::IsObjectHit( SdrObject const * pObj, const Point& rPnt )
if(pObj)
{
tools::Rectangle aRect(pObj->GetCurrentBoundRect());
- return aRect.IsInside(rPnt);
+ return aRect.Contains(rPnt);
}
return false;
}
@@ -291,8 +315,8 @@ bool DrawViewWrapper::IsObjectHit( SdrObject const * pObj, const Point& rPnt )
void DrawViewWrapper::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
//prevent wrong reselection of objects
- SdrModel* pSdrModel( GetModel() );
- if( pSdrModel && pSdrModel->isLocked() )
+ SdrModel& rSdrModel = GetModel();
+ if (rSdrModel.isLocked())
return;
const SdrHint* pSdrHint = ( rHint.GetId() == SfxHintId::ThisIsAnSdrHint ? static_cast<const SdrHint*>(&rHint) : nullptr );
@@ -345,9 +369,7 @@ SdrObject* DrawViewWrapper::getSdrObject( const uno::Reference<
uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY );
if(xTypeProvider.is())
{
- SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
- if(pSvxShape)
- pRet = pSvxShape->GetSdrObject();
+ pRet = SdrObject::getSdrObjectFromXShape(xShape);
}
return pRet;
}
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index 9259ce921819..51b163d1fccd 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -26,14 +26,13 @@
#include <com/sun/star/drawing/Direction3D.hpp>
#include <o3tl/safeint.hxx>
#include <svx/xtable.hxx>
-#include <svl/itempool.hxx>
#include <svtools/ctrltool.hxx>
#include <vcl/svapp.hxx>
#include <svx/svdobj.hxx>
#include <vcl/virdev.hxx>
#include <svx/svdview.hxx>
#include <svx/svdpage.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -110,20 +109,16 @@ SdrObjList* ViewElementListProvider::GetSymbolList() const
{
//@todo use mutex
- //get shape factory
- uno::Reference<lang::XMultiServiceFactory> xShapeFactory(
- m_pDrawModelWrapper->getShapeFactory());
-
//get hidden draw page (target):
- uno::Reference<drawing::XShapes> xTarget = m_pDrawModelWrapper->getHiddenDrawPage();
+ rtl::Reference<SvxDrawPage> xTarget = m_pDrawModelWrapper->getHiddenDrawPage();
//create symbols via uno and convert to native sdr objects
drawing::Direction3D aSymbolSize(220, 220, 0); // should be 250, but 250 -> 280 ??
- uno::Reference<drawing::XShapes> xSymbols
- = DataPointSymbolSupplier::create2DSymbolList(xShapeFactory, xTarget, aSymbolSize);
+ rtl::Reference< SvxShapeGroup > xSymbols
+ = DataPointSymbolSupplier::create2DSymbolList(xTarget, aSymbolSize);
SdrObject* pSdrObject = DrawViewWrapper::getSdrObject(
- uno::Reference<drawing::XShape>(xSymbols, uno::UNO_QUERY));
+ uno::Reference<drawing::XShape>(static_cast<cppu::OWeakObject*>(xSymbols.get()), uno::UNO_QUERY));
if (pSdrObject)
pSymbolList = pSdrObject->GetSubList();
}
@@ -143,7 +138,7 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co
nStandardSymbol*=-1;
if( o3tl::make_unsigned(nStandardSymbol) >= pSymbolList->GetObjCount() )
nStandardSymbol %= pSymbolList->GetObjCount();
- SdrObject* pObj = pSymbolList->GetObj(nStandardSymbol);
+ rtl::Reference<SdrObject> pObj = pSymbolList->GetObj(nStandardSymbol);
ScopedVclPtrInstance< VirtualDevice > pVDev;
pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
@@ -151,32 +146,33 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co
std::unique_ptr<SdrModel> pModel(
new SdrModel());
- pModel->GetItemPool().FreezeIdRanges();
- SdrPage* pPage = new SdrPage( *pModel, false );
+ rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
pPage->SetSize(Size(1000,1000));
- pModel->InsertPage( pPage, 0 );
- std::unique_ptr<SdrView> pView(new SdrView(*pModel, pVDev));
- pView->hideMarkHandles();
- SdrPageView* pPageView = pView->ShowSdrPage(pPage);
+ pModel->InsertPage( pPage.get(), 0 );
+ SdrView aView(*pModel, pVDev);
+ aView.hideMarkHandles();
+ SdrPageView* pPageView = aView.ShowSdrPage(pPage.get());
// directly clone to target SdrModel
pObj = pObj->CloneSdrObject(*pModel);
- pPage->NbcInsertObject(pObj);
- pView->MarkObj(pObj,pPageView);
+ pPage->NbcInsertObject(pObj.get());
+ aView.MarkObj(pObj.get(),pPageView);
if( pSymbolShapeProperties )
pObj->SetMergedItemSet(*pSymbolShapeProperties);
- GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
+ GDIMetaFile aMeta(aView.GetMarkedObjMetaFile());
Graphic aGraph(aMeta);
Size aSize = pObj->GetSnapRect().GetSize();
aGraph.SetPrefSize(aSize);
aGraph.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
- pView->UnmarkAll();
+ aView.UnmarkAll();
pObj=pPage->RemoveObject(0);
- SdrObject::Free( pObj );
+ // these need to die before the associated SdrModel
+ pObj.clear();
+ pPage.clear();
return aGraph;
}
diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx
index 88f4ef79ffb2..b7ccbac900da 100644
--- a/chart2/source/controller/inc/AccessibleBase.hxx
+++ b/chart2/source/controller/inc/AccessibleBase.hxx
@@ -27,20 +27,18 @@
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <comphelper/accessibleeventnotifier.hxx>
+#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase.hxx>
-#include <rtl/ref.hxx>
#include <tools/color.hxx>
+#include <unotools/weakref.hxx>
#include <map>
#include <vector>
#include <memory>
-#include <MutexContainer.hxx>
-
namespace com::sun::star::awt { class XWindow; }
namespace com::sun::star::chart2 { class XChartDocument; }
namespace com::sun::star::view { class XSelectionSupplier; }
-namespace utl { class AccessibleStateSetHelper; }
class SdrView;
@@ -54,7 +52,9 @@ namespace chart
{
class AccessibleBase;
+class ChartView;
class ObjectHierarchy;
+class ChartController;
typedef ObjectIdentifier AccessibleUniqueId;
@@ -62,9 +62,9 @@ struct AccessibleElementInfo
{
AccessibleUniqueId m_aOID;
- css::uno::WeakReference< css::chart2::XChartDocument > m_xChartDocument;
- css::uno::WeakReference< css::view::XSelectionSupplier > m_xSelectionSupplier;
- css::uno::WeakReference< css::uno::XInterface > m_xView;
+ unotools::WeakReference< ::chart::ChartModel > m_xChartDocument;
+ unotools::WeakReference< ::chart::ChartController > m_xChartController;
+ unotools::WeakReference< ::chart::ChartView > m_xView;
css::uno::WeakReference< css::awt::XWindow > m_xWindow;
std::shared_ptr< ObjectHierarchy > m_spObjectHierarchy;
@@ -89,7 +89,7 @@ typedef ::cppu::WeakComponentImplHelper<
/** Base class for all Chart Accessibility objects
*/
class AccessibleBase :
- public MutexContainer,
+ public cppu::BaseMutex,
public impl::AccessibleBase_Base
{
public:
@@ -99,7 +99,7 @@ public:
LOST_SELECTION
};
- AccessibleBase( const AccessibleElementInfo & rAccInfo,
+ AccessibleBase( AccessibleElementInfo aAccInfo,
bool bMayHaveChildren,
bool bAlwaysTransparent );
virtual ~AccessibleBase() override;
@@ -135,14 +135,14 @@ protected:
@throws css::uno::RuntimeException
*/
- void AddState( sal_Int16 aState );
+ void AddState( sal_Int64 aState );
/** Removes a state from the set if the set contains the state, otherwise
nothing is done.
@throws css::uno::RuntimeException
*/
- void RemoveState( sal_Int16 aState );
+ void RemoveState( sal_Int64 aState );
/** has to be overridden by derived classes that support child elements.
With this method a rescan is initiated that should result in a correct
@@ -185,14 +185,10 @@ protected:
/** This method creates an AccessibleEventObject and sends it to all
listeners that are currently listening to this object
-
- If bSendGlobally is true, the event is also broadcast via
- vcl::unohelper::NotifyAccessibleStateEventGlobally()
*/
void BroadcastAccEvent( sal_Int16 nId,
const css::uno::Any & rNew,
- const css::uno::Any & rOld,
- bool bSendGlobally = false ) const;
+ const css::uno::Any & rOld ) const;
/** Removes all children from the internal lists and broadcasts child remove
events.
@@ -209,14 +205,14 @@ protected:
@throws css::uno::RuntimeException
*/
virtual css::uno::Reference< css::accessibility::XAccessible >
- ImplGetAccessibleChildById( sal_Int32 i ) const;
+ ImplGetAccessibleChildById( sal_Int64 i ) const;
/** Is called from getAccessibleChildCount(). Before this method is called,
an update of children is done if necessary.
@throws css::uno::RuntimeException
*/
- virtual sal_Int32 ImplGetAccessibleChildCount() const;
+ virtual sal_Int64 ImplGetAccessibleChildCount() const;
const AccessibleElementInfo& GetInfo() const { return m_aAccInfo;}
void SetInfo( const AccessibleElementInfo & rNewInfo );
@@ -229,12 +225,12 @@ protected:
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override;
// ________ XAccessibleContext ________
- virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
- getAccessibleChild( sal_Int32 i ) override;
+ getAccessibleChild( sal_Int64 i ) override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
getAccessibleParent() override;
- virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
+ virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
/// @return AccessibleRole.SHAPE
virtual sal_Int16 SAL_CALL getAccessibleRole() override;
// has to be implemented by derived classes
@@ -242,8 +238,7 @@ protected:
// throw (css::uno::RuntimeException);
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL
getAccessibleRelationSet() override;
- virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL
- getAccessibleStateSet() override;
+ virtual sal_Int64 SAL_CALL getAccessibleStateSet() override;
virtual css::lang::Locale SAL_CALL getLocale() override;
// has to be implemented by derived classes
// virtual OUString SAL_CALL getAccessibleDescription()
@@ -305,11 +300,9 @@ private:
::comphelper::AccessibleEventNotifier::TClientId m_nEventNotifierId;
- /** Implementation helper for getAccessibleStateSet()
-
- Note: This member must come before m_aStateSet!
+ /** for getAccessibleStateSet()
*/
- rtl::Reference<::utl::AccessibleStateSetHelper> m_xStateSetHelper;
+ sal_Int64 m_nStateSet;
AccessibleElementInfo m_aAccInfo;
const bool m_bAlwaysTransparent;
diff --git a/chart2/source/controller/inc/AccessibleChartView.hxx b/chart2/source/controller/inc/AccessibleChartView.hxx
index 814666e34016..793cdd69ab77 100644
--- a/chart2/source/controller/inc/AccessibleChartView.hxx
+++ b/chart2/source/controller/inc/AccessibleChartView.hxx
@@ -38,21 +38,21 @@ class IAccessibleViewForwarder;
namespace chart
{
+class ChartView;
namespace impl
{
typedef ::cppu::ImplInheritanceHelper<
::chart::AccessibleBase,
- css::lang::XInitialization,
css::view::XSelectionChangeListener >
AccessibleChartView_Base;
}
-class AccessibleChartView :
+class AccessibleChartView final :
public impl::AccessibleChartView_Base
{
public:
- AccessibleChartView(SdrView* pView );
+ AccessibleChartView( SdrView* pView );
virtual ~AccessibleChartView() override;
AccessibleChartView() = delete;
@@ -60,15 +60,19 @@ public:
// ____ WeakComponentHelper (called from XComponent::dispose()) ____
using AccessibleBase::disposing;
- // ____ lang::XInitialization ____
// 0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
// 1: frame::XModel representing the chart model - offers access to object data
// 2: lang::XInterface representing the normal chart view - offers access to some extra object data
// 3: accessibility::XAccessible representing the parent accessible
// 4: awt::XWindow representing the view's window (is a vcl Window)
// all arguments are only valid until next initialization - don't keep them longer
- virtual void SAL_CALL initialize(
- const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+ void initialize( ChartController& rChartController,
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
+ const rtl::Reference<::chart::ChartView>& xChartView,
+ const css::uno::Reference< css::accessibility::XAccessible >& xParent,
+ const css::uno::Reference<css::awt::XWindow>& xViewWindow );
+ // used to disconnect from view
+ void initialize();
// ____ view::XSelectionChangeListener ____
virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
@@ -79,7 +83,7 @@ public:
// ________ XAccessibleContext ________
virtual OUString SAL_CALL getAccessibleDescription() override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
- virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
+ virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
virtual OUString SAL_CALL getAccessibleName() override;
virtual sal_Int16 SAL_CALL getAccessibleRole() override;
@@ -101,9 +105,9 @@ private: // methods
css::awt::Rectangle GetWindowPosSize() const;
private: // members
- css::uno::WeakReference< css::view::XSelectionSupplier > m_xSelectionSupplier;
- css::uno::WeakReference< css::frame::XModel > m_xChartModel;
- css::uno::WeakReference< css::uno::XInterface > m_xChartView;
+ unotools::WeakReference< ::chart::ChartController > m_xChartController;
+ unotools::WeakReference< ::chart::ChartModel > m_xChartModel;
+ unotools::WeakReference< ChartView > m_xChartView;
css::uno::WeakReference< css::awt::XWindow > m_xWindow;
css::uno::WeakReference< css::accessibility::XAccessible > m_xParent;
diff --git a/chart2/source/controller/inc/AccessibleTextHelper.hxx b/chart2/source/controller/inc/AccessibleTextHelper.hxx
index 0a174caaf70d..85fcb83dc3e4 100644
--- a/chart2/source/controller/inc/AccessibleTextHelper.hxx
+++ b/chart2/source/controller/inc/AccessibleTextHelper.hxx
@@ -18,17 +18,11 @@
*/
#pragma once
-#include <memory>
-#include <MutexContainer.hxx>
-#include <cppuhelper/compbase.hxx>
-#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/compbase.hxx>
+#include <svx/AccessibleTextHelper.hxx>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
-// forward declaration of helper class from svx
-namespace accessibility
-{
-class AccessibleTextHelper;
-}
namespace chart
{
@@ -37,21 +31,18 @@ class DrawViewWrapper;
namespace impl
{
-typedef ::cppu::WeakComponentImplHelper<
- css::lang::XInitialization,
+typedef comphelper::WeakComponentImplHelper<
css::accessibility::XAccessibleContext >
AccessibleTextHelper_Base;
}
-class AccessibleTextHelper :
- public MutexContainer,
+class AccessibleTextHelper final :
public impl::AccessibleTextHelper_Base
{
public:
explicit AccessibleTextHelper( DrawViewWrapper * pDrawViewWrapper );
virtual ~AccessibleTextHelper() override;
- // ____ XInitialization ____
/** Must be called at least once for this helper class to work.
mandatory parameter 0: type string. This is the CID that is used to find
@@ -64,24 +55,25 @@ public:
mandatory parameter 2: type awt::XWindow. The Window that shows the
text currently.
*/
- virtual void SAL_CALL initialize(
- const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+ void initialize(const OUString& aCID,
+ const css::uno::Reference< css::accessibility::XAccessible >& xEventSource,
+ const css::uno::Reference< css::awt::XWindow >& xWindow );
// ____ XAccessibleContext ____
- virtual ::sal_Int32 SAL_CALL getAccessibleChildCount() override;
+ virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(
- ::sal_Int32 i ) override;
+ sal_Int64 i ) override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
- virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
+ virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
virtual ::sal_Int16 SAL_CALL getAccessibleRole() override;
virtual OUString SAL_CALL getAccessibleDescription() override;
virtual OUString SAL_CALL getAccessibleName() override;
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
- virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
+ virtual sal_Int64 SAL_CALL getAccessibleStateSet() override;
virtual css::lang::Locale SAL_CALL getLocale() override;
private:
- std::unique_ptr<::accessibility::AccessibleTextHelper> m_pTextHelper;
+ std::optional<::accessibility::AccessibleTextHelper> m_oTextHelper;
DrawViewWrapper * m_pDrawViewWrapper;
};
diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx
index 7f42853d1088..c14ef82bd595 100644
--- a/chart2/source/controller/inc/AxisItemConverter.hxx
+++ b/chart2/source/controller/inc/AxisItemConverter.hxx
@@ -19,30 +19,34 @@
#pragma once
#include "ItemConverter.hxx"
+#include <com/sun/star/awt/Size.hpp>
+#include <rtl/ref.hxx>
+#include <optional>
#include <vector>
-namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::chart2 { class XAxis; }
namespace com::sun::star::chart2 { class XChartDocument; }
+namespace chart { class Axis; }
namespace chart { struct ExplicitIncrementData; }
namespace chart { struct ExplicitScaleData; }
+namespace chart { class ChartModel; }
class SdrModel;
namespace chart::wrapper {
-class AxisItemConverter : public ItemConverter
+class AxisItemConverter final : public ItemConverter
{
public:
AxisItemConverter(
const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
SfxItemPool& rItemPool, SdrModel& rDrawModel,
- const css::uno::Reference<css::chart2::XChartDocument> & xChartDoc,
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
ExplicitScaleData const * pScale,
ExplicitIncrementData const * pIncrement,
- const css::awt::Size* pRefSize );
+ const std::optional<css::awt::Size>& pRefSize );
virtual ~AxisItemConverter() override;
@@ -50,7 +54,7 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
@@ -58,11 +62,9 @@ protected:
private:
std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
- css::uno::Reference<
- css::chart2::XAxis > m_xAxis;
+ rtl::Reference<::chart::Axis> m_xAxis;
- css::uno::Reference<
- css::chart2::XChartDocument > m_xChartDoc;
+ rtl::Reference<::chart::ChartModel>m_xChartDoc;
std::unique_ptr<ExplicitScaleData> m_pExplicitScale;
std::unique_ptr<ExplicitIncrementData> m_pExplicitIncrement;
diff --git a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
index 4322c8c391fd..65ff58ea45ab 100644
--- a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
+++ b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
@@ -35,14 +35,14 @@ public:
CharacterPropertyItemConverter(
const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
SfxItemPool& rItemPool,
- const css::awt::Size* pRefSize,
- const OUString & rRefSizePropertyName,
+ const std::optional<css::awt::Size>& pRefSize,
+ OUString aRefSizePropertyName,
const css::uno::Reference<css::beans::XPropertySet>& rRefSizePropSet = css::uno::Reference<css::beans::XPropertySet>() );
virtual ~CharacterPropertyItemConverter() override;
private:
- virtual const sal_uInt16* GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 8f4d9ade8af2..737d0cf3768f 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <LifeTime.hxx>
+#include <ReferenceSizeProvider.hxx>
#include "CommandDispatchContainer.hxx"
#include "SelectionHelper.hxx"
@@ -34,10 +35,9 @@
#include <com/sun/star/util/XModeChangeListener.hpp>
#include <com/sun/star/util/XCloseListener.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XController2.hpp>
#include <com/sun/star/frame/XLayoutManagerListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <memory>
#include <string_view>
@@ -55,12 +55,12 @@ namespace com::sun::star::awt { struct Point; }
namespace com::sun::star::document { class XUndoManager; }
namespace com::sun::star::frame { class XDispatch; }
namespace com::sun::star::frame { class XLayoutManagerEventBroadcaster; }
+namespace com::sun::star::graphic { class XGraphic; }
namespace com::sun::star::lang { class XInitialization; }
namespace com::sun::star::uno { class XComponentContext; }
namespace com::sun::star::util { class XCloseable; }
namespace com::sun::star::view { class XSelectionSupplier; }
-
class SdrModel;
namespace svt
@@ -72,37 +72,37 @@ namespace svx::sidebar {
class SelectionChangeHandler;
}
-class DropTargetHelper;
-
-namespace com::sun::star {
- namespace graphic {
- class XGraphic;
- }
+namespace weld {
+ class Window;
}
+class DropTargetHelper;
+
namespace chart
{
class UndoGuard;
+class ChartView;
class ChartWindow;
class DrawModelWrapper;
class DrawViewWrapper;
-class ReferenceSizeProvider;
class ViewElementListProvider;
+class ViewElementListProvider;
+class Diagram;
+class AccessibleChartView;
+class AccessibleTextHelper;
enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT };
-class ChartController : public ::cppu::WeakImplHelper <
- css::frame::XController //comprehends XComponent (required interface)
+class ChartController final : public ::cppu::WeakImplHelper <
+ css::frame::XController2 //comprehends XComponent (css::frame::XController is required interface)
,css::frame::XDispatchProvider //(required interface)
,css::view::XSelectionSupplier //(optional interface)
,css::ui::XContextMenuInterception //(optional interface)
,css::util::XCloseListener //(needed for communication with XModel)
- ,css::lang::XServiceInfo
,css::frame::XDispatch
,css::awt::XWindow //this is the Window Controller part of this Controller, that will be given to a Frame via setComponent
- ,css::lang::XMultiServiceFactory
,css::util::XModifyListener
,css::util::XModeChangeListener
,css::frame::XLayoutManagerListener
@@ -110,16 +110,11 @@ class ChartController : public ::cppu::WeakImplHelper <
{
public:
ChartController() = delete;
- explicit ChartController(css::uno::Reference< css::uno::XComponentContext > const & xContext);
+ explicit ChartController(css::uno::Reference< css::uno::XComponentContext > xContext);
virtual ~ChartController() override;
OUString GetContextName();
- // css::lang::XServiceInfo
- virtual OUString SAL_CALL getImplementationName() override;
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-
// css::frame::XController (required interface)
virtual void SAL_CALL
attachFrame( const css::uno::Reference< css::frame::XFrame > & xFrame ) override;
@@ -142,6 +137,12 @@ public:
virtual sal_Bool SAL_CALL
suspend( sal_Bool bSuspend ) override;
+ // css::frame::XController2
+ virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getComponentWindow() override;
+ virtual OUString SAL_CALL getViewControllerName() override;
+ virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getCreationArguments() override;
+ virtual css::uno::Reference<css::ui::XSidebarProvider> SAL_CALL getSidebar() override;
+
// css::lang::XComponent (base of XController)
virtual void SAL_CALL
dispose() override;
@@ -262,16 +263,6 @@ public:
virtual void SAL_CALL
removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
- // css::lang XMultiServiceFactory
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
- createInstance( const OUString& aServiceSpecifier ) override;
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
- createInstanceWithArguments( const OUString& ServiceSpecifier,
- const css::uno::Sequence<
- css::uno::Any >& Arguments ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL
- getAvailableServiceNames() override;
-
// css::util::XModifyListener
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -318,16 +309,26 @@ public:
css::uno::Reference< css::accessibility::XAccessible > CreateAccessible();
+ /** Creates a helper accessibility class that must be initialized via initialize(). For
+ parameters see
+
+ The returned object should not be used directly. Instead a proxy object
+ should use this helper to retrieve its children and add them to its own
+ children.
+ */
+ rtl::Reference< ::chart::AccessibleTextHelper > createAccessibleTextContext();
+
static bool isObjectDeleteable( const css::uno::Any& rSelection );
void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; }
bool isShapeContext() const;
+ bool IsTextEdit() const;
ViewElementListProvider getViewElementListProvider();
DrawModelWrapper* GetDrawModelWrapper();
DrawViewWrapper* GetDrawViewWrapper();
- VclPtr<ChartWindow> GetChartWindow() const;
+ ChartWindow* GetChartWindow() const;
weld::Window* GetChartFrame();
bool isAdditionalShapeSelected() const;
void SetAndApplySelection(const css::uno::Reference<css::drawing::XShape>& rxShape);
@@ -335,26 +336,27 @@ public:
void NotifyUndoActionHdl( std::unique_ptr<SdrUndoAction> );
- css::uno::Reference<css::uno::XInterface> const & getChartView() const;
+ rtl::Reference<::chart::ChartView> const & getChartView() const { return m_xChartView; }
+
+ rtl::Reference<::chart::ChartModel> getChartModel();
+ rtl::Reference<::chart::Diagram> getFirstDiagram();
private:
class TheModel : public salhelper::SimpleReferenceObject
{
public:
- explicit TheModel( const css::uno::Reference<
- css::frame::XModel > & xModel );
+ explicit TheModel( rtl::Reference<::chart::ChartModel> xModel );
virtual ~TheModel() override;
void addListener( ChartController* pController );
void removeListener( ChartController* pController );
void tryTermination();
- const css::uno::Reference< css::frame::XModel >&
+ const rtl::Reference<::chart::ChartModel>&
getModel() const { return m_xModel;}
private:
- css::uno::Reference< css::frame::XModel > m_xModel;
- css::uno::Reference< css::util::XCloseable > m_xCloseable;
+ rtl::Reference<::chart::ChartModel> m_xModel;
//the ownership between model and controller is not clear at first
//each controller might consider himself as owner of the model first
@@ -388,7 +390,7 @@ private:
//view
css::uno::Reference<css::awt::XWindow> m_xViewWindow;
- css::uno::Reference<css::uno::XInterface> m_xChartView;
+ rtl::Reference<::chart::ChartView> m_xChartView;
std::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
std::unique_ptr<DrawViewWrapper> m_pDrawViewWrapper;
@@ -419,7 +421,7 @@ private:
rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler;
bool impl_isDisposedOrSuspended() const;
- std::unique_ptr<ReferenceSizeProvider> impl_createReferenceSizeProvider();
+ ReferenceSizeProvider impl_createReferenceSizeProvider();
void impl_adaptDataSeriesAutoResize();
void impl_createDrawViewController();
@@ -429,7 +431,7 @@ private:
void executeDispatch_ObjectProperties();
void executeDispatch_FormatObject( std::u16string_view rDispatchCommand );
void executeDlg_ObjectProperties( const OUString& rObjectCID );
- bool executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bSuccessOnUnchanged );
+ void executeDlg_ObjectProperties_withUndoGuard( std::shared_ptr<UndoGuard> aUndoGuard, const OUString& rObjectCID, bool bSuccessOnUnchanged );
void executeDispatch_ChartType();
@@ -440,6 +442,10 @@ private:
void executeDispatch_InsertAxes();
void executeDispatch_InsertGrid();
+ void executeDispatch_InsertDataTable();
+ void executeDispatch_DeleteDataTable();
+ void executeDispatch_OpenInsertDataTableDialog();
+
void executeDispatch_InsertMenu_DataLabels();
void executeDispatch_InsertMenu_Trendlines();
void executeDispatch_InsertMenu_MeanValues();
@@ -479,6 +485,8 @@ private:
void executeDispatch_MoveSeries( bool bForward );
bool EndTextEdit();
+ css::uno::Sequence< css::uno::Reference<css::chart2::XFormattedString >> GetFormattedTitle(
+ const EditTextObject& aEdit, const css::uno::Reference< css::drawing::XShape >& xShape );
void executeDispatch_View3D();
void executeDispatch_PositionAndSize( const ::css::uno::Sequence< ::css::beans::PropertyValue >* pArgs = nullptr );
@@ -499,17 +507,17 @@ private:
void executeDispatch_LOKSetTextSelection(int nType, int nX, int nY);
void executeDispatch_LOKPieSegmentDragging(int nOffset);
void executeDispatch_FillColor(sal_uInt32 nColor);
- void executeDispatch_FillGradient(OUString sJSONGradient);
+ void executeDispatch_FillGradient(std::u16string_view sJSONGradient);
void executeDispatch_LineColor(sal_uInt32 nColor);
void executeDispatch_LineWidth(sal_uInt32 nWidth);
- void sendPopupRequest(OUString const & rCID, tools::Rectangle aRectangle);
+ void sendPopupRequest(std::u16string_view rCID, tools::Rectangle aRectangle);
void impl_ShapeControllerDispatch( const css::util::URL& rURL,
const css::uno::Sequence< css::beans::PropertyValue >& rArgs );
DECL_LINK( DoubleClickWaitingHdl, Timer*, void );
- void execute_DoubleClick( const Point* pMousePixel );
+ void execute_DoubleClick( const Point* pMousePixel, bool &bEditText );
void startDoubleClickWaiting();
void stopDoubleClickWaiting();
@@ -517,7 +525,7 @@ private:
void impl_notifySelectionChangeListeners();
void impl_invalidateAccessible();
void impl_initializeAccessible();
- void impl_initializeAccessible( const css::uno::Reference< css::lang::XInitialization >& xInit );
+ void impl_initializeAccessible( AccessibleChartView& xInit );
//sets the model member to null if it equals the parameter
//returns true if successful
@@ -531,20 +539,10 @@ private:
/// @return </sal_True>, if resize/move was successful
bool impl_moveOrResizeObject(
const OUString & rCID, eMoveOrResizeType eType, double fAmountLogicX, double fAmountLogicY );
- bool impl_DragDataPoint( const OUString & rCID, double fOffset );
+ bool impl_DragDataPoint( std::u16string_view rCID, double fOffset );
static const o3tl::sorted_vector< OUString >& impl_getAvailableCommands();
- /** Creates a helper accessibility class that must be initialized via XInitialization. For
- parameters see
-
- The returned object should not be used directly. Instead a proxy object
- should use this helper to retrieve its children and add them to its own
- children.
- */
- css::uno::Reference< css::accessibility::XAccessibleContext >
- impl_createAccessibleTextContext();
-
void impl_PasteGraphic( css::uno::Reference< css::graphic::XGraphic > const & xGraphic,
const ::Point & aPosition );
void impl_PasteShapes( SdrModel* pModel );
diff --git a/chart2/source/controller/inc/ChartDocumentWrapper.hxx b/chart2/source/controller/inc/ChartDocumentWrapper.hxx
index 7eeb4646bfc7..a5bded3c8fb7 100644
--- a/chart2/source/controller/inc/ChartDocumentWrapper.hxx
+++ b/chart2/source/controller/inc/ChartDocumentWrapper.hxx
@@ -26,11 +26,13 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
#include <unotools/eventlisteneradapter.hxx>
-
+#include <rtl/ref.hxx>
+#include <svx/unopage.hxx>
#include <memory>
namespace com::sun::star::uno { class XComponentContext; }
namespace com::sun::star::util { class XRefreshable; }
+namespace chart { class ChartView; }
namespace chart::wrapper
{
@@ -48,7 +50,7 @@ class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper
{
};
-class ChartDocumentWrapper : public ChartDocumentWrapper_Base
+class ChartDocumentWrapper final : public ChartDocumentWrapper_Base
, public ::utl::OEventListenerAdapter
{
public:
@@ -72,7 +74,7 @@ public:
css::uno::Reference< css::drawing::XShapes > getAdditionalShapes() const;
/// @throws css::uno::RuntimeException
- css::uno::Reference< css::drawing::XDrawPage > impl_getDrawPage() const;
+ rtl::Reference<SvxDrawPage> impl_getDrawPage() const;
protected:
@@ -137,6 +139,10 @@ protected:
virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties() override;
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override;
+ // ____ XPropertySet ____
+ virtual void SAL_CALL setPropertyValue(const OUString& rPropertyName,
+ const css::uno::Any& rValue) override;
+
private: //methods
void impl_resetAddIn();
@@ -156,7 +162,7 @@ private: //member
OUString m_aBaseDiagram;
bool m_bUpdateAddIn;
- css::uno::Reference< css::uno::XInterface > m_xChartView;
+ rtl::Reference< ChartView > m_xChartView;
css::uno::Reference< css::lang::XMultiServiceFactory>
m_xShapeFactory;
diff --git a/chart2/source/controller/inc/ChartToolbarController.hxx b/chart2/source/controller/inc/ChartToolbarController.hxx
index 647cd59a6685..ce493bba674b 100644
--- a/chart2/source/controller/inc/ChartToolbarController.hxx
+++ b/chart2/source/controller/inc/ChartToolbarController.hxx
@@ -9,8 +9,7 @@
#pragma once
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
+#include <comphelper/compbase.hxx>
#include <com/sun/star/frame/XToolbarController.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
@@ -23,13 +22,12 @@ namespace com::sun::star::frame { class XFramesSupplier; }
namespace chart {
-typedef cppu::WeakComponentImplHelper<
+typedef comphelper::WeakComponentImplHelper<
css::frame::XToolbarController, css::frame::XStatusListener,
css::util::XUpdatable, css::lang::XInitialization,
css::lang::XServiceInfo> ChartToolbarControllerBase;
-class ChartToolbarController : private cppu::BaseMutex,
- public ChartToolbarControllerBase
+class ChartToolbarController final : public ChartToolbarControllerBase
{
public:
ChartToolbarController(const css::uno::Sequence<css::uno::Any>& rProperties);
@@ -69,7 +67,7 @@ public:
// XUpdatable
virtual void SAL_CALL update() override;
- using cppu::WeakComponentImplHelperBase::disposing;
+ using comphelper::WeakComponentImplHelperBase::disposing;
private:
diff --git a/chart2/source/controller/inc/ChartWindow.hxx b/chart2/source/controller/inc/ChartWindow.hxx
index e7aa36d91cc8..918805cb3a8a 100644
--- a/chart2/source/controller/inc/ChartWindow.hxx
+++ b/chart2/source/controller/inc/ChartWindow.hxx
@@ -29,7 +29,7 @@ class ChartController;
thus the controller can perform appropriate actions
*/
-class ChartWindow : public vcl::Window
+class ChartWindow final : public vcl::Window
{
public:
ChartWindow( ChartController* pController, vcl::Window* pParent, WinBits nStyle );
@@ -53,15 +53,8 @@ public:
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual void RequestHelp( const HelpEvent& rHEvt ) override;
- /// For LibreOfficeKit, we need to route these to the mouse events.
- virtual void LogicMouseButtonDown(const MouseEvent&) override;
- virtual void LogicMouseButtonUp(const MouseEvent&) override;
- virtual void LogicMouseMove(const MouseEvent&) override;
-
void ForceInvalidate();
- virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
- virtual void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
- virtual void Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
+ virtual void ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags nFlags ) override;
/// Notify the LOK client about an invalidated area.
virtual void LogicInvalidate( const tools::Rectangle* pRectangle ) override;
diff --git a/chart2/source/controller/inc/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx
index b23fc28f7199..ae95313c0f20 100644
--- a/chart2/source/controller/inc/CommandDispatchContainer.hxx
+++ b/chart2/source/controller/inc/CommandDispatchContainer.hxx
@@ -18,7 +18,7 @@
*/
#pragma once
-#include <cppuhelper/weakref.hxx>
+#include <unotools/weakref.hxx>
#include <o3tl/sorted_vector.hxx>
#include <map>
@@ -33,7 +33,7 @@ namespace com::sun::star::util { struct URL; }
namespace chart
{
-
+class ChartModel;
class DrawCommandDispatch;
class ShapeController;
@@ -73,14 +73,14 @@ public:
const css::uno::Reference< css::uno::XComponentContext > & xContext );
void setModel(
- const css::uno::Reference< css::frame::XModel > & xModel );
+ const rtl::Reference<::chart::ChartModel> & xModel );
/** Set a chart dispatcher that is used for all commands contained in
rChartCommands
*/
void setChartDispatch(
const css::uno::Reference< css::frame::XDispatch >& rChartDispatch,
- const o3tl::sorted_vector< OUString > & rChartCommands );
+ o3tl::sorted_vector< OUString > && rChartCommands );
/** Returns the dispatch that is able to do the command given in rURL, if
implemented here. If the URL is not implemented here, it should be
@@ -102,7 +102,7 @@ public:
const css::uno::Reference< css::frame::XController > & xChartController,
const css::util::URL & rURL );
- css::uno::Reference< css::frame::XDispatch > getChartDispatcher() const { return m_xChartDispatcher; }
+ const css::uno::Reference< css::frame::XDispatch > & getChartDispatcher() const { return m_xChartDispatcher; }
void setDrawCommandDispatch( DrawCommandDispatch* pDispatch );
DrawCommandDispatch* getDrawCommandDispatch() { return m_pDrawCommandDispatch; }
@@ -122,7 +122,7 @@ private:
mutable tDisposeVector m_aToBeDisposedDispatches;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::WeakReference< css::frame::XModel > m_xModel;
+ unotools::WeakReference< ::chart::ChartModel > m_xModel;
css::uno::Reference< css::frame::XDispatch > m_xChartDispatcher;
o3tl::sorted_vector< OUString > m_aChartCommands;
diff --git a/chart2/source/controller/inc/ConfigurationAccess.hxx b/chart2/source/controller/inc/ConfigurationAccess.hxx
deleted file mode 100644
index 2fb4636d2217..000000000000
--- a/chart2/source/controller/inc/ConfigurationAccess.hxx
+++ /dev/null
@@ -1,38 +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 <tools/fldunit.hxx>
-
-namespace chart::ConfigurationAccess
-{
-/** @descr Retrieve the FieldUnit to be used for the UI. This unit is retrieved
- from the registry settings of the Calc application.
-
- If this setting can not be found there is a fallback to cm which is the most
- common setting worldwide (or not?)
-
- @return the FieldUnit enum. See <vcl/fldunit.hxx> for definition
- */
-FieldUnit getFieldUnit();
-
-} //namespace chart
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx
index f2fbfdf9ca99..720cc0fef2e7 100644
--- a/chart2/source/controller/inc/DataPointItemConverter.hxx
+++ b/chart2/source/controller/inc/DataPointItemConverter.hxx
@@ -20,34 +20,36 @@
#include "ItemConverter.hxx"
#include "GraphicPropertyItemConverter.hxx"
+#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/uno/Sequence.h>
#include <tools/color.hxx>
-
+#include <rtl/ref.hxx>
+#include <optional>
#include <vector>
-namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::chart2 { class XDataSeries; }
namespace com::sun::star::frame { class XModel; }
namespace com::sun::star::uno { class XComponentContext; }
-
+namespace chart { class ChartModel; }
+namespace chart { class DataSeries; }
class SdrModel;
namespace chart::wrapper {
-class DataPointItemConverter : public ItemConverter
+class DataPointItemConverter final : public ItemConverter
{
public:
DataPointItemConverter(
- const css::uno::Reference<css::frame::XModel>& xChartModel,
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
const css::uno::Reference<css::uno::XComponentContext>& xContext,
const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
- const css::uno::Reference<css::chart2::XDataSeries>& xSeries,
+ const rtl::Reference<::chart::DataSeries>& xSeries,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory,
GraphicObjectType eMapTo,
- const css::awt::Size* pRefSize = nullptr,
+ const std::optional<css::awt::Size>& pRefSize = std::nullopt,
bool bDataSeries = false,
bool bUseSpecialFillColor = false,
sal_Int32 nSpecialFillColor = 0,
@@ -62,7 +64,7 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
@@ -80,7 +82,7 @@ private:
bool m_bForbidPercentValue;
bool m_bHideLegendEntry;
sal_Int32 m_nPointIndex;
- css::uno::Reference<css::chart2::XDataSeries> m_xSeries;
+ rtl::Reference<::chart::DataSeries> m_xSeries;
};
}
diff --git a/chart2/source/controller/inc/DataTableItemConverter.hxx b/chart2/source/controller/inc/DataTableItemConverter.hxx
new file mode 100644
index 000000000000..f3809632f8a5
--- /dev/null
+++ b/chart2/source/controller/inc/DataTableItemConverter.hxx
@@ -0,0 +1,56 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include "ItemConverter.hxx"
+#include <rtl/ref.hxx>
+#include <vector>
+
+namespace com::sun::star::awt
+{
+struct Size;
+}
+namespace com::sun::star::beans
+{
+class XPropertySet;
+}
+namespace chart
+{
+class ChartModel;
+}
+
+class SdrModel;
+
+namespace chart::wrapper
+{
+/** Convert data table properties to and from ItemSet and UNO PropertySet */
+class DataTableItemConverter final : public ItemConverter
+{
+public:
+ DataTableItemConverter(const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
+ SfxItemPool& rItemPool, SdrModel& rDrawModel,
+ const rtl::Reference<::chart::ChartModel>& xChartDoc);
+
+ virtual ~DataTableItemConverter() override;
+
+ virtual void FillItemSet(SfxItemSet& rOutItemSet) const override;
+ virtual bool ApplyItemSet(const SfxItemSet& rItemSet) override;
+
+protected:
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
+ virtual bool GetItemProperty(tWhichIdType nWhichId,
+ tPropertyNameWithMemberId& rOutProperty) const override;
+
+private:
+ std::vector<std::unique_ptr<ItemConverter>> m_aConverters;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/DrawViewWrapper.hxx b/chart2/source/controller/inc/DrawViewWrapper.hxx
index 70a1baf40da6..28c2a927ec19 100644
--- a/chart2/source/controller/inc/DrawViewWrapper.hxx
+++ b/chart2/source/controller/inc/DrawViewWrapper.hxx
@@ -43,7 +43,7 @@ protected:
~MarkHandleProvider() {}
};
-class DrawViewWrapper : public E3dView
+class DrawViewWrapper final : public E3dView
{
public:
DrawViewWrapper(
diff --git a/chart2/source/controller/inc/ErrorBarItemConverter.hxx b/chart2/source/controller/inc/ErrorBarItemConverter.hxx
index e370ddd99fe0..a53fbe18ef60 100644
--- a/chart2/source/controller/inc/ErrorBarItemConverter.hxx
+++ b/chart2/source/controller/inc/ErrorBarItemConverter.hxx
@@ -29,11 +29,11 @@ class SdrModel;
namespace chart::wrapper
{
-class ErrorBarItemConverter : public ItemConverter
+class ErrorBarItemConverter final : public ItemConverter
{
public:
ErrorBarItemConverter(
- const css::uno::Reference< css::frame::XModel > & xChartModel,
+ css::uno::Reference< css::frame::XModel > xChartModel,
const css::uno::Reference< css::beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
@@ -44,7 +44,7 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
diff --git a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
index fd221336b774..9d119d53ca3a 100644
--- a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
+++ b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
@@ -35,19 +35,19 @@ enum class GraphicObjectType
LineAndFillProperties
};
-class GraphicPropertyItemConverter : public ItemConverter
+class GraphicPropertyItemConverter final : public ItemConverter
{
public:
GraphicPropertyItemConverter(
const css::uno::Reference< css::beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
- const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ css::uno::Reference< css::lang::XMultiServiceFactory > xNamedPropertyContainerFactory,
GraphicObjectType eObjectType );
virtual ~GraphicPropertyItemConverter() override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
diff --git a/chart2/source/controller/inc/ItemConverter.hxx b/chart2/source/controller/inc/ItemConverter.hxx
index 80b6c9cd2119..031a633c22d8 100644
--- a/chart2/source/controller/inc/ItemConverter.hxx
+++ b/chart2/source/controller/inc/ItemConverter.hxx
@@ -73,7 +73,7 @@ public:
reading/writing converted items
*/
ItemConverter(
- const css::uno::Reference< css::beans::XPropertySet > & rPropertySet ,
+ css::uno::Reference< css::beans::XPropertySet > xPropertySet ,
SfxItemPool& rItemPool );
virtual ~ItemConverter() override;
@@ -116,18 +116,9 @@ public:
protected:
- /** implement this method to provide an array of which-ranges of the form:
-
- const sal_uInt16 aMyPairs[] =
- {
- from_1, to_1,
- from_2, to_2,
- ...
- from_n, to_n,
- 0
- };
+ /** implement this method to provide an array of which-ranges
*/
- virtual const sal_uInt16 * GetWhichPairs() const = 0;
+ virtual const WhichRangesContainer& GetWhichPairs() const = 0;
/** implement this method to return a Property object for a given which id.
diff --git a/chart2/source/controller/inc/LegendItemConverter.hxx b/chart2/source/controller/inc/LegendItemConverter.hxx
index efa167db0856..cbb657edf0d3 100644
--- a/chart2/source/controller/inc/LegendItemConverter.hxx
+++ b/chart2/source/controller/inc/LegendItemConverter.hxx
@@ -19,10 +19,10 @@
#pragma once
#include "ItemConverter.hxx"
-
+#include <com/sun/star/awt/Size.hpp>
+#include <optional>
#include <vector>
-namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
class SdrModel;
@@ -30,7 +30,7 @@ class SdrModel;
namespace chart::wrapper
{
-class LegendItemConverter : public ItemConverter
+class LegendItemConverter final : public ItemConverter
{
public:
LegendItemConverter(
@@ -38,7 +38,7 @@ public:
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
- const css::awt::Size* pRefSize );
+ const std::optional<css::awt::Size>& pRefSize );
virtual ~LegendItemConverter() override;
@@ -46,7 +46,7 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
diff --git a/chart2/source/controller/inc/MultipleChartConverters.hxx b/chart2/source/controller/inc/MultipleChartConverters.hxx
index 6a9110d45be2..8fc9f33b4367 100644
--- a/chart2/source/controller/inc/MultipleChartConverters.hxx
+++ b/chart2/source/controller/inc/MultipleChartConverters.hxx
@@ -19,49 +19,51 @@
#pragma once
#include "MultipleItemConverter.hxx"
+#include <com/sun/star/awt/Size.hpp>
+#include <rtl/ref.hxx>
+#include <optional>
-namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::frame { class XModel; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
-
+namespace chart { class ChartModel; }
class SdrModel;
namespace chart::wrapper {
-class AllAxisItemConverter : public MultipleItemConverter
+class AllAxisItemConverter final : public MultipleItemConverter
{
public:
AllAxisItemConverter(
- const css::uno::Reference<css::frame::XModel> & xChartModel,
+ const rtl::Reference<::chart::ChartModel> & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
- const css::awt::Size* pRefSize );
+ const std::optional<css::awt::Size>& pRefSize );
virtual ~AllAxisItemConverter() override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
};
-class AllGridItemConverter : public MultipleItemConverter
+class AllGridItemConverter final : public MultipleItemConverter
{
public:
AllGridItemConverter(
- const css::uno::Reference<css::frame::XModel>& xChartModel,
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const css::uno::Reference<css::lang::XMultiServiceFactory> & xNamedPropertyContainerFactory );
virtual ~AllGridItemConverter() override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
};
-class AllDataLabelItemConverter : public MultipleItemConverter
+class AllDataLabelItemConverter final : public MultipleItemConverter
{
public:
AllDataLabelItemConverter(
- const css::uno::Reference<css::frame::XModel>& xChartModel,
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory );
@@ -69,32 +71,32 @@ public:
virtual ~AllDataLabelItemConverter() override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
};
-class AllTitleItemConverter : public MultipleItemConverter
+class AllTitleItemConverter final : public MultipleItemConverter
{
public:
AllTitleItemConverter(
- const css::uno::Reference<css::frame::XModel>& xChartModel,
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
SfxItemPool& rItemPool, SdrModel& rDrawModel,
const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory );
virtual ~AllTitleItemConverter() override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
};
-class AllSeriesStatisticsConverter : public MultipleItemConverter
+class AllSeriesStatisticsConverter final : public MultipleItemConverter
{
public:
AllSeriesStatisticsConverter(
- const css::uno::Reference<css::frame::XModel>& xChartModel, SfxItemPool& rItemPool );
+ const rtl::Reference<::chart::ChartModel>& xChartModel, SfxItemPool& rItemPool );
virtual ~AllSeriesStatisticsConverter() override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
};
} // namespace chart::wrapper
diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx
index 6ba57f17b545..1531866aaf2b 100644
--- a/chart2/source/controller/inc/ObjectHierarchy.hxx
+++ b/chart2/source/controller/inc/ObjectHierarchy.hxx
@@ -18,24 +18,19 @@
*/
#pragma once
+#include <ChartModel.hxx>
#include <ObjectIdentifier.hxx>
+#include <map>
+#include <vector>
namespace com::sun::star::awt { struct KeyEvent; }
namespace com::sun::star::chart2 { class XChartDocument; }
-#include <memory>
-#include <vector>
-
namespace chart
{
class ExplicitValueProvider;
-namespace impl
-{
-class ImplObjectHierarchy;
-}
-
class ObjectHierarchy
{
public:
@@ -47,7 +42,7 @@ public:
used for keyboard navigation).
*/
explicit ObjectHierarchy(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument,
+ const rtl::Reference<::chart::ChartModel> & xChartDocument,
ExplicitValueProvider * pExplicitValueProvider,
bool bFlattenDiagram = false,
bool bOrderingForElementSelector = false );
@@ -57,11 +52,10 @@ public:
static bool isRootNode( const ObjectIdentifier& rOID );
/// equal to getChildren( getRootNodeOID())
- tChildContainer getTopLevelChildren() const;
- bool hasChildren( const ObjectIdentifier& rParent ) const;
- tChildContainer getChildren( const ObjectIdentifier& rParent ) const;
-
- tChildContainer getSiblings( const ObjectIdentifier& rNode ) const;
+ const tChildContainer& getTopLevelChildren() const;
+ bool hasChildren(const ObjectIdentifier& rParent) const;
+ const tChildContainer& getChildren(const ObjectIdentifier& rParent) const;
+ const tChildContainer& getSiblings(const ObjectIdentifier& rNode) const;
/// The result is empty, if the node cannot be found in the tree
ObjectIdentifier getParent( const ObjectIdentifier& rNode ) const;
@@ -69,15 +63,42 @@ public:
sal_Int32 getIndexInParent( const ObjectIdentifier& rNode ) const;
private:
-
- std::unique_ptr< impl::ImplObjectHierarchy > m_apImpl;
+ void createTree( const rtl::Reference<::chart::ChartModel> & xChartDocument );
+ void createAxesTree(
+ tChildContainer & rContainer,
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
+ void createDiagramTree(
+ tChildContainer& rContainer,
+ const rtl::Reference<::chart::ChartModel>& xChartDoc,
+ const rtl::Reference< ::chart::Diagram >& xDiagram );
+ void createDataSeriesTree(
+ tChildContainer & rOutDiagramSubContainer,
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
+ static void createWallAndFloor(
+ tChildContainer & rContainer,
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
+ void createLegendTree(
+ tChildContainer & rContainer,
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
+ void createAdditionalShapesTree(tChildContainer& rContainer);
+ ObjectIdentifier getParentImpl(
+ const ObjectIdentifier& rParentOID,
+ const ObjectIdentifier& rOID ) const;
+
+ typedef std::map<ObjectIdentifier, tChildContainer> tChildMap;
+ tChildMap m_aChildMap;
+ ExplicitValueProvider* m_pExplicitValueProvider;
+ bool m_bFlattenDiagram;
+ bool m_bOrderingForElementSelector;
};
class ObjectKeyNavigation
{
public:
- explicit ObjectKeyNavigation( const ObjectIdentifier & rCurrentOID,
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument,
+ explicit ObjectKeyNavigation( ObjectIdentifier aCurrentOID,
+ rtl::Reference<::chart::ChartModel> xChartDocument,
ExplicitValueProvider * pExplicitValueProvider );
bool handleKeyEvent( const css::awt::KeyEvent & rEvent );
@@ -95,7 +116,7 @@ private:
bool veryLast();
ObjectIdentifier m_aCurrentOID;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument;
+ rtl::Reference<::chart::ChartModel> m_xChartDocument;
ExplicitValueProvider * m_pExplicitValueProvider;
};
diff --git a/chart2/source/controller/inc/ObjectNameProvider.hxx b/chart2/source/controller/inc/ObjectNameProvider.hxx
index 07551aefa1d7..c613dd5ce855 100644
--- a/chart2/source/controller/inc/ObjectNameProvider.hxx
+++ b/chart2/source/controller/inc/ObjectNameProvider.hxx
@@ -35,34 +35,33 @@ class ObjectNameProvider
{
public:
static OUString getName( ObjectType eObjectType, bool bPlural=false );
- static OUString getAxisName( const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
- static OUString getGridName( const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
- static OUString getTitleName( const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ static OUString getAxisName( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
+ static OUString getGridName( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
+ static OUString getTitleName( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static OUString getTitleNameByType( TitleHelper::eTitleType eType );
static OUString getNameForCID(
- const OUString& rObjectCID,
- const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument );
+ std::u16string_view rObjectCID,
+ const rtl::Reference<::chart::ChartModel>& xChartDocument );
static OUString getName_ObjectForSeries(
ObjectType eObjectType,
- const OUString& rSeriesCID,
- const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument );
+ std::u16string_view rSeriesCID,
+ const rtl::Reference<::chart::ChartModel>& xChartDocument );
static OUString getName_ObjectForAllSeries( ObjectType eObjectType );
/** Provides help texts for the various chart elements.
The parameter rObjectCID has to be a ClassifiedIdentifier - see class ObjectIdentifier.
*/
- static OUString getHelpText( const OUString& rObjectCID, const css::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel, bool bVerbose=false );
- static OUString getHelpText( const OUString& rObjectCID, const css::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument );
+ static OUString getHelpText( std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel, bool bVerbose=false );
/** This is used for showing the currently selected object in the status bar
(command "Context")
*/
- static OUString getSelectedObjectText( const OUString & rObjectCID, const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument );
+ static OUString getSelectedObjectText( std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartDocument );
};
} //namespace chart
diff --git a/chart2/source/controller/inc/PositionAndSizeHelper.hxx b/chart2/source/controller/inc/PositionAndSizeHelper.hxx
index d1c72c20bd1f..0f79373d52f9 100644
--- a/chart2/source/controller/inc/PositionAndSizeHelper.hxx
+++ b/chart2/source/controller/inc/PositionAndSizeHelper.hxx
@@ -36,8 +36,8 @@ public:
, const css::awt::Rectangle& rOldPositionAndSize
, const css::awt::Rectangle& rPageRectangle );
- static bool moveObject( const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel
+ static bool moveObject( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, const css::awt::Rectangle& rNewPositionAndSize
, const css::awt::Rectangle& rOldPositionAndSize
, const css::awt::Rectangle& rPageRectangle );
diff --git a/chart2/source/controller/inc/RangeSelectionHelper.hxx b/chart2/source/controller/inc/RangeSelectionHelper.hxx
index f04d763e1636..36fe0db99cce 100644
--- a/chart2/source/controller/inc/RangeSelectionHelper.hxx
+++ b/chart2/source/controller/inc/RangeSelectionHelper.hxx
@@ -21,6 +21,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star::beans { struct PropertyValue; }
namespace com::sun::star::chart2 { class XChartDocument; }
@@ -34,14 +35,14 @@ namespace com::sun::star {
namespace chart
{
-
+class ChartModel;
class RangeSelectionListenerParent;
class RangeSelectionHelper
{
public:
explicit RangeSelectionHelper(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument );
+ rtl::Reference<::chart::ChartModel> xChartDocument );
~RangeSelectionHelper();
bool hasRangeSelection();
@@ -59,8 +60,7 @@ private:
css::uno::Reference< css::sheet::XRangeSelection >
m_xRangeSelection;
- css::uno::Reference< css::chart2::XChartDocument >
- m_xChartDocument;
+ rtl::Reference<::chart::ChartModel> m_xChartDocument;
css::uno::Reference< css::sheet::XRangeSelectionListener >
m_xRangeSelectionListener;
diff --git a/chart2/source/controller/inc/RangeSelectionListener.hxx b/chart2/source/controller/inc/RangeSelectionListener.hxx
index f060a2aa95d3..9117b4d9b2fc 100644
--- a/chart2/source/controller/inc/RangeSelectionListener.hxx
+++ b/chart2/source/controller/inc/RangeSelectionListener.hxx
@@ -21,6 +21,7 @@
#include <ControllerLockGuard.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/sheet/XRangeSelectionListener.hpp>
+#include <rtl/ref.hxx>
namespace com::sun::star::frame
{
@@ -29,6 +30,8 @@ class XModel;
namespace chart
{
+class ChartModel;
+
class RangeSelectionListenerParent
{
public:
@@ -39,12 +42,13 @@ protected:
~RangeSelectionListenerParent() {}
};
-class RangeSelectionListener : public ::cppu::WeakImplHelper<css::sheet::XRangeSelectionListener>
+class RangeSelectionListener final
+ : public ::cppu::WeakImplHelper<css::sheet::XRangeSelectionListener>
{
public:
explicit RangeSelectionListener(
- RangeSelectionListenerParent& rParent, const OUString& rInitialRange,
- const css::uno::Reference<css::frame::XModel>& xModelToLockController);
+ RangeSelectionListenerParent& rParent, OUString aInitialRange,
+ const rtl::Reference<::chart::ChartModel>& xModelToLockController);
virtual ~RangeSelectionListener() override;
protected:
diff --git a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
index c5e1665d61a0..8c4262b55ec5 100644
--- a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
+++ b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
@@ -19,21 +19,22 @@
#pragma once
#include "ItemConverter.hxx"
+#include <rtl/ref.hxx>
namespace com::sun::star::chart2 { class XRegressionCurveContainer; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
-
+namespace chart { class DataSeries; }
class SdrModel;
namespace chart::wrapper
{
-class RegressionCurveItemConverter : public ItemConverter
+class RegressionCurveItemConverter final : public ItemConverter
{
public:
RegressionCurveItemConverter(
const css::uno::Reference< css::beans::XPropertySet > & rPropertySet,
- const css::uno::Reference< css::chart2::XRegressionCurveContainer > & xRegCurveCnt,
+ rtl::Reference< ::chart::DataSeries > xRegCurveCnt,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory );
@@ -43,7 +44,7 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
@@ -51,7 +52,7 @@ protected:
private:
std::shared_ptr< ItemConverter > m_spGraphicConverter;
- css::uno::Reference< css::chart2::XRegressionCurveContainer > m_xCurveContainer;
+ rtl::Reference< ::chart::DataSeries > m_xCurveContainer;
};
} // namespace chart::wrapper
diff --git a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
index df05d6e7f8e8..83394b1ea45d 100644
--- a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
+++ b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
@@ -19,10 +19,10 @@
#pragma once
#include "ItemConverter.hxx"
-
+#include <com/sun/star/awt/Size.hpp>
+#include <optional>
#include <vector>
-namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
@@ -30,7 +30,7 @@ class SdrModel;
namespace chart::wrapper {
-class RegressionEquationItemConverter : public ItemConverter
+class RegressionEquationItemConverter final : public ItemConverter
{
public:
RegressionEquationItemConverter(
@@ -38,7 +38,7 @@ public:
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
- const css::awt::Size* pRefSize );
+ const std::optional<css::awt::Size>& pRefSize );
virtual ~RegressionEquationItemConverter() override;
@@ -46,7 +46,7 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
diff --git a/chart2/source/controller/inc/SelectionHelper.hxx b/chart2/source/controller/inc/SelectionHelper.hxx
index c5c2ed551510..119640bd4300 100644
--- a/chart2/source/controller/inc/SelectionHelper.hxx
+++ b/chart2/source/controller/inc/SelectionHelper.hxx
@@ -38,7 +38,8 @@ public: //methods
const ObjectIdentifier& getSelectedOID() const { return m_aSelectedOID;}
bool isResizeableObjectSelected() const;
- bool isRotateableObjectSelected( const css::uno::Reference< css::frame::XModel >& xChartModel ) const;
+ bool isRotateableObjectSelected( const rtl::Reference<::chart::ChartModel>& xChartModel ) const;
+ bool isTitleObjectSelected() const;
bool isDragableObjectSelected() const;
bool isAdditionalShapeSelected() const;
@@ -72,7 +73,7 @@ private: //member
ObjectIdentifier m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing;
};
-class SelectionHelper : public MarkHandleProvider
+class SelectionHelper final : public MarkHandleProvider
{
public:
static bool findNamedParent( SdrObject*& pInOutObject
@@ -92,8 +93,8 @@ public:
DrawViewWrapper const & rDrawViewWrapper,
bool bGetDiagramInsteadOf_Wall=false );
- static bool isRotateableObject( const OUString& rCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ static bool isRotateableObject( std::u16string_view rCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
explicit SelectionHelper( SdrObject* pSelectedObj );
virtual ~SelectionHelper();
diff --git a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
index d43c7cb6d234..b55457ac5b30 100644
--- a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
+++ b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
@@ -20,33 +20,37 @@
#include "ItemConverter.hxx"
#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ref.hxx>
namespace com::sun::star::chart2 { class XCoordinateSystem; }
namespace com::sun::star::frame { class XModel; }
namespace com::sun::star::uno { class XComponentContext; }
+namespace chart { class ChartModel; }
+namespace chart { class BaseCoordinateSystem; }
+namespace chart { class DataSeries; }
namespace chart::wrapper
{
-class SeriesOptionsItemConverter : public ItemConverter
+class SeriesOptionsItemConverter final : public ItemConverter
{
public:
SeriesOptionsItemConverter(
- const css::uno::Reference< css::frame::XModel > & xChartModel,
- const css::uno::Reference< css::uno::XComponentContext > & xContext,
- const css::uno::Reference< css::beans::XPropertySet > & rPropertySet,
+ const rtl::Reference<::chart::ChartModel> & xChartModel,
+ css::uno::Reference< css::uno::XComponentContext > xContext,
+ const rtl::Reference<::chart::DataSeries> & rPropertySet,
SfxItemPool& rItemPool );
virtual ~SeriesOptionsItemConverter() override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private:
- css::uno::Reference< css::frame::XModel > m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
css::uno::Reference< css::uno::XComponentContext> m_xCC;
bool m_bAttachToMainAxis;
@@ -64,7 +68,7 @@ private:
sal_Int32 m_nStartingAngle;
bool m_bClockwise;
- css::uno::Reference< css::chart2::XCoordinateSystem > m_xCooSys;
+ rtl::Reference< ::chart::BaseCoordinateSystem > m_xCooSys;
css::uno::Sequence< sal_Int32 > m_aSupportedMissingValueTreatments;
sal_Int32 m_nMissingValueTreatment;
diff --git a/chart2/source/controller/inc/ShapeController.h b/chart2/source/controller/inc/ShapeController.h
deleted file mode 100644
index 392c28d2fe4c..000000000000
--- a/chart2/source/controller/inc/ShapeController.h
+++ /dev/null
@@ -1,38 +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 .
- */
-#ifndef CHART_SHAPECONTROLLER_H
-#define CHART_SHAPECONTROLLER_H
-
-//Command Ids:
-#define COMMAND_ID_FORMAT_LINE 1
-#define COMMAND_ID_FORMAT_AREA 2
-#define COMMAND_ID_TEXT_ATTRIBUTES 3
-#define COMMAND_ID_TRANSFORM_DIALOG 4
-#define COMMAND_ID_OBJECT_TITLE_DESCRIPTION 5
-#define COMMAND_ID_RENAME_OBJECT 6
-#define COMMAND_ID_BRING_TO_FRONT 8
-#define COMMAND_ID_FORWARD 9
-#define COMMAND_ID_BACKWARD 10
-#define COMMAND_ID_SEND_TO_BACK 11
-#define COMMAND_ID_FONT_DIALOG 15
-#define COMMAND_ID_PARAGRAPH_DIALOG 16
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/StatisticsItemConverter.hxx b/chart2/source/controller/inc/StatisticsItemConverter.hxx
index 5d9fb544c605..a6c56a2691e7 100644
--- a/chart2/source/controller/inc/StatisticsItemConverter.hxx
+++ b/chart2/source/controller/inc/StatisticsItemConverter.hxx
@@ -19,30 +19,32 @@
#pragma once
#include "ItemConverter.hxx"
+#include <rtl/ref.hxx>
namespace com::sun::star::frame { class XModel; }
+namespace chart { class ChartModel; }
namespace chart::wrapper
{
-class StatisticsItemConverter : public ItemConverter
+class StatisticsItemConverter final : public ItemConverter
{
public:
StatisticsItemConverter(
- const css::uno::Reference< css::frame::XModel > & xChartModel,
+ rtl::Reference<::chart::ChartModel> xChartModel,
const css::uno::Reference< css::beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool );
virtual ~StatisticsItemConverter() override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private:
- css::uno::Reference< css::frame::XModel > m_xModel;
+ rtl::Reference<::chart::ChartModel> m_xModel;
};
} // namespace chart::wrapper
diff --git a/chart2/source/controller/inc/TabPageNotifiable.hxx b/chart2/source/controller/inc/TabPageNotifiable.hxx
index 440cda2de9aa..c0b53972e546 100644
--- a/chart2/source/controller/inc/TabPageNotifiable.hxx
+++ b/chart2/source/controller/inc/TabPageNotifiable.hxx
@@ -18,6 +18,8 @@
*/
#pragma once
+#include <sal/types.h>
+
// color to use as foreground for an invalid range
#define RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR COL_WHITE
// color to use as background for an invalid range
@@ -27,7 +29,7 @@ class BuilderPage;
namespace chart
{
-class TabPageNotifiable
+class SAL_LOPLUGIN_ANNOTATE("crosscast") TabPageNotifiable
{
public:
virtual void setInvalidPage(BuilderPage* pTabPage) = 0;
diff --git a/chart2/source/controller/inc/TextDirectionListBox.hxx b/chart2/source/controller/inc/TextDirectionListBox.hxx
index 208e0df6cf02..d346a23cb45d 100644
--- a/chart2/source/controller/inc/TextDirectionListBox.hxx
+++ b/chart2/source/controller/inc/TextDirectionListBox.hxx
@@ -23,7 +23,7 @@
namespace chart
{
-class TextDirectionListBox : public svx::FrameDirectionListBox
+class TextDirectionListBox final : public svx::FrameDirectionListBox
{
public:
explicit TextDirectionListBox(std::unique_ptr<weld::ComboBox> pControl);
diff --git a/chart2/source/controller/inc/TextLabelItemConverter.hxx b/chart2/source/controller/inc/TextLabelItemConverter.hxx
index ebe1b3961d89..cb5406cf6a01 100644
--- a/chart2/source/controller/inc/TextLabelItemConverter.hxx
+++ b/chart2/source/controller/inc/TextLabelItemConverter.hxx
@@ -20,25 +20,28 @@
#include "ItemConverter.hxx"
+#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/uno/Sequence.h>
-
+#include <rtl/ref.hxx>
+#include <optional>
#include <vector>
-namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::chart2 { class XDataSeries; }
namespace com::sun::star::frame { class XModel; }
+namespace chart { class ChartModel; }
+namespace chart { class DataSeries; }
namespace chart::wrapper {
-class TextLabelItemConverter : public ItemConverter
+class TextLabelItemConverter final : public ItemConverter
{
public:
TextLabelItemConverter(
- const css::uno::Reference<css::frame::XModel>& xChartModel,
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
- const css::uno::Reference<css::chart2::XDataSeries>& xSeries,
+ const rtl::Reference<::chart::DataSeries>& xSeries,
SfxItemPool& rItemPool,
- const css::awt::Size* pRefSize,
+ const std::optional<css::awt::Size>& pRefSize,
bool bDataSeries,
sal_Int32 nNumberFormat,
sal_Int32 nPercentNumberFormat );
@@ -49,7 +52,7 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
protected:
- virtual const sal_uInt16* GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
@@ -64,7 +67,7 @@ private:
bool mbDataSeries:1;
bool mbForbidPercentValue:1;
- css::uno::Reference<css::chart2::XDataSeries> m_xSeries;
+ rtl::Reference<::chart::DataSeries> m_xSeries;
};
}
diff --git a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
index f8e899df1d19..49541b1552d4 100644
--- a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
+++ b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
@@ -19,8 +19,8 @@
#pragma once
-#include <com/sun/star/uno/Reference.h>
#include <vcl/timer.hxx>
+#include <rtl/ref.hxx>
#include <memory>
@@ -35,16 +35,18 @@ class ControllerLockGuardUNO;
namespace chart
{
+class ChartModel;
+
class TimerTriggeredControllerLock final
{
public:
- TimerTriggeredControllerLock(const css::uno::Reference<css::frame::XModel>& xModel);
+ TimerTriggeredControllerLock(rtl::Reference<::chart::ChartModel> xModel);
~TimerTriggeredControllerLock();
void startTimer();
private:
- css::uno::Reference<css::frame::XModel> m_xModel;
+ rtl::Reference<::chart::ChartModel> m_xModel;
std::unique_ptr<ControllerLockGuardUNO> m_apControllerLockGuard;
AutoTimer m_aTimer;
diff --git a/chart2/source/controller/inc/TitleDialogData.hxx b/chart2/source/controller/inc/TitleDialogData.hxx
index c69205169699..123ae9d6d65f 100644
--- a/chart2/source/controller/inc/TitleDialogData.hxx
+++ b/chart2/source/controller/inc/TitleDialogData.hxx
@@ -19,31 +19,32 @@
#pragma once
#include <ReferenceSizeProvider.hxx>
-#include <memory>
#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star::frame { class XModel; }
namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class ChartModel;
struct TitleDialogData
{
css::uno::Sequence< sal_Bool > aPossibilityList;
css::uno::Sequence< sal_Bool > aExistenceList;
css::uno::Sequence< OUString > aTextList;
- std::unique_ptr< ReferenceSizeProvider > apReferenceSizeProvider;
+ std::optional< ReferenceSizeProvider > apReferenceSizeProvider;
- TitleDialogData(std::unique_ptr<ReferenceSizeProvider> pReferenzeSizeProvider = nullptr);
+ TitleDialogData(std::optional<ReferenceSizeProvider> pReferenzeSizeProvider = std::nullopt);
- void readFromModel( const css::uno::Reference< css::frame::XModel >& xChartModel );
+ void readFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel );
/* return true if anything has changed;
when pOldState is NULL then all data are written to the model
*/
- bool writeDifferenceToModel( const css::uno::Reference< css::frame::XModel >& xChartModel
+ bool writeDifferenceToModel( const rtl::Reference<::chart::ChartModel>& xChartModel
, const css::uno::Reference< css::uno::XComponentContext >& xContext
- , TitleDialogData* pOldState=nullptr );
+ , const TitleDialogData* pOldState=nullptr );
};
} //namespace chart
diff --git a/chart2/source/controller/inc/TitleItemConverter.hxx b/chart2/source/controller/inc/TitleItemConverter.hxx
index bc8e87e10cf0..4a306b690363 100644
--- a/chart2/source/controller/inc/TitleItemConverter.hxx
+++ b/chart2/source/controller/inc/TitleItemConverter.hxx
@@ -20,23 +20,24 @@
#include "ItemConverter.hxx"
+#include <com/sun/star/awt/Size.hpp>
+#include <optional>
#include <vector>
-namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
class SdrModel;
namespace chart::wrapper {
-class TitleItemConverter : public ItemConverter
+class TitleItemConverter final : public ItemConverter
{
public:
TitleItemConverter(
const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
SfxItemPool& rItemPool, SdrModel& rDrawModel,
const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory,
- const css::awt::Size* pRefSize );
+ const std::optional<css::awt::Size>& pRefSize );
virtual ~TitleItemConverter() override;
@@ -44,7 +45,7 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override;
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override;
virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override;
diff --git a/chart2/source/controller/inc/dlg_ChartType.hxx b/chart2/source/controller/inc/dlg_ChartType.hxx
index d2864f3fd577..02e6ac998bbc 100644
--- a/chart2/source/controller/inc/dlg_ChartType.hxx
+++ b/chart2/source/controller/inc/dlg_ChartType.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <vcl/weld.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star::frame
{
@@ -27,16 +28,17 @@ class XModel;
namespace chart
{
+class ChartModel;
class ChartTypeTabPage;
-class ChartTypeDialog : public weld::GenericDialogController
+
+class ChartTypeDialog final : public weld::GenericDialogController
{
public:
- ChartTypeDialog(weld::Window* pWindow,
- const css::uno::Reference<css::frame::XModel>& xChartModel);
+ ChartTypeDialog(weld::Window* pWindow, rtl::Reference<::chart::ChartModel> xChartModel);
virtual ~ChartTypeDialog() override;
private:
- css::uno::Reference<css::frame::XModel> m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
std::unique_ptr<weld::Container> m_xContentArea;
std::unique_ptr<ChartTypeTabPage> m_xChartTypeTabPage;
};
diff --git a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
index c3aaa4222a6a..4566ec75142d 100644
--- a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
+++ b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
@@ -27,8 +27,10 @@ namespace com::sun::star::beans { class XPropertySetInfo; }
namespace chart
{
+class ChartModel;
+
typedef ::svt::OGenericUnoDialog ChartTypeUnoDlg_BASE;
-class ChartTypeUnoDlg : public ChartTypeUnoDlg_BASE
+class ChartTypeUnoDlg final : public ChartTypeUnoDlg_BASE
,public ::comphelper::OPropertyArrayUsageHelper< ChartTypeUnoDlg >
{
public:
@@ -57,7 +59,7 @@ private:
ChartTypeUnoDlg(const ChartTypeUnoDlg&) = delete;
void operator =(const ChartTypeUnoDlg&) = delete;
- css::uno::Reference< css::frame::XModel > m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
};
} //namespace chart
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index a8edc627e860..1b782632f4d3 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -22,6 +22,7 @@
#include "TimerTriggeredControllerLock.hxx"
#include "TabPageNotifiable.hxx"
+#include <rtl/ref.hxx>
#include <vcl/roadmapwizard.hxx>
#include <memory>
@@ -36,19 +37,18 @@ class XComponentContext;
}
using vcl::WizardTypes::WizardState;
-using vcl::WizardTypes::CommitPageReason;
namespace chart
{
-class DialogModel;
+class ChartModel;
class ChartTypeTemplateProvider;
+class DialogModel;
-class CreationWizard : public vcl::RoadmapWizardMachine, public TabPageNotifiable
+class CreationWizard final : public vcl::RoadmapWizardMachine, public TabPageNotifiable
{
public:
- CreationWizard(weld::Window* pParent,
- const css::uno::Reference<css::frame::XModel>& xChartModel,
- const css::uno::Reference<css::uno::XComponentContext>& xContext);
+ CreationWizard(weld::Window* pParent, const rtl::Reference<::chart::ChartModel>& xChartModel,
+ css::uno::Reference<css::uno::XComponentContext> xContext);
CreationWizard() = delete;
virtual ~CreationWizard() override;
@@ -67,7 +67,7 @@ protected:
private:
virtual std::unique_ptr<BuilderPage> createPage(WizardState nState) override;
- css::uno::Reference<css::chart2::XChartDocument> m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
ChartTypeTemplateProvider* m_pTemplateProvider;
std::unique_ptr<DialogModel> m_pDialogModel;
diff --git a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
index 645d4bbec094..89b8cb5a08f2 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
@@ -19,7 +19,7 @@
#pragma once
-#include <MutexContainer.hxx>
+#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/component.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XTerminateListener.hpp>
@@ -27,6 +27,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
+#include <rtl/ref.hxx>
#include "dlg_CreationWizard.hxx"
#include <tools/link.hxx>
@@ -39,8 +40,9 @@ class VclWindowEvent;
namespace chart
{
+class ChartModel;
-class CreationWizardUnoDlg : public MutexContainer
+class CreationWizardUnoDlg final : public cppu::BaseMutex
, public ::cppu::OComponentHelper
, public css::ui::dialogs::XAsynchronousExecutableDialog
, public css::lang::XServiceInfo
@@ -51,14 +53,14 @@ class CreationWizardUnoDlg : public MutexContainer
public:
CreationWizardUnoDlg() = delete;
- CreationWizardUnoDlg( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ CreationWizardUnoDlg( css::uno::Reference< css::uno::XComponentContext > xContext );
virtual ~CreationWizardUnoDlg() override;
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) override;
- virtual void SAL_CALL acquire() throw () override;
- virtual void SAL_CALL release() throw () override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
@@ -101,7 +103,7 @@ private:
DECL_STATIC_LINK(CreationWizardUnoDlg, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*);
private:
- css::uno::Reference< css::frame::XModel > m_xChartModel;
+ rtl::Reference< ::chart::ChartModel > m_xChartModel;
css::uno::Reference< css::uno::XComponentContext> m_xCC;
css::uno::Reference< css::awt::XWindow > m_xParentWindow;
diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx
index 7f0c8141c15a..205e822a12a5 100644
--- a/chart2/source/controller/inc/dlg_DataEditor.hxx
+++ b/chart2/source/controller/inc/dlg_DataEditor.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <vcl/weld.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star::uno { class XComponentContext; }
namespace comphelper { template <class Tp, class Arg> class mem_fun1_t; }
@@ -32,14 +33,14 @@ namespace com::sun::star {
namespace chart
{
-
+class ChartModel;
class DataBrowser;
-class DataEditor : public weld::GenericDialogController
+class DataEditor final : public weld::GenericDialogController
{
public:
DataEditor(weld::Window* pParent,
- const css::uno::Reference<css::chart2::XChartDocument> & xChartDoc,
+ rtl::Reference<::chart::ChartModel> xChartDoc,
const css::uno::Reference<css::uno::XComponentContext> & xContext);
virtual ~DataEditor() override;
@@ -50,7 +51,7 @@ public:
private:
bool m_bReadOnly;
- css::uno::Reference<css::chart2::XChartDocument> m_xChartDoc;
+ rtl::Reference<::chart::ChartModel> m_xChartDoc;
css::uno::Reference<css::uno::XComponentContext> m_xContext;
std::unique_ptr<weld::Toolbar> m_xTbxData;
@@ -62,7 +63,7 @@ private:
VclPtr<DataBrowser> m_xBrwData;
/// handles actions of the toolbox
- DECL_LINK( ToolboxHdl, const OString&, void );
+ DECL_LINK( ToolboxHdl, const OUString&, void );
/// is called, if the cursor of the table has moved
DECL_LINK( BrowserCursorMovedHdl, DataBrowser*, void);
};
diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx
index 1e505ff63ef6..166131e30ec9 100644
--- a/chart2/source/controller/inc/dlg_DataSource.hxx
+++ b/chart2/source/controller/inc/dlg_DataSource.hxx
@@ -18,24 +18,21 @@
*/
#pragma once
-#include <vcl/weld.hxx>
-
#include "TabPageNotifiable.hxx"
+#include <vcl/weld.hxx>
+#include <memory>
namespace com::sun::star::chart2 { class XChartDocument; }
namespace com::sun::star::uno { class XComponentContext; }
-
-#include <memory>
-
class BuilderPage;
namespace chart
{
-
-class RangeChooserTabPage;
-class DataSourceTabPage;
+class ChartModel;
class ChartTypeTemplateProvider;
+class DataSourceTabPage;
class DialogModel;
+class RangeChooserTabPage;
class DataSourceDialog final :
public weld::GenericDialogController,
@@ -44,8 +41,7 @@ class DataSourceDialog final :
public:
explicit DataSourceDialog(
weld::Window * pParent,
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument,
- const css::uno::Reference< css::uno::XComponentContext > & xContext );
+ const rtl::Reference<::chart::ChartModel> & xChartDocument );
virtual ~DataSourceDialog() override;
// from GenericDialogController base
@@ -56,8 +52,8 @@ public:
virtual void setValidPage( BuilderPage * pTabPage ) override;
private:
- DECL_LINK(ActivatePageHdl, const OString&, void);
- DECL_LINK(DeactivatePageHdl, const OString&, bool);
+ DECL_LINK(ActivatePageHdl, const OUString&, void);
+ DECL_LINK(DeactivatePageHdl, const OUString&, bool);
std::unique_ptr< ChartTypeTemplateProvider > m_apDocTemplateProvider;
std::unique_ptr< DialogModel > m_apDialogModel;
diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
index d799f1765078..2b265c7d6541 100644
--- a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
+++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
@@ -38,7 +38,6 @@ struct InsertAxisOrGridDialogData
\************************************************************************/
class SchAxisDlg : public weld::GenericDialogController
{
-protected:
std::unique_ptr<weld::CheckButton> m_xCbPrimaryX;
std::unique_ptr<weld::CheckButton> m_xCbPrimaryY;
std::unique_ptr<weld::CheckButton> m_xCbPrimaryZ;
@@ -57,7 +56,7 @@ public:
|* Grid dialog
|*
\************************************************************************/
-class SchGridDlg : public SchAxisDlg
+class SchGridDlg final : public SchAxisDlg
{
public:
SchGridDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput);
diff --git a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
index 54c280ade2fc..7777db3c9696 100644
--- a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
+++ b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
@@ -28,7 +28,7 @@ namespace chart
{
class DataLabelResources;
-class DataLabelsDialog : public weld::GenericDialogController
+class DataLabelsDialog final : public weld::GenericDialogController
{
private:
std::unique_ptr<DataLabelResources> m_apDataLabelResources;
diff --git a/chart2/source/controller/inc/dlg_InsertDataTable.hxx b/chart2/source/controller/inc/dlg_InsertDataTable.hxx
new file mode 100644
index 000000000000..cd77099864c4
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_InsertDataTable.hxx
@@ -0,0 +1,52 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+#include "res_DataTableProperties.hxx"
+
+namespace chart
+{
+/** The data table properties (data) used by the dialog */
+struct DataTableDialogData
+{
+ bool mbShow = true;
+ bool mbHorizontalBorders = false;
+ bool mbVerticalBorders = false;
+ bool mbOutline = false;
+ bool mbKeys = false;
+};
+
+/** The dialog to change the data table specific properties */
+class InsertDataTableDialog final : public weld::GenericDialogController
+{
+private:
+ DataTablePropertiesResources m_aDataTablePropertiesResources;
+ std::unique_ptr<weld::CheckButton> m_xCbShowDataTable;
+
+ DataTableDialogData m_aData;
+
+ DECL_LINK(ShowDataTableToggle, weld::Toggleable&, void);
+
+ void changeEnabled();
+
+public:
+ InsertDataTableDialog(weld::Window* pParent);
+
+ /** Set the initial state of the data table properties */
+ void init(DataTableDialogData const& rData);
+
+ /** Get the state of the data table properties from the dialog */
+ DataTableDialogData& getDataTableDialogData();
+};
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
index d4ef7ec80ef2..4f8e8d094a34 100644
--- a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
+++ b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
@@ -31,19 +31,21 @@ class XModel;
namespace chart
{
-class InsertErrorBarsDialog : public weld::GenericDialogController
+class ChartView;
+
+class InsertErrorBarsDialog final : public weld::GenericDialogController
{
public:
InsertErrorBarsDialog(weld::Window* pParent, const SfxItemSet& rMyAttrs,
- const css::uno::Reference<css::chart2::XChartDocument>& xChartDocument,
+ const rtl::Reference<::chart::ChartModel>& xChartDocument,
ErrorBarResources::tErrorBarType eType);
void SetAxisMinorStepWidthForErrorBarDecimals(double fMinorStepWidth);
- static double getAxisMinorStepWidthForErrorBarDecimals(
- const css::uno::Reference<css::frame::XModel>& xChartModel,
- const css::uno::Reference<css::uno::XInterface>& xChartView,
- const OUString& rSelectedObjectCID);
+ static double
+ getAxisMinorStepWidthForErrorBarDecimals(const rtl::Reference<::chart::ChartModel>& xChartModel,
+ const rtl::Reference<::chart::ChartView>& xChartView,
+ std::u16string_view rSelectedObjectCID);
void FillItemSet(SfxItemSet& rOutAttrs);
diff --git a/chart2/source/controller/inc/dlg_InsertLegend.hxx b/chart2/source/controller/inc/dlg_InsertLegend.hxx
index de073bb0f0bb..0e2cccc3809a 100644
--- a/chart2/source/controller/inc/dlg_InsertLegend.hxx
+++ b/chart2/source/controller/inc/dlg_InsertLegend.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <vcl/weld.hxx>
+#include <rtl/ref.hxx>
#include <memory>
@@ -29,8 +30,9 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class ChartModel;
-class SchLegendDlg : public weld::GenericDialogController
+class SchLegendDlg final : public weld::GenericDialogController
{
private:
std::unique_ptr<LegendPositionResources> m_xLegendPositionResources;
@@ -38,8 +40,8 @@ private:
public:
SchLegendDlg(weld::Window* pParent, const css::uno::Reference< css::uno::XComponentContext>& xCC);
- void init( const css::uno::Reference< css::frame::XModel >& xChartModel );
- void writeToModel( const css::uno::Reference< css::frame::XModel >& xChartModel ) const;
+ void init( const rtl::Reference<::chart::ChartModel>& xChartModel );
+ void writeToModel( const rtl::Reference<::chart::ChartModel>& xChartModel ) const;
};
} //namespace chart
diff --git a/chart2/source/controller/inc/dlg_InsertTitle.hxx b/chart2/source/controller/inc/dlg_InsertTitle.hxx
index 77c3926b3134..096628529e9f 100644
--- a/chart2/source/controller/inc/dlg_InsertTitle.hxx
+++ b/chart2/source/controller/inc/dlg_InsertTitle.hxx
@@ -24,7 +24,7 @@
namespace chart
{
-class SchTitleDlg : public weld::GenericDialogController
+class SchTitleDlg final : public weld::GenericDialogController
{
private:
std::unique_ptr<TitleResources> m_xTitleResources;
diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
index 3a7e87fbe6dc..621f096753e4 100644
--- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx
+++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
@@ -20,9 +20,9 @@
#include <ObjectIdentifier.hxx>
#include <sfx2/tabdlg.hxx>
+#include <vcl/graph.hxx>
namespace com::sun::star::util { class XNumberFormatsSupplier; }
-class Graphic;
namespace chart
{
@@ -30,10 +30,10 @@ namespace chart
class ObjectPropertiesDialogParameter final
{
public:
- ObjectPropertiesDialogParameter( const OUString& rObjectCID );
+ ObjectPropertiesDialogParameter( OUString aObjectCID );
~ObjectPropertiesDialogParameter();
- void init( const css::uno::Reference< css::frame::XModel >& xModel );
+ void init( const rtl::Reference<::chart::ChartModel>& xModel );
ObjectType getObjectType() const { return m_eObjectType;}
const OUString& getLocalizedName() const { return m_aLocalizedName;}
@@ -57,7 +57,7 @@ public:
bool IsSupportingCategoryPositioning() const { return m_bSupportingCategoryPositioning;}
const css::uno::Sequence< OUString >& GetCategories() const { return m_aCategories;}
- const css::uno::Reference< css::chart2::XChartDocument >&
+ const rtl::Reference<::chart::ChartModel>&
getDocument() const { return m_xChartDocument;}
bool IsComplexCategoriesAxis() const { return m_bComplexCategoriesAxis;}
@@ -92,7 +92,7 @@ private:
bool m_bSupportingCategoryPositioning;
css::uno::Sequence< OUString > m_aCategories;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument;
+ rtl::Reference<::chart::ChartModel> m_xChartDocument;
bool m_bComplexCategoriesAxis;
@@ -107,22 +107,22 @@ private:
class ViewElementListProvider;
-class SchAttribTabDlg : public SfxTabDialogController
+class SchAttribTabDlg final : public SfxTabDialogController
{
private:
const ObjectPropertiesDialogParameter * const m_pParameter;
const ViewElementListProvider* const m_pViewElementListProvider;
SvNumberFormatter* m_pNumberFormatter;
- std::unique_ptr<SfxItemSet> m_pSymbolShapeProperties;
- std::unique_ptr<Graphic> m_pAutoSymbolGraphic;
+ std::optional<SfxItemSet> m_oSymbolShapeProperties;
+ std::optional<Graphic> m_oAutoSymbolGraphic;
double m_fAxisMinorStepWidthForErrorBarDecimals;
bool m_bOKPressed;
DECL_LINK(OKPressed, weld::Button&, void);
- virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override;
public:
SchAttribTabDlg(weld::Window* pParent, const SfxItemSet* pAttr,
@@ -133,7 +133,7 @@ public:
//pSymbolShapeProperties: Properties to be set on the symbollist shapes
//pAutoSymbolGraphic: Graphic to be shown if AutoSymbol gets selected
- void setSymbolInformation( std::unique_ptr<SfxItemSet> pSymbolShapeProperties, std::unique_ptr<Graphic> pAutoSymbolGraphic );
+ void setSymbolInformation( SfxItemSet&& rSymbolShapeProperties, std::optional<Graphic> oAutoSymbolGraphic );
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
diff --git a/chart2/source/controller/inc/dlg_ShapeFont.hxx b/chart2/source/controller/inc/dlg_ShapeFont.hxx
index 372ce9a15b2a..cfeb002fb92d 100644
--- a/chart2/source/controller/inc/dlg_ShapeFont.hxx
+++ b/chart2/source/controller/inc/dlg_ShapeFont.hxx
@@ -26,14 +26,14 @@ class ViewElementListProvider;
/** dialog for font properties of shapes
*/
-class ShapeFontDialog : public SfxTabDialogController
+class ShapeFontDialog final : public SfxTabDialogController
{
public:
ShapeFontDialog(weld::Window* pParent, const SfxItemSet* pAttr,
const ViewElementListProvider* pViewElementListProvider);
private:
- virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override;
const ViewElementListProvider* m_pViewElementListProvider;
};
diff --git a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
index 28d04a33eff4..15d0c014d848 100644
--- a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
+++ b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
@@ -24,13 +24,13 @@ namespace chart
{
/** dialog for paragraph properties of shapes
*/
-class ShapeParagraphDialog : public SfxTabDialogController
+class ShapeParagraphDialog final : public SfxTabDialogController
{
public:
ShapeParagraphDialog(weld::Window* pParent, const SfxItemSet* pAttr);
private:
- virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override;
};
} // namespace chart
diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx
index e31668e01f38..66c4a8eaf41a 100644
--- a/chart2/source/controller/inc/dlg_View3D.hxx
+++ b/chart2/source/controller/inc/dlg_View3D.hxx
@@ -32,16 +32,16 @@ class ThreeD_SceneGeometry_TabPage;
class ThreeD_SceneAppearance_TabPage;
class ThreeD_SceneIllumination_TabPage;
-class View3DDialog : public weld::GenericDialogController
+class View3DDialog final : public weld::GenericDialogController
{
public:
- View3DDialog(weld::Window* pWindow, const css::uno::Reference<css::frame::XModel>& xChartModel);
+ View3DDialog(weld::Window* pWindow, const rtl::Reference<::chart::ChartModel>& xChartModel);
virtual ~View3DDialog() override;
virtual short run() override;
private:
- DECL_LINK(ActivatePageHdl, const OString&, void);
+ DECL_LINK(ActivatePageHdl, const OUString&, void);
ControllerLockHelper m_aControllerLocker;
diff --git a/chart2/source/controller/inc/helpids.h b/chart2/source/controller/inc/helpids.h
index 2867867d6323..775ec1489b42 100644
--- a/chart2/source/controller/inc/helpids.h
+++ b/chart2/source/controller/inc/helpids.h
@@ -17,18 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef CHART_HELPIDS_H
-#define CHART_HELPIDS_H
+#pragma once
-#define HID_SCH_WIN_DOCUMENT "CHART2_HID_SCH_WIN_DOCUMENT"
-#define HID_SCH_ERROR_BARS_FROM_DATA "CHART2_SCH_ERROR_BARS_FROM_DATA"
+#include <rtl/ustring.hxx>
+inline constexpr OUString HID_SCH_WIN_DOCUMENT = u"CHART2_HID_SCH_WIN_DOCUMENT"_ustr;
+inline constexpr OUString HID_SCH_ERROR_BARS_FROM_DATA = u"CHART2_SCH_ERROR_BARS_FROM_DATA"_ustr;
-#define HID_SCH_WIZARD_ROADMAP "CHART2_HID_SCH_WIZARD_ROADMAP"
-#define HID_SCH_DATA_SERIES_LABEL "CHART2_HID_SCH_DATA_SERIES_LABEL"
-
-#endif
+inline constexpr OUString HID_SCH_WIZARD_ROADMAP = u"CHART2_HID_SCH_WIZARD_ROADMAP"_ustr;
+inline constexpr OUString HID_SCH_DATA_SERIES_LABEL = u"CHART2_HID_SCH_DATA_SERIES_LABEL"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/res_DataTableProperties.hxx b/chart2/source/controller/inc/res_DataTableProperties.hxx
new file mode 100644
index 000000000000..4b2aaa4f2ef7
--- /dev/null
+++ b/chart2/source/controller/inc/res_DataTableProperties.hxx
@@ -0,0 +1,48 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <svl/itemset.hxx>
+#include <vcl/weld.hxx>
+
+namespace chart
+{
+/** The shared UI elements for the data table properties */
+class DataTablePropertiesResources final
+{
+private:
+ std::unique_ptr<weld::CheckButton> m_xCbHorizontalBorder;
+ std::unique_ptr<weld::CheckButton> m_xCbVerticalBorder;
+ std::unique_ptr<weld::CheckButton> m_xCbOutilne;
+ std::unique_ptr<weld::CheckButton> m_xCbKeys;
+
+public:
+ DataTablePropertiesResources(weld::Builder& rBuilder);
+
+ void initFromItemSet(SfxItemSet const& rInAttrs);
+ bool writeToItemSet(SfxItemSet& rOutAttrs) const;
+ void setChecksSensitive(bool bSensitive);
+
+ bool getHorizontalBorder() { return m_xCbHorizontalBorder->get_active(); }
+ void setHorizontalBorder(bool bActive) { m_xCbHorizontalBorder->set_active(bActive); }
+
+ bool getVerticalBorder() { return m_xCbVerticalBorder->get_active(); }
+ void setVerticalBorder(bool bActive) { m_xCbVerticalBorder->set_active(bActive); }
+
+ bool getOutline() { return m_xCbOutilne->get_active(); }
+ void setOutline(bool bActive) { m_xCbOutilne->set_active(bActive); }
+
+ bool getKeys() { return m_xCbKeys->get_active(); }
+ void setKeys(bool bActive) { m_xCbKeys->set_active(bActive); }
+};
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx
index 00a75e9204ed..c3521d5ba087 100644
--- a/chart2/source/controller/inc/res_ErrorBar.hxx
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -23,6 +23,7 @@
#include <svl/itemset.hxx>
#include <svx/chrtitem.hxx>
#include "RangeSelectionListener.hxx"
+#include <rtl/ref.hxx>
namespace com::sun::star::chart2 { class XChartDocument; }
namespace weld { class Builder; }
@@ -36,15 +37,15 @@ namespace weld { class Image; }
namespace weld { class Label; }
namespace weld { class MetricSpinButton; }
namespace weld { class RadioButton; }
-namespace weld { class ToggleButton; }
+namespace weld { class Toggleable; }
namespace weld { class Widget; }
namespace chart
{
-
+class ChartModel;
class RangeSelectionHelper;
-class ErrorBarResources : public RangeSelectionListenerParent
+class ErrorBarResources final : public RangeSelectionListenerParent
{
public:
enum tErrorBarType
@@ -60,7 +61,7 @@ public:
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
void SetErrorBarType( tErrorBarType eNewType );
void SetChartDocumentForRangeChoosing(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument );
+ const rtl::Reference<::chart::ChartModel> & xChartDocument );
void Reset(const SfxItemSet& rInAttrs);
void FillItemSet(SfxItemSet& rOutAttrs) const;
@@ -124,11 +125,11 @@ private:
std::unique_ptr<weld::Label> m_xUIStringNeg;
std::unique_ptr<weld::Label> m_xUIStringRbRange;
- DECL_LINK( CategoryChosen, weld::ToggleButton&, void );
+ DECL_LINK( CategoryChosen, weld::Toggleable&, void );
DECL_LINK( CategoryChosen2, weld::ComboBox&, void );
- DECL_LINK( SynchronizePosAndNeg, weld::ToggleButton&, void );
+ DECL_LINK( SynchronizePosAndNeg, weld::Toggleable&, void );
DECL_LINK( PosValueChanged, weld::MetricSpinButton&, void );
- DECL_LINK( IndicatorChanged, weld::ToggleButton&, void );
+ DECL_LINK( IndicatorChanged, weld::Toggleable&, void );
DECL_LINK( ChooseRange, weld::Button&, void );
DECL_LINK( RangeChanged, weld::Entry&, void );
diff --git a/chart2/source/controller/inc/res_LegendPosition.hxx b/chart2/source/controller/inc/res_LegendPosition.hxx
index cfe3a12435fe..80ccaa85da6e 100644
--- a/chart2/source/controller/inc/res_LegendPosition.hxx
+++ b/chart2/source/controller/inc/res_LegendPosition.hxx
@@ -20,16 +20,18 @@
#include <svl/itemset.hxx>
#include <tools/link.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star::frame { class XModel; }
namespace com::sun::star::uno { class XComponentContext; }
namespace weld { class Builder; }
namespace weld { class CheckButton; }
namespace weld { class RadioButton; }
-namespace weld { class ToggleButton; }
+namespace weld { class Toggleable; }
namespace chart
{
+class ChartModel;
class LegendPositionResources final
{
@@ -38,23 +40,24 @@ public:
//constructor without Display checkbox
LegendPositionResources(weld::Builder& rBuilder);
//constructor inclusive Display checkbox
- LegendPositionResources(weld::Builder& rBuilder, const css::uno::Reference<
- css::uno::XComponentContext>& xCC );
+ LegendPositionResources(weld::Builder& rBuilder, css::uno::Reference<
+ css::uno::XComponentContext> xCC );
~LegendPositionResources();
- void writeToResources( const css::uno::Reference< css::frame::XModel >& xChartModel );
- void writeToModel( const css::uno::Reference< css::frame::XModel >& xChartModel ) const;
+ void writeToResources( const rtl::Reference<::chart::ChartModel>& xChartModel );
+ void writeToModel( const rtl::Reference<::chart::ChartModel>& xChartModel ) const;
void initFromItemSet( const SfxItemSet& rInAttrs );
void writeToItemSet( SfxItemSet& rOutAttrs ) const;
void SetChangeHdl( const Link<LinkParamNone*,void>& rLink );
- DECL_LINK( PositionEnableHdl, weld::ToggleButton&, void );
- DECL_LINK( PositionChangeHdl, weld::ToggleButton&, void );
+ DECL_LINK( PositionEnableHdl, weld::Toggleable&, void );
+ DECL_LINK( PositionChangeHdl, weld::Toggleable&, void );
private:
void impl_setRadioButtonToggleHdl();
+ void PositionEnable();
private:
css::uno::Reference< css::uno::XComponentContext> m_xCC;
diff --git a/chart2/source/controller/inc/uiobject.hxx b/chart2/source/controller/inc/uiobject.hxx
index 01dc8b500043..6de63f5d3fdf 100644
--- a/chart2/source/controller/inc/uiobject.hxx
+++ b/chart2/source/controller/inc/uiobject.hxx
@@ -14,12 +14,12 @@
#include "ChartWindow.hxx"
-class ChartUIObject : public UIObject
+class ChartUIObject final : public UIObject
{
public:
ChartUIObject(const VclPtr<chart::ChartWindow>& xChartWindow,
- const OUString& rCID);
+ OUString aCID);
StringMap get_state() override;
@@ -32,6 +32,8 @@ public:
virtual OUString get_type() const override;
+ virtual bool equals(const UIObject& rOther) const override;
+
private:
OUString maCID;
@@ -41,7 +43,7 @@ private:
DECL_LINK(PostCommand, void*, void);
};
-class ChartWindowUIObject : public WindowUIObject
+class ChartWindowUIObject final : public WindowUIObject
{
VclPtr<chart::ChartWindow> mxChartWindow;
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
index 297b3de704ee..c91eb41dbe97 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -25,11 +25,15 @@
#include <chartview/ExplicitScaleValues.hxx>
#include <chartview/ExplicitValueProvider.hxx>
#include "SchWhichPairs.hxx"
-#include <ChartModelHelper.hxx>
+#include <ChartModel.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <CommonConverters.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
+#include <Diagram.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <memory>
#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
@@ -37,10 +41,8 @@
#include <com/sun/star/chart/ChartAxisPosition.hpp>
#include <com/sun/star/chart/TimeInterval.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/AxisOrientation.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <osl/diagnose.h>
#include <o3tl/any.hxx>
@@ -79,15 +81,13 @@ AxisItemConverter::AxisItemConverter(
const Reference< beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
- const Reference< chart2::XChartDocument > & xChartDoc,
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
::chart::ExplicitScaleData const * pScale /* = NULL */,
::chart::ExplicitIncrementData const * pIncrement /* = NULL */,
- const awt::Size* pRefSize ) :
+ const std::optional<awt::Size>& pRefSize ) :
ItemConverter( rPropertySet, rItemPool ),
m_xChartDoc( xChartDoc )
{
- Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY );
-
if( pScale )
m_pExplicitScale.reset( new ::chart::ExplicitScaleData( *pScale ) );
if( pIncrement )
@@ -95,13 +95,13 @@ AxisItemConverter::AxisItemConverter(
m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel,
- xNamedPropertyContainerFactory,
+ xChartDoc,
GraphicObjectType::LineProperties ));
m_aConverters.emplace_back(
new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
- m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) );
- OSL_ASSERT( m_xAxis.is());
+ m_xAxis = dynamic_cast<::chart::Axis*>(rPropertySet.get());
+ assert(m_xAxis);
}
AxisItemConverter::~AxisItemConverter()
@@ -128,7 +128,7 @@ bool AxisItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const sal_uInt16 * AxisItemConverter::GetWhichPairs() const
+const WhichRangesContainer& AxisItemConverter::GetWhichPairs() const
{
// must span all used items!
return nAxisWhichPairs;
@@ -179,12 +179,12 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
{
double fMax = 10.0;
if( rScale.Maximum >>= fMax )
- rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
+ rOutItemSet.Put( SvxDoubleItem( fMax, SCHATTR_AXIS_MAX ) );
else
{
if( m_pExplicitScale )
fMax = m_pExplicitScale->Maximum;
- rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
+ rOutItemSet.Put( SvxDoubleItem( fMax, SCHATTR_AXIS_MAX ) );
}
}
break;
@@ -197,9 +197,9 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
{
double fMin = 0.0;
if( rScale.Minimum >>= fMin )
- rOutItemSet.Put( SvxDoubleItem( fMin, nWhichId ) );
+ rOutItemSet.Put( SvxDoubleItem( fMin, SCHATTR_AXIS_MIN ) );
else if( m_pExplicitScale )
- rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, SCHATTR_AXIS_MIN ));
}
break;
@@ -237,17 +237,17 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
{
TimeInterval aTimeInterval;
if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval )
- rOutItemSet.Put( SvxDoubleItem(aTimeInterval.Number, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem(aTimeInterval.Number, SCHATTR_AXIS_STEP_MAIN ));
else if( m_pExplicitIncrement )
- rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->MajorTimeInterval.Number, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->MajorTimeInterval.Number, SCHATTR_AXIS_STEP_MAIN ));
}
else
{
double fDistance = 1.0;
if( rIncrement.Distance >>= fDistance )
- rOutItemSet.Put( SvxDoubleItem(fDistance, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem(fDistance, SCHATTR_AXIS_STEP_MAIN ));
else if( m_pExplicitIncrement )
- rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, SCHATTR_AXIS_STEP_MAIN ));
}
break;
@@ -306,7 +306,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
break;
case SCHATTR_AXIS_TIME_RESOLUTION:
{
- tools::Long nTimeResolution=0;
+ sal_Int32 nTimeResolution=0;
if( rTimeIncrement.TimeResolution >>= nTimeResolution )
rOutItemSet.Put( SfxInt32Item( nWhichId, nTimeResolution ) );
else if( m_pExplicitScale )
@@ -328,7 +328,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
if( m_pExplicitScale )
fOrigin = m_pExplicitScale->Origin;
}
- rOutItemSet.Put( SvxDoubleItem( fOrigin, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( fOrigin, SCHATTR_AXIS_ORIGIN ));
}
break;
@@ -344,7 +344,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
{
double fValue = 0.0;
if( GetPropertySet()->getPropertyValue( "CrossoverValue" ) >>= fValue )
- rOutItemSet.Put( SvxDoubleItem( fValue, nWhichId ) );
+ rOutItemSet.Put( SvxDoubleItem( fValue, SCHATTR_AXIS_POSITION_VALUE ) );
}
break;
@@ -353,10 +353,10 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
//read only item
//necessary tp display the crossing value with an appropriate format
- Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
- m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
+ m_xAxis, m_xChartDoc->getFirstChartDiagram() ) );
- Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) );
+ rtl::Reference< Axis > xCrossingMainAxis = AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys );
sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
xCrossingMainAxis, xCooSys, m_xChartDoc);
@@ -392,7 +392,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal )
{
- rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >(
+ rOutItemSet.Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, Degree100(static_cast< sal_Int32 >(
::rtl::math::round( fVal * 100.0 )) ) ));
}
}
@@ -402,9 +402,9 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
{
if( m_pExplicitScale )
{
- Reference< chart2::XCoordinateSystem > xCooSys(
+ rtl::Reference< BaseCoordinateSystem > xCooSys(
AxisHelper::getCoordinateSystemOfAxis(
- m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+ m_xAxis, m_xChartDoc->getFirstChartDiagram() ) );
sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
m_xAxis, xCooSys, m_xChartDoc);
@@ -432,8 +432,8 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
case SCHATTR_AXIS_ALLOW_DATEAXIS:
{
- Reference< chart2::XCoordinateSystem > xCooSys(
- AxisHelper::getCoordinateSystemOfAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys(
+ AxisHelper::getCoordinateSystemOfAxis( m_xAxis, m_xChartDoc->getFirstChartDiagram() ) );
sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
AxisHelper::getIndicesForAxis(m_xAxis, xCooSys, nDimensionIndex, nAxisIndex );
bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), nDimensionIndex );
@@ -616,7 +616,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
if( aScale.IncrementData.SubIncrements.hasElements() &&
aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() )
{
- aScale.IncrementData.SubIncrements[0].IntervalCount.clear();
+ aScale.IncrementData.SubIncrements.getArray()[0].IntervalCount.clear();
bSetScale = true;
}
if( aScale.TimeIncrement.MinorTimeInterval.hasValue() )
@@ -661,7 +661,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
aScale.IncrementData.SubIncrements[0].IntervalCount != aValue )
{
OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG );
- aScale.IncrementData.SubIncrements[0].IntervalCount = aValue;
+ aScale.IncrementData.SubIncrements.getArray()[0].IntervalCount = aValue;
bSetScale = true;
}
}
@@ -714,14 +714,14 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
if( !AxisHelper::isAxisPositioningEnabled() )
{
//keep old and new settings for axis positioning in sync somehow
- Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
- m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
+ m_xAxis, m_xChartDoc->getFirstChartDiagram() ) );
sal_Int32 nDimensionIndex=0;
sal_Int32 nAxisIndex=0;
if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 )
{
- Reference< beans::XPropertySet > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ), uno::UNO_QUERY );
+ rtl::Reference< Axis > xCrossingMainAxis = AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys );
if( xCrossingMainAxis.is() )
{
double fValue = 0.0;
@@ -756,7 +756,8 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
//move the parallel axes to the other side if necessary
if( eAxisPos==css::chart::ChartAxisPosition_START || eAxisPos==css::chart::ChartAxisPosition_END )
{
- Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY );
+ rtl::Reference<Diagram> xDiagram = m_xChartDoc->getFirstChartDiagram();
+ rtl::Reference< Axis > xParallelAxis = AxisHelper::getParallelAxis( m_xAxis, xDiagram );
if( xParallelAxis.is() )
{
css::chart::ChartAxisPosition eOtherPos;
@@ -791,8 +792,8 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
//keep old and new settings for axis positioning in sync somehow
{
- Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
- m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
+ m_xAxis, m_xChartDoc->getFirstChartDiagram() ) );
sal_Int32 nDimensionIndex=0;
sal_Int32 nAxisIndex=0;
@@ -839,7 +840,8 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
//move the parallel axes to the other side if necessary
if( ePos==css::chart::ChartAxisLabelPosition_OUTSIDE_START || ePos==css::chart::ChartAxisLabelPosition_OUTSIDE_END )
{
- Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY );
+ rtl::Reference<Diagram> xDiagram = m_xChartDoc->getFirstChartDiagram();
+ rtl::Reference< Axis > xParallelAxis = AxisHelper::getParallelAxis( m_xAxis, xDiagram );
if( xParallelAxis.is() )
{
css::chart::ChartAxisLabelPosition eOtherPos;
@@ -878,10 +880,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
case SCHATTR_TEXT_DEGREES:
{
- // convert int to double (divided by 100)
- double fVal = static_cast< double >(
- static_cast< const SdrAngleItem & >(
- rItemSet.Get( nWhichId )).GetValue().get()) / 100.0;
+ double fVal = toDegrees(rItemSet.Get(SCHATTR_TEXT_DEGREES).GetValue());
double fOldVal = 0.0;
bool bPropExisted =
( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal );
@@ -899,8 +898,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
if( m_pExplicitScale )
{
bool bUseSourceFormat =
- static_cast< const SfxBoolItem & >(
- rItemSet.Get( SID_ATTR_NUMBERFORMAT_SOURCE )).GetValue();
+ rItemSet.Get( SID_ATTR_NUMBERFORMAT_SOURCE ).GetValue();
if( ! bUseSourceFormat )
{
@@ -942,9 +940,9 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
}
else
{
- Reference< chart2::XCoordinateSystem > xCooSys(
- AxisHelper::getCoordinateSystemOfAxis(
- m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys =
+ AxisHelper::getCoordinateSystemOfAxis(
+ m_xAxis, m_xChartDoc->getFirstChartDiagram() );
sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
m_xAxis, xCooSys, m_xChartDoc);
diff --git a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
index 49945b2f5803..a338ae70b4b8 100644
--- a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
@@ -33,7 +33,8 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart2/XFormattedString.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
@@ -73,11 +74,11 @@ CharacterPropertyItemConverter::CharacterPropertyItemConverter(
CharacterPropertyItemConverter::CharacterPropertyItemConverter(
const uno::Reference< beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool,
- const awt::Size* pRefSize,
- const OUString & rRefSizePropertyName,
+ const std::optional<awt::Size>& pRefSize,
+ OUString aRefSizePropertyName,
const uno::Reference< beans::XPropertySet > & rRefSizePropSet ) :
ItemConverter( rPropertySet, rItemPool ),
- m_aRefSizePropertyName( rRefSizePropertyName ),
+ m_aRefSizePropertyName(std::move( aRefSizePropertyName )),
m_xRefSizePropSet( rRefSizePropSet.is() ? rRefSizePropSet : rPropertySet )
{
if (pRefSize)
@@ -87,7 +88,7 @@ CharacterPropertyItemConverter::CharacterPropertyItemConverter(
CharacterPropertyItemConverter::~CharacterPropertyItemConverter()
{}
-const sal_uInt16 * CharacterPropertyItemConverter::GetWhichPairs() const
+const WhichRangesContainer& CharacterPropertyItemConverter::GetWhichPairs() const
{
return nCharacterPropertyWhichPairs;
}
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 2c27b6ae7dc1..571f98a56952 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -25,9 +25,12 @@
#include <CharacterPropertyItemConverter.hxx>
#include <StatisticsItemConverter.hxx>
#include <SeriesOptionsItemConverter.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
-#include <DiagramHelper.hxx>
-#include <ChartModelHelper.hxx>
+#include <DataSeriesProperties.hxx>
+#include <Diagram.hxx>
+#include <ChartModel.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <unonames.hxx>
@@ -37,7 +40,8 @@
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/frame/XModel.hpp>
+
+#include <comphelper/sequence.hxx>
#include <svx/xflclit.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
@@ -46,9 +50,8 @@
#include <editeng/brushitem.hxx>
#include <svl/ilstitem.hxx>
#include <svx/sdangitm.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/graph.hxx>
-#include <oox/helper/containerhelper.hxx>
#include <rtl/math.hxx>
#include <svx/tabline.hxx>
@@ -57,6 +60,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
namespace chart::wrapper {
@@ -102,7 +106,7 @@ bool lcl_NumberFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSe
bool bChanged = false;
if( !xPropertySet.is() )
return bChanged;
- OUString aPropertyName = (nWhichId==SID_ATTR_NUMBERFORMAT_VALUE) ? OUString(CHART_UNONAME_NUMFMT) : OUString( "PercentageNumberFormat" );
+ OUString aPropertyName = (nWhichId==SID_ATTR_NUMBERFORMAT_VALUE) ? CHART_UNONAME_NUMFMT : OUString( "PercentageNumberFormat" );
sal_uInt16 nSourceWhich = (nWhichId==SID_ATTR_NUMBERFORMAT_VALUE) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE;
if( rItemSet.GetItemState( nSourceWhich ) != SfxItemState::SET )
@@ -128,7 +132,7 @@ bool lcl_NumberFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSe
uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) );
if( bOverwriteAttributedDataPointsAlso )
{
- Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY);
+ rtl::Reference< DataSeries > xSeries( dynamic_cast<DataSeries*>(xPropertySet.get()) );
if( aValue != aOldValue ||
::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) )
{
@@ -149,7 +153,7 @@ bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxIte
bool bChanged = false;
if( !xPropertySet.is() )
return bChanged;
- OUString aPropertyName = (nWhichId==SID_ATTR_NUMBERFORMAT_SOURCE) ? OUString(CHART_UNONAME_NUMFMT) : OUString( "PercentageNumberFormat" );
+ OUString aPropertyName = (nWhichId==SID_ATTR_NUMBERFORMAT_SOURCE) ? CHART_UNONAME_NUMFMT : OUString( "PercentageNumberFormat" );
sal_uInt16 nFormatWhich = (nWhichId==SID_ATTR_NUMBERFORMAT_SOURCE) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE;
if( rItemSet.GetItemState( nWhichId ) != SfxItemState::SET )
@@ -176,7 +180,7 @@ bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxIte
uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) );
if( bOverwriteAttributedDataPointsAlso )
{
- Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY);
+ rtl::Reference< DataSeries > xSeries( dynamic_cast<DataSeries*>(xPropertySet.get()) );
if( aNewValue != aOldValue ||
::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) )
{
@@ -196,15 +200,15 @@ bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxIte
} // anonymous namespace
DataPointItemConverter::DataPointItemConverter(
- const uno::Reference< frame::XModel > & xChartModel,
+ const rtl::Reference<::chart::ChartModel> & xChartModel,
const uno::Reference< uno::XComponentContext > & xContext,
const uno::Reference< beans::XPropertySet > & rPropertySet,
- const uno::Reference< XDataSeries > & xSeries,
+ const rtl::Reference< DataSeries > & xSeries,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference<lang::XMultiServiceFactory>& xNamedPropertyContainerFactory,
GraphicObjectType eMapTo,
- const awt::Size* pRefSize,
+ const std::optional<awt::Size>& pRefSize,
bool bDataSeries,
bool bUseSpecialFillColor,
sal_Int32 nSpecialFillColor,
@@ -219,7 +223,6 @@ DataPointItemConverter::DataPointItemConverter(
m_nSpecialFillColor(ColorTransparency, nSpecialFillColor),
m_nNumberFormat(nNumberFormat),
m_nPercentNumberFormat(nPercentNumberFormat),
- m_aAvailableLabelPlacements(),
m_bForbidPercentValue(true),
m_bHideLegendEntry(false),
m_nPointIndex(nPointIndex),
@@ -230,15 +233,17 @@ DataPointItemConverter::DataPointItemConverter(
m_aConverters.emplace_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
if( bDataSeries )
{
+ assert(dynamic_cast<DataSeries*>(rPropertySet.get()));
m_aConverters.emplace_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
- m_aConverters.emplace_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
+ m_aConverters.emplace_back( new SeriesOptionsItemConverter( xChartModel, xContext,
+ dynamic_cast<DataSeries*>(rPropertySet.get()), rItemPool ));
}
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
- uno::Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram , xSeries ) );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) );
bool bFound = false;
bool bAmbiguous = false;
- bool bSwapXAndY = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ bool bSwapXAndY = xDiagram->getVertical( bFound, bAmbiguous );
m_aAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements( xChartType, bSwapXAndY, xSeries );
m_bForbidPercentValue = ChartTypeHelper::getAxisType( xChartType, 0 ) != AxisType::CATEGORY;
@@ -246,10 +251,10 @@ DataPointItemConverter::DataPointItemConverter(
if (bDataSeries)
return;
- uno::Reference<beans::XPropertySet> xSeriesProp(xSeries, uno::UNO_QUERY);
uno::Sequence<sal_Int32> deletedLegendEntriesSeq;
- xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq;
- for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+ // "DeletedLegendEntries"
+ xSeries->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntriesSeq;
+ for (const auto& deletedLegendEntry : deletedLegendEntriesSeq)
{
if (nPointIndex == deletedLegendEntry)
{
@@ -289,7 +294,7 @@ bool DataPointItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const sal_uInt16 * DataPointItemConverter::GetWhichPairs() const
+const WhichRangesContainer& DataPointItemConverter::GetWhichPairs() const
{
// must span all used items!
if( m_bDataSeries )
@@ -319,6 +324,7 @@ bool DataPointItemConverter::ApplySpecialItem(
case SCHATTR_DATADESCR_SHOW_NUMBER:
case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
case SCHATTR_DATADESCR_SHOW_CATEGORY:
+ case SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME:
case SCHATTR_DATADESCR_SHOW_SYMBOL:
{
const SfxBoolItem & rItem = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId ));
@@ -329,12 +335,13 @@ bool DataPointItemConverter::ApplySpecialItem(
{
sal_Bool& rValue = (nWhichId==SCHATTR_DATADESCR_SHOW_NUMBER) ? aLabel.ShowNumber : (
(nWhichId==SCHATTR_DATADESCR_SHOW_PERCENTAGE) ? aLabel.ShowNumberInPercent : (
- (nWhichId==SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol ));
+ (nWhichId==SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName : (
+ (nWhichId==SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME) ? aLabel.ShowSeriesName : aLabel.ShowLegendSymbol )));
bool bOldValue = rValue;
rValue = rItem.GetValue();
if( m_bOverwriteLabelsForAttributedDataPointsAlso )
{
- Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
if( bOldValue != bool(rValue) ||
DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, CHART_UNONAME_LABEL , aOldValue ) )
{
@@ -375,7 +382,7 @@ bool DataPointItemConverter::ApplySpecialItem(
GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aOldValue;
if( m_bOverwriteLabelsForAttributedDataPointsAlso )
{
- Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
if( aOldValue != aNewValue ||
DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "LabelSeparator" , uno::Any( aOldValue ) ) )
{
@@ -406,7 +413,7 @@ bool DataPointItemConverter::ApplySpecialItem(
GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld;
if( m_bOverwriteLabelsForAttributedDataPointsAlso )
{
- Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
if( bOld!=bNew ||
DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "TextWordWrap", uno::Any( bOld ) ) )
{
@@ -438,7 +445,7 @@ bool DataPointItemConverter::ApplySpecialItem(
GetPropertySet()->getPropertyValue("LabelPlacement") >>= nOld;
if( m_bOverwriteLabelsForAttributedDataPointsAlso )
{
- Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
if( nOld!=nNew ||
DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "LabelPlacement" , uno::Any( nOld ) ) )
{
@@ -450,6 +457,7 @@ bool DataPointItemConverter::ApplySpecialItem(
{
GetPropertySet()->setPropertyValue("LabelPlacement", uno::Any(nNew));
GetPropertySet()->setPropertyValue("CustomLabelPosition", uno::Any());
+ GetPropertySet()->setPropertyValue("CustomLabelSize", uno::Any());
bChanged = true;
}
}
@@ -548,9 +556,7 @@ bool DataPointItemConverter::ApplySpecialItem(
case SCHATTR_TEXT_DEGREES:
{
- double fValue = static_cast< double >(
- static_cast< const SdrAngleItem & >(
- rItemSet.Get( nWhichId )).GetValue().get()) / 100.0;
+ double fValue = toDegrees(rItemSet.Get(SCHATTR_TEXT_DEGREES).GetValue());
double fOldValue = 0.0;
bool bPropExisted =
( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldValue );
@@ -569,17 +575,18 @@ bool DataPointItemConverter::ApplySpecialItem(
if (bHideLegendEntry != m_bHideLegendEntry)
{
uno::Sequence<sal_Int32> deletedLegendEntriesSeq;
- Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
- xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq;
+ // "DeletedLegendEntries"
+ m_xSeries->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntriesSeq;
std::vector<sal_Int32> deletedLegendEntries;
- for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+ for (const auto& deletedLegendEntry : deletedLegendEntriesSeq)
{
if (bHideLegendEntry || m_nPointIndex != deletedLegendEntry)
deletedLegendEntries.push_back(deletedLegendEntry);
}
if (bHideLegendEntry)
deletedLegendEntries.push_back(m_nPointIndex);
- xSeriesProp->setPropertyValue("DeletedLegendEntries", uno::makeAny(oox::ContainerHelper::vectorToSequence(deletedLegendEntries)));
+ // "DeletedLegendEntries"
+ m_xSeries->setFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES, uno::Any(comphelper::containerToSequence(deletedLegendEntries)));
}
}
break;
@@ -590,10 +597,9 @@ bool DataPointItemConverter::ApplySpecialItem(
{
bool bNew = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
bool bOld = true;
- Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
- if( (xSeriesProp->getPropertyValue("ShowCustomLeaderLines") >>= bOld) && bOld != bNew )
+ if( (m_xSeries->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES) >>= bOld) && bOld != bNew )
{
- xSeriesProp->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew));
+ m_xSeries->setFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, uno::Any(bNew));
bChanged = true;
}
}
@@ -616,6 +622,7 @@ void DataPointItemConverter::FillSpecialItem(
case SCHATTR_DATADESCR_SHOW_NUMBER:
case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
case SCHATTR_DATADESCR_SHOW_CATEGORY:
+ case SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME:
case SCHATTR_DATADESCR_SHOW_SYMBOL:
{
chart2::DataPointLabel aLabel;
@@ -623,14 +630,15 @@ void DataPointItemConverter::FillSpecialItem(
{
bool bValue = (nWhichId==SCHATTR_DATADESCR_SHOW_NUMBER) ? aLabel.ShowNumber : (
(nWhichId==SCHATTR_DATADESCR_SHOW_PERCENTAGE) ? aLabel.ShowNumberInPercent : (
- (nWhichId==SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol ));
+ (nWhichId==SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName : (
+ (nWhichId==SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME) ? aLabel.ShowSeriesName : aLabel.ShowLegendSymbol )));
rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
if( m_bOverwriteLabelsForAttributedDataPointsAlso )
{
if( DataSeriesHelper::hasAttributedDataPointDifferentValue(
- Reference< chart2::XDataSeries >( GetPropertySet(), uno::UNO_QUERY), CHART_UNONAME_LABEL , uno::Any(aLabel) ) )
+ dynamic_cast<DataSeries*>(GetPropertySet().get()), CHART_UNONAME_LABEL , uno::Any(aLabel) ) )
{
rOutItemSet.InvalidateItem(nWhichId);
}
@@ -755,8 +763,7 @@ void DataPointItemConverter::FillSpecialItem(
try
{
bool bValue = true;
- Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
- if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue )
+ if( m_xSeries->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES ) >>= bValue )
rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
}
catch (const uno::Exception&)
@@ -800,7 +807,7 @@ void DataPointItemConverter::FillSpecialItem(
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fValue )
{
- rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >(
+ rOutItemSet.Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, Degree100(static_cast< sal_Int32 >(
::rtl::math::round( fValue * 100.0 ) ) )));
}
}
diff --git a/chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx
new file mode 100644
index 000000000000..e152bf298dfc
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx
@@ -0,0 +1,92 @@
+/* -*- 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 <DataTableItemConverter.hxx>
+#include <ItemPropertyMap.hxx>
+#include <CharacterPropertyItemConverter.hxx>
+#include <GraphicPropertyItemConverter.hxx>
+#include <chartview/ChartSfxItemIds.hxx>
+#include "SchWhichPairs.hxx"
+#include <ChartModel.hxx>
+#include <memory>
+
+using namespace css;
+
+namespace chart::wrapper
+{
+namespace
+{
+ItemPropertyMapType& lclDataTablePropertyMap()
+{
+ static ItemPropertyMapType aPropertyMap{
+ { SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, { "HBorder", 0 } },
+ { SCHATTR_DATA_TABLE_VERTICAL_BORDER, { "VBorder", 0 } },
+ { SCHATTR_DATA_TABLE_OUTLINE, { "Outline", 0 } },
+ { SCHATTR_DATA_TABLE_KEYS, { "Keys", 0 } },
+ };
+ return aPropertyMap;
+};
+}
+
+DataTableItemConverter::DataTableItemConverter(
+ const uno::Reference<beans::XPropertySet>& rPropertySet, SfxItemPool& rItemPool,
+ SdrModel& rDrawModel, const rtl::Reference<::chart::ChartModel>& xChartDoc)
+ : ItemConverter(rPropertySet, rItemPool)
+{
+ m_aConverters.emplace_back(new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel, xChartDoc, GraphicObjectType::LineProperties));
+ m_aConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool));
+}
+
+DataTableItemConverter::~DataTableItemConverter() = default;
+
+void DataTableItemConverter::FillItemSet(SfxItemSet& rOutItemSet) const
+{
+ for (const auto& pConv : m_aConverters)
+ {
+ pConv->FillItemSet(rOutItemSet);
+ }
+
+ // own items
+ ItemConverter::FillItemSet(rOutItemSet);
+}
+
+bool DataTableItemConverter::ApplyItemSet(const SfxItemSet& rItemSet)
+{
+ bool bResult = false;
+
+ for (const auto& pConv : m_aConverters)
+ {
+ bResult = pConv->ApplyItemSet(rItemSet) || bResult;
+ }
+
+ // own items
+ return ItemConverter::ApplyItemSet(rItemSet) || bResult;
+}
+
+const WhichRangesContainer& DataTableItemConverter::GetWhichPairs() const
+{
+ return nDataTableWhichPairs;
+}
+
+bool DataTableItemConverter::GetItemProperty(tWhichIdType nWhichId,
+ tPropertyNameWithMemberId& rOutProperty) const
+{
+ ItemPropertyMapType& rMap(lclDataTablePropertyMap());
+ auto aIt = rMap.find(nWhichId);
+ if (aIt == rMap.cend())
+ return false;
+
+ rOutProperty = (*aIt).second;
+
+ return true;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx
index 5a8114c215c9..33e09062a9a7 100644
--- a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx
@@ -30,7 +30,8 @@
#include <com/sun/star/chart2/XInternalDataProvider.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
@@ -78,7 +79,7 @@ namespace chart::wrapper
{
ErrorBarItemConverter::ErrorBarItemConverter(
- const uno::Reference< frame::XModel > & xModel,
+ uno::Reference< frame::XModel > xModel,
const uno::Reference< beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
@@ -88,7 +89,7 @@ ErrorBarItemConverter::ErrorBarItemConverter(
rPropertySet, rItemPool, rDrawModel,
xNamedPropertyContainerFactory,
GraphicObjectType::LineProperties )),
- m_xModel( xModel )
+ m_xModel(std::move( xModel ))
{}
ErrorBarItemConverter::~ErrorBarItemConverter()
@@ -110,7 +111,7 @@ bool ErrorBarItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const sal_uInt16 * ErrorBarItemConverter::GetWhichPairs() const
+const WhichRangesContainer& ErrorBarItemConverter::GetWhichPairs() const
{
// must span all used items!
return nErrorBarWhichPairs;
@@ -356,7 +357,7 @@ void ErrorBarItemConverter::FillSpecialItem(
{
double fPos(0.0), fNeg(0.0);
lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
- rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, SCHATTR_STAT_PERCENT ));
}
break;
@@ -364,7 +365,7 @@ void ErrorBarItemConverter::FillSpecialItem(
{
double fPos(0.0), fNeg(0.0);
lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
- rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, SCHATTR_STAT_BIGERROR ));
}
break;
@@ -372,7 +373,7 @@ void ErrorBarItemConverter::FillSpecialItem(
{
double fPos(0.0), fNeg(0.0);
lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
- rOutItemSet.Put( SvxDoubleItem( fPos, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( fPos, SCHATTR_STAT_CONSTPLUS ));
}
break;
@@ -380,7 +381,7 @@ void ErrorBarItemConverter::FillSpecialItem(
{
double fPos(0.0), fNeg(0.0);
lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
- rOutItemSet.Put( SvxDoubleItem( fNeg, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( fNeg, SCHATTR_STAT_CONSTMINUS ));
}
break;
diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
index 55e954e946d9..ac0b961ba2e4 100644
--- a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
@@ -39,7 +39,8 @@
#include <com/sun/star/drawing/BitmapMode.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
@@ -137,33 +138,32 @@ GraphicPropertyItemConverter::GraphicPropertyItemConverter(
beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
- const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ uno::Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory,
GraphicObjectType eObjectType /* = FILL_PROPERTIES */ ) :
ItemConverter( rPropertySet, rItemPool ),
m_GraphicObjectType( eObjectType ),
m_rDrawModel( rDrawModel ),
- m_xNamedPropertyTableFactory( xNamedPropertyContainerFactory )
+ m_xNamedPropertyTableFactory(std::move( xNamedPropertyContainerFactory ))
{}
GraphicPropertyItemConverter::~GraphicPropertyItemConverter()
{}
-const sal_uInt16 * GraphicPropertyItemConverter::GetWhichPairs() const
+const WhichRangesContainer& GraphicPropertyItemConverter::GetWhichPairs() const
{
- const sal_uInt16 * pResult = nullptr;
-
switch( m_GraphicObjectType )
{
case GraphicObjectType::LineDataPoint:
case GraphicObjectType::FilledDataPoint:
- pResult = nRowWhichPairs; break;
+ return nRowWhichPairs;
case GraphicObjectType::LineProperties:
- pResult = nLinePropertyWhichPairs; break;
+ return nLinePropertyWhichPairs;
case GraphicObjectType::LineAndFillProperties:
- pResult = nLineAndFillPropertyWhichPairs; break;
+ return nLineAndFillPropertyWhichPairs;
}
- return pResult;
+ static const WhichRangesContainer empty;
+ return empty;
}
bool GraphicPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
@@ -426,7 +426,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem(
case XATTR_FILLBMP_STRETCH:
if( lcl_supportsFillProperties( m_GraphicObjectType ))
{
- const OUString aModePropName("FillBitmapMode");
+ static constexpr OUString aModePropName(u"FillBitmapMode"_ustr);
bool bStretched = rItemSet.Get( XATTR_FILLBMP_STRETCH ).GetValue();
drawing::BitmapMode aMode =
(bStretched ? drawing::BitmapMode_STRETCH : drawing::BitmapMode_NO_REPEAT);
@@ -448,7 +448,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem(
case XATTR_FILLBMP_TILE:
if( lcl_supportsFillProperties( m_GraphicObjectType ))
{
- const OUString aModePropName("FillBitmapMode");
+ static constexpr OUString aModePropName(u"FillBitmapMode"_ustr);
bool bTiled = rItemSet.Get( XATTR_FILLBMP_TILE ).GetValue();
drawing::BitmapMode aMode =
(bTiled ? drawing::BitmapMode_REPEAT : drawing::BitmapMode_NO_REPEAT);
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
index a99d848d0c8c..3d4cf2abc309 100644
--- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
@@ -25,17 +25,18 @@
#include <svl/itemiter.hxx>
#include <svl/whiter.hxx>
#include <svx/svxids.hrc>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
+#include <utility>
using namespace ::com::sun::star;
namespace chart::wrapper {
ItemConverter::ItemConverter(
- const uno::Reference< beans::XPropertySet > & rPropertySet,
+ uno::Reference< beans::XPropertySet > xPropertySet,
SfxItemPool& rItemPool ) :
- m_xPropertySet( rPropertySet ),
+ m_xPropertySet(std::move( xPropertySet )),
m_rItemPool( rItemPool )
{
resetPropertySet( m_xPropertySet );
@@ -75,20 +76,18 @@ void ItemConverter::_disposing( const lang::EventObject& )
void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
{
- const sal_uInt16 * pRanges = rOutItemSet.GetRanges();
+ const WhichRangesContainer& pRanges = rOutItemSet.GetRanges();
tPropertyNameWithMemberId aProperty;
SfxItemPool & rPool = GetItemPool();
- assert(pRanges != nullptr);
+ assert(!pRanges.empty());
OSL_ASSERT( m_xPropertySetInfo.is());
OSL_ASSERT( m_xPropertySet.is());
- while( (*pRanges) != 0)
+ for(const auto& rPair : pRanges)
{
- sal_uInt16 nBeg = *pRanges;
- ++pRanges;
- sal_uInt16 nEnd = *pRanges;
- ++pRanges;
+ sal_uInt16 nBeg = rPair.first;
+ sal_uInt16 nEnd = rPair.second;
OSL_ASSERT( nBeg <= nEnd );
for( sal_uInt16 nWhich = nBeg; nWhich <= nEnd; ++nWhich )
@@ -96,7 +95,7 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
if( GetItemProperty( nWhich, aProperty ))
{
// put the Property into the itemset
- std::unique_ptr<SfxPoolItem> pItem(rPool.GetDefaultItem( nWhich ).Clone());
+ std::unique_ptr<SfxPoolItem> pItem(rPool.GetUserOrPoolDefaultItem( nWhich ).Clone());
if( pItem )
{
@@ -159,7 +158,7 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
- if( rItemSet.GetItemState( pItem->Which(), false ) == SfxItemState::SET )
+ if( aIter.GetItemState( false ) == SfxItemState::SET )
{
if( GetItemProperty( pItem->Which(), aProperty ))
{
@@ -200,7 +199,8 @@ void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItem
while (nWhich)
{
- if ((rSourceSet.GetItemState(nWhich, true, &pPoolItem) == SfxItemState::SET) &&
+ SfxItemState nSourceItemState = aIter.GetItemState(true, &pPoolItem);
+ if ((nSourceItemState == SfxItemState::SET) &&
(rDestSet.GetItemState(nWhich, true, &pPoolItem) == SfxItemState::SET))
{
if (rSourceSet.Get(nWhich) != rDestSet.Get(nWhich))
@@ -211,7 +211,7 @@ void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItem
}
}
}
- else if( rSourceSet.GetItemState(nWhich, true, &pPoolItem) == SfxItemState::DONTCARE )
+ else if( nSourceItemState == SfxItemState::INVALID )
rDestSet.InvalidateItem(nWhich);
nWhich = aIter.NextWhich ();
diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
index 9ae14be68a21..255445764b04 100644
--- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
@@ -27,7 +27,7 @@
#include <svl/intitem.hxx>
#include <svl/eitem.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <memory>
@@ -41,7 +41,7 @@ LegendItemConverter::LegendItemConverter(
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
- const awt::Size* pRefSize ) :
+ const std::optional<awt::Size>& pRefSize ) :
ItemConverter( rPropertySet, rItemPool )
{
m_aConverters.emplace_back( new GraphicPropertyItemConverter(
@@ -76,7 +76,7 @@ bool LegendItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const sal_uInt16 * LegendItemConverter::GetWhichPairs() const
+const WhichRangesContainer& LegendItemConverter::GetWhichPairs() const
{
// must span all used items!
return nLegendWhichPairs;
@@ -96,10 +96,9 @@ bool LegendItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSe
{
case SCHATTR_LEGEND_SHOW:
{
- const SfxPoolItem* pPoolItem = nullptr;
- if( rInItemSet.GetItemState( SCHATTR_LEGEND_SHOW, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxBoolItem* pShowItem = rInItemSet.GetItemIfSet( SCHATTR_LEGEND_SHOW ) )
{
- bool bShow = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ bool bShow = pShowItem->GetValue();
bool bWasShown = true;
if( ! (GetPropertySet()->getPropertyValue( "Show" ) >>= bWasShown) ||
( bWasShown != bShow ))
@@ -113,10 +112,9 @@ bool LegendItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSe
break;
case SCHATTR_LEGEND_POS:
{
- const SfxPoolItem* pPoolItem = nullptr;
- if( rInItemSet.GetItemState( SCHATTR_LEGEND_POS, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxInt32Item* pPosItem = rInItemSet.GetItemIfSet( SCHATTR_LEGEND_POS ) )
{
- chart2::LegendPosition eNewPos = static_cast<chart2::LegendPosition>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
+ chart2::LegendPosition eNewPos = static_cast<chart2::LegendPosition>(pPosItem->GetValue());
css::chart::ChartLegendExpansion eExpansion = css::chart::ChartLegendExpansion_HIGH;
switch( eNewPos )
@@ -154,10 +152,9 @@ bool LegendItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSe
break;
case SCHATTR_LEGEND_NO_OVERLAY:
{
- const SfxPoolItem* pPoolItem = nullptr;
- if(rInItemSet.GetItemState(SCHATTR_LEGEND_NO_OVERLAY, true, &pPoolItem) == SfxItemState::SET)
+ if(const SfxBoolItem* pNoOverlayItem = rInItemSet.GetItemIfSet(SCHATTR_LEGEND_NO_OVERLAY))
{
- bool bOverlay = !static_cast<const SfxBoolItem *>(pPoolItem)->GetValue();
+ bool bOverlay = !pNoOverlayItem->GetValue();
bool bOldOverlay = false;
if(!(GetPropertySet()->getPropertyValue("Overlay") >>= bOldOverlay) ||
(bOldOverlay != bOverlay))
diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
index 8351e5bf02ab..ef0a1fc4c098 100644
--- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
+++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
@@ -25,15 +25,15 @@
#include <GraphicPropertyItemConverter.hxx>
#include <DataPointItemConverter.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartModel.hxx>
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
+#include <GridProperties.hxx>
#include <TitleHelper.hxx>
#include <TitleItemConverter.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <chartview/ExplicitValueProvider.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XDataSeries.hpp>
-#include <com/sun/star/chart2/XTitle.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/chart2/XAxis.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -43,20 +43,20 @@ using ::com::sun::star::uno::Sequence;
namespace chart::wrapper {
AllAxisItemConverter::AllAxisItemConverter(
- const uno::Reference< frame::XModel > & xChartModel,
+ const rtl::Reference<::chart::ChartModel> & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
- const awt::Size* pRefSize )
+ const std::optional<awt::Size>& pRefSize )
: MultipleItemConverter( rItemPool )
{
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- const Sequence< Reference< XAxis > > aElementList( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
- for( Reference< XAxis > const & axis : aElementList )
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
+ const std::vector< rtl::Reference< Axis > > aElementList = AxisHelper::getAllAxesOfDiagram( xDiagram );
+ for( rtl::Reference< Axis > const & axis : aElementList )
{
- uno::Reference< beans::XPropertySet > xObjectProperties(axis, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xObjectProperties(axis);
m_aConverters.emplace_back( new ::chart::wrapper::AxisItemConverter(
xObjectProperties, rItemPool, rDrawModel,
- uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), nullptr, nullptr,
+ xChartModel, nullptr, nullptr,
pRefSize));
}
}
@@ -65,22 +65,22 @@ AllAxisItemConverter::~AllAxisItemConverter()
{
}
-const sal_uInt16 * AllAxisItemConverter::GetWhichPairs() const
+const WhichRangesContainer& AllAxisItemConverter::GetWhichPairs() const
{
// must span all used items!
return nAllAxisWhichPairs;
}
AllGridItemConverter::AllGridItemConverter(
- const uno::Reference< frame::XModel > & xChartModel,
+ const rtl::Reference<::chart::ChartModel> & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory )
: MultipleItemConverter( rItemPool )
{
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- const Sequence< Reference< beans::XPropertySet > > aElementList( AxisHelper::getAllGrids( xDiagram ) );
- for( Reference< beans::XPropertySet > const & xObjectProperties : aElementList )
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
+ std::vector< rtl::Reference< GridProperties > > aElementList( AxisHelper::getAllGrids( xDiagram ) );
+ for( rtl::Reference< GridProperties > const & xObjectProperties : aElementList )
{
m_aConverters.emplace_back( new ::chart::wrapper::GraphicPropertyItemConverter(
xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
@@ -92,36 +92,35 @@ AllGridItemConverter::~AllGridItemConverter()
{
}
-const sal_uInt16 * AllGridItemConverter::GetWhichPairs() const
+const WhichRangesContainer& AllGridItemConverter::GetWhichPairs() const
{
// must span all used items!
return nGridWhichPairs;
}
AllDataLabelItemConverter::AllDataLabelItemConverter(
- const uno::Reference< frame::XModel > & xChartModel,
+ const rtl::Reference<::chart::ChartModel> & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory )
: MultipleItemConverter( rItemPool )
{
- std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
- ::chart::ChartModelHelper::getDataSeries( xChartModel ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesList =
+ ::chart::ChartModelHelper::getDataSeries( xChartModel );
for (auto const& series : aSeriesList)
{
- uno::Reference< beans::XPropertySet > xObjectProperties(series, uno::UNO_QUERY);
uno::Reference< uno::XComponentContext> xContext;//do not need Context for label properties
- sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties );
+ sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( series );
sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
- xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
+ series,xChartModel);
m_aConverters.emplace_back(
new ::chart::wrapper::DataPointItemConverter(
- xChartModel, xContext, xObjectProperties, series, rItemPool, rDrawModel,
+ xChartModel, xContext, series, series, rItemPool, rDrawModel,
xNamedPropertyContainerFactory, GraphicObjectType::FilledDataPoint,
- nullptr, true, false, 0, true, nNumberFormat, nPercentNumberFormat));
+ std::nullopt, true, false, 0, true, nNumberFormat, nPercentNumberFormat));
}
}
@@ -129,14 +128,14 @@ AllDataLabelItemConverter::~AllDataLabelItemConverter()
{
}
-const sal_uInt16 * AllDataLabelItemConverter::GetWhichPairs() const
+const WhichRangesContainer& AllDataLabelItemConverter::GetWhichPairs() const
{
// must span all used items!
return nDataLabelWhichPairs;
}
AllTitleItemConverter::AllTitleItemConverter(
- const uno::Reference< frame::XModel > & xChartModel,
+ const rtl::Reference<::chart::ChartModel> & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory )
@@ -144,13 +143,13 @@ AllTitleItemConverter::AllTitleItemConverter(
{
for(sal_Int32 nTitle = TitleHelper::TITLE_BEGIN; nTitle < TitleHelper::NORMAL_TITLE_END; nTitle++ )
{
- uno::Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( TitleHelper::eTitleType(nTitle), xChartModel ) );
+ rtl::Reference< Title > xTitle( TitleHelper::getTitle( TitleHelper::eTitleType(nTitle), xChartModel ) );
if(!xTitle.is())
continue;
- uno::Reference< beans::XPropertySet > xObjectProperties( xTitle, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xObjectProperties( xTitle );
m_aConverters.emplace_back(
new ::chart::wrapper::TitleItemConverter(
- xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, nullptr));
+ xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, std::nullopt));
}
}
@@ -158,32 +157,31 @@ AllTitleItemConverter::~AllTitleItemConverter()
{
}
-const sal_uInt16 * AllTitleItemConverter::GetWhichPairs() const
+const WhichRangesContainer& AllTitleItemConverter::GetWhichPairs() const
{
// must span all used items!
return nTitleWhichPairs;
}
AllSeriesStatisticsConverter::AllSeriesStatisticsConverter(
- const uno::Reference< frame::XModel > & xChartModel,
+ const rtl::Reference<::chart::ChartModel> & xChartModel,
SfxItemPool& rItemPool )
: MultipleItemConverter( rItemPool )
{
- std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
- ::chart::ChartModelHelper::getDataSeries( xChartModel ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesList =
+ ::chart::ChartModelHelper::getDataSeries( xChartModel );
for (auto const& series : aSeriesList)
{
- uno::Reference< beans::XPropertySet > xObjectProperties(series, uno::UNO_QUERY);
m_aConverters.emplace_back( new ::chart::wrapper::StatisticsItemConverter(
- xChartModel, xObjectProperties, rItemPool ));
+ xChartModel, series, rItemPool ));
}
}
AllSeriesStatisticsConverter::~AllSeriesStatisticsConverter()
{}
-const sal_uInt16 * AllSeriesStatisticsConverter::GetWhichPairs() const
+const WhichRangesContainer& AllSeriesStatisticsConverter::GetWhichPairs() const
{
// must span all used items!
return nStatWhichPairs;
diff --git a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
index 8859158ac5b8..da521d874df6 100644
--- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
@@ -18,9 +18,11 @@
*/
#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <RegressionCurveItemConverter.hxx>
#include "SchWhichPairs.hxx"
#include <GraphicPropertyItemConverter.hxx>
+#include <DataSeries.hxx>
#include <com/sun/star/chart2/XRegressionCurve.hpp>
#include <osl/diagnose.h>
@@ -28,6 +30,7 @@
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
+#include <utility>
using namespace ::com::sun::star;
@@ -65,12 +68,12 @@ void lclConvertToItemSet(SfxItemSet& rItemSet, sal_uInt16 nWhichId, const uno::R
}
}
-void lclConvertToItemSetDouble(SfxItemSet& rItemSet, sal_uInt16 nWhichId, const uno::Reference<beans::XPropertySet>& xProperties, const OUString& aPropertyID)
+void lclConvertToItemSetDouble(SfxItemSet& rItemSet, TypedWhichId<SvxDoubleItem> nWhichId, const uno::Reference<beans::XPropertySet>& xProperties, const OUString& aPropertyID)
{
OSL_ASSERT(xProperties.is());
if( xProperties.is() )
{
- double aValue = static_cast<const SvxDoubleItem&>(rItemSet.Get( nWhichId )).GetValue();
+ double aValue = rItemSet.Get( nWhichId ).GetValue();
if(xProperties->getPropertyValue( aPropertyID ) >>= aValue)
{
rItemSet.Put(SvxDoubleItem( aValue, nWhichId ));
@@ -85,7 +88,7 @@ namespace chart::wrapper
RegressionCurveItemConverter::RegressionCurveItemConverter(
const uno::Reference< beans::XPropertySet >& rPropertySet,
- const uno::Reference< chart2::XRegressionCurveContainer >& xContainer,
+ rtl::Reference< DataSeries > xContainer,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory ) :
@@ -94,7 +97,7 @@ RegressionCurveItemConverter::RegressionCurveItemConverter(
rPropertySet, rItemPool, rDrawModel,
xNamedPropertyContainerFactory,
GraphicObjectType::LineProperties )),
- m_xCurveContainer( xContainer )
+ m_xCurveContainer(std::move( xContainer ))
{}
RegressionCurveItemConverter::~RegressionCurveItemConverter()
@@ -116,7 +119,7 @@ bool RegressionCurveItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const sal_uInt16 * RegressionCurveItemConverter::GetWhichPairs() const
+const WhichRangesContainer& RegressionCurveItemConverter::GetWhichPairs() const
{
// must span all used items!
return nRegressionCurveWhichPairs;
@@ -212,6 +215,13 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
}
break;
+ case SCHATTR_REGRESSION_MOVING_TYPE:
+ {
+ uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
+ bChanged = lclConvertToPropertySet<sal_Int32, SfxInt32Item>(rItemSet, nWhichId, xProperties, "MovingAverageType");
+ }
+ break;
+
case SCHATTR_REGRESSION_SHOW_EQUATION:
{
uno::Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties());
@@ -276,13 +286,13 @@ void RegressionCurveItemConverter::FillSpecialItem(sal_uInt16 nWhichId, SfxItemS
case SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD:
{
- lclConvertToItemSetDouble(rOutItemSet, nWhichId, xProperties, "ExtrapolateForward");
+ lclConvertToItemSetDouble(rOutItemSet, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD, xProperties, "ExtrapolateForward");
}
break;
case SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD:
{
- lclConvertToItemSetDouble(rOutItemSet, nWhichId, xProperties, "ExtrapolateBackward");
+ lclConvertToItemSetDouble(rOutItemSet, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD, xProperties, "ExtrapolateBackward");
}
break;
@@ -294,7 +304,7 @@ void RegressionCurveItemConverter::FillSpecialItem(sal_uInt16 nWhichId, SfxItemS
case SCHATTR_REGRESSION_INTERCEPT_VALUE:
{
- lclConvertToItemSetDouble(rOutItemSet, nWhichId, xProperties, "InterceptValue");
+ lclConvertToItemSetDouble(rOutItemSet, SCHATTR_REGRESSION_INTERCEPT_VALUE, xProperties, "InterceptValue");
}
break;
@@ -304,6 +314,12 @@ void RegressionCurveItemConverter::FillSpecialItem(sal_uInt16 nWhichId, SfxItemS
}
break;
+ case SCHATTR_REGRESSION_MOVING_TYPE:
+ {
+ lclConvertToItemSet<sal_Int32, SfxInt32Item>(rOutItemSet, nWhichId, xProperties, "MovingAverageType");
+ }
+ break;
+
case SCHATTR_REGRESSION_SHOW_EQUATION:
{
lclConvertToItemSet<bool, SfxBoolItem>(rOutItemSet, nWhichId, xCurve->getEquationProperties(), "ShowEquation");
diff --git a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx
index 234d2b5ba47f..9b10afd4f79d 100644
--- a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx
@@ -49,7 +49,7 @@ RegressionEquationItemConverter::RegressionEquationItemConverter(
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
- const awt::Size* pRefSize ) :
+ const std::optional<awt::Size>& pRefSize ) :
ItemConverter( rPropertySet, rItemPool )
{
m_aConverters.emplace_back( new GraphicPropertyItemConverter(
@@ -85,7 +85,7 @@ bool RegressionEquationItemConverter::ApplyItemSet( const SfxItemSet & rItemSet
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const sal_uInt16 * RegressionEquationItemConverter::GetWhichPairs() const
+const WhichRangesContainer& RegressionEquationItemConverter::GetWhichPairs() const
{
// must span all used items!
return nRegEquationWhichPairs;
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
index ac08f2c99cf6..676527f3fef3 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -18,6 +18,7 @@
*/
#pragma once
+#include <svl/whichranges.hxx>
#include <svx/svxids.hrc>
#include <svx/xdef.hxx>
#include <svx/svddef.hxx>
@@ -25,178 +26,156 @@
#include <chartview/ChartSfxItemIds.hxx>
-#define CHARACTER_WHICHPAIRS \
- EE_ITEMS_START, EE_ITEMS_END, \
- SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING
-
-const sal_uInt16 nTitleWhichPairs[] =
-{
+const WhichRangesContainer nTitleWhichPairs(svl::Items<
SCHATTR_TEXT_START, SCHATTR_TEXT_END,
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
- CHARACTER_WHICHPAIRS,
- 0
-};
+ EE_ITEMS_START, EE_ITEMS_END, // Characters
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING // Characters
+>);
-const sal_uInt16 nAxisWhichPairs[] =
-{
+const WhichRangesContainer nAxisWhichPairs(svl::Items<
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END,
+ SCHATTR_AXIS_START, SCHATTR_AXIS_END,
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
- CHARACTER_WHICHPAIRS,
+ EE_ITEMS_START, EE_ITEMS_END, // Characters
SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE, // 10585 - 10585 svx/svxids.hrc
SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, // 11432 svx/svxids.hrc
- SCHATTR_AXIS_START, SCHATTR_AXIS_END,
- SCHATTR_TEXT_START, SCHATTR_TEXT_END,
- 0
-};
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING // Characters
+>);
-const sal_uInt16 nAllAxisWhichPairs[] =
-{
- XATTR_LINE_FIRST, XATTR_LINE_LAST,
- CHARACTER_WHICHPAIRS,
- SCHATTR_AXIS_LABEL_START, SCHATTR_AXIS_LABEL_END,
+const WhichRangesContainer nAllAxisWhichPairs(svl::Items<
SCHATTR_TEXT_START, SCHATTR_TEXT_END,
- 0
-};
+ SCHATTR_AXIS_LABEL_START, SCHATTR_AXIS_LABEL_END,
+ XATTR_LINE_FIRST, XATTR_LINE_LAST,
+ EE_ITEMS_START, EE_ITEMS_END, // Characters
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING // Characters
+>);
-const sal_uInt16 nGridWhichPairs[] =
-{
- XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
- 0
-};
+const WhichRangesContainer nGridWhichPairs(svl::Items<
+ XATTR_LINE_FIRST, XATTR_LINE_LAST // 1000 - 1016 svx/xdef.hxx
+>);
-const sal_uInt16 nLegendWhichPairs[] =
-{
+const WhichRangesContainer nLegendWhichPairs(svl::Items<
+ SCHATTR_LEGEND_START, SCHATTR_LEGEND_END, // 3 - 3 sch/schattr.hxx
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
- CHARACTER_WHICHPAIRS,
- SCHATTR_LEGEND_START, SCHATTR_LEGEND_END, // 3 - 3 sch/schattr.hxx
- 0
-};
+ EE_ITEMS_START, EE_ITEMS_END, // Characters
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING // Characters
+>);
-const sal_uInt16 nDataLabelWhichPairs[] =
-{
+const WhichRangesContainer nDataLabelWhichPairs(svl::Items<
SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END,
- SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, /* 10585 - 10585 svx/svxids.hrc */
- SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, /* 11432 svx/svxids.hrc */
SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES,
EE_PARA_WRITINGDIR,EE_PARA_WRITINGDIR,
- 0
-};
-
-#define CHART_POINT_WHICHPAIRS \
- XATTR_LINE_FIRST, XATTR_LINE_LAST, /* 1000 - 1016 svx/xdef.hxx */ \
- XATTR_FILL_FIRST, XATTR_FILL_LAST, /* 1018 - 1046 svx/xdef.hxx */ \
- EE_ITEMS_START, EE_ITEMS_END, /* 3994 - 4037 editeng/eeitem.hxx */ \
- SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING, \
- SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, /* 1 - 2 sch/schattr.hxx*/ \
- SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, /* 10585 - 10585 svx/svxids.hrc */ \
- SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, /* 11432 svx/svxids.hrc */ \
- SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES, \
- SCHATTR_STYLE_START,SCHATTR_STYLE_END, /* 59 - 68 sch/schattr.hxx*/ \
- SCHATTR_SYMBOL_BRUSH,SCHATTR_SYMBOL_BRUSH, /* 94 sch/schattr.hxx*/ \
- SCHATTR_SYMBOL_SIZE,SCHATTR_SYMBOL_SIZE, /* 97 sch/schattr.hxx*/ \
- SDRATTR_3D_FIRST, SDRATTR_3D_LAST, /* 1244 - 1334 svx/svddef.hxx */ \
- SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY
-
-const sal_uInt16 nDataPointWhichPairs[] =
-{
- CHART_POINT_WHICHPAIRS,
- 0
-};
-
-const sal_uInt16 nTextLabelWhichPairs[] =
-{
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, /* 10585 - 10585 svx/svxids.hrc */
+ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE /* 11432 svx/svxids.hrc */
+>);
+
+const WhichRangesContainer nDataPointWhichPairs(svl::Items<
+ SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, /* 1 - 2 sch/schattr.hxx*/
+ SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES,
+ SCHATTR_STYLE_START,SCHATTR_STYLE_END, /* 59 - 68 sch/schattr.hxx*/
+ SCHATTR_SYMBOL_BRUSH,SCHATTR_SYMBOL_BRUSH, /* 94 sch/schattr.hxx*/
+ SCHATTR_SYMBOL_SIZE,SCHATTR_SYMBOL_SIZE, /* 97 sch/schattr.hxx*/
+ SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY,
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, /* 1000 - 1016 svx/xdef.hxx */
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, /* 1018 - 1046 svx/xdef.hxx */
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST, /* 1244 - 1334 svx/svddef.hxx */
+ EE_ITEMS_START, EE_ITEMS_END, /* 3994 - 4037 editeng/eeitem.hxx */
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, /* 10585 - 10585 svx/svxids.hrc */
+ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, /* 11432 svx/svxids.hrc */
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING
+>);
+
+const WhichRangesContainer nTextLabelWhichPairs(svl::Items<
+ SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END,
+ SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES,
+ SCHATTR_STYLE_SYMBOL, SCHATTR_STYLE_SYMBOL,
+ SCHATTR_SYMBOL_BRUSH, SCHATTR_SYMBOL_BRUSH,
+ SCHATTR_SYMBOL_SIZE, SCHATTR_SYMBOL_SIZE,
XATTR_LINESTYLE, XATTR_LINECOLOR,
XATTR_LINETRANSPARENCE, XATTR_LINETRANSPARENCE,
EE_ITEMS_START, EE_ITEMS_END,
- SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING,
- SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END,
SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE,
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING
+>);
+
+const WhichRangesContainer nSeriesOptionsWhichPairs(svl::Items<
+ SCHATTR_AXIS,SCHATTR_AXIS, /* 69 sch/schattr.hxx*/
+ SCHATTR_BAR_OVERLAP,SCHATTR_BAR_CONNECT, /* 98 - 100 (incl. SCHATTR_GAPWIDTH) */
+ SCHATTR_GROUP_BARS_PER_AXIS,SCHATTR_AXIS_FOR_ALL_SERIES
+>);
+
+// nDataPointWhichPairs + nSeriesOptionsWhichPairs
+const WhichRangesContainer nRowWhichPairs(svl::Items<
+ SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, /* 1 - 2 sch/schattr.hxx*/
SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES,
- SCHATTR_STYLE_SYMBOL, SCHATTR_STYLE_SYMBOL,
- SCHATTR_SYMBOL_BRUSH, SCHATTR_SYMBOL_BRUSH,
- SCHATTR_SYMBOL_SIZE, SCHATTR_SYMBOL_SIZE,
- 0
-};
-
-#define CHART_SERIES_OPTIONS_WHICHPAIRS \
- SCHATTR_AXIS,SCHATTR_AXIS, /* 69 sch/schattr.hxx*/ \
- SCHATTR_BAR_OVERLAP,SCHATTR_BAR_CONNECT, /* 98 - 100 (incl. SCHATTR_GAPWIDTH) */ \
- SCHATTR_GROUP_BARS_PER_AXIS,SCHATTR_AXIS_FOR_ALL_SERIES, \
- SCHATTR_STARTING_ANGLE,SCHATTR_STARTING_ANGLE, \
- SCHATTR_CLOCKWISE,SCHATTR_CLOCKWISE, \
- SCHATTR_MISSING_VALUE_TREATMENT,SCHATTR_MISSING_VALUE_TREATMENT, \
- SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, \
- SCHATTR_INCLUDE_HIDDEN_CELLS,SCHATTR_INCLUDE_HIDDEN_CELLS, \
- SCHATTR_HIDE_LEGEND_ENTRY,SCHATTR_HIDE_LEGEND_ENTRY
-
-const sal_uInt16 nSeriesOptionsWhichPairs[] =
-{
- CHART_SERIES_OPTIONS_WHICHPAIRS,
- 0
-};
-
-const sal_uInt16 nRowWhichPairs[] =
-{
- CHART_POINT_WHICHPAIRS,
- CHART_SERIES_OPTIONS_WHICHPAIRS,
- 0
-};
-
-const sal_uInt16 nStatWhichPairs[]=
-{
+ SCHATTR_STYLE_START,SCHATTR_STYLE_END, /* 59 - 68 sch/schattr.hxx*/
+ SCHATTR_AXIS,SCHATTR_AXIS, /* 69 sch/schattr.hxx*/
+ SCHATTR_SYMBOL_BRUSH,SCHATTR_SYMBOL_BRUSH, /* 94 sch/schattr.hxx*/
+ SCHATTR_SYMBOL_SIZE,SCHATTR_SYMBOL_SIZE, /* 97 sch/schattr.hxx*/
+ SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY,
+ SCHATTR_BAR_OVERLAP,SCHATTR_BAR_CONNECT, /* 98 - 100 (incl. SCHATTR_GAPWIDTH) */
+ SCHATTR_GROUP_BARS_PER_AXIS,SCHATTR_AXIS_FOR_ALL_SERIES,
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, /* 1000 - 1016 svx/xdef.hxx */
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, /* 1018 - 1046 svx/xdef.hxx */
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST, /* 1244 - 1334 svx/svddef.hxx */
+ EE_ITEMS_START, EE_ITEMS_END, /* 3994 - 4037 editeng/eeitem.hxx */
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, /* 10585 - 10585 svx/svxids.hrc */
+ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, /* 11432 svx/svxids.hrc */
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING
+>);
+
+const WhichRangesContainer nStatWhichPairs(svl::Items<
SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx
- SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END, // 108 - 109
- 0
-};
+ SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END // 108 - 109
+>);
-const sal_uInt16 nErrorBarWhichPairs[]=
-{
+const WhichRangesContainer nErrorBarWhichPairs(svl::Items<
SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx
- XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
- 0
-};
+ XATTR_LINE_FIRST, XATTR_LINE_LAST // 1000 - 1016 svx/xdef.hxx
+>);
// for CharacterProperties
-const sal_uInt16 nCharacterPropertyWhichPairs[] =
-{
- CHARACTER_WHICHPAIRS,
- 0
-};
+const WhichRangesContainer nCharacterPropertyWhichPairs(svl::Items<
+ EE_ITEMS_START, EE_ITEMS_END, // Characters
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING // Characters
+>);
-const sal_uInt16 nLinePropertyWhichPairs[] =
-{
- XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
- 0
-};
+const WhichRangesContainer nLinePropertyWhichPairs(svl::Items<
+ XATTR_LINE_FIRST, XATTR_LINE_LAST // 1000 - 1016 svx/xdef.hxx
+>);
-const sal_uInt16 nLineAndFillPropertyWhichPairs[] =
-{
+const WhichRangesContainer nLineAndFillPropertyWhichPairs(svl::Items<
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
- SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
- 0
-};
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST // 1067 - 1078 svx/svddef.hxx
+>);
-const sal_uInt16 nRegressionCurveWhichPairs[] =
-{
+const WhichRangesContainer nRegressionCurveWhichPairs(svl::Items<
SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END, // 108 - 109
- XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
- 0
-};
+ XATTR_LINE_FIRST, XATTR_LINE_LAST // 1000 - 1016 svx/xdef.hxx
+>);
-const sal_uInt16 nRegEquationWhichPairs[] =
-{
+const WhichRangesContainer nRegEquationWhichPairs(svl::Items<
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
- CHARACTER_WHICHPAIRS,
+ EE_ITEMS_START, EE_ITEMS_END, // Characters
SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE, // 10585 - 10585 svx/svxids.hrc
- 0
-};
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING // Characters
+>);
+
+const WhichRangesContainer nDataTableWhichPairs(svl::Items<
+ SCHATTR_DATA_TABLE_START, SCHATTR_DATA_TABLE_END,
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
+ EE_ITEMS_START, EE_ITEMS_END
+>);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index fc25407d1a58..653e7bf20e5a 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -21,19 +21,22 @@
#include "SchWhichPairs.hxx"
#include <ChartModelHelper.hxx>
+#include <ChartType.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <ChartTypeHelper.hxx>
#include <DataSeriesHelper.hxx>
#include <ChartModel.hxx>
-
-#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <BaseCoordinateSystem.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
#include <svl/ilstitem.hxx>
#include <svx/sdangitm.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -42,13 +45,13 @@ namespace chart::wrapper
{
SeriesOptionsItemConverter::SeriesOptionsItemConverter(
- const uno::Reference< frame::XModel >& xChartModel
- , const uno::Reference< uno::XComponentContext > & xContext
- , const uno::Reference< beans::XPropertySet >& xPropertySet
+ const rtl::Reference<::chart::ChartModel>& xChartModel
+ , uno::Reference< uno::XComponentContext > xContext
+ , const rtl::Reference< ::chart::DataSeries >& xDataSeries
, SfxItemPool& rItemPool )
- : ItemConverter( xPropertySet, rItemPool )
+ : ItemConverter( xDataSeries, rItemPool )
, m_xChartModel(xChartModel)
- , m_xCC(xContext)
+ , m_xCC(std::move(xContext))
, m_bAttachToMainAxis(true)
, m_bSupportingOverlapAndGapWidthProperties(false)
, m_bSupportingBarConnectors(false)
@@ -60,7 +63,6 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
, m_bSupportingStartingAngle(false)
, m_nStartingAngle(90)
, m_bClockwise(false)
- , m_aSupportedMissingValueTreatments()
, m_nMissingValueTreatment(0)
, m_bSupportingPlottingOfHiddenCells(false)
, m_bIncludeHiddenCells(true)
@@ -68,23 +70,20 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
{
try
{
- uno::Reference< XDataSeries > xDataSeries( xPropertySet, uno::UNO_QUERY );
-
m_bAttachToMainAxis = DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
- uno::Reference< beans::XPropertySet > xDiagramProperties( xDiagram, uno::UNO_QUERY );
- uno::Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram , xDataSeries ) );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xDataSeries ) );
m_xCooSys = DataSeriesHelper::getCoordinateSystemOfSeries( xDataSeries, xDiagram );
if( m_xCooSys.is() )
{
- uno::Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 1, 0, m_xCooSys ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( 1, 0, m_xCooSys );
chart2::ScaleData aScale( xAxis->getScaleData() );
m_bClockwise = (aScale.Orientation == chart2::AxisOrientation_REVERSE);
}
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
m_bSupportingOverlapAndGapWidthProperties = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
if( m_bSupportingOverlapAndGapWidthProperties )
@@ -93,15 +92,14 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
uno::Sequence< sal_Int32 > aBarPositionSequence;
- uno::Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY );
- if( xChartTypeProps.is() )
+ if( xChartType.is() )
{
- if( xChartTypeProps->getPropertyValue( "OverlapSequence" ) >>= aBarPositionSequence )
+ if( xChartType->getPropertyValue( "OverlapSequence" ) >>= aBarPositionSequence )
{
if( nAxisIndex >= 0 && nAxisIndex < aBarPositionSequence.getLength() )
m_nBarOverlap = aBarPositionSequence[nAxisIndex];
}
- if( xChartTypeProps->getPropertyValue( "GapwidthSequence" ) >>= aBarPositionSequence )
+ if( xChartType->getPropertyValue( "GapwidthSequence" ) >>= aBarPositionSequence )
{
if( nAxisIndex >= 0 && nAxisIndex < aBarPositionSequence.getLength() )
m_nGapWidth = aBarPositionSequence[nAxisIndex];
@@ -110,29 +108,27 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
}
m_bSupportingBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
- if( m_bSupportingBarConnectors && xDiagramProperties.is() )
+ if( m_bSupportingBarConnectors && xDiagram.is() )
{
- xDiagramProperties->getPropertyValue( "ConnectBars" ) >>= m_bConnectBars;
+ xDiagram->getPropertyValue( "ConnectBars" ) >>= m_bConnectBars;
}
m_bSupportingAxisSideBySide = ChartTypeHelper::isSupportingAxisSideBySide( xChartType, nDimensionCount );
- if( m_bSupportingAxisSideBySide && xDiagramProperties.is() )
+ if( m_bSupportingAxisSideBySide && xDiagram.is() )
{
- xDiagramProperties->getPropertyValue( "GroupBarsPerAxis" ) >>= m_bGroupBarsPerAxis;
+ xDiagram->getPropertyValue( "GroupBarsPerAxis" ) >>= m_bGroupBarsPerAxis;
}
m_bSupportingStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
if( m_bSupportingStartingAngle )
{
- xDiagramProperties->getPropertyValue( "StartingAngle" ) >>= m_nStartingAngle;
+ xDiagram->getPropertyValue( "StartingAngle" ) >>= m_nStartingAngle;
}
m_aSupportedMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType );
- m_nMissingValueTreatment = DiagramHelper::getCorrectedMissingValueTreatment(
- ChartModelHelper::findDiagram(m_xChartModel), xChartType );
+ m_nMissingValueTreatment = xDiagram->getCorrectedMissingValueTreatment( xChartType );
- uno::Reference< XChartDocument > xChartDoc( m_xChartModel, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xProp( xChartDoc->getDataProvider(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProp( m_xChartModel->getDataProvider(), uno::UNO_QUERY );
if( xProp.is() )
{
try
@@ -141,14 +137,14 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
xProp->getPropertyValue( "IncludeHiddenCells" );
//if not exception is thrown the property is offered
m_bSupportingPlottingOfHiddenCells = true;
- xDiagramProperties->getPropertyValue( "IncludeHiddenCells" ) >>= m_bIncludeHiddenCells;
+ xDiagram->getPropertyValue( "IncludeHiddenCells" ) >>= m_bIncludeHiddenCells;
}
catch( const beans::UnknownPropertyException& )
{
}
}
- m_bHideLegendEntry = !xPropertySet->getPropertyValue("ShowLegendEntry").get<bool>();
+ m_bHideLegendEntry = !xDataSeries->getPropertyValue("ShowLegendEntry").get<bool>();
}
catch( const uno::Exception & )
{
@@ -160,7 +156,7 @@ SeriesOptionsItemConverter::~SeriesOptionsItemConverter()
{
}
-const sal_uInt16 * SeriesOptionsItemConverter::GetWhichPairs() const
+const WhichRangesContainer& SeriesOptionsItemConverter::GetWhichPairs() const
{
// must span all used items!
return nSeriesOptionsWhichPairs;
@@ -184,8 +180,9 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
if( bAttachToMainAxis != m_bAttachToMainAxis )
{
//change model:
- bChanged = DiagramHelper::attachSeriesToAxis( bAttachToMainAxis, uno::Reference< XDataSeries >::query( GetPropertySet() )
- , ChartModelHelper::findDiagram(m_xChartModel), m_xCC );
+ rtl::Reference<DataSeries> xDataSeries = dynamic_cast<DataSeries*>( GetPropertySet().get() );
+ bChanged = m_xChartModel->getFirstChartDiagram()->attachSeriesToAxis( bAttachToMainAxis, xDataSeries
+ , m_xCC );
if( bChanged )
m_bAttachToMainAxis = bAttachToMainAxis;
@@ -205,30 +202,27 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
if( nWhichId == SCHATTR_BAR_OVERLAP )
aPropName = "OverlapSequence";
- uno::Reference< XDataSeries > xDataSeries( GetPropertySet(), uno::UNO_QUERY );
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(m_xChartModel) );
- uno::Reference< beans::XPropertySet > xChartTypeProps( DiagramHelper::getChartTypeOfSeries( xDiagram , xDataSeries ), uno::UNO_QUERY );
- if( xChartTypeProps.is() )
+ rtl::Reference< DataSeries > xDataSeries( dynamic_cast<DataSeries*>(GetPropertySet().get()) );
+ rtl::Reference< Diagram > xDiagram( m_xChartModel->getFirstChartDiagram() );
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xDataSeries ) );
+ if( xChartType.is() )
{
sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
uno::Sequence< sal_Int32 > aBarPositionSequence;
- if( xChartTypeProps.is() )
+ if( xChartType->getPropertyValue( aPropName ) >>= aBarPositionSequence )
{
- if( xChartTypeProps->getPropertyValue( aPropName ) >>= aBarPositionSequence )
+ bool bGroupBarsPerAxis = rItemSet.Get( SCHATTR_GROUP_BARS_PER_AXIS ).GetValue();
+ if(!bGroupBarsPerAxis)
{
- bool bGroupBarsPerAxis = rItemSet.Get( SCHATTR_GROUP_BARS_PER_AXIS ).GetValue();
- if(!bGroupBarsPerAxis)
- {
- //set the same value for all axes
- for( auto & pos : aBarPositionSequence )
- pos = rBarPosition;
- }
- else if( nAxisIndex >= 0 && nAxisIndex < aBarPositionSequence.getLength() )
- aBarPositionSequence[nAxisIndex] = rBarPosition;
-
- xChartTypeProps->setPropertyValue( aPropName, uno::Any(aBarPositionSequence) );
- bChanged = true;
+ //set the same value for all axes
+ for( auto & pos : asNonConstRange(aBarPositionSequence) )
+ pos = rBarPosition;
}
+ else if( nAxisIndex >= 0 && nAxisIndex < aBarPositionSequence.getLength() )
+ aBarPositionSequence.getArray()[nAxisIndex] = rBarPosition;
+
+ xChartType->setPropertyValue( aPropName, uno::Any(aBarPositionSequence) );
+ bChanged = true;
}
}
}
@@ -242,7 +236,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
if( m_bSupportingBarConnectors )
{
bool bOldConnectBars = false;
- uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
+ rtl::Reference< Diagram > xDiagramProperties( m_xChartModel->getFirstChartDiagram() );
if( xDiagramProperties.is() &&
(xDiagramProperties->getPropertyValue( "ConnectBars" ) >>= bOldConnectBars) &&
bOldConnectBars != m_bConnectBars )
@@ -261,7 +255,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
if( m_bSupportingAxisSideBySide )
{
bool bOldGroupBarsPerAxis = true;
- uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
+ rtl::Reference< Diagram > xDiagramProperties( m_xChartModel->getFirstChartDiagram() );
if( xDiagramProperties.is() &&
(xDiagramProperties->getPropertyValue( "GroupBarsPerAxis" ) >>= bOldGroupBarsPerAxis) &&
bOldGroupBarsPerAxis != m_bGroupBarsPerAxis )
@@ -278,7 +272,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
if( m_bSupportingStartingAngle )
{
m_nStartingAngle = static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue().get() / 100;
- uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
+ rtl::Reference< Diagram > xDiagramProperties( m_xChartModel->getFirstChartDiagram() );
if( xDiagramProperties.is() )
{
xDiagramProperties->setPropertyValue( "StartingAngle" , uno::Any(m_nStartingAngle) );
@@ -294,7 +288,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
rItemSet.Get( nWhichId )).GetValue();
if( m_xCooSys.is() )
{
- uno::Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 1, 0, m_xCooSys ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( 1, 0, m_xCooSys );
if( xAxis.is() )
{
chart2::ScaleData aScaleData( xAxis->getScaleData() );
@@ -315,7 +309,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
{
try
{
- uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
+ rtl::Reference< Diagram > xDiagramProperties( m_xChartModel->getFirstChartDiagram() );
if( xDiagramProperties.is() )
{
xDiagramProperties->setPropertyValue( "MissingValueTreatment" , uno::Any( nNew ));
@@ -337,9 +331,8 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
bool bIncludeHiddenCells = static_cast<const SfxBoolItem &>(rItemSet.Get(nWhichId)).GetValue();
if (bIncludeHiddenCells != m_bIncludeHiddenCells)
{
- ChartModel* pModel = dynamic_cast<ChartModel*>(m_xChartModel.get());
- if (pModel)
- bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, *pModel );
+ if (m_xChartModel)
+ bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, *m_xChartModel );
}
}
}
@@ -349,7 +342,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
bool bHideLegendEntry = static_cast<const SfxBoolItem &>(rItemSet.Get(nWhichId)).GetValue();
if (bHideLegendEntry != m_bHideLegendEntry)
{
- GetPropertySet()->setPropertyValue("ShowLegendEntry", css::uno::makeAny(!bHideLegendEntry));
+ GetPropertySet()->setPropertyValue("ShowLegendEntry", css::uno::Any(!bHideLegendEntry));
}
}
break;
@@ -399,7 +392,7 @@ void SeriesOptionsItemConverter::FillSpecialItem(
case SCHATTR_STARTING_ANGLE:
{
if( m_bSupportingStartingAngle )
- rOutItemSet.Put( SdrAngleItem(nWhichId, Degree100(m_nStartingAngle*100)) );
+ rOutItemSet.Put( SdrAngleItem(SCHATTR_STARTING_ANGLE, Degree100(m_nStartingAngle*100)) );
break;
}
case SCHATTR_CLOCKWISE:
diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
index c0691daf24cf..c725972c249b 100644
--- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
@@ -20,9 +20,10 @@
#include <StatisticsItemConverter.hxx>
#include "SchWhichPairs.hxx"
#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <ErrorBar.hxx>
#include <StatisticsHelper.hxx>
-
+#include <ChartModel.hxx>
#include <unonames.hxx>
#include <svl/stritem.hxx>
@@ -31,10 +32,10 @@
#include <rtl/math.hxx>
#include <com/sun/star/chart2/XInternalDataProvider.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
@@ -49,7 +50,7 @@ uno::Reference< beans::XPropertySet > lcl_GetErrorBar(
if( xProp.is())
try
{
- ( xProp->getPropertyValue( bYError ? OUString(CHART_UNONAME_ERRORBAR_Y) : OUString(CHART_UNONAME_ERRORBAR_X) ) >>= xResult );
+ ( xProp->getPropertyValue( bYError ? CHART_UNONAME_ERRORBAR_Y : CHART_UNONAME_ERRORBAR_X ) >>= xResult );
}
catch( const uno::Exception & )
{
@@ -107,10 +108,9 @@ uno::Reference< beans::XPropertySet > lcl_getEquationProperties(
// ensure that a trendline is on
if( pItemSet )
{
- const SfxPoolItem *pPoolItem = nullptr;
- if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SvxChartRegressItem* pRegressionItem = pItemSet->GetItemIfSet( SCHATTR_REGRESSION_TYPE ) )
{
- SvxChartRegress eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
+ SvxChartRegress eRegress = pRegressionItem->GetValue();
bEquationExists = ( eRegress != SvxChartRegress::NONE );
}
}
@@ -118,8 +118,8 @@ uno::Reference< beans::XPropertySet > lcl_getEquationProperties(
if( bEquationExists )
{
uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropSet, uno::UNO_QUERY );
- uno::Reference< chart2::XRegressionCurve > xCurve(
- ::chart::RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ));
+ rtl::Reference< ::chart::RegressionCurveModel > xCurve =
+ ::chart::RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt );
if( xCurve.is())
{
return xCurve->getEquationProperties();
@@ -137,10 +137,9 @@ uno::Reference< beans::XPropertySet > lcl_getCurveProperties(
// ensure that a trendline is on
if( pItemSet )
{
- const SfxPoolItem *pPoolItem = nullptr;
- if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SvxChartRegressItem* pRegressionItem = pItemSet->GetItemIfSet( SCHATTR_REGRESSION_TYPE ) )
{
- SvxChartRegress eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
+ SvxChartRegress eRegress = pRegressionItem->GetValue();
bExists = ( eRegress != SvxChartRegress::NONE );
}
}
@@ -192,12 +191,12 @@ void lclConvertToItemSet(SfxItemSet& rItemSet, sal_uInt16 nWhichId, const uno::R
}
}
-void lclConvertToItemSetDouble(SfxItemSet& rItemSet, sal_uInt16 nWhichId, const uno::Reference<beans::XPropertySet>& xProperties, const OUString& aPropertyID)
+void lclConvertToItemSetDouble(SfxItemSet& rItemSet, TypedWhichId<SvxDoubleItem> nWhichId, const uno::Reference<beans::XPropertySet>& xProperties, const OUString& aPropertyID)
{
OSL_ASSERT(xProperties.is());
if( xProperties.is() )
{
- double aValue = static_cast<const SvxDoubleItem&>(rItemSet.Get( nWhichId )).GetValue();
+ double aValue = rItemSet.Get( nWhichId ).GetValue();
if(xProperties->getPropertyValue( aPropertyID ) >>= aValue)
{
rItemSet.Put(SvxDoubleItem( aValue, nWhichId ));
@@ -211,11 +210,11 @@ namespace chart::wrapper
{
StatisticsItemConverter::StatisticsItemConverter(
- const uno::Reference< frame::XModel > & xModel,
+ rtl::Reference<::chart::ChartModel> xModel,
const uno::Reference< beans::XPropertySet > & rPropertySet,
SfxItemPool& rItemPool ) :
ItemConverter( rPropertySet, rItemPool ),
- m_xModel( xModel )
+ m_xModel(std::move( xModel ))
{
}
@@ -223,7 +222,7 @@ StatisticsItemConverter::~StatisticsItemConverter()
{
}
-const sal_uInt16 * StatisticsItemConverter::GetWhichPairs() const
+const WhichRangesContainer& StatisticsItemConverter::GetWhichPairs() const
{
// must span all used items!
return nStatWhichPairs;
@@ -309,7 +308,7 @@ bool StatisticsItemConverter::ApplySpecialItem(
if( !xErrorBarProp.is() )
{
xErrorBarProp = lcl_GetDefaultErrorBar();
- GetPropertySet()->setPropertyValue( bYError ? OUString(CHART_UNONAME_ERRORBAR_Y) : OUString(CHART_UNONAME_ERRORBAR_X),
+ GetPropertySet()->setPropertyValue( bYError ? CHART_UNONAME_ERRORBAR_Y : CHART_UNONAME_ERRORBAR_X,
uno::Any( xErrorBarProp ));
}
@@ -447,6 +446,13 @@ bool StatisticsItemConverter::ApplySpecialItem(
}
break;
+ case SCHATTR_REGRESSION_MOVING_TYPE:
+ {
+ uno::Reference< beans::XPropertySet > xProperties( lcl_getCurveProperties( GetPropertySet(), &rItemSet ));
+ bChanged = lclConvertToPropertySet<sal_Int32, SfxInt32Item>(rItemSet, nWhichId, xProperties, "MovingAverageType");
+ }
+ break;
+
case SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD:
{
uno::Reference< beans::XPropertySet > xProperties( lcl_getCurveProperties( GetPropertySet(), &rItemSet ));
@@ -546,18 +552,17 @@ bool StatisticsItemConverter::ApplySpecialItem(
rItemSet.Get(SCHATTR_STAT_ERRORBAR_TYPE).GetValue();
uno::Reference< chart2::data::XDataSource > xErrorBarSource( lcl_GetErrorBar( GetPropertySet(), bYError),
uno::UNO_QUERY );
- uno::Reference< chart2::XChartDocument > xChartDoc( m_xModel, uno::UNO_QUERY );
uno::Reference< chart2::data::XDataProvider > xDataProvider;
- if( xChartDoc.is())
- xDataProvider.set( xChartDoc->getDataProvider());
+ if( m_xModel.is())
+ xDataProvider.set( m_xModel->getDataProvider());
if( xErrorBarSource.is() && xDataProvider.is())
{
OUString aNewRange( static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue());
bool bApplyNewRange = false;
bool bIsPositiveValue( nWhichId == SCHATTR_STAT_RANGE_POS );
- if( xChartDoc->hasInternalDataProvider())
+ if( m_xModel->hasInternalDataProvider())
{
if( !aNewRange.isEmpty())
{
@@ -657,7 +662,7 @@ void StatisticsItemConverter::FillSpecialItem(
{
double fPos(0.0), fNeg(0.0);
lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
- rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, SCHATTR_STAT_PERCENT ));
}
}
break;
@@ -671,7 +676,7 @@ void StatisticsItemConverter::FillSpecialItem(
{
double fPos(0.0), fNeg(0.0);
lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
- rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, SCHATTR_STAT_BIGERROR ));
}
}
break;
@@ -685,7 +690,7 @@ void StatisticsItemConverter::FillSpecialItem(
{
double fPos(0.0), fNeg(0.0);
lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
- rOutItemSet.Put( SvxDoubleItem( fPos, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( fPos, SCHATTR_STAT_CONSTPLUS ));
}
}
break;
@@ -699,7 +704,7 @@ void StatisticsItemConverter::FillSpecialItem(
{
double fPos(0.0), fNeg(0.0);
lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
- rOutItemSet.Put( SvxDoubleItem( fNeg, nWhichId ));
+ rOutItemSet.Put( SvxDoubleItem( fNeg, SCHATTR_STAT_CONSTMINUS ));
}
}
break;
@@ -729,17 +734,24 @@ void StatisticsItemConverter::FillSpecialItem(
}
break;
+ case SCHATTR_REGRESSION_MOVING_TYPE:
+ {
+ uno::Reference< beans::XPropertySet > xProperties( lcl_getCurveProperties( GetPropertySet(), nullptr ));
+ lclConvertToItemSet<sal_Int32, SfxInt32Item>(rOutItemSet, nWhichId, xProperties, "MovingAverageType");
+ }
+ break;
+
case SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD:
{
uno::Reference< beans::XPropertySet > xProperties( lcl_getCurveProperties( GetPropertySet(), nullptr ));
- lclConvertToItemSetDouble(rOutItemSet, nWhichId, xProperties, "ExtrapolateForward");
+ lclConvertToItemSetDouble(rOutItemSet, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD, xProperties, "ExtrapolateForward");
}
break;
case SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD:
{
uno::Reference< beans::XPropertySet > xProperties( lcl_getCurveProperties( GetPropertySet(), nullptr ));
- lclConvertToItemSetDouble(rOutItemSet, nWhichId, xProperties, "ExtrapolateBackward");
+ lclConvertToItemSetDouble(rOutItemSet, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD, xProperties, "ExtrapolateBackward");
}
break;
@@ -753,7 +765,7 @@ void StatisticsItemConverter::FillSpecialItem(
case SCHATTR_REGRESSION_INTERCEPT_VALUE:
{
uno::Reference< beans::XPropertySet > xProperties( lcl_getCurveProperties( GetPropertySet(), nullptr ));
- lclConvertToItemSetDouble(rOutItemSet, nWhichId, xProperties, "InterceptValue");
+ lclConvertToItemSetDouble(rOutItemSet, SCHATTR_REGRESSION_INTERCEPT_VALUE, xProperties, "InterceptValue");
}
break;
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
index adc0b849414b..a8838f3b24e0 100644
--- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
@@ -19,10 +19,13 @@
#include <TextLabelItemConverter.hxx>
#include <CharacterPropertyItemConverter.hxx>
-#include <ChartModelHelper.hxx>
+#include <ChartModel.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <DataSeriesProperties.hxx>
+#include <Diagram.hxx>
#include <ItemPropertyMap.hxx>
#include "SchWhichPairs.hxx"
#include <unonames.hxx>
@@ -35,7 +38,7 @@
#include <svl/stritem.hxx>
#include <svx/tabline.hxx>
#include <svx/sdangitm.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/graph.hxx>
#include <rtl/math.hxx>
@@ -44,12 +47,12 @@
#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <memory>
using namespace com::sun::star;
using namespace com::sun::star::chart2;
using com::sun::star::uno::Reference;
+using namespace ::chart::DataSeriesProperties;
namespace chart::wrapper {
@@ -98,7 +101,7 @@ bool numberFormatFromItemToPropertySet(
if (!xPropertySet.is())
return bChanged;
- OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_VALUE) ? OUString(CHART_UNONAME_NUMFMT) : OUString("PercentageNumberFormat");
+ OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_VALUE) ? CHART_UNONAME_NUMFMT : OUString("PercentageNumberFormat");
sal_uInt16 nSourceWhich = (nWhichId == SID_ATTR_NUMBERFORMAT_VALUE) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE;
if (rItemSet.GetItemState(nSourceWhich) != SfxItemState::SET)
@@ -123,7 +126,7 @@ bool numberFormatFromItemToPropertySet(
uno::Any aOldValue = xPropertySet->getPropertyValue(aPropertyName);
if (bOverwriteDataPoints)
{
- Reference<chart2::XDataSeries> xSeries(xPropertySet, uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries( dynamic_cast<DataSeries*>(xPropertySet.get()) );
if (aValue != aOldValue ||
::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, aPropertyName, aOldValue))
{
@@ -146,7 +149,7 @@ bool useSourceFormatFromItemToPropertySet(
bool bChanged = false;
if (!xPropertySet.is())
return bChanged;
- OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_SOURCE) ? OUString(CHART_UNONAME_NUMFMT) : OUString("PercentageNumberFormat");
+ OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_SOURCE) ? CHART_UNONAME_NUMFMT : OUString("PercentageNumberFormat");
sal_uInt16 nFormatWhich = (nWhichId == SID_ATTR_NUMBERFORMAT_SOURCE) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE;
if (rItemSet.GetItemState(nWhichId) != SfxItemState::SET)
@@ -173,7 +176,7 @@ bool useSourceFormatFromItemToPropertySet(
uno::Any aOldValue(xPropertySet->getPropertyValue(aPropertyName));
if (bOverwriteDataPoints)
{
- Reference<chart2::XDataSeries> xSeries(xPropertySet, uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(xPropertySet.get()));
if (aNewValue != aOldValue ||
::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, aPropertyName, aOldValue))
{
@@ -193,10 +196,10 @@ bool useSourceFormatFromItemToPropertySet(
} // anonymous namespace
TextLabelItemConverter::TextLabelItemConverter(
- const uno::Reference<frame::XModel>& xChartModel,
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
const uno::Reference<beans::XPropertySet>& rPropertySet,
- const uno::Reference<XDataSeries>& xSeries,
- SfxItemPool& rItemPool, const awt::Size* pRefSize,
+ const rtl::Reference<DataSeries>& xSeries,
+ SfxItemPool& rItemPool, const std::optional<awt::Size>& pRefSize,
bool bDataSeries, sal_Int32 nNumberFormat, sal_Int32 nPercentNumberFormat ) :
ItemConverter(rPropertySet, rItemPool),
mnNumberFormat(nNumberFormat),
@@ -207,11 +210,11 @@ TextLabelItemConverter::TextLabelItemConverter(
{
maConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
- uno::Reference<XDiagram> xDiagram(ChartModelHelper::findDiagram(xChartModel));
- uno::Reference<XChartType> xChartType(DiagramHelper::getChartTypeOfSeries(xDiagram, xSeries));
+ rtl::Reference< Diagram > xDiagram(xChartModel->getFirstChartDiagram());
+ rtl::Reference< ChartType > xChartType(xDiagram->getChartTypeOfSeries(xSeries));
bool bFound = false;
bool bAmbiguous = false;
- bool bSwapXAndY = DiagramHelper::getVertical(xDiagram, bFound, bAmbiguous);
+ bool bSwapXAndY = xDiagram->getVertical(bFound, bAmbiguous);
maAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements(xChartType, bSwapXAndY, xSeries);
mbForbidPercentValue = ChartTypeHelper::getAxisType(xChartType, 0) != AxisType::CATEGORY;
@@ -241,7 +244,7 @@ bool TextLabelItemConverter::ApplyItemSet( const SfxItemSet& rItemSet )
return ItemConverter::ApplyItemSet(rItemSet) || bResult;
}
-const sal_uInt16* TextLabelItemConverter::GetWhichPairs() const
+const WhichRangesContainer& TextLabelItemConverter::GetWhichPairs() const
{
// must span all used items!
return nTextLabelWhichPairs;
@@ -268,6 +271,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
case SCHATTR_DATADESCR_SHOW_NUMBER:
case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
case SCHATTR_DATADESCR_SHOW_CATEGORY:
+ case SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME:
case SCHATTR_DATADESCR_SHOW_SYMBOL:
{
const SfxBoolItem& rItem = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId));
@@ -278,12 +282,13 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
{
sal_Bool& rValue = (nWhichId == SCHATTR_DATADESCR_SHOW_NUMBER) ? aLabel.ShowNumber : (
(nWhichId == SCHATTR_DATADESCR_SHOW_PERCENTAGE) ? aLabel.ShowNumberInPercent : (
- (nWhichId == SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol));
+ (nWhichId == SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName :
+ (nWhichId == SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME) ? aLabel.ShowSeriesName : aLabel.ShowLegendSymbol));
bool bOldValue = rValue;
rValue = rItem.GetValue();
if (mbDataSeries)
{
- Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
if (bOldValue != bool(rValue) ||
DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, CHART_UNONAME_LABEL, aOldValue))
{
@@ -321,7 +326,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
GetPropertySet()->getPropertyValue("LabelSeparator") >>= aOldValue;
if (mbDataSeries)
{
- Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
if (aOldValue != aNewValue ||
DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, "LabelSeparator", uno::Any(aOldValue)))
{
@@ -351,7 +356,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld;
if( mbDataSeries )
{
- Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
+ rtl::Reference< DataSeries > xSeries( dynamic_cast<DataSeries*>(GetPropertySet().get()) );
if( bOld!=bNew ||
DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "TextWordWrap", uno::Any( bOld ) ) )
{
@@ -381,7 +386,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
GetPropertySet()->getPropertyValue("LabelPlacement") >>= nOld;
if (mbDataSeries)
{
- Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY);
+ rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get()));
if (nOld != nNew ||
DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, "LabelPlacement", uno::Any(nOld)))
{
@@ -393,6 +398,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
{
GetPropertySet()->setPropertyValue("LabelPlacement", uno::Any(nNew));
GetPropertySet()->setPropertyValue("CustomLabelPosition", uno::Any());
+ GetPropertySet()->setPropertyValue("CustomLabelSize", uno::Any());
bChanged = true;
}
}
@@ -507,10 +513,9 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
{
bool bNew = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
bool bOld = true;
- Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
- if( (xSeriesProp->getPropertyValue("ShowCustomLeaderLines") >>= bOld) && bOld != bNew )
+ if( (m_xSeries->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES) >>= bOld) && bOld != bNew )
{
- xSeriesProp->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew));
+ m_xSeries->setFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, uno::Any(bNew));
bChanged = true;
}
}
@@ -532,6 +537,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
case SCHATTR_DATADESCR_SHOW_NUMBER:
case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
case SCHATTR_DATADESCR_SHOW_CATEGORY:
+ case SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME:
case SCHATTR_DATADESCR_SHOW_SYMBOL:
{
chart2::DataPointLabel aLabel;
@@ -539,14 +545,15 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
{
bool bValue = (nWhichId == SCHATTR_DATADESCR_SHOW_NUMBER) ? aLabel.ShowNumber : (
(nWhichId == SCHATTR_DATADESCR_SHOW_PERCENTAGE) ? aLabel.ShowNumberInPercent : (
- (nWhichId == SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol));
+ (nWhichId == SCHATTR_DATADESCR_SHOW_CATEGORY) ? aLabel.ShowCategoryName : (
+ (nWhichId == SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME) ? aLabel.ShowSeriesName : aLabel.ShowLegendSymbol)));
rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
if (mbDataSeries)
{
if (DataSeriesHelper::hasAttributedDataPointDifferentValue(
- Reference<chart2::XDataSeries>(GetPropertySet(), uno::UNO_QUERY), CHART_UNONAME_LABEL, uno::Any(aLabel)))
+ dynamic_cast<DataSeries*>(GetPropertySet().get()), CHART_UNONAME_LABEL, uno::Any(aLabel)))
{
rOutItemSet.InvalidateItem(nWhichId);
}
@@ -662,8 +669,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
try
{
bool bValue = true;
- Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
- if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue )
+ if( m_xSeries->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES ) >>= bValue )
rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
}
catch (const uno::Exception&)
@@ -705,7 +711,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
if (GetPropertySet()->getPropertyValue("TextRotation") >>= fValue)
{
rOutItemSet.Put(
- SdrAngleItem(nWhichId, Degree100(static_cast<sal_Int32>(rtl::math::round(fValue * 100.0)))));
+ SdrAngleItem(SCHATTR_TEXT_DEGREES, Degree100(static_cast<sal_Int32>(rtl::math::round(fValue * 100.0)))));
}
}
break;
diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
index 9109bc3ea3a1..1327a0a0d91b 100644
--- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
@@ -23,7 +23,6 @@
#include <GraphicPropertyItemConverter.hxx>
#include <CharacterPropertyItemConverter.hxx>
#include <MultipleItemConverter.hxx>
-#include <svl/intitem.hxx>
#include <svx/sdangitm.hxx>
#include <rtl/math.hxx>
@@ -51,11 +50,11 @@ public:
FormattedStringsConverter(
const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings,
SfxItemPool & rItemPool,
- const awt::Size* pRefSize,
+ const std::optional<awt::Size>& pRefSize,
const uno::Reference< beans::XPropertySet > & xParentProp );
protected:
- virtual const sal_uInt16 * GetWhichPairs() const override;
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
};
} // anonymous namespace
@@ -63,7 +62,7 @@ protected:
FormattedStringsConverter::FormattedStringsConverter(
const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings,
SfxItemPool & rItemPool,
- const awt::Size* pRefSize,
+ const std::optional<awt::Size>& pRefSize,
const uno::Reference< beans::XPropertySet > & xParentProp ) :
MultipleItemConverter( rItemPool )
{
@@ -83,7 +82,7 @@ FormattedStringsConverter::FormattedStringsConverter(
}
}
-const sal_uInt16 * FormattedStringsConverter::GetWhichPairs() const
+const WhichRangesContainer& FormattedStringsConverter::GetWhichPairs() const
{
return nCharacterPropertyWhichPairs;
}
@@ -93,7 +92,7 @@ TitleItemConverter::TitleItemConverter(
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
- const awt::Size* pRefSize ) :
+ const std::optional<awt::Size>& pRefSize ) :
ItemConverter( rPropertySet, rItemPool )
{
m_aConverters.emplace_back( new GraphicPropertyItemConverter(
@@ -139,7 +138,7 @@ bool TitleItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const sal_uInt16 * TitleItemConverter::GetWhichPairs() const
+const WhichRangesContainer& TitleItemConverter::GetWhichPairs() const
{
// must span all used items!
return nTitleWhichPairs;
@@ -198,7 +197,7 @@ void TitleItemConverter::FillSpecialItem(
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal )
{
- rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >(
+ rOutItemSet.Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, Degree100(static_cast< sal_Int32 >(
::rtl::math::round( fVal * 100.0 ) ) )));
}
}
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 219ad91cfa70..2bd0bf549e89 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -20,67 +20,68 @@
#include <memory>
#include <sal/config.h>
+#include <config_wasm_strip.h>
#include <ChartController.hxx>
+#include <ChartView.hxx>
#include <servicenames.hxx>
#include <ResId.hxx>
#include <dlg_DataSource.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartType.hxx>
#include "ControllerCommandDispatch.hxx"
+#include <DataSeries.hxx>
+#include <Diagram.hxx>
#include <strings.hrc>
-#include <chartview/ExplicitValueProvider.hxx>
#include <ChartViewHelper.hxx>
#include <ChartWindow.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include <DrawViewWrapper.hxx>
#include <ObjectIdentifier.hxx>
-#include <DiagramHelper.hxx>
#include <ControllerLockGuard.hxx>
#include "UndoGuard.hxx"
#include "ChartDropTargetHelper.hxx"
#include <dlg_ChartType.hxx>
+#if !ENABLE_WASM_STRIP_ACCESSIBILITY
#include <AccessibleChartView.hxx>
+#endif
#include "DrawCommandDispatch.hxx"
#include "ShapeController.hxx"
#include "UndoActions.hxx"
#include <ViewElementListProvider.hxx>
-#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/dispatchcommand.hxx>
+#include <BaseCoordinateSystem.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include <com/sun/star/frame/XController2.hpp>
#include <com/sun/star/util/CloseVetoException.hpp>
-#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/frame/LayoutManagerEvents.hpp>
#include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
-#include <com/sun/star/document/XUndoManagerSupplier.hpp>
#include <com/sun/star/ui/XSidebar.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XDataProviderAccess.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <sal/log.hxx>
#include <tools/debug.hxx>
#include <svx/sidebar/SelectionChangeHandler.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/helper/vclunohelper.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <osl/mutex.hxx>
+#include <comphelper/lok.hxx>
#include <sfx2/sidebar/SidebarController.hxx>
-
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
// this is needed to properly destroy the unique_ptr to the AcceleratorExecute
// object in the DTOR
#include <svtools/acceleratorexecute.hxx>
#include <svx/ActionDescriptionProvider.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
// enable the following define to let the controller listen to model changes and
// react on this by rebuilding the view
@@ -95,16 +96,13 @@ using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
-ChartController::ChartController(uno::Reference<uno::XComponentContext> const & xContext) :
+ChartController::ChartController(uno::Reference<uno::XComponentContext> xContext) :
m_aLifeTimeManager( nullptr ),
m_bSuspended( false ),
- m_xCC(xContext), //@todo is it allowed to hold this context??
- m_aModelMutex(),
+ m_xCC(std::move(xContext)),
m_aModel( nullptr, m_aModelMutex ),
- m_xViewWindow(),
- m_xChartView(),
- m_pDrawModelWrapper(),
m_eDragMode(SdrDragMode::Move),
+ m_aDoubleClickTimer("chart2 ChartController m_aDoubleClickTimer"),
m_bWaitingForDoubleClick(false),
m_bWaitingForMouseUp(false),
m_bFieldButtonDown(false),
@@ -124,12 +122,10 @@ ChartController::~ChartController()
stopDoubleClickWaiting();
}
-ChartController::TheModel::TheModel( const uno::Reference< frame::XModel > & xModel ) :
- m_xModel( xModel ),
+ChartController::TheModel::TheModel( rtl::Reference<::chart::ChartModel> xModel ) :
+ m_xModel(std::move( xModel )),
m_bOwnership( true )
{
- m_xCloseable =
- uno::Reference< util::XCloseable >( xModel, uno::UNO_QUERY );
}
ChartController::TheModel::~TheModel()
@@ -138,33 +134,22 @@ ChartController::TheModel::~TheModel()
void ChartController::TheModel::addListener( ChartController* pController )
{
- if(m_xCloseable.is())
+ if(m_xModel)
{
//if you need to be able to veto against the destruction of the model
// you must add as a close listener
//otherwise you 'can' add as closelistener or 'must' add as dispose event listener
- m_xCloseable->addCloseListener(
+ m_xModel->addCloseListener(
static_cast<util::XCloseListener*>(pController) );
}
- else if( m_xModel.is() )
- {
- //we need to add as dispose event listener
- m_xModel->addEventListener(
- static_cast<util::XCloseListener*>(pController) );
- }
-
}
void ChartController::TheModel::removeListener( ChartController* pController )
{
- if(m_xCloseable.is())
- m_xCloseable->removeCloseListener(
- static_cast<util::XCloseListener*>(pController) );
-
- else if( m_xModel.is() )
- m_xModel->removeEventListener(
+ if(m_xModel)
+ m_xModel->removeCloseListener(
static_cast<util::XCloseListener*>(pController) );
}
@@ -175,7 +160,7 @@ void ChartController::TheModel::tryTermination()
try
{
- if(m_xCloseable.is())
+ if(m_xModel.is())
{
try
{
@@ -183,7 +168,7 @@ void ChartController::TheModel::tryTermination()
//I think yes, because there might be other CloseListeners later in the list which might be interested still
//but make sure that we do not throw the CloseVetoException here ourselves
//so stop listening before trying to terminate or check the source of queryclosing event
- m_xCloseable->close(true);
+ m_xModel->close(true);
m_bOwnership = false;
}
@@ -198,12 +183,6 @@ void ChartController::TheModel::tryTermination()
}
}
- else if( m_xModel.is() )
- {
- //@todo correct??
- m_xModel->dispose();
- return;
- }
}
catch(const uno::Exception&)
{
@@ -247,26 +226,17 @@ bool ChartController::TheModelRef::is() const
namespace {
-css::uno::Reference<css::chart2::XChartType> getChartType(
- const css::uno::Reference<css::chart2::XChartDocument>& xChartDoc)
+rtl::Reference<ChartType> getChartType(const rtl::Reference<ChartModel>& xChartDoc)
{
- Reference <chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();
- if (!xDiagram.is()) {
- return css::uno::Reference<css::chart2::XChartType>();
- }
-
- Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY_THROW );
-
- Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
- if (!xCooSysSequence.hasElements()) {
- return css::uno::Reference<css::chart2::XChartType>();
- }
-
- Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[0], uno::UNO_QUERY_THROW );
+ rtl::Reference<Diagram > xDiagram = xChartDoc->getFirstChartDiagram();
+ if (!xDiagram.is())
+ return nullptr;
- Sequence< Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & xCooSysSequence( xDiagram->getBaseCoordinateSystems());
+ if (xCooSysSequence.empty())
+ return nullptr;
- return xChartTypeSequence[0];
+ return xCooSysSequence[0]->getChartTypes2()[0];
}
}
@@ -291,7 +261,6 @@ OUString ChartController::GetContextName()
{
case OBJECTTYPE_DATA_SERIES:
return "Series";
- break;
case OBJECTTYPE_DATA_ERRORS_X:
case OBJECTTYPE_DATA_ERRORS_Y:
case OBJECTTYPE_DATA_ERRORS_Z:
@@ -302,7 +271,7 @@ OUString ChartController::GetContextName()
return "Grid";
case OBJECTTYPE_DIAGRAM:
{
- css::uno::Reference<css::chart2::XChartType> xChartType = getChartType(css::uno::Reference<css::chart2::XChartDocument>(getModel(), uno::UNO_QUERY));
+ rtl::Reference<ChartType> xChartType = getChartType(getChartModel());
if (xChartType.is() && xChartType->getChartType() == "com.sun.star.chart2.PieChartType")
return "ChartElements";
break;
@@ -332,27 +301,6 @@ bool ChartController::impl_isDisposedOrSuspended() const
return false;
}
-// lang::XServiceInfo
-
-OUString SAL_CALL ChartController::getImplementationName()
-{
- return CHART_CONTROLLER_SERVICE_IMPLEMENTATION_NAME;
-}
-
-sal_Bool SAL_CALL ChartController::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-css::uno::Sequence< OUString > SAL_CALL ChartController::getSupportedServiceNames()
-{
- return {
- CHART_CONTROLLER_SERVICE_NAME,
- "com.sun.star.frame.Controller"
- //// @todo : add additional services if you support any further
- };
-}
-
namespace {
uno::Reference<ui::XSidebar> getSidebarFromModel(const uno::Reference<frame::XModel>& xModel)
@@ -388,19 +336,6 @@ void SAL_CALL ChartController::attachFrame(
if( impl_isDisposedOrSuspended() ) //@todo? allow attaching the frame while suspended?
return; //behave passive if already disposed or suspended
- mpSelectionChangeHandler->Connect();
-
- uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getModel());
- if (xSidebar.is())
- {
- auto pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
- assert(pSidebar);
- sfx2::sidebar::SidebarController::registerSidebarForFrame(pSidebar, this);
- pSidebar->updateModel(getModel());
- css::lang::EventObject aEvent;
- mpSelectionChangeHandler->selectionChanged(aEvent);
- }
-
if(m_xFrame.is()) //what happens, if we do have a Frame already??
{
//@todo? throw exception?
@@ -411,6 +346,20 @@ void SAL_CALL ChartController::attachFrame(
//--attach frame
m_xFrame = xFrame; //the frameloader is responsible to call xFrame->setComponent
+ // Only notify after setting the frame, otherwise notification will fail
+ mpSelectionChangeHandler->Connect();
+
+ uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getChartModel());
+ if (xSidebar.is())
+ {
+ auto pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
+ assert(pSidebar);
+ pSidebar->registerSidebarForFrame(this);
+ pSidebar->updateModel(getChartModel());
+ css::lang::EventObject aEvent;
+ mpSelectionChangeHandler->selectionChanged(aEvent);
+ }
+
//add as disposelistener to the frame (due to persistent reference) ??...:
//the frame is considered to be owner of this controller and will live longer than we do
@@ -425,13 +374,10 @@ void SAL_CALL ChartController::attachFrame(
//get the window parent from the frame to use as parent for our new window
if(xFrame.is())
{
- uno::Reference< awt::XWindow > xContainerWindow = xFrame->getContainerWindow();
- VCLXWindow* pParentComponent = comphelper::getUnoTunnelImplementation<VCLXWindow>(xContainerWindow);
- assert(pParentComponent);
- if (pParentComponent)
- pParentComponent->setVisible(true);
-
- pParent = VCLUnoHelper::GetWindow( xContainerWindow ).get();
+ uno::Reference<awt::XWindow> xContainerWindow = xFrame->getContainerWindow();
+ if (xContainerWindow)
+ xContainerWindow->setVisible(true);
+ pParent = VCLUnoHelper::GetWindow( xContainerWindow );
}
{
@@ -442,8 +388,7 @@ void SAL_CALL ChartController::attachFrame(
m_xViewWindow.set( pChartWindow->GetComponentInterface(), uno::UNO_QUERY );
pChartWindow->Show();
m_apDropTargetHelper.reset(
- new ChartDropTargetHelper( pChartWindow->GetDropTarget(),
- uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY )));
+ new ChartDropTargetHelper( pChartWindow->GetDropTarget(), getChartModel()));
impl_createDrawViewController();
}
@@ -535,7 +480,7 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent
if( m_aSelection.hasSelection() )
this->impl_selectObjectAndNotiy();
else
- ChartModelHelper::triggerRangeHighlighting( getModel() );
+ ChartModelHelper::triggerRangeHighlighting( getChartModel() );
impl_initializeAccessible();
@@ -563,23 +508,24 @@ sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XMo
return false; //behave passive if already disposed or suspended
aGuard.clear();
- TheModelRef aNewModelRef( new TheModel( xModel), m_aModelMutex);
+ ::chart::ChartModel* pChartModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
+ assert(!xModel || pChartModel);
+
+ TheModelRef aNewModelRef( new TheModel(pChartModel), m_aModelMutex);
TheModelRef aOldModelRef(m_aModel,m_aModelMutex);
m_aModel = aNewModelRef;
//--handle relations to the old model if any
if( aOldModelRef.is() )
{
- uno::Reference< util::XModeChangeBroadcaster > xViewBroadcaster( m_xChartView, uno::UNO_QUERY );
- if( xViewBroadcaster.is() )
- xViewBroadcaster->removeModeChangeListener(this);
+ if( m_xChartView.is() )
+ m_xChartView->removeModeChangeListener(this);
m_pDrawModelWrapper.reset();
aOldModelRef->removeListener( this );
#ifdef TEST_ENABLE_MODIFY_LISTENER
- uno::Reference< util::XModifyBroadcaster > xMBroadcaster( aOldModelRef->getModel(),uno::UNO_QUERY );
- if( xMBroadcaster.is())
- xMBroadcaster->removeModifyListener( this );
+ if( aOldModelRef->getModel().is())
+ aOldModelRef->getModel()->removeModifyListener( this );
#endif
}
@@ -589,41 +535,38 @@ sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XMo
aGuard.reset(); // lock for m_aDispatchContainer access
// set new model at dispatchers
m_aDispatchContainer.setModel( aNewModelRef->getModel());
- ControllerCommandDispatch * pDispatch = new ControllerCommandDispatch( m_xCC, this, &m_aDispatchContainer );
+ rtl::Reference<ControllerCommandDispatch> pDispatch = new ControllerCommandDispatch( m_xCC, this, &m_aDispatchContainer );
pDispatch->initialize();
// the dispatch container will return "this" for all commands returned by
// impl_getAvailableCommands(). That means, for those commands dispatch()
// is called here at the ChartController.
- m_aDispatchContainer.setChartDispatch( pDispatch, impl_getAvailableCommands() );
+ m_aDispatchContainer.setChartDispatch( pDispatch, o3tl::sorted_vector(impl_getAvailableCommands()) );
- DrawCommandDispatch* pDrawDispatch = new DrawCommandDispatch( m_xCC, this );
+ rtl::Reference<DrawCommandDispatch> pDrawDispatch = new DrawCommandDispatch( m_xCC, this );
pDrawDispatch->initialize();
- m_aDispatchContainer.setDrawCommandDispatch( pDrawDispatch );
+ m_aDispatchContainer.setDrawCommandDispatch( pDrawDispatch.get() );
- ShapeController* pShapeController = new ShapeController( m_xCC, this );
+ rtl::Reference<ShapeController> pShapeController = new ShapeController( m_xCC, this );
pShapeController->initialize();
- m_aDispatchContainer.setShapeController( pShapeController );
+ m_aDispatchContainer.setShapeController( pShapeController.get() );
aGuard.clear();
#ifdef TEST_ENABLE_MODIFY_LISTENER
- uno::Reference< util::XModifyBroadcaster > xMBroadcaster( aNewModelRef->getModel(),uno::UNO_QUERY );
- if( xMBroadcaster.is())
- xMBroadcaster->addModifyListener( this );
+ if( aNewModelRef->getModel().is())
+ aNewModelRef->getModel()->addModifyListener( this );
#endif
// #i119999# Do not do this per default to allow the user to deselect the chart OLE with a single press to ESC
// select chart area per default:
// select( uno::Any( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ) );
- uno::Reference< lang::XMultiServiceFactory > xFact( getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xFact = getChartModel();
if( xFact.is())
{
- m_xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME );
+ m_xChartView = dynamic_cast<::chart::ChartView*>(xFact->createInstance( CHART_VIEW_SERVICE_NAME ).get());
GetDrawModelWrapper();
- uno::Reference< util::XModeChangeBroadcaster > xViewBroadcaster( m_xChartView, uno::UNO_QUERY );
- if( xViewBroadcaster.is() )
- xViewBroadcaster->addModeChangeListener(this);
+ m_xChartView->addModeChangeListener(this);
}
//the frameloader is responsible to call xModel->connectController
@@ -634,8 +577,7 @@ sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XMo
pChartWindow->Invalidate();
}
- uno::Reference< document::XUndoManagerSupplier > xSuppUndo( getModel(), uno::UNO_QUERY_THROW );
- m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_SET_THROW );
+ m_xUndoManager.set( getChartModel()->getUndoManager(), uno::UNO_SET_THROW );
return true;
}
@@ -650,6 +592,11 @@ uno::Reference< frame::XFrame > SAL_CALL ChartController::getFrame()
uno::Reference< frame::XModel > SAL_CALL ChartController::getModel()
{
+ return getChartModel();
+}
+
+rtl::Reference<::chart::ChartModel> ChartController::getChartModel()
+{
//provides access to currently attached model
//returns the currently attached model
@@ -658,7 +605,12 @@ uno::Reference< frame::XModel > SAL_CALL ChartController::getModel()
if(aModelRef.is())
return aModelRef->getModel();
- return uno::Reference< frame::XModel > ();
+ return nullptr;
+}
+
+rtl::Reference<::chart::Diagram> ChartController::getFirstDiagram()
+{
+ return getChartModel()->getFirstChartDiagram();
}
uno::Any SAL_CALL ChartController::getViewData()
@@ -714,6 +666,24 @@ sal_Bool SAL_CALL ChartController::suspend( sal_Bool bSuspend )
return true;
}
+// css::frame::XController2
+
+css::uno::Reference<css::awt::XWindow> SAL_CALL ChartController::getComponentWindow()
+{
+ // it is a special characteristic of ChartController
+ // that it simultaneously provides the XWindow functionality
+ return this;
+}
+
+OUString SAL_CALL ChartController::getViewControllerName() { return {}; }
+
+css::uno::Sequence<css::beans::PropertyValue> SAL_CALL ChartController::getCreationArguments()
+{
+ return {};
+}
+
+css::uno::Reference<css::ui::XSidebarProvider> SAL_CALL ChartController::getSidebar() { return {}; }
+
void ChartController::impl_createDrawViewController()
{
SolarMutexGuard aGuard;
@@ -721,8 +691,21 @@ void ChartController::impl_createDrawViewController()
{
if( m_pDrawModelWrapper )
{
- m_pDrawViewWrapper.reset( new DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow()) );
- m_pDrawViewWrapper->attachParentReferenceDevice( getModel() );
+ bool bLokCalcGlobalRTL = false;
+ if(comphelper::LibreOfficeKit::isActive() && AllSettings::GetLayoutRTL())
+ {
+ rtl::Reference< ChartModel > xChartModel = getChartModel();
+ if (xChartModel.is())
+ {
+ uno::Reference<css::sheet::XSpreadsheetDocument> xSSDoc(xChartModel->getParent(), uno::UNO_QUERY);
+ if (xSSDoc.is())
+ bLokCalcGlobalRTL = true;
+ }
+ }
+
+ m_pDrawViewWrapper.reset( new DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow()->GetOutDev()) );
+ m_pDrawViewWrapper->SetNegativeX(bLokCalcGlobalRTL);
+ m_pDrawViewWrapper->attachParentReferenceDevice( getChartModel() );
}
}
}
@@ -749,10 +732,10 @@ void SAL_CALL ChartController::dispose()
if (getModel().is())
{
- uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getModel());
+ uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getChartModel());
if (sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get()))
{
- sfx2::sidebar::SidebarController::unregisterSidebarForFrame(pSidebar, this);
+ pSidebar->unregisterSidebarForFrame(this);
}
}
@@ -775,7 +758,7 @@ void SAL_CALL ChartController::dispose()
if( m_aModel.is())
{
uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener;
- uno::Reference< chart2::data::XDataReceiver > xDataReceiver( getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xDataReceiver = getChartModel();
if( xDataReceiver.is() )
xSelectionChangeListener.set( xDataReceiver->getRangeHighlighter(), uno::UNO_QUERY );
if( xSelectionChangeListener.is() )
@@ -788,9 +771,8 @@ void SAL_CALL ChartController::dispose()
//--release all resources and references
{
- uno::Reference< util::XModeChangeBroadcaster > xViewBroadcaster( m_xChartView, uno::UNO_QUERY );
- if( xViewBroadcaster.is() )
- xViewBroadcaster->removeModeChangeListener(this);
+ if( m_xChartView.is() )
+ m_xChartView->removeModeChangeListener(this);
impl_invalidateAccessible();
SolarMutexGuard aSolarGuard;
@@ -809,7 +791,7 @@ void SAL_CALL ChartController::dispose()
if( m_xLayoutManagerEventBroadcaster.is())
{
m_xLayoutManagerEventBroadcaster->removeLayoutManagerEventListener( this );
- m_xLayoutManagerEventBroadcaster.set( nullptr );
+ m_xLayoutManagerEventBroadcaster.clear();
}
m_xFrame.clear();
@@ -828,9 +810,8 @@ void SAL_CALL ChartController::dispose()
#ifdef TEST_ENABLE_MODIFY_LISTENER
try
{
- uno::Reference< util::XModifyBroadcaster > xMBroadcaster( aModelRef->getModel(),uno::UNO_QUERY );
- if( xMBroadcaster.is())
- xMBroadcaster->removeModifyListener( this );
+ if( aModelRef->getModel().is())
+ aModelRef->getModel()->removeModifyListener( this );
}
catch( const uno::Exception & )
{
@@ -856,12 +837,12 @@ void SAL_CALL ChartController::dispose()
void SAL_CALL ChartController::addEventListener(
const uno::Reference<lang::XEventListener>& xListener )
{
- SolarMutexGuard aGuard;
if( impl_isDisposedOrSuspended() )//@todo? allow adding of listeners in suspend mode?
return; //behave passive if already disposed or suspended
//--add listener
- m_aLifeTimeManager.m_aListenerContainer.addInterface( cppu::UnoType<lang::XEventListener>::get(), xListener );
+ std::unique_lock aGuard2(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aEventListeners.addInterface( aGuard2, xListener );
}
void SAL_CALL ChartController::removeEventListener(
@@ -872,7 +853,8 @@ void SAL_CALL ChartController::removeEventListener(
return; //behave passive if already disposed or suspended
//--remove listener
- m_aLifeTimeManager.m_aListenerContainer.removeInterface( cppu::UnoType<lang::XEventListener>::get(), xListener );
+ std::unique_lock aGuard2(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aEventListeners.removeInterface( aGuard2, xListener );
}
// util::XCloseListener
@@ -887,7 +869,7 @@ void SAL_CALL ChartController::queryClosing(
if( !aModelRef.is() )
return;
- if( aModelRef->getModel() != rSource.Source )
+ if( uno::Reference<XInterface>(static_cast<cppu::OWeakObject*>(aModelRef->getModel().get())) != rSource.Source )
{
OSL_FAIL( "queryClosing was called on a controller from an unknown source" );
return;
@@ -931,7 +913,7 @@ bool ChartController::impl_releaseThisModel(
bool bReleaseModel = false;
{
::osl::Guard< ::osl::Mutex > aGuard( m_aModelMutex );
- if( m_aModel.is() && m_aModel->getModel() == xModel )
+ if( m_aModel.is() && uno::Reference< uno::XInterface >(static_cast<cppu::OWeakObject*>(m_aModel->getModel().get())) == xModel )
{
m_aModel = nullptr;
m_xUndoManager.clear();
@@ -953,7 +935,7 @@ void SAL_CALL ChartController::disposing(
if( !impl_releaseThisModel( rSource.Source ))
{
if( rSource.Source == m_xLayoutManagerEventBroadcaster )
- m_xLayoutManagerEventBroadcaster.set( nullptr );
+ m_xLayoutManagerEventBroadcaster.clear();
}
}
@@ -1132,7 +1114,7 @@ void SAL_CALL ChartController::dispatch(
}
else if(aCommand.startsWith("FillGradient"))
{
- this->executeDispatch_FillGradient(aCommand.copy(aCommand.indexOf('=') + 1));
+ this->executeDispatch_FillGradient(aCommand.subView(aCommand.indexOf('=') + 1));
}
else if(aCommand == "Paste")
this->executeDispatch_Paste();
@@ -1144,7 +1126,7 @@ void SAL_CALL ChartController::dispatch(
this->executeDispatch_SourceData();
else if(aCommand == "Update" ) //Update Chart
{
- ChartViewHelper::setViewToDirtyState( getModel() );
+ ChartViewHelper::setViewToDirtyState( getChartModel() );
SolarMutexGuard aGuard;
auto pChartWindow(GetChartWindow());
if( pChartWindow )
@@ -1177,6 +1159,8 @@ void SAL_CALL ChartController::dispatch(
this->executeDispatch_InsertErrorBars(false);
else if( aCommand == "InsertMenuYErrorBars" )
this->executeDispatch_InsertErrorBars(true);
+ else if( aCommand == "InsertMenuDataTable" )
+ this->executeDispatch_OpenInsertDataTableDialog();
else if( aCommand == "InsertSymbol" )
this->executeDispatch_InsertSpecialCharacter();
else if( aCommand == "InsertTrendline" )
@@ -1231,6 +1215,10 @@ void SAL_CALL ChartController::dispatch(
this->executeDispatch_DeleteMajorGrid();
else if( aCommand == "DeleteMinorGrid" )
this->executeDispatch_DeleteMinorGrid();
+ else if( aCommand == "InsertDataTable" )
+ this->executeDispatch_InsertDataTable();
+ else if( aCommand == "DeleteDataTable" )
+ this->executeDispatch_DeleteDataTable();
//format objects
else if( aCommand == "FormatSelection" )
this->executeDispatch_ObjectProperties();
@@ -1245,7 +1233,9 @@ void SAL_CALL ChartController::dispatch(
this->executeDispatch_PositionAndSize();
}
}
- else if( lcl_isFormatObjectCommand(aCommand) )
+ else if ( aCommand == "FontDialog" )
+ this->impl_ShapeControllerDispatch(rURL, rArgs);
+ else if (lcl_isFormatObjectCommand(aCommand))
this->executeDispatch_FormatObject(rURL.Path);
//more format
else if( aCommand == "DiagramType" )
@@ -1309,6 +1299,8 @@ void SAL_CALL ChartController::dispatch(
}
}
}
+ else if( aCommand == "ChangeTheme" )
+ comphelper::dispatchCommand(".uno:ChangeTheme", getFrame(), rArgs);
}
void SAL_CALL ChartController::addStatusListener(
@@ -1343,30 +1335,32 @@ void SAL_CALL ChartController::releaseContextMenuInterceptor(
void ChartController::executeDispatch_ChartType()
{
- UndoLiveUpdateGuard aUndoGuard(
- SchResId( STR_ACTION_EDIT_CHARTTYPE ), m_xUndoManager );
+ auto xUndoGuard = std::make_shared<UndoLiveUpdateGuard>(SchResId(STR_ACTION_EDIT_CHARTTYPE),
+ m_xUndoManager);
SolarMutexGuard aSolarGuard;
//prepare and open dialog
- ChartTypeDialog aDlg(GetChartFrame(), getModel());
- if (aDlg.run() == RET_OK)
- {
- impl_adaptDataSeriesAutoResize();
- aUndoGuard.commit();
- }
+ auto aDlg = std::make_shared<ChartTypeDialog>(GetChartFrame(), getChartModel());
+ weld::DialogController::runAsync(aDlg, [this, xUndoGuard=std::move(xUndoGuard)](int nResult) {
+ if (nResult == RET_OK)
+ {
+ impl_adaptDataSeriesAutoResize();
+ xUndoGuard->commit();
+ }
+ });
}
void ChartController::executeDispatch_SourceData()
{
//convert properties to ItemSet
- uno::Reference< XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
+ rtl::Reference< ::chart::ChartModel > xChartDoc = getChartModel();
OSL_ENSURE( xChartDoc.is(), "Invalid XChartDocument" );
if( !xChartDoc.is() )
return;
// If there is a data table we should ask user if we really want to destroy it
// and switch to data ranges.
- ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartDoc);
+ ChartModel& rModel = *xChartDoc;
if ( rModel.hasInternalDataProvider() )
{
// Check if we will able to create data provider later
@@ -1395,27 +1389,27 @@ void ChartController::executeDispatch_SourceData()
rModel.attachDataProvider(xDataProvider);
}
}
-
- UndoLiveUpdateGuard aUndoGuard(
- SchResId(STR_ACTION_EDIT_DATA_RANGES), m_xUndoManager);
-
+ auto xUndoGuard = std::make_shared<UndoLiveUpdateGuard>(SchResId(STR_ACTION_EDIT_DATA_RANGES),
+ m_xUndoManager);
SolarMutexGuard aSolarGuard;
- ::chart::DataSourceDialog aDlg(GetChartFrame(), xChartDoc, m_xCC);
- if (aDlg.run() == RET_OK)
- {
- impl_adaptDataSeriesAutoResize();
- aUndoGuard.commit();
- }
+ auto aDlg = std::make_shared<DataSourceDialog>(GetChartFrame(), xChartDoc);
+ weld::DialogController::runAsync(aDlg, [this, xUndoGuard=std::move(xUndoGuard)](int nResult) {
+ if (nResult == RET_OK)
+ {
+ impl_adaptDataSeriesAutoResize();
+ xUndoGuard->commit();
+ }
+ });
}
void ChartController::executeDispatch_MoveSeries( bool bForward )
{
- ControllerLockGuardUNO aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
//get selected series
OUString aObjectCID(m_aSelection.getSelectedCID());
- uno::Reference< XDataSeries > xGivenDataSeries( ObjectIdentifier::getDataSeriesForCID( //yyy todo also legend entries and labels?
- aObjectCID, getModel() ) );
+ rtl::Reference< DataSeries > xGivenDataSeries = ObjectIdentifier::getDataSeriesForCID( //yyy todo also legend entries and labels?
+ aObjectCID, getChartModel() );
UndoGuardWithSelection aUndoGuard(
ActionDescriptionProvider::createDescription(
@@ -1423,7 +1417,7 @@ void ChartController::executeDispatch_MoveSeries( bool bForward )
SchResId(STR_OBJECT_DATASERIES)),
m_xUndoManager );
- bool bChanged = DiagramHelper::moveSeries( ChartModelHelper::findDiagram( getModel() ), xGivenDataSeries, bForward );
+ bool bChanged = getFirstDiagram()->moveSeries( xGivenDataSeries, bForward );
if( bChanged )
{
m_aSelection.setSelection( ObjectIdentifier::getMovedSeriesCID( aObjectCID, bForward ) );
@@ -1431,33 +1425,6 @@ void ChartController::executeDispatch_MoveSeries( bool bForward )
}
}
-// ____ XMultiServiceFactory ____
-uno::Reference< uno::XInterface > SAL_CALL
- ChartController::createInstance( const OUString& aServiceSpecifier )
-{
- uno::Reference< uno::XInterface > xResult;
-
- if( aServiceSpecifier == CHART_ACCESSIBLE_TEXT_SERVICE_NAME )
- xResult.set( impl_createAccessibleTextContext());
- return xResult;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL
- ChartController::createInstanceWithArguments(
- const OUString& ServiceSpecifier,
- const uno::Sequence< uno::Any >& /* Arguments */ )
-{
- // ignore Arguments
- return createInstance( ServiceSpecifier );
-}
-
-uno::Sequence< OUString > SAL_CALL
- ChartController::getAvailableServiceNames()
-{
- uno::Sequence< OUString > aServiceNames { CHART_ACCESSIBLE_TEXT_SERVICE_NAME };
- return aServiceNames;
-}
-
// ____ XModifyListener ____
void SAL_CALL ChartController::modified(
const lang::EventObject& /* aEvent */ )
@@ -1477,7 +1444,7 @@ void ChartController::NotifyUndoActionHdl( std::unique_ptr<SdrUndoAction> pUndoA
try
{
- const Reference< document::XUndoManagerSupplier > xSuppUndo( getModel(), uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartModel > xSuppUndo = getChartModel();
const Reference< document::XUndoManager > xUndoManager( xSuppUndo->getUndoManager(), uno::UNO_SET_THROW );
const Reference< document::XUndoAction > xAction( new impl::ShapeUndoElement( std::move(pUndoAction) ) );
xUndoManager->addUndoAction( xAction );
@@ -1492,9 +1459,8 @@ DrawModelWrapper* ChartController::GetDrawModelWrapper()
{
if( !m_pDrawModelWrapper )
{
- ExplicitValueProvider* pProvider = comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView );
- if( pProvider )
- m_pDrawModelWrapper = pProvider->getDrawModelWrapper();
+ if( m_xChartView )
+ m_pDrawModelWrapper = m_xChartView->getDrawModelWrapper();
if ( m_pDrawModelWrapper )
{
m_pDrawModelWrapper->getSdrModel().SetNotifyUndoActionHdl(
@@ -1514,7 +1480,7 @@ DrawViewWrapper* ChartController::GetDrawViewWrapper()
}
-VclPtr<ChartWindow> ChartController::GetChartWindow() const
+ChartWindow* ChartController::GetChartWindow() const
{
// clients getting the naked VCL Window from UNO should always have the
// solar mutex (and keep it over the lifetime of this ptr), as VCL might
@@ -1522,7 +1488,7 @@ VclPtr<ChartWindow> ChartController::GetChartWindow() const
DBG_TESTSOLARMUTEX();
if(!m_xViewWindow.is())
return nullptr;
- return dynamic_cast<ChartWindow*>(VCLUnoHelper::GetWindow(m_xViewWindow).get());
+ return dynamic_cast<ChartWindow*>(VCLUnoHelper::GetWindow(m_xViewWindow));
}
weld::Window* ChartController::GetChartFrame()
@@ -1552,41 +1518,46 @@ void ChartController::SetAndApplySelection(const Reference<drawing::XShape>& rxS
uno::Reference< XAccessible > ChartController::CreateAccessible()
{
- uno::Reference< XAccessible > xResult = new AccessibleChartView( GetDrawViewWrapper() );
- impl_initializeAccessible( uno::Reference< lang::XInitialization >( xResult, uno::UNO_QUERY ) );
+#if !ENABLE_WASM_STRIP_ACCESSIBILITY
+ rtl::Reference< AccessibleChartView > xResult = new AccessibleChartView( GetDrawViewWrapper() );
+ impl_initializeAccessible( *xResult );
return xResult;
+#else
+ return uno::Reference< XAccessible >();
+#endif
}
void ChartController::impl_invalidateAccessible()
{
+#if !ENABLE_WASM_STRIP_ACCESSIBILITY
SolarMutexGuard aGuard;
auto pChartWindow(GetChartWindow());
if( pChartWindow )
{
- Reference< lang::XInitialization > xInit( pChartWindow->GetAccessible(false), uno::UNO_QUERY );
+ Reference< XInterface > xInit( pChartWindow->GetAccessible(false) );
if(xInit.is())
{
- uno::Sequence< uno::Any > aArguments(3);//empty arguments -> invalid accessible
- xInit->initialize(aArguments);
+ //empty arguments -> invalid accessible
+ dynamic_cast<AccessibleChartView&>(*xInit).initialize();
}
}
+#endif
}
void ChartController::impl_initializeAccessible()
{
+#if !ENABLE_WASM_STRIP_ACCESSIBILITY
SolarMutexGuard aGuard;
auto pChartWindow(GetChartWindow());
- if( pChartWindow )
- this->impl_initializeAccessible( Reference< lang::XInitialization >( pChartWindow->GetAccessible(false), uno::UNO_QUERY ) );
+ if( !pChartWindow )
+ return;
+ Reference< XInterface > xInit( pChartWindow->GetAccessible(false) );
+ if(xInit.is())
+ impl_initializeAccessible( dynamic_cast<AccessibleChartView&>(*xInit) );
+#endif
}
-void ChartController::impl_initializeAccessible( const uno::Reference< lang::XInitialization >& xInit )
+#if !ENABLE_WASM_STRIP_ACCESSIBILITY
+void ChartController::impl_initializeAccessible( AccessibleChartView& rAccChartView )
{
- if(!xInit.is())
- return;
-
- uno::Sequence< uno::Any > aArguments(5);
- aArguments[0] <<= uno::Reference<view::XSelectionSupplier>(this);
- aArguments[1] <<= getModel();
- aArguments[2] <<= m_xChartView;
uno::Reference< XAccessible > xParent;
{
SolarMutexGuard aGuard;
@@ -1598,11 +1569,12 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn
xParent.set( pParentWin->GetAccessible());
}
}
- aArguments[3] <<= xParent;
- aArguments[4] <<= m_xViewWindow;
- xInit->initialize(aArguments);
+ rAccChartView.initialize(*this, getChartModel(), m_xChartView, xParent, m_xViewWindow);
}
+#else
+void ChartController::impl_initializeAccessible( AccessibleChartView& /* rAccChartView */) {}
+#endif
const o3tl::sorted_vector< OUString >& ChartController::impl_getAvailableCommands()
{
@@ -1631,8 +1603,10 @@ const o3tl::sorted_vector< OUString >& ChartController::impl_getAvailableCommand
"DeleteTrendline", "DeleteMeanValue", "DeleteTrendlineEquation",
"DeleteXErrorBars", "DeleteYErrorBars",
"DeleteDataLabels", "DeleteDataLabel",
+ "InsertMenuDataTable",
+ "InsertDataTable", "DeleteDataTable",
//format objects
- "FormatSelection", "TransformDialog",
+ "FormatSelection", "FontDialog", "TransformDialog",
"DiagramType", "View3D",
"Forward", "Backward",
"MainTitle", "SubTitle",
@@ -1679,11 +1653,4 @@ ViewElementListProvider ChartController::getViewElementListProvider()
} //namespace chart
-extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
-com_sun_star_comp_chart2_ChartController_get_implementation(css::uno::XComponentContext *context,
- css::uno::Sequence<css::uno::Any> const &)
-{
- return cppu::acquire(new chart::ChartController(context));
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
index e9820cab3cce..63577edf3920 100644
--- a/chart2/source/controller/main/ChartController_EditData.cxx
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -17,8 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <ChartWindow.hxx>
#include <ChartController.hxx>
+#include <ChartModel.hxx>
#include <dlg_DataEditor.hxx>
#include "UndoGuard.hxx"
@@ -26,18 +26,15 @@
#include <strings.hrc>
#include <vcl/svapp.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
using namespace ::com::sun::star;
-using ::com::sun::star::uno::Reference;
-
namespace chart
{
void ChartController::executeDispatch_EditData()
{
- Reference< chart2::XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
+ rtl::Reference<::chart::ChartModel> xChartDoc( getChartModel(), uno::UNO_QUERY );
if (xChartDoc.is())
{
SolarMutexGuard aSolarGuard;
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 320282a5deb5..b3455ad49e04 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -25,13 +25,15 @@
#include <dlg_InsertLegend.hxx>
#include <dlg_InsertErrorBars.hxx>
#include <dlg_InsertTitle.hxx>
+#include <dlg_InsertDataTable.hxx>
#include <dlg_ObjectProperties.hxx>
-#include <ChartModel.hxx>
-#include <ChartModelHelper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <TitleHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <DataSeries.hxx>
+#include <Diagram.hxx>
+#include <GridProperties.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include <chartview/ChartSfxItemIds.hxx>
#include <NumberFormatterWrapper.hxx>
@@ -49,15 +51,17 @@
#include <ErrorBarItemConverter.hxx>
#include <DataSeriesHelper.hxx>
#include <ObjectNameProvider.hxx>
+#include <Legend.hxx>
#include <LegendHelper.hxx>
+#include <DataTable.hxx>
+#include <RegressionCurveModel.hxx>
#include <com/sun/star/chart2/XRegressionCurve.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <svx/ActionDescriptionProvider.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
@@ -68,14 +72,12 @@ using ::com::sun::star::uno::Sequence;
namespace
{
-void lcl_InsertMeanValueLine( const uno::Reference< chart2::XDataSeries > & xSeries )
+void lcl_InsertMeanValueLine( const rtl::Reference< ::chart::DataSeries > & xSeries )
{
- uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
- xSeries, uno::UNO_QUERY );
- if( xRegCurveCnt.is())
+ if( xSeries.is())
{
::chart::RegressionCurveHelper::addMeanValueLine(
- xRegCurveCnt, uno::Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ));
+ xSeries, xSeries);
}
}
@@ -86,35 +88,36 @@ namespace chart
void ChartController::executeDispatch_InsertAxes()
{
- UndoGuard aUndoGuard(
+ auto xUndoGuard = std::make_shared<UndoGuard>(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_AXES )),
m_xUndoManager );
try
{
- InsertAxisOrGridDialogData aDialogInput;
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(getModel());
- AxisHelper::getAxisOrGridExistence( aDialogInput.aExistenceList, xDiagram );
- AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram );
+ auto aDialogInput = std::make_shared<InsertAxisOrGridDialogData>();
+ rtl::Reference< Diagram > xDiagram = getFirstDiagram();
+ AxisHelper::getAxisOrGridExistence( aDialogInput->aExistenceList, xDiagram );
+ AxisHelper::getAxisOrGridPossibilities( aDialogInput->aPossibilityList, xDiagram );
SolarMutexGuard aGuard;
- SchAxisDlg aDlg(GetChartFrame(), aDialogInput);
- if (aDlg.run() == RET_OK)
- {
- // lock controllers till end of block
- ControllerLockGuardUNO aCLGuard( getModel() );
-
- InsertAxisOrGridDialogData aDialogOutput;
- aDlg.getResult(aDialogOutput);
- std::unique_ptr< ReferenceSizeProvider > pRefSizeProvider(
- impl_createReferenceSizeProvider());
- bool bChanged = AxisHelper::changeVisibilityOfAxes( xDiagram
- , aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC
- , pRefSizeProvider.get() );
- if( bChanged )
- aUndoGuard.commit();
- }
+ auto aDlg = std::make_shared<SchAxisDlg>(GetChartFrame(), *aDialogInput);
+ weld::DialogController::runAsync(aDlg, [this, aDlg, aDialogInput, xUndoGuard=std::move(xUndoGuard)](int nResult) {
+ if ( nResult == RET_OK )
+ {
+ // lock controllers till end of block
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
+
+ InsertAxisOrGridDialogData aDialogOutput;
+ aDlg->getResult(aDialogOutput);
+ ReferenceSizeProvider aRefSizeProvider(impl_createReferenceSizeProvider());
+ bool bChanged = AxisHelper::changeVisibilityOfAxes( getFirstDiagram()
+ , aDialogInput->aExistenceList, aDialogOutput.aExistenceList, m_xCC
+ , &aRefSizeProvider );
+ if( bChanged )
+ xUndoGuard->commit();
+ }
+ });
}
catch(const uno::RuntimeException&)
{
@@ -132,7 +135,7 @@ void ChartController::executeDispatch_InsertGrid()
try
{
InsertAxisOrGridDialogData aDialogInput;
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(getModel());
+ rtl::Reference< Diagram > xDiagram = getFirstDiagram();
AxisHelper::getAxisOrGridExistence( aDialogInput.aExistenceList, xDiagram, false );
AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, false );
@@ -141,7 +144,7 @@ void ChartController::executeDispatch_InsertGrid()
if (aDlg.run() == RET_OK)
{
// lock controllers till end of block
- ControllerLockGuardUNO aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
InsertAxisOrGridDialogData aDialogOutput;
aDlg.getResult( aDialogOutput );
bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
@@ -156,30 +159,145 @@ void ChartController::executeDispatch_InsertGrid()
}
}
+void ChartController::executeDispatch_OpenInsertDataTableDialog()
+{
+ SolarMutexGuard aGuard;
+
+ auto aUndoDescription = ActionDescriptionProvider::createDescription(ActionDescriptionProvider::ActionType::Insert, SchResId(STR_DATA_TABLE));
+ UndoGuard aUndoGuard(aUndoDescription, m_xUndoManager);
+
+ rtl::Reference<Diagram> xDiagram = getFirstDiagram();
+
+ InsertDataTableDialog aDialog(GetChartFrame());
+ {
+ // init values
+ DataTableDialogData aData;
+ auto xDataTable = xDiagram->getDataTable();
+ aData.mbShow = xDataTable.is();
+ if (xDataTable.is())
+ {
+ uno::Reference<beans::XPropertySet> xProperties(xDataTable, uno::UNO_QUERY);
+
+ uno::Any aAny = xProperties->getPropertyValue("HBorder");
+ if (aAny.has<bool>())
+ aData.mbHorizontalBorders = aAny.get<bool>();
+
+ aAny = xProperties->getPropertyValue("VBorder");
+ if (aAny.has<bool>())
+ aData.mbVerticalBorders = aAny.get<bool>();
+
+ aAny = xProperties->getPropertyValue("Outline");
+ if (aAny.has<bool>())
+ aData.mbOutline = aAny.get<bool>();
+
+ aAny = xProperties->getPropertyValue("Keys");
+ if (aAny.has<bool>())
+ aData.mbKeys = aAny.get<bool>();
+ }
+ aDialog.init(aData);
+ }
+
+ // show the dialog
+ if (aDialog.run() == RET_OK)
+ {
+ bool bChanged = false;
+
+ auto& rDialogData = aDialog.getDataTableDialogData();
+ auto xDataTable = xDiagram->getDataTable();
+ if (!rDialogData.mbShow && xDataTable.is())
+ {
+ xDiagram->setDataTable(uno::Reference<chart2::XDataTable>());
+ bChanged = true;
+ }
+ else if (rDialogData.mbShow && !xDataTable.is())
+ {
+ uno::Reference<chart2::XDataTable> xNewDataTable(new DataTable);
+ if (xNewDataTable.is())
+ {
+ xDiagram->setDataTable(xNewDataTable);
+ bChanged = true;
+ }
+ }
+
+ // Set the properties
+ xDataTable = xDiagram->getDataTable();
+ if (rDialogData.mbShow && xDataTable.is())
+ {
+ uno::Reference<beans::XPropertySet> xProperties(xDataTable, uno::UNO_QUERY);
+ xProperties->setPropertyValue("HBorder" , uno::Any(rDialogData.mbHorizontalBorders));
+ xProperties->setPropertyValue("VBorder" , uno::Any(rDialogData.mbVerticalBorders));
+ xProperties->setPropertyValue("Outline" , uno::Any(rDialogData.mbOutline));
+ xProperties->setPropertyValue("Keys" , uno::Any(rDialogData.mbKeys));
+ bChanged = true;
+ }
+
+ if (bChanged)
+ aUndoGuard.commit();
+ }
+}
+
+/** Create and insert a data table to the chart */
+void ChartController::executeDispatch_InsertDataTable()
+{
+ auto aUndoDescription = ActionDescriptionProvider::createDescription(ActionDescriptionProvider::ActionType::Insert, SchResId(STR_DATA_TABLE));
+ UndoGuard aUndoGuard(aUndoDescription, m_xUndoManager);
+
+
+ rtl::Reference<Diagram> xDiagram = getFirstDiagram();
+ auto xDataTable = xDiagram->getDataTable();
+ if (!xDataTable.is())
+ {
+ uno::Reference<chart2::XDataTable> xNewDataTable(new DataTable);
+ if (xNewDataTable.is())
+ {
+ xDiagram->setDataTable(xNewDataTable);
+ aUndoGuard.commit();
+ }
+ }
+}
+
+/** Delete a data table from the chart */
+void ChartController::executeDispatch_DeleteDataTable()
+{
+ auto aUndoDescription = ActionDescriptionProvider::createDescription(ActionDescriptionProvider::ActionType::Delete, SchResId(STR_DATA_TABLE));
+ UndoGuard aUndoGuard(aUndoDescription, m_xUndoManager);
+
+ rtl::Reference<Diagram> xDiagram = getFirstDiagram();
+ auto xDataTable = xDiagram->getDataTable();
+ if (xDataTable.is())
+ {
+ // insert a empty data table reference
+ xDiagram->setDataTable(uno::Reference<chart2::XDataTable>());
+ aUndoGuard.commit();
+ }
+}
+
void ChartController::executeDispatch_InsertTitles()
{
- UndoGuard aUndoGuard(
+ auto xUndoGuard = std::make_shared<UndoGuard>(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_TITLES )),
m_xUndoManager );
try
{
- TitleDialogData aDialogInput;
- aDialogInput.readFromModel( getModel() );
+ auto aDialogInput = std::make_shared<TitleDialogData>();
+ aDialogInput->readFromModel( getChartModel() );
SolarMutexGuard aGuard;
- SchTitleDlg aDlg(GetChartFrame(), aDialogInput);
- if (aDlg.run() == RET_OK)
- {
- // lock controllers till end of block
- ControllerLockGuardUNO aCLGuard( getModel() );
- TitleDialogData aDialogOutput(impl_createReferenceSizeProvider());
- aDlg.getResult(aDialogOutput);
- bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput );
- if( bChanged )
- aUndoGuard.commit();
- }
+ auto aDlg = std::make_shared<SchTitleDlg>(GetChartFrame(), *aDialogInput);
+ weld::DialogController::runAsync(aDlg, [this, aDlg, aDialogInput, xUndoGuard=std::move(xUndoGuard)](int nResult){
+ if ( nResult == RET_OK )
+ {
+ // lock controllers till end of block
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
+ TitleDialogData aDialogOutput( impl_createReferenceSizeProvider() );
+ aDlg->getResult( aDialogOutput );
+ bool bChanged = aDialogOutput.writeDifferenceToModel( getChartModel(), m_xCC, aDialogInput.get() );
+ if( bChanged )
+ xUndoGuard->commit();
+ }
+ });
}
catch(const uno::RuntimeException&)
{
@@ -194,8 +312,7 @@ void ChartController::executeDispatch_DeleteLegend()
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_LEGEND )),
m_xUndoManager );
- ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel());
- LegendHelper::hideLegend(rModel);
+ LegendHelper::hideLegend(*getChartModel());
aUndoGuard.commit();
}
@@ -206,8 +323,7 @@ void ChartController::executeDispatch_InsertLegend()
ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_LEGEND )),
m_xUndoManager );
- ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel());
- LegendHelper::showLegend(rModel, m_xCC);
+ LegendHelper::showLegend(*getChartModel(), m_xCC);
aUndoGuard.commit();
}
@@ -223,12 +339,12 @@ void ChartController::executeDispatch_OpenLegendDialog()
//prepare and open dialog
SolarMutexGuard aGuard;
SchLegendDlg aDlg(GetChartFrame(), m_xCC);
- aDlg.init( getModel() );
+ aDlg.init( getChartModel() );
if (aDlg.run() == RET_OK)
{
// lock controllers till end of block
- ControllerLockGuardUNO aCLGuard( getModel() );
- aDlg.writeToModel( getModel() );
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
+ aDlg.writeToModel( getChartModel() );
aUndoGuard.commit();
}
}
@@ -240,14 +356,14 @@ void ChartController::executeDispatch_OpenLegendDialog()
void ChartController::executeDispatch_InsertMenu_DataLabels()
{
- UndoGuard aUndoGuard(
+ std::shared_ptr<UndoGuard> aUndoGuard = std::make_shared<UndoGuard>(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_DATALABELS )),
m_xUndoManager );
//if a series is selected insert labels for that series only:
- uno::Reference< chart2::XDataSeries > xSeries =
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel());
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel());
if( xSeries.is() )
{
// add labels
@@ -257,19 +373,16 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
OUString aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticles(
ObjectIdentifier::getSeriesParticleFromCID(m_aSelection.getSelectedCID()), aChildParticle );
- bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, true );
- if( bSuccess )
- aUndoGuard.commit();
+ ChartController::executeDlg_ObjectProperties_withUndoGuard( aUndoGuard, aObjectCID, true );
return;
}
-
try
{
wrapper::AllDataLabelItemConverter aItemConverter(
- getModel(),
+ getChartModel(),
m_pDrawModelWrapper->GetItemPool(),
m_pDrawModelWrapper->getSdrModel(),
- uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
+ getChartModel() );
SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
aItemConverter.FillItemSet( aItemSet );
@@ -277,8 +390,7 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
SolarMutexGuard aGuard;
//get number formatter
- uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( getModel(), uno::UNO_QUERY );
- NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+ NumberFormatterWrapper aNumberFormatterWrapper( getChartModel() );
SvNumberFormatter* pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
DataLabelsDialog aDlg(GetChartFrame(), aItemSet, pNumberFormatter);
@@ -288,10 +400,10 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
aDlg.FillItemSet(aOutItemSet);
// lock controllers till end of block
- ControllerLockGuardUNO aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
if( bChanged )
- aUndoGuard.commit();
+ aUndoGuard->commit();
}
}
catch(const uno::RuntimeException&)
@@ -307,7 +419,7 @@ void ChartController::executeDispatch_InsertMeanValue()
ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_AVERAGE_LINE )),
m_xUndoManager );
lcl_InsertMeanValueLine( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(),
- getModel() ) );
+ getChartModel() ) );
aUndoGuard.commit();
}
@@ -318,17 +430,17 @@ void ChartController::executeDispatch_InsertMenu_MeanValues()
ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_AVERAGE_LINE )),
m_xUndoManager );
- uno::Reference< chart2::XDataSeries > xSeries =
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xSeries.is() )
{
//if a series is selected insert mean value only for that series:
lcl_InsertMeanValueLine( xSeries );
}
- else
+ else if (rtl::Reference<Diagram> xDiagram = getFirstDiagram())
{
- std::vector< uno::Reference< chart2::XDataSeries > > aSeries(
- DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( getModel() )));
+ std::vector< rtl::Reference< DataSeries > > aSeries =
+ xDiagram->getDataSeries();
for( const auto& xSrs : aSeries )
lcl_InsertMeanValueLine( xSrs );
@@ -340,8 +452,8 @@ void ChartController::executeDispatch_InsertMenu_Trendlines()
{
OUString aCID = m_aSelection.getSelectedCID();
- uno::Reference< chart2::XDataSeries > xSeries =
- ObjectIdentifier::getDataSeriesForCID( aCID, getModel() );
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID( aCID, getChartModel() );
if( !xSeries.is() )
return;
@@ -351,60 +463,57 @@ void ChartController::executeDispatch_InsertMenu_Trendlines()
void ChartController::executeDispatch_InsertTrendline()
{
- uno::Reference< chart2::XRegressionCurveContainer > xRegressionCurveContainer(
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel()), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegressionCurveContainer =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel());
if( !xRegressionCurveContainer.is() )
return;
- UndoLiveUpdateGuard aUndoGuard(
+ auto xUndoGuard = std::make_shared<UndoLiveUpdateGuard>(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_CURVE )),
m_xUndoManager );
- uno::Reference< chart2::XRegressionCurve > xCurve =
+ rtl::Reference< RegressionCurveModel > xCurve =
RegressionCurveHelper::addRegressionCurve(
SvxChartRegress::Linear,
xRegressionCurveContainer );
- uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
-
- if( !xProperties.is())
+ if( !xCurve.is())
return;
- wrapper::RegressionCurveItemConverter aItemConverter(
- xProperties, xRegressionCurveContainer, m_pDrawModelWrapper->getSdrModel().GetItemPool(),
+ auto aItemConverter = std::make_shared<wrapper::RegressionCurveItemConverter>(
+ xCurve, xRegressionCurveContainer, m_pDrawModelWrapper->getSdrModel().GetItemPool(),
m_pDrawModelWrapper->getSdrModel(),
- uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
+ getChartModel() );
// open dialog
- SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
- aItemConverter.FillItemSet( aItemSet );
+ SfxItemSet aItemSet = aItemConverter->CreateEmptyItemSet();
+ aItemConverter->FillItemSet( aItemSet );
ObjectPropertiesDialogParameter aDialogParameter(
ObjectIdentifier::createDataCurveCID(
ObjectIdentifier::getSeriesParticleFromCID( m_aSelection.getSelectedCID()),
RegressionCurveHelper::getRegressionCurveIndex( xRegressionCurveContainer, xCurve ), false ));
- aDialogParameter.init( getModel() );
+ aDialogParameter.init( getChartModel() );
ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
SolarMutexGuard aGuard;
- SchAttribTabDlg aDialog(
- GetChartFrame(), &aItemSet, &aDialogParameter,
- &aViewElementListProvider,
- uno::Reference< util::XNumberFormatsSupplier >(
- getModel(), uno::UNO_QUERY ) );
+ auto aDialog = std::make_shared<SchAttribTabDlg>(GetChartFrame(), &aItemSet, &aDialogParameter,
+ &aViewElementListProvider, getChartModel());
// note: when a user pressed "OK" but didn't change any settings in the
// dialog, the SfxTabDialog returns "Cancel"
- if( aDialog.run() == RET_OK || aDialog.DialogWasClosedWithOK())
- {
- const SfxItemSet* pOutItemSet = aDialog.GetOutputItemSet();
- if( pOutItemSet )
+ SfxTabDialogController::runAsync(aDialog, [this, aDialog, aItemConverter, xUndoGuard=std::move(xUndoGuard)](int nResult) {
+ if ( nResult == RET_OK || aDialog->DialogWasClosedWithOK() )
{
- ControllerLockGuardUNO aCLGuard( getModel() );
- aItemConverter.ApplyItemSet( *pOutItemSet );
+ const SfxItemSet* pOutItemSet = aDialog->GetOutputItemSet();
+ if( pOutItemSet )
+ {
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
+ aItemConverter->ApplyItemSet( *pOutItemSet );
+ }
+ xUndoGuard->commit();
}
- aUndoGuard.commit();
- }
+ });
}
void ChartController::executeDispatch_InsertErrorBars( bool bYError )
@@ -412,12 +521,12 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
ObjectType objType = bYError ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X;
//if a series is selected insert error bars for that series only:
- uno::Reference< chart2::XDataSeries > xSeries =
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xSeries.is())
{
- UndoLiveUpdateGuard aUndoGuard(
+ auto xUndoGuard = std::make_shared<UndoLiveUpdateGuard>(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Insert,
SchResId( bYError ? STR_OBJECT_ERROR_BARS_Y : STR_OBJECT_ERROR_BARS_X )),
@@ -430,47 +539,48 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
bYError));
// get an appropriate item converter
- wrapper::ErrorBarItemConverter aItemConverter(
- getModel(), xErrorBarProp, m_pDrawModelWrapper->getSdrModel().GetItemPool(),
+ auto aItemConverter = std::make_shared<wrapper::ErrorBarItemConverter> (
+ getChartModel(), xErrorBarProp, m_pDrawModelWrapper->getSdrModel().GetItemPool(),
m_pDrawModelWrapper->getSdrModel(),
- uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
+ getChartModel() );
// open dialog
- SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
+ SfxItemSet aItemSet = aItemConverter->CreateEmptyItemSet();
aItemSet.Put(SfxBoolItem(SCHATTR_STAT_ERRORBAR_TYPE,bYError));
- aItemConverter.FillItemSet( aItemSet );
+ aItemConverter->FillItemSet( aItemSet );
ObjectPropertiesDialogParameter aDialogParameter(
ObjectIdentifier::createClassifiedIdentifierWithParent(
- objType, OUString(), m_aSelection.getSelectedCID()));
- aDialogParameter.init( getModel() );
+ objType, u"", m_aSelection.getSelectedCID()));
+ aDialogParameter.init( getChartModel() );
ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
SolarMutexGuard aGuard;
- SchAttribTabDlg aDlg(
+ auto aDlg = std::make_shared<SchAttribTabDlg>(
GetChartFrame(), &aItemSet, &aDialogParameter,
&aViewElementListProvider,
- uno::Reference< util::XNumberFormatsSupplier >(
- getModel(), uno::UNO_QUERY ) );
- aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
- InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(),
+ getChartModel() );
+ aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
+ InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getChartModel(),
m_xChartView, m_aSelection.getSelectedCID()));
// note: when a user pressed "OK" but didn't change any settings in the
// dialog, the SfxTabDialog returns "Cancel"
- if (aDlg.run() == RET_OK || aDlg.DialogWasClosedWithOK())
- {
- const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
- if( pOutItemSet )
+ SfxTabDialogController::runAsync(aDlg, [this, aDlg, aItemConverter, xUndoGuard=std::move(xUndoGuard)](int nResult) {
+ if ( nResult == RET_OK || aDlg->DialogWasClosedWithOK() )
{
- ControllerLockGuardUNO aCLGuard( getModel() );
- aItemConverter.ApplyItemSet( *pOutItemSet );
+ const SfxItemSet* pOutItemSet = aDlg->GetOutputItemSet();
+ if( pOutItemSet )
+ {
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
+ aItemConverter->ApplyItemSet( *pOutItemSet );
+ }
+ xUndoGuard->commit();
}
- aUndoGuard.commit();
- }
+ });
}
else
{
//if no series is selected insert error bars for all series
- UndoGuard aUndoGuard(
+ auto xUndoGuard = std::make_shared<UndoGuard>(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Insert,
ObjectNameProvider::getName_ObjectForAllSeries( objType ) ),
@@ -478,32 +588,34 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
try
{
- wrapper::AllSeriesStatisticsConverter aItemConverter(
- getModel(), m_pDrawModelWrapper->GetItemPool() );
- SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
- aItemConverter.FillItemSet( aItemSet );
+ auto aItemConverter = std::make_shared<wrapper::AllSeriesStatisticsConverter>(
+ getChartModel(), m_pDrawModelWrapper->GetItemPool() );
+ SfxItemSet aItemSet = aItemConverter->CreateEmptyItemSet();
+ aItemConverter->FillItemSet( aItemSet );
//prepare and open dialog
SolarMutexGuard aGuard;
- InsertErrorBarsDialog aDlg(
+ auto aDlg = std::make_shared<InsertErrorBarsDialog>(
GetChartFrame(), aItemSet,
- uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ),
+ getChartModel(),
bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X);
- aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
- InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, OUString() ) );
-
- if (aDlg.run() == RET_OK)
- {
- SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
- aDlg.FillItemSet( aOutItemSet );
-
- // lock controllers till end of block
- ControllerLockGuardUNO aCLGuard( getModel() );
- bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
- if( bChanged )
- aUndoGuard.commit();
- }
+ aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
+ InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getChartModel(), m_xChartView, u"" ) );
+
+ weld::DialogController::runAsync(aDlg, [this, aDlg, aItemConverter, xUndoGuard=std::move(xUndoGuard)](int nResult) {
+ if ( nResult == RET_OK )
+ {
+ SfxItemSet aOutItemSet = aItemConverter->CreateEmptyItemSet();
+ aDlg->FillItemSet( aOutItemSet );
+
+ // lock controllers till end of block
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
+ bool bChanged = aItemConverter->ApplyItemSet( aOutItemSet );//model should be changed now
+ if( bChanged )
+ xUndoGuard->commit();
+ }
+ });
}
catch(const uno::RuntimeException&)
{
@@ -515,11 +627,11 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 )
{
uno::Reference< chart2::XRegressionCurve > xRegCurve(
- ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getChartModel() ), uno::UNO_QUERY );
if( !xRegCurve.is() )
{
- uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegCurveCnt =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
xRegCurve.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) );
}
if( !xRegCurve.is())
@@ -543,7 +655,7 @@ void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 )
void ChartController::executeDispatch_InsertR2Value()
{
uno::Reference< beans::XPropertySet > xEqProp =
- ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() );
+ ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getChartModel() );
if( xEqProp.is())
{
UndoGuard aUndoGuard(
@@ -558,7 +670,7 @@ void ChartController::executeDispatch_InsertR2Value()
void ChartController::executeDispatch_DeleteR2Value()
{
uno::Reference< beans::XPropertySet > xEqProp =
- ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() );
+ ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getChartModel() );
if( xEqProp.is())
{
UndoGuard aUndoGuard(
@@ -572,8 +684,8 @@ void ChartController::executeDispatch_DeleteR2Value()
void ChartController::executeDispatch_DeleteMeanValue()
{
- uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegCurveCnt =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xRegCurveCnt.is())
{
UndoGuard aUndoGuard(
@@ -587,8 +699,8 @@ void ChartController::executeDispatch_DeleteMeanValue()
void ChartController::executeDispatch_DeleteTrendline()
{
- uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegCurveCnt =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xRegCurveCnt.is())
{
UndoGuard aUndoGuard(
@@ -602,8 +714,8 @@ void ChartController::executeDispatch_DeleteTrendline()
void ChartController::executeDispatch_DeleteTrendlineEquation()
{
- uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegCurveCnt =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xRegCurveCnt.is())
{
UndoGuard aUndoGuard(
@@ -617,8 +729,8 @@ void ChartController::executeDispatch_DeleteTrendlineEquation()
void ChartController::executeDispatch_DeleteErrorBars( bool bYError )
{
- uno::Reference< chart2::XDataSeries > xDataSeries(
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ));
+ rtl::Reference< DataSeries > xDataSeries =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xDataSeries.is())
{
UndoGuard aUndoGuard(
@@ -632,8 +744,8 @@ void ChartController::executeDispatch_DeleteErrorBars( bool bYError )
void ChartController::executeDispatch_InsertDataLabels()
{
- uno::Reference< chart2::XDataSeries > xSeries =
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xSeries.is() )
{
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::ActionType::Insert,
@@ -649,14 +761,14 @@ void ChartController::executeDispatch_InsertDataLabel()
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::ActionType::Insert,
SchResId( STR_OBJECT_LABEL )),
m_xUndoManager );
- DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) );
+ DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getChartModel() ) );
aUndoGuard.commit();
}
void ChartController::executeDispatch_DeleteDataLabels()
{
- uno::Reference< chart2::XDataSeries > xSeries =
- ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xSeries.is() )
{
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::ActionType::Delete,
@@ -672,7 +784,7 @@ void ChartController::executeDispatch_DeleteDataLabel()
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::ActionType::Delete,
SchResId( STR_OBJECT_LABEL )),
m_xUndoManager );
- DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) );
+ DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getChartModel() ) );
aUndoGuard.commit();
}
@@ -681,7 +793,7 @@ void ChartController::executeDispatch_ResetAllDataPoints()
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::ActionType::Format,
SchResId( STR_OBJECT_DATAPOINTS )),
m_xUndoManager );
- uno::Reference< chart2::XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xSeries.is() )
xSeries->resetAllDataPoints();
aUndoGuard.commit();
@@ -691,7 +803,7 @@ void ChartController::executeDispatch_ResetDataPoint()
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::ActionType::Format,
SchResId( STR_OBJECT_DATAPOINT )),
m_xUndoManager );
- uno::Reference< chart2::XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xSeries.is() )
{
sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
@@ -704,18 +816,18 @@ void ChartController::executeDispatch_InsertAxisTitle()
{
try
{
- uno::Reference< XTitle > xTitle;
+ rtl::Reference< Title > xTitle;
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_TITLE )),
m_xUndoManager );
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
sal_Int32 nDimensionIndex = -1;
sal_Int32 nCooSysIndex = -1;
sal_Int32 nAxisIndex = -1;
- AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram(getModel()), nCooSysIndex, nDimensionIndex, nAxisIndex );
+ AxisHelper::getIndicesForAxis( xAxis, getFirstDiagram(), nCooSysIndex, nDimensionIndex, nAxisIndex );
TitleHelper::eTitleType eTitleType = TitleHelper::X_AXIS_TITLE;
if( nDimensionIndex==0 )
@@ -725,8 +837,8 @@ void ChartController::executeDispatch_InsertAxisTitle()
else
eTitleType = TitleHelper::Z_AXIS_TITLE;
- std::unique_ptr< ReferenceSizeProvider > apRefSizeProvider( impl_createReferenceSizeProvider());
- xTitle = TitleHelper::createTitle( eTitleType, ObjectNameProvider::getTitleNameByType(eTitleType), getModel(), m_xCC, apRefSizeProvider.get() );
+ ReferenceSizeProvider aRefSizeProvider( impl_createReferenceSizeProvider());
+ xTitle = TitleHelper::createTitle( eTitleType, ObjectNameProvider::getTitleNameByType(eTitleType), getChartModel(), m_xCC, &aRefSizeProvider );
aUndoGuard.commit();
}
}
@@ -745,7 +857,7 @@ void ChartController::executeDispatch_InsertAxis()
try
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xAxis.is() )
{
AxisHelper::makeAxisVisible( xAxis );
@@ -767,7 +879,7 @@ void ChartController::executeDispatch_DeleteAxis()
try
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xAxis.is() )
{
AxisHelper::makeAxisInvisible( xAxis );
@@ -789,10 +901,10 @@ void ChartController::executeDispatch_InsertMajorGrid()
try
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xAxis.is() )
{
- AxisHelper::makeGridVisible( xAxis->getGridProperties() );
+ AxisHelper::makeGridVisible( xAxis->getGridProperties2() );
aUndoGuard.commit();
}
}
@@ -811,10 +923,10 @@ void ChartController::executeDispatch_DeleteMajorGrid()
try
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xAxis.is() )
{
- AxisHelper::makeGridInvisible( xAxis->getGridProperties() );
+ AxisHelper::makeGridInvisible( xAxis->getGridProperties2() );
aUndoGuard.commit();
}
}
@@ -833,11 +945,11 @@ void ChartController::executeDispatch_InsertMinorGrid()
try
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xAxis.is() )
{
- const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
- for( Reference< beans::XPropertySet > const & props : aSubGrids)
+ std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
+ for( rtl::Reference< GridProperties > const & props : aSubGrids)
AxisHelper::makeGridVisible( props );
aUndoGuard.commit();
}
@@ -857,11 +969,11 @@ void ChartController::executeDispatch_DeleteMinorGrid()
try
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
if( xAxis.is() )
{
- const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
- for( Reference< beans::XPropertySet > const & props : aSubGrids)
+ std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
+ for( rtl::Reference< ::chart::GridProperties > const & props : aSubGrids)
AxisHelper::makeGridInvisible( props );
aUndoGuard.commit();
}
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
index c6af3878bdd7..df047d747afd 100644
--- a/chart2/source/controller/main/ChartController_Position.cxx
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -19,31 +19,28 @@
#include <ChartController.hxx>
-#include <ChartWindow.hxx>
#include <DrawViewWrapper.hxx>
#include <PositionAndSizeHelper.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartView.hxx>
#include "UndoGuard.hxx"
#include <ObjectNameProvider.hxx>
#include <DiagramHelper.hxx>
-#include <chartview/ExplicitValueProvider.hxx>
#include <CommonConverters.hxx>
#include <svx/ActionDescriptionProvider.hxx>
-#include <comphelper/servicehelper.hxx>
#include <svx/svxids.hrc>
#include <svx/rectenum.hxx>
#include <svl/intitem.hxx>
#include <svx/svxdlg.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <memory>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
static void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, awt::Rectangle& rPosAndSize, const awt::Size& rOriginalSize )
{
@@ -54,19 +51,18 @@ static void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, awt::
RectPoint eRP = RectPoint::LT;
- const SfxPoolItem* pPoolItem=nullptr;
//read position
- if (rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_X,true,&pPoolItem)==SfxItemState::SET)
- nPosX= static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
- if (rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_Y,true,&pPoolItem)==SfxItemState::SET)
- nPosY=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ if (const SfxInt32Item* pPosXItem = rItemSet.GetItemIfSet(SID_ATTR_TRANSFORM_POS_X))
+ nPosX = pPosXItem->GetValue();
+ if (const SfxInt32Item* pPosYItem = rItemSet.GetItemIfSet(SID_ATTR_TRANSFORM_POS_Y))
+ nPosY = pPosYItem->GetValue();
//read size
- if (rItemSet.GetItemState(SID_ATTR_TRANSFORM_WIDTH,true,&pPoolItem)==SfxItemState::SET)
- nSizX=static_cast<const SfxUInt32Item*>(pPoolItem)->GetValue();
- if (rItemSet.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,true,&pPoolItem)==SfxItemState::SET)
- nSizY=static_cast<const SfxUInt32Item*>(pPoolItem)->GetValue();
- if (rItemSet.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT,true,&pPoolItem)==SfxItemState::SET)
- eRP=static_cast<RectPoint>(static_cast<const SfxUInt16Item*>(pPoolItem)->GetValue());
+ if (const SfxUInt32Item* pWidthItem = rItemSet.GetItemIfSet(SID_ATTR_TRANSFORM_WIDTH))
+ nSizX = pWidthItem->GetValue();
+ if (const SfxUInt32Item* pHeightItem = rItemSet.GetItemIfSet(SID_ATTR_TRANSFORM_HEIGHT))
+ nSizY = pHeightItem->GetValue();
+ if (const SfxUInt16Item* pSizeItem = rItemSet.GetItemIfSet(SID_ATTR_TRANSFORM_SIZE_POINT))
+ eRP=static_cast<RectPoint>(pSizeItem->GetValue());
switch( eRP )
{
@@ -150,26 +146,21 @@ void ChartController::executeDispatch_PositionAndSize(const ::css::uno::Sequence
if (!pPool)
return;
- sal_uInt16 nWhich;
for (const auto& aProp: *pArgs)
{
sal_Int32 nValue = 0;
aProp.Value >>= nValue;
if (aProp.Name == "TransformPosX") {
- nWhich = pPool->GetWhich(SID_ATTR_TRANSFORM_POS_X);
- aItemSet.Put(SfxInt32Item(nWhich, nValue));
+ aItemSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_X, nValue));
}
else if (aProp.Name == "TransformPosY") {
- nWhich = pPool->GetWhich(SID_ATTR_TRANSFORM_POS_Y);
- aItemSet.Put(SfxInt32Item(nWhich, nValue));
+ aItemSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_Y, nValue));
}
else if (aProp.Name == "TransformWidth") {
- nWhich = pPool->GetWhich(SID_ATTR_TRANSFORM_WIDTH);
- aItemSet.Put(SfxUInt32Item(nWhich, static_cast<sal_uInt32>(nValue)));
+ aItemSet.Put(SfxUInt32Item(SID_ATTR_TRANSFORM_WIDTH, static_cast<sal_uInt32>(nValue)));
}
else if (aProp.Name == "TransformHeight") {
- nWhich = pPool->GetWhich(SID_ATTR_TRANSFORM_HEIGHT);
- aItemSet.Put(SfxUInt32Item(nWhich, static_cast<sal_uInt32>(nValue)));
+ aItemSet.Put(SfxUInt32Item(SID_ATTR_TRANSFORM_HEIGHT, static_cast<sal_uInt32>(nValue)));
}
}
}
@@ -177,23 +168,21 @@ void ChartController::executeDispatch_PositionAndSize(const ::css::uno::Sequence
if(pOutItemSet || pArgs)
{
awt::Rectangle aOldObjectRect;
- ExplicitValueProvider* pProvider(comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView ));
- if( pProvider )
- aOldObjectRect = pProvider->getRectangleOfObject(aCID);
+ if( m_xChartView )
+ aOldObjectRect = m_xChartView->getRectangleOfObject(aCID);
awt::Rectangle aNewObjectRect;
lcl_getPositionAndSizeFromItemSet( aItemSet, aNewObjectRect, ToSize(aOldObjectRect) );
- awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+ awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) );
awt::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
bool bChanged = false;
if ( eObjectType == OBJECTTYPE_LEGEND )
{
- ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel());
- bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning(rModel, false , true);
+ bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning(*getChartModel(), false , true);
}
- bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getModel()
+ bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getChartModel()
, aNewObjectRect, aOldObjectRect, aPageRect );
if( bMoved || bChanged )
aUndoGuard.commit();
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index 666c9979830e..62b7ad8a6beb 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -18,7 +18,7 @@
*/
#include <ChartController.hxx>
-#include <ChartWindow.hxx>
+#include <ChartView.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include <chartview/ChartSfxItemIds.hxx>
#include <ObjectIdentifier.hxx>
@@ -34,15 +34,21 @@
#include <MultipleChartConverters.hxx>
#include <TitleItemConverter.hxx>
#include <LegendItemConverter.hxx>
+#include <DataTableItemConverter.hxx>
#include <RegressionCurveItemConverter.hxx>
#include <RegressionEquationItemConverter.hxx>
#include <ErrorBarItemConverter.hxx>
#include <ChartModelHelper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <TitleHelper.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
+#include <ChartModel.hxx>
#include <ColorPerPointHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <DataSeries.hxx>
+#include <DataSeriesProperties.hxx>
+#include <Diagram.hxx>
#include <ControllerLockGuard.hxx>
#include "UndoGuard.hxx"
#include <ObjectNameProvider.hxx>
@@ -50,28 +56,28 @@
#include <strings.hrc>
#include <ReferenceSizeProvider.hxx>
#include <RegressionCurveHelper.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <RegressionCurveModel.hxx>
+#include <o3tl/string_view.hxx>
#include <com/sun/star/util/CloseVetoException.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
-#include <comphelper/servicehelper.hxx>
#include <memory>
#include <vcl/svapp.hxx>
#include <svx/ActionDescriptionProvider.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
namespace
{
wrapper::ItemConverter* createItemConverter(
- const OUString & aObjectCID, const uno::Reference<frame::XModel>& xChartModel,
+ std::u16string_view aObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel,
const uno::Reference<uno::XComponentContext>& xContext, SdrModel& rDrawModel,
ExplicitValueProvider* pExplicitValueProvider, ReferenceSizeProvider const * pRefSizeProvider )
{
@@ -85,8 +91,8 @@ wrapper::ItemConverter* createItemConverter(
return nullptr;
}
- OUString aParticleID = ObjectIdentifier::getParticleID( aObjectCID );
- bool bAffectsMultipleObjects = aParticleID == "ALLELEMENTS";
+ std::u16string_view aParticleID = ObjectIdentifier::getParticleID( aObjectCID );
+ bool bAffectsMultipleObjects = aParticleID == u"ALLELEMENTS";
if( !bAffectsMultipleObjects )
{
uno::Reference< beans::XPropertySet > xObjectProperties =
@@ -99,31 +105,31 @@ wrapper::ItemConverter* createItemConverter(
case OBJECTTYPE_PAGE:
pItemConverter = new wrapper::GraphicPropertyItemConverter(
xObjectProperties, rDrawModel.GetItemPool(),
- rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ rDrawModel, xChartModel,
wrapper::GraphicObjectType::LineAndFillProperties );
break;
case OBJECTTYPE_TITLE:
{
- std::unique_ptr<awt::Size> pRefSize;
+ std::optional<awt::Size> pRefSize;
if (pRefSizeProvider)
- pRefSize.reset(new awt::Size(pRefSizeProvider->getPageSize()));
+ pRefSize.emplace(pRefSizeProvider->getPageSize());
pItemConverter = new wrapper::TitleItemConverter(
xObjectProperties, rDrawModel.GetItemPool(), rDrawModel,
- uno::Reference<lang::XMultiServiceFactory>(xChartModel, uno::UNO_QUERY),
- pRefSize.get());
+ xChartModel,
+ pRefSize);
}
break;
case OBJECTTYPE_LEGEND:
{
- std::unique_ptr<awt::Size> pRefSize;
+ std::optional<awt::Size> pRefSize;
if (pRefSizeProvider)
- pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+ pRefSize.emplace( pRefSizeProvider->getPageSize() );
pItemConverter = new wrapper::LegendItemConverter(
xObjectProperties, rDrawModel.GetItemPool(), rDrawModel,
- uno::Reference<lang::XMultiServiceFactory>(xChartModel, uno::UNO_QUERY),
- pRefSize.get());
+ xChartModel,
+ pRefSize);
}
break;
case OBJECTTYPE_LEGEND_ENTRY:
@@ -134,17 +140,14 @@ wrapper::ItemConverter* createItemConverter(
case OBJECTTYPE_DIAGRAM_FLOOR:
pItemConverter = new wrapper::GraphicPropertyItemConverter(
xObjectProperties, rDrawModel.GetItemPool(),
- rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ rDrawModel, xChartModel,
wrapper::GraphicObjectType::LineAndFillProperties );
break;
case OBJECTTYPE_AXIS:
{
- std::unique_ptr<awt::Size> pRefSize;
+ std::optional<awt::Size> pRefSize;
if (pRefSizeProvider)
- pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
-
- uno::Reference< beans::XPropertySet > xDiaProp;
- xDiaProp.set( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
+ pRefSize.emplace( pRefSizeProvider->getPageSize() );
// the second property set contains the property CoordinateOrigin
// nOriginIndex is the index of the corresponding index of the
@@ -154,15 +157,15 @@ wrapper::ItemConverter* createItemConverter(
ExplicitIncrementData aExplicitIncrement;
if( pExplicitValueProvider )
pExplicitValueProvider->getExplicitValuesForAxis(
- uno::Reference< XAxis >( xObjectProperties, uno::UNO_QUERY ),
+ dynamic_cast< Axis* >( xObjectProperties.get() ),
aExplicitScale, aExplicitIncrement );
pItemConverter = new wrapper::AxisItemConverter(
xObjectProperties, rDrawModel.GetItemPool(),
rDrawModel,
- uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ),
+ xChartModel,
&aExplicitScale, &aExplicitIncrement,
- pRefSize.get() );
+ pRefSize );
}
break;
case OBJECTTYPE_AXIS_UNITLABEL:
@@ -170,39 +173,39 @@ wrapper::ItemConverter* createItemConverter(
case OBJECTTYPE_DATA_LABELS:
case OBJECTTYPE_DATA_LABEL:
{
- std::unique_ptr<awt::Size> pRefSize;
+ std::optional<awt::Size> pRefSize;
if (pRefSizeProvider)
- pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+ pRefSize.emplace( pRefSizeProvider->getPageSize() );
- uno::Reference<XDataSeries> xSeries = ObjectIdentifier::getDataSeriesForCID(aObjectCID, xChartModel);
+ rtl::Reference<DataSeries> xSeries = ObjectIdentifier::getDataSeriesForCID(aObjectCID, xChartModel);
bool bDataSeries = eObjectType == OBJECTTYPE_DATA_LABELS;
sal_Int32 nNumberFormat = ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties );
sal_Int32 nPercentNumberFormat = ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
- xObjectProperties,uno::Reference<util::XNumberFormatsSupplier>(xChartModel, uno::UNO_QUERY));
+ xObjectProperties, xChartModel);
pItemConverter = new wrapper::TextLabelItemConverter(
xChartModel, xObjectProperties, xSeries,
- rDrawModel.GetItemPool(), pRefSize.get(), bDataSeries,
+ rDrawModel.GetItemPool(), pRefSize, bDataSeries,
nNumberFormat, nPercentNumberFormat);
}
break;
case OBJECTTYPE_DATA_SERIES:
case OBJECTTYPE_DATA_POINT:
{
- std::unique_ptr<awt::Size> pRefSize;
+ std::optional<awt::Size> pRefSize;
if (pRefSizeProvider)
- pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+ pRefSize.emplace( pRefSizeProvider->getPageSize() );
wrapper::GraphicObjectType eMapTo =
wrapper::GraphicObjectType::FilledDataPoint;
- uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( aObjectCID, xChartModel );
- uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( aObjectCID, xChartModel );
+ rtl::Reference< ChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
if( !ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount ) )
eMapTo = wrapper::GraphicObjectType::LineDataPoint;
@@ -214,14 +217,14 @@ wrapper::ItemConverter* createItemConverter(
sal_Int32 nPointIndex = -1; /*-1 for whole series*/
if(!bDataSeries)
{
- nPointIndex = aParticleID.toInt32();
- uno::Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
+ nPointIndex = o3tl::toInt32(aParticleID);
bool bVaryColorsByPoint = false;
- if( xSeriesProp.is() &&
- (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint) &&
+ if( xSeries.is() &&
+ // "VaryColorsByPoint"
+ (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint) &&
bVaryColorsByPoint )
{
- if( !ColorPerPointHelper::hasPointOwnColor( xSeriesProp, nPointIndex, xObjectProperties ) )
+ if( !ColorPerPointHelper::hasPointOwnColor( xSeries, nPointIndex, xObjectProperties ) )
{
bUseSpecialFillColor = true;
OSL_ASSERT( xDiagram.is());
@@ -233,12 +236,12 @@ wrapper::ItemConverter* createItemConverter(
}
sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties );
sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
- xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
+ xObjectProperties, xChartModel);
pItemConverter = new wrapper::DataPointItemConverter( xChartModel, xContext,
xObjectProperties, xSeries, rDrawModel.GetItemPool(), rDrawModel,
- uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
- eMapTo, pRefSize.get(), bDataSeries, bUseSpecialFillColor, nSpecialFillColor, true,
+ xChartModel,
+ eMapTo, pRefSize, bDataSeries, bUseSpecialFillColor, nSpecialFillColor, true,
nNumberFormat, nPercentNumberFormat, nPointIndex );
break;
}
@@ -247,7 +250,7 @@ wrapper::ItemConverter* createItemConverter(
case OBJECTTYPE_DATA_AVERAGE_LINE:
pItemConverter = new wrapper::GraphicPropertyItemConverter(
xObjectProperties, rDrawModel.GetItemPool(),
- rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ rDrawModel, xChartModel,
wrapper::GraphicObjectType::LineProperties );
break;
@@ -256,26 +259,26 @@ wrapper::ItemConverter* createItemConverter(
case OBJECTTYPE_DATA_ERRORS_Z:
pItemConverter = new wrapper::ErrorBarItemConverter(
xChartModel, xObjectProperties, rDrawModel.GetItemPool(),
- rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ));
+ rDrawModel, xChartModel);
break;
case OBJECTTYPE_DATA_CURVE:
pItemConverter = new wrapper::RegressionCurveItemConverter(
- xObjectProperties, uno::Reference< chart2::XRegressionCurveContainer >(
- ObjectIdentifier::getDataSeriesForCID( aObjectCID, xChartModel ), uno::UNO_QUERY ),
- rDrawModel.GetItemPool(), rDrawModel,
- uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ));
+ xObjectProperties,
+ ObjectIdentifier::getDataSeriesForCID( aObjectCID, xChartModel ),
+ rDrawModel.GetItemPool(), rDrawModel,
+ xChartModel);
break;
case OBJECTTYPE_DATA_CURVE_EQUATION:
{
- std::unique_ptr<awt::Size> pRefSize;
+ std::optional<awt::Size> pRefSize;
if (pRefSizeProvider)
- pRefSize.reset(new awt::Size(pRefSizeProvider->getPageSize()));
+ pRefSize.emplace(pRefSizeProvider->getPageSize());
pItemConverter = new wrapper::RegressionEquationItemConverter(
xObjectProperties, rDrawModel.GetItemPool(), rDrawModel,
- uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
- pRefSize.get());
+ xChartModel,
+ pRefSize);
break;
}
case OBJECTTYPE_DATA_STOCK_RANGE:
@@ -284,9 +287,16 @@ wrapper::ItemConverter* createItemConverter(
case OBJECTTYPE_DATA_STOCK_GAIN:
pItemConverter = new wrapper::GraphicPropertyItemConverter(
xObjectProperties, rDrawModel.GetItemPool(),
- rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ rDrawModel, xChartModel,
wrapper::GraphicObjectType::LineAndFillProperties );
break;
+ case OBJECTTYPE_DATA_TABLE:
+ {
+ pItemConverter = new wrapper::DataTableItemConverter(
+ xObjectProperties, rDrawModel.GetItemPool(),
+ rDrawModel, xChartModel);
+ }
+ break;
default: //OBJECTTYPE_UNKNOWN
break;
}
@@ -298,23 +308,23 @@ wrapper::ItemConverter* createItemConverter(
{
case OBJECTTYPE_TITLE:
pItemConverter = new wrapper::AllTitleItemConverter( xChartModel, rDrawModel.GetItemPool(),
- rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ));
+ rDrawModel, xChartModel);
break;
case OBJECTTYPE_AXIS:
{
- std::unique_ptr<awt::Size> pRefSize;
+ std::optional<awt::Size> pRefSize;
if (pRefSizeProvider)
- pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+ pRefSize.emplace( pRefSizeProvider->getPageSize() );
pItemConverter = new wrapper::AllAxisItemConverter(
xChartModel, rDrawModel.GetItemPool(),
- rDrawModel, pRefSize.get());
+ rDrawModel, pRefSize );
}
break;
case OBJECTTYPE_GRID:
case OBJECTTYPE_SUBGRID:
pItemConverter = new wrapper::AllGridItemConverter( xChartModel, rDrawModel.GetItemPool(),
- rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ));
+ rDrawModel, xChartModel);
break;
default: //for this type it is not supported to change all elements at once
break;
@@ -324,10 +334,10 @@ wrapper::ItemConverter* createItemConverter(
return pItemConverter;
}
-OUString lcl_getTitleCIDForCommand( std::string_view rDispatchCommand, const uno::Reference< frame::XModel > & xChartModel )
+OUString lcl_getTitleCIDForCommand( std::string_view rDispatchCommand, const rtl::Reference<::chart::ChartModel> & xChartModel )
{
if( rDispatchCommand == "AllTitles")
- return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_TITLE, "ALLELEMENTS" );
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_TITLE, u"ALLELEMENTS" );
TitleHelper::eTitleType nTitleType( TitleHelper::MAIN_TITLE );
if( rDispatchCommand == "SubTitle" )
@@ -343,14 +353,14 @@ OUString lcl_getTitleCIDForCommand( std::string_view rDispatchCommand, const uno
else if( rDispatchCommand == "SecondaryYTitle" )
nTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
- uno::Reference< XTitle > xTitle( TitleHelper::getTitle( nTitleType, xChartModel ) );
+ rtl::Reference< Title > xTitle( TitleHelper::getTitle( nTitleType, xChartModel ) );
return ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, xChartModel );
}
-OUString lcl_getAxisCIDForCommand( std::string_view rDispatchCommand, const uno::Reference< frame::XModel >& xChartModel )
+OUString lcl_getAxisCIDForCommand( std::string_view rDispatchCommand, const rtl::Reference<::chart::ChartModel>& xChartModel )
{
if( rDispatchCommand == "DiagramAxisAll")
- return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_AXIS, "ALLELEMENTS" );
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_AXIS, u"ALLELEMENTS" );
sal_Int32 nDimensionIndex=0;
bool bMainAxis=true;
@@ -375,17 +385,17 @@ OUString lcl_getAxisCIDForCommand( std::string_view rDispatchCommand, const uno:
nDimensionIndex=1; bMainAxis=false;
}
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- uno::Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram );
return ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, xChartModel );
}
-OUString lcl_getGridCIDForCommand( std::string_view rDispatchCommand, const uno::Reference< frame::XModel >& xChartModel )
+OUString lcl_getGridCIDForCommand( std::string_view rDispatchCommand, const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
if( rDispatchCommand == "DiagramGridAll")
- return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_GRID, "ALLELEMENTS" );
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_GRID, u"ALLELEMENTS" );
sal_Int32 nDimensionIndex=0;
bool bMainGrid=true;
@@ -417,7 +427,7 @@ OUString lcl_getGridCIDForCommand( std::string_view rDispatchCommand, const uno:
nDimensionIndex=2; bMainGrid=false;
}
- uno::Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, true/*bMainAxis*/, xDiagram ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, true/*bMainAxis*/, xDiagram );
sal_Int32 nSubGridIndex= bMainGrid ? -1 : 0;
OUString aCID( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGridIndex ) );
@@ -429,17 +439,15 @@ OUString lcl_getErrorCIDForCommand( const ObjectType eDispatchType, const Object
if( eSelectedType == eDispatchType )
return rSelectedCID;
- return ObjectIdentifier::createClassifiedIdentifierWithParent( eDispatchType, OUString(), rSelectedCID );
+ return ObjectIdentifier::createClassifiedIdentifierWithParent( eDispatchType, u"", rSelectedCID );
}
-OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const uno::Reference< XChartDocument > & xChartDocument, const OUString& rSelectedCID )
+OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const rtl::Reference<::chart::ChartModel> & xChartDocument, const OUString& rSelectedCID )
{
ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
- uno::Reference< frame::XModel > xChartModel = xChartDocument;
const ObjectType eSelectedType = ObjectIdentifier::getObjectType( rSelectedCID );
- uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedCID, xChartModel );
- uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xSeries, uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedCID, xChartDocument );
//legend
if( rDispatchCommand == "Legend" || rDispatchCommand == "FormatLegend" )
@@ -474,7 +482,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
|| rDispatchCommand == "AllTitles"
)
{
- return lcl_getTitleCIDForCommand( rDispatchCommand, xChartModel );
+ return lcl_getTitleCIDForCommand( rDispatchCommand, xChartDocument );
}
//axis
else if( rDispatchCommand == "DiagramAxisX"
@@ -485,7 +493,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
|| rDispatchCommand == "DiagramAxisAll"
)
{
- return lcl_getAxisCIDForCommand( rDispatchCommand, xChartModel );
+ return lcl_getAxisCIDForCommand( rDispatchCommand, xChartDocument );
}
//grid
else if( rDispatchCommand == "DiagramGridYMain"
@@ -497,7 +505,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
|| rDispatchCommand == "DiagramGridAll"
)
{
- return lcl_getGridCIDForCommand( rDispatchCommand, xChartModel );
+ return lcl_getGridCIDForCommand( rDispatchCommand, xChartDocument );
}
//data series
else if( rDispatchCommand == "FormatDataSeries" )
@@ -520,7 +528,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
return rSelectedCID;
else
return ObjectIdentifier::createClassifiedIdentifierWithParent(
- OBJECTTYPE_DATA_LABELS, OUString(), rSelectedCID );
+ OBJECTTYPE_DATA_LABELS, u"", rSelectedCID );
}
//data labels
else if( rDispatchCommand == "FormatDataLabel" )
@@ -529,14 +537,14 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
return rSelectedCID;
else
{
- sal_Int32 nPointIndex = ObjectIdentifier::getParticleID( rSelectedCID ).toInt32();
+ sal_Int32 nPointIndex = o3tl::toInt32(ObjectIdentifier::getParticleID( rSelectedCID ));
if( nPointIndex>=0 )
{
OUString aSeriesParticle = ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID );
OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) + "=" );
OUString aLabelsCID = ObjectIdentifier::createClassifiedIdentifierForParticles( aSeriesParticle, aChildParticle );
OUString aLabelCID_Stub = ObjectIdentifier::createClassifiedIdentifierWithParent(
- OBJECTTYPE_DATA_LABEL, OUString(), aLabelsCID );
+ OBJECTTYPE_DATA_LABEL, u"", aLabelsCID );
return ObjectIdentifier::createPointCID( aLabelCID_Stub, nPointIndex );
}
@@ -550,8 +558,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
else
return ObjectIdentifier::createDataCurveCID(
ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
- RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
- RegressionCurveHelper::getMeanValueLine( xRegCurveCnt ) ), true );
+ RegressionCurveHelper::getRegressionCurveIndex( xSeries,
+ RegressionCurveHelper::getMeanValueLine( xSeries ) ), true );
}
//trend line
else if( rDispatchCommand == "FormatTrendline" )
@@ -561,8 +569,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
else
return ObjectIdentifier::createDataCurveCID(
ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
- RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
- RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ), false );
+ RegressionCurveHelper::getRegressionCurveIndex( xSeries,
+ RegressionCurveHelper::getFirstCurveNotMeanValueLine( xSeries ) ), false );
}
//trend line equation
else if( rDispatchCommand == "FormatTrendlineEquation" )
@@ -572,8 +580,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
else
return ObjectIdentifier::createDataCurveEquationCID(
ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
- RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
- RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ) );
+ RegressionCurveHelper::getRegressionCurveIndex( xSeries,
+ RegressionCurveHelper::getFirstCurveNotMeanValueLine( xSeries ) ) );
}
// y error bars
else if( rDispatchCommand == "FormatXErrorBars" )
@@ -592,8 +600,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
return rSelectedCID;
else
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
- return ObjectIdentifier::createClassifiedIdentifierForObject( xAxis , xChartModel );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartDocument );
+ return ObjectIdentifier::createClassifiedIdentifierForObject( xAxis , xChartDocument );
}
}
// major grid
@@ -603,8 +611,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
return rSelectedCID;
else
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
- return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartDocument );
+ return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartDocument );
}
}
@@ -615,8 +623,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
return rSelectedCID;
else
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
- return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, 0 /*sub grid index*/ );
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartDocument );
+ return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartDocument, 0 /*sub grid index*/ );
}
}
// title
@@ -631,7 +639,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
if( eSelectedType == OBJECTTYPE_DATA_STOCK_LOSS )
return rSelectedCID;
else
- return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_LOSS, OUString());
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_LOSS, u"");
}
// stock gain
else if( rDispatchCommand == "FormatStockGain" )
@@ -639,12 +647,12 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
if( eSelectedType == OBJECTTYPE_DATA_STOCK_GAIN )
return rSelectedCID;
else
- return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_GAIN, OUString() );
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_GAIN, u"" );
}
return ObjectIdentifier::createClassifiedIdentifier(
eObjectType,
- OUString() ); // aParticleID
+ u"" ); // aParticleID
}
}
@@ -652,7 +660,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un
void ChartController::executeDispatch_FormatObject(std::u16string_view rDispatchCommand)
{
- uno::Reference< XChartDocument > xChartDocument( getModel(), uno::UNO_QUERY );
+ rtl::Reference<::chart::ChartModel> xChartDocument( getChartModel() );
OString aCommand( OUStringToOString( rDispatchCommand, RTL_TEXTENCODING_ASCII_US ) );
OUString rObjectCID = lcl_getObjectCIDForCommand( aCommand, xChartDocument, m_aSelection.getSelectedCID() );
executeDlg_ObjectProperties( rObjectCID );
@@ -676,13 +684,13 @@ OUString lcl_getFormatCIDforSelectedCID( const OUString& rSelectedCID )
// some legend entries are handled as if they were data series
if( eObjectType==OBJECTTYPE_LEGEND_ENTRY )
{
- OUString aParentParticle( ObjectIdentifier::getFullParentParticle( rSelectedCID ) );
+ std::u16string_view aParentParticle( ObjectIdentifier::getFullParentParticle( rSelectedCID ) );
aFormatCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle );
}
// treat diagram as wall
if( eObjectType==OBJECTTYPE_DIAGRAM )
- aFormatCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, OUString() );
+ aFormatCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" );
return aFormatCID;
}
@@ -693,24 +701,22 @@ void ChartController::executeDlg_ObjectProperties( const OUString& rSelectedObje
{
OUString aObjectCID = lcl_getFormatCIDforSelectedCID( rSelectedObjectCID );
- UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::ActionType::Format,
- ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))),
- m_xUndoManager );
+ auto xUndoGuard = std::make_shared<UndoGuard>(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::ActionType::Format,
+ ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))),
+ m_xUndoManager );
- bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, false );
- if( bSuccess )
- aUndoGuard.commit();
+ ChartController::executeDlg_ObjectProperties_withUndoGuard(std::move(xUndoGuard), aObjectCID, false );
}
-bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard(
- const OUString& rObjectCID, bool bSuccessOnUnchanged )
+void ChartController::executeDlg_ObjectProperties_withUndoGuard(
+ std::shared_ptr<UndoGuard> xUndoGuard, const OUString& rObjectCID, bool bSuccessOnUnchanged )
{
//return true if the properties were changed successfully
- bool bRet = false;
if( rObjectCID.isEmpty() )
{
- return bRet;
+ return;
}
try
{
@@ -718,26 +724,28 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard(
ObjectType eObjectType = ObjectIdentifier::getObjectType( rObjectCID );
if( eObjectType==OBJECTTYPE_UNKNOWN )
{
- return bRet;
+ return;
}
if( eObjectType==OBJECTTYPE_DIAGRAM_WALL || eObjectType==OBJECTTYPE_DIAGRAM_FLOOR )
{
- if( !DiagramHelper::isSupportingFloorAndWall( ChartModelHelper::findDiagram( getModel() ) ) )
- return bRet;
+ if( !getFirstDiagram()->isSupportingFloorAndWall() )
+ return;
}
//convert properties to ItemSet
- std::unique_ptr<ReferenceSizeProvider> pRefSizeProv(impl_createReferenceSizeProvider());
+ ReferenceSizeProvider aRefSizeProv(impl_createReferenceSizeProvider());
+
+ rtl::Reference<::chart::ChartModel> xChartDoc(getChartModel());
- std::unique_ptr<wrapper::ItemConverter> pItemConverter(
- createItemConverter( rObjectCID, getModel(), m_xCC,
+ std::shared_ptr<wrapper::ItemConverter> pItemConverter(
+ createItemConverter( rObjectCID, xChartDoc, m_xCC,
m_pDrawModelWrapper->getSdrModel(),
- comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(m_xChartView),
- pRefSizeProv.get()));
+ m_xChartView.get(),
+ &aRefSizeProv));
if (!pItemConverter)
- return bRet;
+ return;
SfxItemSet aItemSet = pItemConverter->CreateEmptyItemSet();
@@ -748,52 +756,53 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard(
//prepare dialog
ObjectPropertiesDialogParameter aDialogParameter( rObjectCID );
- aDialogParameter.init( getModel() );
+ aDialogParameter.init(xChartDoc);
ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get() );
SolarMutexGuard aGuard;
- SchAttribTabDlg aDlg(
- GetChartFrame(), &aItemSet, &aDialogParameter,
- &aViewElementListProvider,
- uno::Reference< util::XNumberFormatsSupplier >(
- getModel(), uno::UNO_QUERY ) );
+ std::shared_ptr<SchAttribTabDlg> aDlgPtr = std::make_shared<SchAttribTabDlg>(
+ GetChartFrame(), &aItemSet, &aDialogParameter,
+ &aViewElementListProvider,
+ xChartDoc);
if(aDialogParameter.HasSymbolProperties())
{
uno::Reference< beans::XPropertySet > xObjectProperties =
- ObjectIdentifier::getObjectPropertySet( rObjectCID, getModel() );
- wrapper::DataPointItemConverter aSymbolItemConverter( getModel(), m_xCC
- , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( rObjectCID, getModel() )
+ ObjectIdentifier::getObjectPropertySet( rObjectCID, xChartDoc );
+ wrapper::DataPointItemConverter aSymbolItemConverter( xChartDoc, m_xCC
+ , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( rObjectCID, xChartDoc )
, m_pDrawModelWrapper->getSdrModel().GetItemPool()
, m_pDrawModelWrapper->getSdrModel()
- , uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY )
+ , xChartDoc
, wrapper::GraphicObjectType::FilledDataPoint );
- std::unique_ptr<SfxItemSet> pSymbolShapeProperties(new SfxItemSet( aSymbolItemConverter.CreateEmptyItemSet() ));
- aSymbolItemConverter.FillItemSet( *pSymbolShapeProperties );
+ SfxItemSet aSymbolShapeProperties(aSymbolItemConverter.CreateEmptyItemSet() );
+ aSymbolItemConverter.FillItemSet( aSymbolShapeProperties );
sal_Int32 const nStandardSymbol=0;//@todo get from somewhere
- std::unique_ptr<Graphic> pAutoSymbolGraphic(new Graphic( aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, pSymbolShapeProperties.get() ) ));
+ std::optional<Graphic> oAutoSymbolGraphic(std::in_place, aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, &aSymbolShapeProperties ) );
// note: the dialog takes the ownership of pSymbolShapeProperties and pAutoSymbolGraphic
- aDlg.setSymbolInformation( std::move(pSymbolShapeProperties), std::move(pAutoSymbolGraphic) );
+ aDlgPtr->setSymbolInformation( std::move(aSymbolShapeProperties), std::move(oAutoSymbolGraphic) );
}
if( aDialogParameter.HasStatisticProperties() )
{
- aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
- InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, rObjectCID ) );
+ aDlgPtr->SetAxisMinorStepWidthForErrorBarDecimals(
+ InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( xChartDoc, m_xChartView, rObjectCID ) );
}
//open the dialog
- if (aDlg.run() == RET_OK || (bSuccessOnUnchanged && aDlg.DialogWasClosedWithOK()))
+ SfxTabDialogController::runAsync(aDlgPtr, [aDlgPtr, xChartDoc, pItemConverter,bSuccessOnUnchanged,
+ xUndoGuard=std::move(xUndoGuard)] (int nResult)
{
- const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
- if(pOutItemSet)
- {
- ControllerLockGuardUNO aCLGuard( getModel());
- (void)pItemConverter->ApplyItemSet(*pOutItemSet); //model should be changed now
- bRet = true;
+ if (nResult == RET_OK || (bSuccessOnUnchanged && aDlgPtr->DialogWasClosedWithOK())) {
+ const SfxItemSet* pOutItemSet = aDlgPtr->GetOutputItemSet();
+ if(pOutItemSet) {
+ ControllerLockGuardUNO aCLGuard(xChartDoc);
+ (void)pItemConverter->ApplyItemSet(*pOutItemSet); //model should be changed now
+ xUndoGuard->commit();
+ }
}
- }
+ });
}
catch( const util::CloseVetoException& )
{
@@ -801,7 +810,6 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard(
catch( const uno::RuntimeException& )
{
}
- return bRet;
}
void ChartController::executeDispatch_View3D()
@@ -814,7 +822,7 @@ void ChartController::executeDispatch_View3D()
//open dialog
SolarMutexGuard aSolarGuard;
- View3DDialog aDlg(GetChartFrame(), getModel());
+ View3DDialog aDlg(GetChartFrame(), getChartModel());
if (aDlg.run() == RET_OK)
aUndoGuard.commit();
}
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index ae18162d8a80..600d46b434d0 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -17,18 +17,26 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_wasm_strip.h>
+
#include <ChartController.hxx>
#include <ResId.hxx>
#include "UndoGuard.hxx"
#include <DrawViewWrapper.hxx>
#include <ChartWindow.hxx>
+#include <ChartModel.hxx>
+#include <ChartView.hxx>
#include <TitleHelper.hxx>
#include <ObjectIdentifier.hxx>
#include <ControllerLockGuard.hxx>
+#include <comphelper/diagnose_ex.hxx>
+#if !ENABLE_WASM_STRIP_ACCESSIBILITY
#include <AccessibleTextHelper.hxx>
+#endif
#include <strings.hrc>
#include <chartview/DrawModelWrapper.hxx>
+#include <osl/diagnose.h>
#include <svx/svdoutl.hxx>
#include <svx/svxdlg.hxx>
@@ -36,9 +44,12 @@
#include <editeng/editids.hrc>
#include <vcl/svapp.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/chart2/FormattedString.hpp>
#include <svl/stritem.hxx>
#include <editeng/fontitem.hxx>
+#include <editeng/section.hxx>
#include <memory>
namespace chart
@@ -66,13 +77,14 @@ void ChartController::StartTextEdit( const Point* pMousePixel )
SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
//#i77362 change notification for changes on additional shapes are missing
- uno::Reference< beans::XPropertySet > xChartViewProps( m_xChartView, uno::UNO_QUERY );
- if( xChartViewProps.is() )
- xChartViewProps->setPropertyValue( "SdrViewIsInEditMode", uno::Any(true) );
+ if( m_xChartView.is() )
+ m_xChartView->setPropertyValue( "SdrViewIsInEditMode", uno::Any(true) );
+
+ auto pChartWindow(GetChartWindow());
bool bEdit = m_pDrawViewWrapper->SdrBeginTextEdit( pTextObj
, m_pDrawViewWrapper->GetPageView()
- , GetChartWindow()
+ , pChartWindow
, false //bIsNewObj
, pOutliner
, nullptr //pOutlinerView
@@ -96,9 +108,12 @@ void ChartController::StartTextEdit( const Point* pMousePixel )
}
}
- //we invalidate the outliner region because the outliner has some
- //paint problems (some characters are painted twice a little bit shifted)
- GetChartWindow()->Invalidate( m_pDrawViewWrapper->GetMarkedObjBoundRect() );
+ if (pChartWindow)
+ {
+ //we invalidate the outliner region because the outliner has some
+ //paint problems (some characters are painted twice a little bit shifted)
+ pChartWindow->Invalidate( m_pDrawViewWrapper->GetMarkedObjBoundRect() );
+ }
}
bool ChartController::EndTextEdit()
@@ -106,43 +121,102 @@ bool ChartController::EndTextEdit()
m_pDrawViewWrapper->SdrEndTextEdit();
//#i77362 change notification for changes on additional shapes are missing
- uno::Reference< beans::XPropertySet > xChartViewProps( m_xChartView, uno::UNO_QUERY );
- if( xChartViewProps.is() )
- xChartViewProps->setPropertyValue( "SdrViewIsInEditMode", uno::Any(false) );
+ if( m_xChartView.is() )
+ m_xChartView->setPropertyValue( "SdrViewIsInEditMode", uno::Any(false) );
SdrObject* pTextObject = m_pDrawViewWrapper->getTextEditObject();
if(!pTextObject)
return false;
- SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
OutlinerParaObject* pParaObj = pTextObject->GetOutlinerParaObject();
- if( pParaObj && pOutliner )
+ if( !pParaObj )
+ return true;
+
+ OUString aObjectCID = m_aSelection.getSelectedCID();
+ if ( !aObjectCID.isEmpty() )
{
- pOutliner->SetText( *pParaObj );
+ uno::Reference< beans::XPropertySet > xPropSet =
+ ObjectIdentifier::getObjectPropertySet( aObjectCID, getChartModel() );
- OUString aString = pOutliner->GetText(
- pOutliner->GetParagraph( 0 ),
- pOutliner->GetParagraphCount() );
+ // lock controllers till end of block
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
- OUString aObjectCID = m_aSelection.getSelectedCID();
- if ( !aObjectCID.isEmpty() )
- {
- uno::Reference< beans::XPropertySet > xPropSet =
- ObjectIdentifier::getObjectPropertySet( aObjectCID, getModel() );
+ uno::Sequence< uno::Reference< chart2::XFormattedString > > aNewFormattedTitle =
+ GetFormattedTitle(pParaObj->GetTextObject(), pTextObject->getUnoShape());
+
+ Title* pTitle = dynamic_cast<Title*>(xPropSet.get());
+ TitleHelper::setFormattedString(pTitle, aNewFormattedTitle);
+
+ OSL_ENSURE(m_pTextActionUndoGuard, "ChartController::EndTextEdit: no TextUndoGuard!");
+ if (m_pTextActionUndoGuard)
+ m_pTextActionUndoGuard->commit();
+ }
+ m_pTextActionUndoGuard.reset();
+ return true;
+}
+
+uno::Sequence< uno::Reference< chart2::XFormattedString > > ChartController::GetFormattedTitle(
+ const EditTextObject& aEdit, const uno::Reference< drawing::XShape >& xShape )
+{
+ std::vector < uno::Reference< chart2::XFormattedString > > aNewStrings;
+ if (!xShape.is())
+ return comphelper::containerToSequence(aNewStrings);
+
+ uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
+ if (!xText.is())
+ return comphelper::containerToSequence(aNewStrings);
+
+ uno::Reference< text::XTextCursor > xSelectionCursor(xText->createTextCursor());
+ if (!xSelectionCursor.is())
+ return comphelper::containerToSequence(aNewStrings);
+
+ xSelectionCursor->gotoStart(false);
+
+ std::vector<editeng::Section> aSecAttrs;
+ aEdit.GetAllSections(aSecAttrs);
+
+ for (editeng::Section const& rSection : aSecAttrs)
+ {
+ if (!xSelectionCursor->isCollapsed())
+ xSelectionCursor->collapseToEnd();
+
+ xSelectionCursor->goRight(rSection.mnEnd - rSection.mnStart, true);
- // lock controllers till end of block
- ControllerLockGuardUNO aCLGuard( getModel() );
+ OUString aNewString = xSelectionCursor->getString();
- TitleHelper::setCompleteString( aString, uno::Reference<
- css::chart2::XTitle >::query( xPropSet ), m_xCC );
+ bool bNextPara = (aEdit.GetParagraphCount() > 1 && rSection.mnParagraph != aEdit.GetParagraphCount() - 1 &&
+ aEdit.GetTextLen(rSection.mnParagraph) <= rSection.mnEnd);
- OSL_ENSURE(m_pTextActionUndoGuard, "ChartController::EndTextEdit: no TextUndoGuard!");
- if (m_pTextActionUndoGuard)
- m_pTextActionUndoGuard->commit();
+ uno::Reference< chart2::XFormattedString2 > xFmtStr = chart2::FormattedString::create(m_xCC);
+ if (bNextPara)
+ aNewString = aNewString + OUStringChar('\n');
+ xFmtStr->setString(aNewString);
+ aNewStrings.emplace_back(xFmtStr);
+
+ uno::Reference< beans::XPropertySetInfo > xInfo = xFmtStr->getPropertySetInfo();
+ uno::Reference< beans::XPropertySet > xSelectionProp(xSelectionCursor, uno::UNO_QUERY);
+ try
+ {
+ for (const beans::Property& rProp : xSelectionProp->getPropertySetInfo()->getProperties())
+ {
+ if (xInfo.is() && xInfo->hasPropertyByName(rProp.Name))
+ {
+ const uno::Any aValue = xSelectionProp->getPropertyValue(rProp.Name);
+ xFmtStr->setPropertyValue(rProp.Name, aValue);
+ }
+ }
}
- m_pTextActionUndoGuard.reset();
+ catch ( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ aNewStrings.clear();
+ }
+
+ if (bNextPara)
+ xSelectionCursor->goRight(1, false); // next paragraph
}
- return true;
+
+ return comphelper::containerToSequence(aNewStrings);
}
void ChartController::executeDispatch_InsertSpecialCharacter()
@@ -167,52 +241,59 @@ void ChartController::executeDispatch_InsertSpecialCharacter()
vcl::Font aCurFont = m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont();
aSet.Put( SvxFontItem( aCurFont.GetFamilyType(), aCurFont.GetFamilyName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) );
- ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetChartFrame(), aSet, nullptr));
- if( pDlg->Execute() != RET_OK )
- return;
-
- const SfxItemSet* pSet = pDlg->GetOutputItemSet();
- const SfxPoolItem* pItem=nullptr;
- OUString aString;
- if (pSet && pSet->GetItemState(SID_CHARMAP, true, &pItem) == SfxItemState::SET)
- if (auto pStringItem = dynamic_cast<const SfxStringItem*>(pItem))
- aString = pStringItem->GetValue();
-
- OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
- SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
-
- if(!pOutliner || !pOutlinerView)
- return;
-
- // insert string to outliner
-
- // prevent flicker
- pOutlinerView->HideCursor();
- pOutliner->SetUpdateMode(false);
-
- // delete current selection by inserting empty String, so current
- // attributes become unique (sel. has to be erased anyway)
- pOutlinerView->InsertText(OUString());
-
- pOutlinerView->InsertText(aString, true);
-
- ESelection aSel = pOutlinerView->GetSelection();
- aSel.nStartPara = aSel.nEndPara;
- aSel.nStartPos = aSel.nEndPos;
- pOutlinerView->SetSelection(aSel);
+ VclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetChartFrame(), aSet, nullptr));
+ pDlg->StartExecuteAsync(
+ [this, pDlg] (sal_Int32 nResult)->void
+ {
+ if (nResult == RET_OK)
+ {
+ const SfxItemSet* pSet = pDlg->GetOutputItemSet();
+ OUString aString;
+ if (pSet)
+ if (const SfxStringItem* pCharMapItem = pSet->GetItemIfSet(SID_CHARMAP))
+ aString = pCharMapItem->GetValue();
+
+ OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
+ SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
+
+ if(pOutliner && pOutlinerView)
+ {
+ // insert string to outliner
+
+ // prevent flicker
+ pOutlinerView->HideCursor();
+ pOutliner->SetUpdateLayout(false);
+
+ // delete current selection by inserting empty String, so current
+ // attributes become unique (sel. has to be erased anyway)
+ pOutlinerView->InsertText(OUString());
+
+ pOutlinerView->InsertText(aString, true);
+
+ ESelection aSel = pOutlinerView->GetSelection();
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOutlinerView->SetSelection(aSel);
+
+ // show changes
+ pOutliner->SetUpdateLayout(true);
+ pOutlinerView->ShowCursor();
+ }
+ }
+ pDlg->disposeOnce();
+ }
+ );
- // show changes
- pOutliner->SetUpdateMode(true);
- pOutlinerView->ShowCursor();
}
-uno::Reference< css::accessibility::XAccessibleContext >
- ChartController::impl_createAccessibleTextContext()
+rtl::Reference< ::chart::AccessibleTextHelper >
+ ChartController::createAccessibleTextContext()
{
- uno::Reference< css::accessibility::XAccessibleContext > xResult(
- new AccessibleTextHelper( m_pDrawViewWrapper.get() ));
-
- return xResult;
+#if !ENABLE_WASM_STRIP_ACCESSIBILITY
+ return new AccessibleTextHelper( m_pDrawViewWrapper.get() );
+#else
+ return {};
+#endif
}
} //namespace chart
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 55b4bed88ab6..5774ff1350d4 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -21,8 +21,9 @@
#include <ChartWindow.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartType.hxx>
#include <TitleHelper.hxx>
-#include <ThreeDHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include "UndoGuard.hxx"
#include <ControllerLockGuard.hxx>
@@ -33,24 +34,27 @@
#include <chartview/DrawModelWrapper.hxx>
#include "ChartTransferable.hxx"
#include <DrawViewWrapper.hxx>
+#include <Legend.hxx>
#include <LegendHelper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <RegressionCurveHelper.hxx>
#include "ShapeController.hxx"
#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <ObjectNameProvider.hxx>
#include <unonames.hxx>
+#include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/chart2/DataPointLabel.hpp>
-#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <docmodel/uno/UnoGradientTools.hxx>
#include <editeng/editview.hxx>
#include <editeng/outliner.hxx>
#include <svx/ActionDescriptionProvider.hxx>
@@ -69,13 +73,12 @@
#include <svx/svdundo.hxx>
#include <svx/unoapi.hxx>
#include <svx/unopage.hxx>
-#include <svx/xgrad.hxx>
-#include <svx/xflgrit.hxx>
+#include <svx/unoshape.hxx>
#include <PropertyHelper.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/UnitConversion.hxx>
#include <memory>
@@ -92,17 +95,16 @@ namespace
{
bool lcl_deleteDataSeries(
- const OUString & rCID,
- const Reference< frame::XModel > & xModel,
+ std::u16string_view rCID,
+ const rtl::Reference<::chart::ChartModel> & xModel,
const Reference< document::XUndoManager > & xUndoManager )
{
bool bResult = false;
- uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rCID, xModel ));
- uno::Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- if( xSeries.is() && xChartDoc.is())
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rCID, xModel );
+ if( xSeries.is() && xModel.is())
{
- uno::Reference< chart2::XChartType > xChartType(
- DataSeriesHelper::getChartTypeOfSeries( xSeries, xChartDoc->getFirstDiagram()));
+ rtl::Reference< ::chart::ChartType > xChartType =
+ DataSeriesHelper::getChartTypeOfSeries( xSeries, xModel->getFirstChartDiagram());
if( xChartType.is())
{
UndoGuard aUndoGuard(
@@ -110,8 +112,8 @@ bool lcl_deleteDataSeries(
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_DATASERIES )),
xUndoManager );
- Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) );
- uno::Reference< chart2::XAxis > xAxis( DiagramHelper::getAttachedAxis( xSeries, xDiagram ) );
+ rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram();
+ rtl::Reference< Axis > xAxis = xDiagram->getAttachedAxis( xSeries );
DataSeriesHelper::deleteSeries( xSeries, xChartType );
@@ -125,8 +127,8 @@ bool lcl_deleteDataSeries(
}
bool lcl_deleteDataCurve(
- const OUString & rCID,
- const Reference< frame::XModel > & xModel,
+ std::u16string_view rCID,
+ const rtl::Reference<::chart::ChartModel> & xModel,
const Reference< document::XUndoManager > & xUndoManager )
{
bool bResult = false;
@@ -160,19 +162,16 @@ bool lcl_deleteDataCurve(
} // anonymous namespace
-std::unique_ptr<ReferenceSizeProvider> ChartController::impl_createReferenceSizeProvider()
+ReferenceSizeProvider ChartController::impl_createReferenceSizeProvider()
{
- awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+ awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) );
- return std::make_unique<ReferenceSizeProvider>(
- aPageSize, Reference<chart2::XChartDocument>(getModel(), uno::UNO_QUERY));
+ return ReferenceSizeProvider(aPageSize, getChartModel());
}
void ChartController::impl_adaptDataSeriesAutoResize()
{
- std::unique_ptr<ReferenceSizeProvider> pRefSizeProvider(impl_createReferenceSizeProvider());
- if (pRefSizeProvider)
- pRefSizeProvider->setValuesAtAllDataSeries();
+ impl_createReferenceSizeProvider().setValuesAtAllDataSeries();
}
void ChartController::executeDispatch_NewArrangement()
@@ -182,8 +181,8 @@ void ChartController::executeDispatch_NewArrangement()
try
{
- Reference< frame::XModel > xModel( getModel() );
- Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
+ rtl::Reference<::chart::ChartModel> xModel( getChartModel() );
+ rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram();
if( xDiagram.is())
{
UndoGuard aUndoGuard(
@@ -192,21 +191,20 @@ void ChartController::executeDispatch_NewArrangement()
ControllerLockGuardUNO aCtlLockGuard( xModel );
// diagram
- Reference< beans::XPropertyState > xState( xDiagram, uno::UNO_QUERY_THROW );
- xState->setPropertyToDefault( "RelativeSize");
- xState->setPropertyToDefault( "RelativePosition");
- xState->setPropertyToDefault( "PosSizeExcludeAxes");
+ xDiagram->setPropertyToDefault( "RelativeSize");
+ xDiagram->setPropertyToDefault( "RelativePosition");
+ xDiagram->setPropertyToDefault( "PosSizeExcludeAxes");
// 3d rotation
- ThreeDHelper::set3DSettingsToDefault( uno::Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ) );
+ xDiagram->set3DSettingsToDefault();
// legend
- Reference< beans::XPropertyState > xLegendState( xDiagram->getLegend(), uno::UNO_QUERY );
- if( xLegendState.is())
+ rtl::Reference< Legend > xLegend = xDiagram->getLegend2();
+ if( xLegend.is())
{
- xLegendState->setPropertyToDefault( "RelativePosition");
- xLegendState->setPropertyToDefault( "RelativeSize");
- xLegendState->setPropertyToDefault( "AnchorPosition");
+ xLegend->setPropertyToDefault( "RelativePosition");
+ xLegend->setPropertyToDefault( "RelativeSize");
+ xLegend->setPropertyToDefault( "AnchorPosition");
}
// titles
@@ -214,16 +212,16 @@ void ChartController::executeDispatch_NewArrangement()
eType < TitleHelper::NORMAL_TITLE_END;
++eType )
{
- Reference< beans::XPropertyState > xTitleState(
+ rtl::Reference< Title > xTitleState =
TitleHelper::getTitle(
- static_cast< TitleHelper::eTitleType >( eType ), xModel ), uno::UNO_QUERY );
+ static_cast< TitleHelper::eTitleType >( eType ), xModel );
if( xTitleState.is())
xTitleState->setPropertyToDefault( "RelativePosition");
}
// regression curve equations
- std::vector< Reference< chart2::XRegressionCurve > > aRegressionCurves(
- RegressionCurveHelper::getAllRegressionCurvesNotMeanValueLine( xDiagram ));
+ std::vector< rtl::Reference< RegressionCurveModel > > aRegressionCurves =
+ xDiagram->getAllRegressionCurvesNotMeanValueLine();
// reset equation position
for( const auto& xCurve : aRegressionCurves )
@@ -244,12 +242,9 @@ void ChartController::executeDispatch_ScaleText()
UndoGuard aUndoGuard(
SchResId( STR_ACTION_SCALE_TEXT ),
m_xUndoManager );
- ControllerLockGuardUNO aCtlLockGuard( getModel() );
+ ControllerLockGuardUNO aCtlLockGuard( getChartModel() );
- std::unique_ptr<ReferenceSizeProvider> pRefSizeProv(impl_createReferenceSizeProvider());
- OSL_ASSERT(pRefSizeProv);
- if (pRefSizeProv)
- pRefSizeProv->toggleAutoResizeState();
+ impl_createReferenceSizeProvider().toggleAutoResizeState();
aUndoGuard.commit();
}
@@ -263,7 +258,7 @@ void ChartController::executeDispatch_Paste()
Graphic aGraphic;
// paste location: center of window
- Point aPos = pChartWindow->PixelToLogic( tools::Rectangle( {}, pChartWindow->GetSizePixel()).Center());
+ Point aPos = pChartWindow->PixelToLogic( tools::Rectangle(Point{}, pChartWindow->GetSizePixel()).Center());
// handle different formats
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pChartWindow ));
@@ -271,8 +266,7 @@ void ChartController::executeDispatch_Paste()
{
if ( aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) )
{
- tools::SvRef<SotTempStream> xStm;
- if ( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStm ) )
+ if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING) )
{
xStm->Seek( 0 );
Reference< io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) );
@@ -289,8 +283,7 @@ void ChartController::executeDispatch_Paste()
else if ( aDataHelper.HasFormat( SotClipboardFormatId::SVXB ) )
{
// graphic exchange format (graphic manager bitmap format?)
- tools::SvRef<SotTempStream> xStm;
- if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ))
+ if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB ))
{
TypeSerializer aSerializer(*xStm);
aSerializer.readGraphic(aGraphic);
@@ -318,8 +311,8 @@ void ChartController::executeDispatch_Paste()
if( m_pDrawViewWrapper )
{
OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
- if( pOutlinerView )//in case of edit mode insert into edited string
- pOutlinerView->InsertText( aString );
+ if (pOutlinerView)//in case of edit mode insert the formatted string
+ pOutlinerView->PasteSpecial();
else
{
impl_PasteStringAsTextShape( aString, awt::Point( 0, 0 ) );
@@ -346,43 +339,50 @@ void ChartController::impl_PasteGraphic(
DBG_TESTSOLARMUTEX();
// note: the XPropertySet of the model is the old API. Also the property
// "AdditionalShapes" that is used there.
- uno::Reference< beans::XPropertySet > xModelProp( getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xModel = getChartModel();
DrawModelWrapper * pDrawModelWrapper( GetDrawModelWrapper());
- if( ! (xGraphic.is() && xModelProp.is()))
- return;
- uno::Reference< lang::XMultiServiceFactory > xFact( pDrawModelWrapper->getShapeFactory());
- uno::Reference< drawing::XShape > xGraphicShape(
- xFact->createInstance( "com.sun.star.drawing.GraphicObjectShape" ), uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xGraphicShapeProp( xGraphicShape, uno::UNO_QUERY );
- if( !(xGraphicShapeProp.is() && xGraphicShape.is()))
+ if( ! (xGraphic.is() && xModel.is()))
return;
+ rtl::Reference<SvxGraphicObject> xGraphicShape = new SvxGraphicObject(nullptr);
+ xGraphicShape->setShapeKind(SdrObjKind::Graphic);
uno::Reference< drawing::XShapes > xPage = pDrawModelWrapper->getMainDrawPage();
if( xPage.is())
{
xPage->add( xGraphicShape );
//need to change the model state manually
- {
- uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY );
- if( xModifiable.is() )
- xModifiable->setModified( true );
- }
+ xModel->setModified( true );
//select new shape
m_aSelection.setSelection( xGraphicShape );
m_aSelection.applySelection( m_pDrawViewWrapper.get() );
}
- xGraphicShapeProp->setPropertyValue( "Graphic", uno::Any( xGraphic ));
- uno::Reference< beans::XPropertySet > xGraphicProp( xGraphic, uno::UNO_QUERY );
+ xGraphicShape->SvxShape::setPropertyValue( "Graphic", uno::Any( xGraphic ));
awt::Size aGraphicSize( 1000, 1000 );
+ bool bGotGraphicSize = false;
+ try
+ {
+ bGotGraphicSize = xGraphicShape->SvxShape::getPropertyValue( "Size100thMM") >>= aGraphicSize;
+ }
+ catch (css::beans::UnknownPropertyException& )
+ {}
auto pChartWindow(GetChartWindow());
// first try size in 100th mm, then pixel size
- if( ! ( xGraphicProp->getPropertyValue( "Size100thMM") >>= aGraphicSize ) &&
- ( ( xGraphicProp->getPropertyValue( "SizePixel") >>= aGraphicSize ) && pChartWindow ))
+ if( !bGotGraphicSize )
{
- ::Size aVCLSize( pChartWindow->PixelToLogic( Size( aGraphicSize.Width, aGraphicSize.Height )));
- aGraphicSize.Width = aVCLSize.getWidth();
- aGraphicSize.Height = aVCLSize.getHeight();
+ bool bGotSizePixel = false;
+ try
+ {
+ bGotSizePixel = xGraphicShape->SvxShape::getPropertyValue( "SizePixel") >>= aGraphicSize;
+ }
+ catch (css::beans::UnknownPropertyException& )
+ {}
+ if ( bGotSizePixel && pChartWindow )
+ {
+ ::Size aVCLSize( pChartWindow->PixelToLogic( Size( aGraphicSize.Width, aGraphicSize.Height )));
+ aGraphicSize.Width = aVCLSize.getWidth();
+ aGraphicSize.Height = aVCLSize.getHeight();
+ }
}
xGraphicShape->setSize( aGraphicSize );
xGraphicShape->setPosition( awt::Point( 0, 0 ) );
@@ -410,7 +410,9 @@ void ChartController::impl_PasteShapes( SdrModel* pModel )
{
SdrObject* pObj(aIter.Next());
// Clone to new SdrModel
- SdrObject* pNewObj(pObj ? pObj->CloneSdrObject(pDrawModelWrapper->getSdrModel()) : nullptr);
+ rtl::Reference<SdrObject> pNewObj;
+ if (pObj)
+ pNewObj = pObj->CloneSdrObject(pDrawModelWrapper->getSdrModel());
if ( pNewObj )
{
@@ -421,14 +423,14 @@ void ChartController::impl_PasteShapes( SdrModel* pModel )
xShape->setPosition( awt::Point( 0, 0 ) );
}
- pDestPage->InsertObject( pNewObj );
+ pDestPage->InsertObject( pNewObj.get() );
m_pDrawViewWrapper->AddUndo( std::make_unique<SdrUndoInsertObj>( *pNewObj ) );
xSelShape = xShape;
}
}
}
- Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xModifiable = getChartModel();
if ( xModifiable.is() )
{
xModifiable->setModified( true );
@@ -449,32 +451,29 @@ void ChartController::impl_PasteStringAsTextShape( const OUString& rString, cons
if ( !(pDrawModelWrapper && m_pDrawViewWrapper) )
return;
- const Reference< lang::XMultiServiceFactory >& xShapeFactory( pDrawModelWrapper->getShapeFactory() );
const Reference< drawing::XDrawPage >& xDrawPage( pDrawModelWrapper->getMainDrawPage() );
- OSL_ASSERT( xShapeFactory.is() && xDrawPage.is() );
+ OSL_ASSERT( xDrawPage.is() );
- if ( !(xShapeFactory.is() && xDrawPage.is()) )
+ if ( !xDrawPage )
return;
try
{
- Reference< drawing::XShape > xTextShape(
- xShapeFactory->createInstance( "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY_THROW );
+ rtl::Reference<SvxShapeText> xTextShape = new SvxShapeText(nullptr);
+ xTextShape->setShapeKind(SdrObjKind::Text);
xDrawPage->add( xTextShape );
- Reference< text::XTextRange > xRange( xTextShape, uno::UNO_QUERY_THROW );
- xRange->setString( rString );
+ xTextShape->setString( rString );
float fCharHeight = 10.0;
- Reference< beans::XPropertySet > xProperties( xTextShape, uno::UNO_QUERY_THROW );
- xProperties->setPropertyValue( "TextAutoGrowHeight", uno::Any( true ) );
- xProperties->setPropertyValue( "TextAutoGrowWidth", uno::Any( true ) );
- xProperties->setPropertyValue( "CharHeight", uno::Any( fCharHeight ) );
- xProperties->setPropertyValue( "CharHeightAsian", uno::Any( fCharHeight ) );
- xProperties->setPropertyValue( "CharHeightComplex", uno::Any( fCharHeight ) );
- xProperties->setPropertyValue( "TextVerticalAdjust", uno::Any( drawing::TextVerticalAdjust_CENTER ) );
- xProperties->setPropertyValue( "TextHorizontalAdjust", uno::Any( drawing::TextHorizontalAdjust_CENTER ) );
- xProperties->setPropertyValue( "CharFontName", uno::Any( OUString("Albany") ) );
+ xTextShape->SvxShape::setPropertyValue( "TextAutoGrowHeight", uno::Any( true ) );
+ xTextShape->SvxShape::setPropertyValue( "TextAutoGrowWidth", uno::Any( true ) );
+ xTextShape->SvxShape::setPropertyValue( "CharHeight", uno::Any( fCharHeight ) );
+ xTextShape->SvxShape::setPropertyValue( "CharHeightAsian", uno::Any( fCharHeight ) );
+ xTextShape->SvxShape::setPropertyValue( "CharHeightComplex", uno::Any( fCharHeight ) );
+ xTextShape->SvxShape::setPropertyValue( "TextVerticalAdjust", uno::Any( drawing::TextVerticalAdjust_CENTER ) );
+ xTextShape->SvxShape::setPropertyValue( "TextHorizontalAdjust", uno::Any( drawing::TextHorizontalAdjust_CENTER ) );
+ xTextShape->SvxShape::setPropertyValue( "CharFontName", uno::Any( OUString("Albany") ) );
xTextShape->setPosition( rPosition );
@@ -578,7 +577,14 @@ bool ChartController::isShapeContext() const
{
return m_aSelection.isAdditionalShapeSelected() ||
( m_pDrawViewWrapper && m_pDrawViewWrapper->AreObjectsMarked() &&
- ( m_pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) );
+ ( m_pDrawViewWrapper->GetCurrentObjIdentifier() == SdrObjKind::Text ) );
+}
+
+bool ChartController::IsTextEdit() const
+{
+ // only Title objects are editable textshapes
+ return m_aSelection.isTitleObjectSelected() &&
+ m_pDrawViewWrapper && m_pDrawViewWrapper->IsTextEdit();
}
void ChartController::impl_ClearSelection()
@@ -602,7 +608,7 @@ bool ChartController::executeDispatch_Delete()
return false;
//remove chart object
- uno::Reference< chart2::XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xChartDoc = getChartModel();
if( !xChartDoc.is() )
return false;
@@ -616,24 +622,24 @@ bool ChartController::executeDispatch_Delete()
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_TITLE )),
m_xUndoManager );
TitleHelper::removeTitle(
- ObjectIdentifier::getTitleTypeForCID( aCID ), getModel() );
+ ObjectIdentifier::getTitleTypeForCID( aCID ), getChartModel() );
bReturn = true;
aUndoGuard.commit();
break;
}
case OBJECTTYPE_LEGEND:
{
- uno::Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
+ rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram());
if( xDiagram.is())
{
- uno::Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
- if( xLegendProp.is())
+ rtl::Reference< Legend > xLegend( xDiagram->getLegend2() );
+ if( xLegend.is())
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_LEGEND )),
m_xUndoManager );
- xLegendProp->setPropertyValue( "Show", uno::Any( false ));
+ xLegend->setPropertyValue( "Show", uno::Any( false ));
bReturn = true;
aUndoGuard.commit();
}
@@ -642,7 +648,7 @@ bool ChartController::executeDispatch_Delete()
}
case OBJECTTYPE_DATA_SERIES:
- bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xUndoManager );
+ bReturn = lcl_deleteDataSeries( aCID, getChartModel(), m_xUndoManager );
break;
case OBJECTTYPE_LEGEND_ENTRY:
@@ -651,14 +657,14 @@ bool ChartController::executeDispatch_Delete()
ObjectIdentifier::getFullParentParticle( aCID ));
if( eParentObjectType == OBJECTTYPE_DATA_SERIES )
{
- bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xUndoManager );
+ bReturn = lcl_deleteDataSeries( aCID, getChartModel(), m_xUndoManager );
}
else if( eParentObjectType == OBJECTTYPE_DATA_CURVE )
{
sal_Int32 nEndPos = aCID.lastIndexOf(':');
OUString aParentCID = aCID.copy(0, nEndPos);
- bReturn = lcl_deleteDataCurve(aParentCID, getModel(), m_xUndoManager );
+ bReturn = lcl_deleteDataCurve(aParentCID, getChartModel(), m_xUndoManager );
}
else if( eParentObjectType == OBJECTTYPE_DATA_AVERAGE_LINE )
{
@@ -672,7 +678,7 @@ bool ChartController::executeDispatch_Delete()
{
uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
ObjectIdentifier::getObjectPropertySet(
- ObjectIdentifier::getFullParentParticle( aCID ), getModel()), uno::UNO_QUERY );
+ ObjectIdentifier::getFullParentParticle( aCID ), getChartModel()), uno::UNO_QUERY );
if( xRegCurveCnt.is())
{
UndoGuard aUndoGuard(
@@ -688,18 +694,18 @@ bool ChartController::executeDispatch_Delete()
case OBJECTTYPE_DATA_CURVE:
{
- bReturn = lcl_deleteDataCurve( aCID, getModel(), m_xUndoManager );
+ bReturn = lcl_deleteDataCurve( aCID, getChartModel(), m_xUndoManager );
}
break;
case OBJECTTYPE_DATA_CURVE_EQUATION:
{
uno::Reference< beans::XPropertySet > xEqProp(
- ObjectIdentifier::getObjectPropertySet( aCID, getModel()));
+ ObjectIdentifier::getObjectPropertySet( aCID, getChartModel()));
if( xEqProp.is())
{
- uno::Reference< frame::XModel > xModel( getModel() );
+ rtl::Reference<::chart::ChartModel> xModel( getChartModel() );
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_CURVE_EQUATION )),
@@ -722,10 +728,10 @@ bool ChartController::executeDispatch_Delete()
case OBJECTTYPE_DATA_ERRORS_Z:
{
uno::Reference< beans::XPropertySet > xErrorBarProp(
- ObjectIdentifier::getObjectPropertySet( aCID, getModel() ));
+ ObjectIdentifier::getObjectPropertySet( aCID, getChartModel() ));
if( xErrorBarProp.is())
{
- const char* pId;
+ TranslateId pId;
if ( aObjectType == OBJECTTYPE_DATA_ERRORS_X )
pId = STR_OBJECT_ERROR_BARS_X;
@@ -734,7 +740,7 @@ bool ChartController::executeDispatch_Delete()
else
pId = STR_OBJECT_ERROR_BARS_Z;
- uno::Reference< frame::XModel > xModel( getModel() );
+ rtl::Reference<::chart::ChartModel> xModel( getChartModel() );
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::ActionType::Delete, SchResId(pId)),
@@ -755,7 +761,7 @@ bool ChartController::executeDispatch_Delete()
case OBJECTTYPE_DATA_LABEL:
{
uno::Reference< beans::XPropertySet > xObjectProperties =
- ObjectIdentifier::getObjectPropertySet( aCID, getModel() );
+ ObjectIdentifier::getObjectPropertySet( aCID, getChartModel() );
if( xObjectProperties.is() )
{
UndoGuard aUndoGuard(
@@ -770,9 +776,10 @@ bool ChartController::executeDispatch_Delete()
aLabel.ShowCategoryName = false;
aLabel.ShowLegendSymbol = false;
aLabel.ShowCustomLabel = false;
+ aLabel.ShowSeriesName = false;
if( aObjectType == OBJECTTYPE_DATA_LABELS )
{
- uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( aCID, getModel() ));
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( aCID, getChartModel() );
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_LABEL, uno::Any(aLabel) );
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any() );
}
@@ -829,11 +836,10 @@ bool ChartController::executeDispatch_Delete()
void ChartController::executeDispatch_ToggleLegend()
{
- Reference< frame::XModel > xModel( getModel() );
+ rtl::Reference< ChartModel > xModel = getChartModel();
UndoGuard aUndoGuard(
SchResId( STR_ACTION_TOGGLE_LEGEND ), m_xUndoManager );
- ChartModel& rModel = dynamic_cast<ChartModel&>(*xModel);
- Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(rModel), uno::UNO_QUERY );
+ rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*xModel);
bool bChanged = false;
if( xLegendProp.is())
{
@@ -853,7 +859,7 @@ void ChartController::executeDispatch_ToggleLegend()
}
else
{
- xLegendProp.set( LegendHelper::getLegend(rModel, m_xCC, true), uno::UNO_QUERY );
+ xLegendProp = LegendHelper::getLegend(*xModel, m_xCC, true);
if( xLegendProp.is())
bChanged = true;
}
@@ -866,7 +872,7 @@ void ChartController::executeDispatch_ToggleGridHorizontal()
{
UndoGuard aUndoGuard(
SchResId( STR_ACTION_TOGGLE_GRID_HORZ ), m_xUndoManager );
- Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( getModel() ));
+ rtl::Reference< Diagram > xDiagram( getFirstDiagram() );
if( !xDiagram.is())
return;
@@ -899,7 +905,7 @@ void ChartController::executeDispatch_ToggleGridVertical()
{
UndoGuard aUndoGuard(
SchResId( STR_ACTION_TOGGLE_GRID_VERTICAL ), m_xUndoManager );
- Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( getModel() ));
+ rtl::Reference< Diagram > xDiagram( getFirstDiagram() );
if( !xDiagram.is())
return;
@@ -933,7 +939,7 @@ void ChartController::executeDispatch_FillColor(sal_uInt32 nColor)
try
{
OUString aCID( m_aSelection.getSelectedCID() );
- const uno::Reference< frame::XModel >& xChartModel = getModel();
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
if( xChartModel.is() )
{
Reference< beans::XPropertySet > xPointProperties(
@@ -948,15 +954,15 @@ void ChartController::executeDispatch_FillColor(sal_uInt32 nColor)
}
}
-void ChartController::executeDispatch_FillGradient(OUString sJSONGradient)
+void ChartController::executeDispatch_FillGradient(std::u16string_view sJSONGradient)
{
- XGradient aXGradient = XGradient::fromJSON(sJSONGradient);
- css::awt::Gradient aGradient = aXGradient.toGradientUNO();
+ basegfx::BGradient aBGradient = basegfx::BGradient::fromJSON(sJSONGradient);
+ css::awt::Gradient aGradient = model::gradient::createUnoGradient2(aBGradient);
try
{
OUString aCID( m_aSelection.getSelectedCID() );
- const uno::Reference< frame::XModel >& xChartModel = getModel();
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
if( xChartModel.is() )
{
@@ -965,12 +971,13 @@ void ChartController::executeDispatch_FillGradient(OUString sJSONGradient)
if( xPropSet.is() )
{
- OUString aPrefferedName = OUString::number(static_cast<sal_Int32>(aXGradient.GetStartColor()))
- + OUString::number(static_cast<sal_Int32>(aXGradient.GetEndColor()))
- + OUString::number(static_cast<sal_Int32>(aXGradient.GetAngle().get()));
+ OUString aPrefferedName =
+ OUString::number(static_cast<sal_Int32>(Color(aBGradient.GetColorStops().front().getStopColor())))
+ + OUString::number(static_cast<sal_Int32>(Color(aBGradient.GetColorStops().back().getStopColor())))
+ + OUString::number(static_cast<sal_Int32>(aBGradient.GetAngle().get()));
OUString aNewName = PropertyHelper::addGradientUniqueNameToTable(css::uno::Any(aGradient),
- css::uno::Reference<css::lang::XMultiServiceFactory>(xChartModel, css::uno::UNO_QUERY_THROW),
+ xChartModel,
aPrefferedName);
xPropSet->setPropertyValue("FillGradientName", css::uno::Any(aNewName));
@@ -988,7 +995,7 @@ void ChartController::executeDispatch_LineColor(sal_uInt32 nColor)
try
{
OUString aCID( m_aSelection.getSelectedCID() );
- const uno::Reference< frame::XModel >& xChartModel = getModel();
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
if( xChartModel.is() )
{
Reference< beans::XPropertySet > xPropSet(
@@ -1004,7 +1011,7 @@ void ChartController::executeDispatch_LineColor(sal_uInt32 nColor)
}
if( xPropSet.is() )
- xPropSet->setPropertyValue( "LineColor", css::uno::makeAny( Color(ColorTransparency, nColor) ) );
+ xPropSet->setPropertyValue( "LineColor", css::uno::Any( Color(ColorTransparency, nColor) ) );
}
}
catch( const uno::Exception& )
@@ -1018,7 +1025,7 @@ void ChartController::executeDispatch_LineWidth(sal_uInt32 nWidth)
try
{
OUString aCID( m_aSelection.getSelectedCID() );
- const uno::Reference< frame::XModel >& xChartModel = getModel();
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
if( xChartModel.is() )
{
Reference< beans::XPropertySet > xPropSet(
@@ -1034,7 +1041,7 @@ void ChartController::executeDispatch_LineWidth(sal_uInt32 nWidth)
}
if( xPropSet.is() )
- xPropSet->setPropertyValue( "LineWidth", css::uno::makeAny( nWidth ) );
+ xPropSet->setPropertyValue( "LineWidth", css::uno::Any( nWidth ) );
}
}
catch( const uno::Exception& )
@@ -1079,7 +1086,7 @@ void ChartController::executeDispatch_LOKPieSegmentDragging( int nOffset )
try
{
OUString aCID( m_aSelection.getSelectedCID() );
- const uno::Reference< frame::XModel >& xChartModel = getModel();
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
if( xChartModel.is() )
{
Reference< beans::XPropertySet > xPointProperties(
@@ -1109,8 +1116,7 @@ void ChartController::impl_switchDiagramPositioningToExcludingPositioning()
ActionDescriptionProvider::ActionType::PosSize,
ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)),
m_xUndoManager );
- ChartModel& rModel = dynamic_cast<ChartModel&>(*m_aModel->getModel());
- if (DiagramHelper::switchDiagramPositioningToExcludingPositioning(rModel, true, true))
+ if (DiagramHelper::switchDiagramPositioningToExcludingPositioning(*getChartModel(), true, true))
aUndoGuard.commit();
}
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index d9879174656d..375c2824a8a1 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -22,13 +22,16 @@
#include <string_view>
#include <ChartController.hxx>
+#include <ChartView.hxx>
#include <PositionAndSizeHelper.hxx>
#include <ObjectIdentifier.hxx>
#include <ChartWindow.hxx>
#include <ResId.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartType.hxx>
#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <TitleHelper.hxx>
#include "UndoGuard.hxx"
#include <ControllerLockGuard.hxx>
@@ -41,8 +44,12 @@
#include <RelativePositionHelper.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <StatisticsHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
+#include <DataSeriesProperties.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <LegendHelper.hxx>
#include <servicenames_charttypes.hxx>
@@ -52,24 +59,17 @@
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/chart2/data/XPivotTableDataProvider.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/awt/PopupMenuDirection.hpp>
#include <com/sun/star/frame/DispatchHelper.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XPopupMenuController.hpp>
-#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/qa/XDumper.hpp>
#include <comphelper/lok.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/propertyvalue.hxx>
-#include <comphelper/sequence.hxx>
-
-#include <toolkit/awt/vclxmenu.hxx>
#include <sfx2/viewsh.hxx>
#include <svx/ActionDescriptionProvider.hxx>
@@ -78,14 +78,15 @@
#include <svx/svddrgmt.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
-#include <vcl/menu.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/weld.hxx>
#include <vcl/ptrstyle.hxx>
#include <svtools/acceleratorexecute.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
#include <boost/property_tree/json_parser.hpp>
#include <sfx2/dispatch.hxx>
@@ -95,6 +96,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
namespace chart
@@ -148,7 +150,7 @@ void lcl_insertMenuCommand(
xMenu->setCommand( nId, rCommand );
}
-OUString lcl_getFormatCommandForObjectCID( const OUString& rCID )
+OUString lcl_getFormatCommandForObjectCID( std::u16string_view rCID )
{
OUString aDispatchCommand( ".uno:FormatSelection" );
@@ -251,7 +253,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( getModel() );
+ awt::Size aModelPageSize = ChartModelHelper::getPageSize( getChartModel() );
sal_Int32 nScaleXNumerator = aLogicSize.Width();
sal_Int32 nScaleXDenominator = aModelPageSize.Width;
sal_Int32 nScaleYNumerator = aLogicSize.Height();
@@ -265,8 +267,7 @@ void SAL_CALL ChartController::setPosSize(
pChartWindow->setPosSizePixel( X, Y, Width, Height, static_cast<PosSizeFlags>(Flags) );
//#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
- uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY );
- if( xProp.is() )
+ if( m_xChartView.is() )
{
auto aZoomFactors(::comphelper::InitPropertySequence({
{ "ScaleXNumerator", uno::Any( nScaleXNumerator ) },
@@ -274,13 +275,13 @@ void SAL_CALL ChartController::setPosSize(
{ "ScaleYNumerator", uno::Any( nScaleYNumerator ) },
{ "ScaleYDenominator", uno::Any( nScaleYDenominator ) }
}));
- xProp->setPropertyValue( "ZoomFactors", uno::Any( aZoomFactors ));
+ m_xChartView->setPropertyValue( "ZoomFactors", uno::Any( aZoomFactors ));
}
//a correct work area is at least necessary for correct values in the position and size dialog and for dragging area
if(m_pDrawViewWrapper)
{
- tools::Rectangle aRect(Point(0,0), pChartWindow->GetOutputSize());
+ tools::Rectangle aRect(Point(0,0), pChartWindow->GetOutDev()->GetOutputSize());
m_pDrawViewWrapper->SetWorkArea( aRect );
}
pChartWindow->Invalidate();
@@ -461,14 +462,13 @@ void ChartController::execute_Paint(vcl::RenderContext& rRenderContext, const to
{
try
{
- uno::Reference<frame::XModel> xModel(getModel());
+ rtl::Reference<ChartModel> xModel(getChartModel());
//OSL_ENSURE( xModel.is(), "ChartController::execute_Paint: have no model to paint");
if (!xModel.is())
return;
//better performance for big data
- uno::Reference<beans::XPropertySet> xProp(m_xChartView, uno::UNO_QUERY);
- if (xProp.is())
+ if (m_xChartView.is())
{
awt::Size aResolution(1000, 1000);
{
@@ -480,12 +480,11 @@ void ChartController::execute_Paint(vcl::RenderContext& rRenderContext, const to
aResolution.Height = pChartWindow->GetSizePixel().Height();
}
}
- xProp->setPropertyValue( "Resolution", uno::Any( aResolution ));
+ m_xChartView->setPropertyValue( "Resolution", uno::Any( aResolution ));
}
- uno::Reference< util::XUpdatable > xUpdatable( m_xChartView, uno::UNO_QUERY );
- if (xUpdatable.is())
- xUpdatable->update();
+ if (m_xChartView.is())
+ m_xChartView->update();
{
SolarMutexGuard aGuard;
@@ -601,7 +600,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
// #i12587# support for shapes in chart
( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ) == SdrHitKind::MarkedObject ) )
{
- pDrawViewWrapper->MouseButtonDown(rMEvt, pChartWindow);
+ pDrawViewWrapper->MouseButtonDown(rMEvt, pChartWindow->GetOutDev());
return;
}
else
@@ -638,7 +637,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
}
if ( !pDrawViewWrapper->IsAction() )
{
- if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CAPTION )
+ if ( pDrawViewWrapper->GetCurrentObjIdentifier() == SdrObjKind::Caption )
{
Size aCaptionSize( 2268, 1134 );
pDrawViewWrapper->BegCreateCaptionObj( aMPos, aCaptionSize );
@@ -667,7 +666,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
rMEvt.IsRight(),
m_bWaitingForDoubleClick );
- if( !m_aSelection.isRotateableObjectSelected( getModel() ) )
+ if( !m_aSelection.isRotateableObjectSelected( getChartModel() ) )
{
m_eDragMode = SdrDragMode::Move;
pDrawViewWrapper->SetDragMode(m_eDragMode);
@@ -700,14 +699,14 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
else if( eKind==SdrHdlKind::UpperLeft || eKind==SdrHdlKind::UpperRight || eKind==SdrHdlKind::LowerLeft || eKind==SdrHdlKind::LowerRight )
eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_Z;
}
- pDragMethod = new DragMethod_RotateDiagram( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getModel(), eRotationDirection );
+ pDragMethod = new DragMethod_RotateDiagram( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getChartModel(), eRotationDirection );
}
}
else
{
- OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ) );
+ std::u16string_view aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ) );
if( aDragMethodServiceName == ObjectIdentifier::getPieSegmentDragMethodServiceName() )
- pDragMethod = new DragMethod_PieSegment( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getModel() );
+ pDragMethod = new DragMethod_PieSegment( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getChartModel() );
}
pDrawViewWrapper->SdrView::BegDragObj(aMPos, nullptr, pHitSelectionHdl, nDrgLog, pDragMethod);
}
@@ -726,7 +725,7 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
if( m_pDrawViewWrapper->IsTextEdit() )
{
- if( m_pDrawViewWrapper->MouseMove(rMEvt,pChartWindow) )
+ if( m_pDrawViewWrapper->MouseMove(rMEvt,pChartWindow->GetOutDev()) )
return;
}
@@ -740,10 +739,11 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
{
- ControllerLockGuardUNO aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getChartModel() );
bool bMouseUpWithoutMouseDown = !m_bWaitingForMouseUp;
m_bWaitingForMouseUp = false;
bool bNotifySelectionChange = false;
+ bool bEditText = false;
{
SolarMutexGuard aGuard;
@@ -772,7 +772,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
if(pDrawViewWrapper->IsTextEdit())
{
- if( pDrawViewWrapper->MouseButtonUp(rMEvt,pChartWindow) )
+ if( pDrawViewWrapper->MouseButtonUp(rMEvt,pChartWindow->GetOutDev()) )
return;
}
@@ -787,7 +787,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
}
if ( pDrawViewWrapper->AreObjectsMarked() )
{
- if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT )
+ if ( pDrawViewWrapper->GetCurrentObjIdentifier() == SdrObjKind::Text )
{
executeDispatch_EditText();
}
@@ -840,10 +840,10 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
{
tools::Rectangle aObjectRect = pObj->GetSnapRect();
tools::Rectangle aOldObjectRect = pObj->GetLastBoundRect();
- awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+ awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) );
tools::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
- const E3dObject* pE3dObject(dynamic_cast< const E3dObject*>(pObj));
+ const E3dObject* pE3dObject(DynCastE3dObject(pObj));
if(nullptr != pE3dObject)
{
E3dScene* pScene(pE3dObject->getRootE3dSceneFromE3dObject());
@@ -864,16 +864,15 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
m_xUndoManager );
bool bChanged = false;
- ChartModel* pModel = dynamic_cast<ChartModel*>(getModel().get());
- assert(pModel);
+ rtl::Reference< ChartModel > xModel = getChartModel();
if ( eObjectType == OBJECTTYPE_LEGEND )
- bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( *pModel, false , true );
+ bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( *xModel, false , true );
bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID()
- , getModel()
- , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight())
- , awt::Rectangle(aOldObjectRect.getX(), aOldObjectRect.getY(), 0, 0)
- , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) );
+ , xModel
+ , awt::Rectangle(aObjectRect.Left(),aObjectRect.Top(),aObjectRect.getOpenWidth(),aObjectRect.getOpenHeight())
+ , awt::Rectangle(aOldObjectRect.Left(), aOldObjectRect.Top(), 0, 0)
+ , awt::Rectangle(aPageRect.Left(),aPageRect.Top(),aPageRect.getOpenWidth(),aPageRect.getOpenHeight()) );
if( bMoved || bChanged )
{
@@ -893,7 +892,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
if( !bDraggingDone ) //mouse wasn't moved while dragging
{
bool bClickedTwiceOnDragableObject = SelectionHelper::isDragableObjectHitTwice( aMPos, m_aSelection.getSelectedCID(), *pDrawViewWrapper );
- bool bIsRotateable = m_aSelection.isRotateableObjectSelected( getModel() );
+ bool bIsRotateable = m_aSelection.isRotateableObjectSelected( getChartModel() );
//toggle between move and rotate
if( bIsRotateable && bClickedTwiceOnDragableObject && m_eDragMode==SdrDragMode::Move )
@@ -921,7 +920,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
if( isDoubleClick(rMEvt) && !bMouseUpWithoutMouseDown /*#i106966#*/ )
{
Point aMousePixel = rMEvt.GetPosPixel();
- execute_DoubleClick( &aMousePixel );
+ execute_DoubleClick( &aMousePixel, bEditText );
}
if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
@@ -930,18 +929,17 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
impl_SetMousePointer( rMEvt );
- if(bNotifySelectionChange)
+ if(bNotifySelectionChange || bEditText)
impl_notifySelectionChangeListeners();
}
-void ChartController::execute_DoubleClick( const Point* pMousePixel )
+void ChartController::execute_DoubleClick( const Point* pMousePixel, bool &bEditText )
{
const SfxViewShell* pViewShell = SfxViewShell::Current();
- bool isMobilePhone = pViewShell && pViewShell->isLOKMobilePhone();
- if (isMobilePhone)
+ bool notAllowed = pViewShell && (pViewShell->isLOKMobilePhone() || pViewShell->IsLokReadOnlyView());
+ if (notAllowed)
return;
- bool bEditText = false;
if ( m_aSelection.hasSelection() )
{
OUString aCID( m_aSelection.getSelectedCID() );
@@ -957,7 +955,7 @@ void ChartController::execute_DoubleClick( const Point* pMousePixel )
{
// #i12587# support for shapes in chart
SdrObject* pObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() );
- if ( dynamic_cast< const SdrTextObj* >(pObj) != nullptr )
+ if ( DynCastSdrTextObj(pObj) != nullptr )
{
bEditText = true;
}
@@ -1005,8 +1003,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
impl_notifySelectionChangeListeners();
- css::uno::Reference< css::awt::XPopupMenu > xPopupMenu( m_xCC->getServiceManager()->createInstanceWithContext(
- "com.sun.star.awt.PopupMenu", m_xCC ), css::uno::UNO_QUERY );
+ rtl::Reference< VCLXPopupMenu > xPopupMenu = new VCLXPopupMenu();
Point aPos( rCEvt.GetMousePosPixel() );
if( !rCEvt.IsMouseEvent() )
@@ -1021,260 +1018,256 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
aMenuName = m_pDrawViewWrapper->IsTextEdit() ? std::u16string_view( u"drawtext" ) : std::u16string_view( u"draw" );
else
{
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
+
// todo: the context menu should be specified by an xml file in uiconfig
- if( xPopupMenu.is())
+ sal_Int16 nUniqueId = 1;
+ if (eObjectType != OBJECTTYPE_DATA_TABLE)
{
- sal_Int16 nUniqueId = 1;
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Cut" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Copy" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:Paste" );
xPopupMenu->insertSeparator( -1 );
+ }
- ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
- Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( getModel() );
+ rtl::Reference< Diagram > xDiagram = getFirstDiagram();
- OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, aFormatCommand );
+ OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, aFormatCommand );
+ if (eObjectType == OBJECTTYPE_TITLE && m_pDrawViewWrapper->IsTextEdit())
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FontDialog" );
- //some commands for dataseries and points:
+ //some commands for dataseries and points:
- if( eObjectType == OBJECTTYPE_DATA_SERIES || eObjectType == OBJECTTYPE_DATA_POINT )
+ if( eObjectType == OBJECTTYPE_DATA_SERIES || eObjectType == OBJECTTYPE_DATA_POINT )
+ {
+ bool bIsPoint = ( eObjectType == OBJECTTYPE_DATA_POINT );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getChartModel() );
+ rtl::Reference< RegressionCurveModel > xTrendline = RegressionCurveHelper::getFirstCurveNotMeanValueLine( xSeries );
+ bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline );
+ rtl::Reference< RegressionCurveModel > xMeanValue = RegressionCurveHelper::getMeanValueLine( xSeries );
+ bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries );
+ bool bHasXErrorBars = StatisticsHelper::hasErrorBars( xSeries, false );
+ bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries );
+ bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries );
+ bool bHasDataLabelAtPoint = false;
+ sal_Int32 nPointIndex = -1;
+ if( bIsPoint )
{
- bool bIsPoint = ( eObjectType == OBJECTTYPE_DATA_POINT );
- uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
- uno::Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
- Reference< chart2::XRegressionCurve > xTrendline( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ) );
- bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline );
- Reference< chart2::XRegressionCurve > xMeanValue( RegressionCurveHelper::getMeanValueLine( xCurveCnt ) );
- bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries );
- bool bHasXErrorBars = StatisticsHelper::hasErrorBars( xSeries, false );
- bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries );
- bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries );
- bool bHasDataLabelAtPoint = false;
- sal_Int32 nPointIndex = -1;
- if( bIsPoint )
- {
- nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
- bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex );
- }
- bool bSelectedPointIsFormatted = false;
- bool bHasFormattedDataPointsOtherThanSelected = false;
+ nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
+ bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex );
+ }
+ bool bSelectedPointIsFormatted = false;
+ bool bHasFormattedDataPointsOtherThanSelected = false;
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( xSeriesProperties.is() )
+ if( xSeries.is() )
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
- uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ if( aAttributedDataPointIndexList.hasElements() )
{
- if( aAttributedDataPointIndexList.hasElements() )
+ if( bIsPoint )
{
- if( bIsPoint )
- {
- auto aIndices( comphelper::sequenceToContainer<std::vector< sal_Int32 >>( aAttributedDataPointIndexList ) );
- std::vector< sal_Int32 >::iterator aIt = std::find( aIndices.begin(), aIndices.end(), nPointIndex );
- if( aIt != aIndices.end())
- bSelectedPointIsFormatted = true;
- else
- bHasFormattedDataPointsOtherThanSelected = true;
- }
+ auto aIt = std::find( aAttributedDataPointIndexList.begin(), aAttributedDataPointIndexList.end(), nPointIndex );
+ if (aIt != aAttributedDataPointIndexList.end())
+ bSelectedPointIsFormatted = true;
else
bHasFormattedDataPointsOtherThanSelected = true;
}
+ else
+ bHasFormattedDataPointsOtherThanSelected = true;
}
}
+ }
- if( bIsPoint )
- {
- if( bHasDataLabelAtPoint )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabel" );
- if( !bHasDataLabelAtPoint )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabel" );
- else
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabel" );
- if( bSelectedPointIsFormatted )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetDataPoint" );
+ if( bIsPoint )
+ {
+ if( bHasDataLabelAtPoint )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabel" );
+ if( !bHasDataLabelAtPoint )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabel" );
+ else
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabel" );
+ if( bSelectedPointIsFormatted )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetDataPoint" );
- xPopupMenu->insertSeparator( -1 );
+ xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataSeries" );
- }
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataSeries" );
+ }
- Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
- if( xChartType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) );
+ if( xChartType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
+ {
+ try
{
- try
- {
- Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
- if( xChartTypeProp.is() )
- {
- bool bJapaneseStyle = false;
- xChartTypeProp->getPropertyValue( "Japanese" ) >>= bJapaneseStyle;
-
- if( bJapaneseStyle )
- {
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" );
- }
- }
- }
- catch( const uno::Exception & )
+ bool bJapaneseStyle = false;
+ xChartType->getPropertyValue( "Japanese" ) >>= bJapaneseStyle;
+
+ if( bJapaneseStyle )
{
- DBG_UNHANDLED_EXCEPTION("chart2");
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" );
}
}
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
- if( bHasDataLabelsAtSeries )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabels" );
- if( bHasEquation )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
- if( xMeanValue.is() )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMeanValue" );
- if( bHasXErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatXErrorBars" );
- if( bHasYErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatYErrorBars" );
+ if( bHasDataLabelsAtSeries )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabels" );
+ if( bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
+ if( xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMeanValue" );
+ if( bHasXErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatXErrorBars" );
+ if( bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatYErrorBars" );
- xPopupMenu->insertSeparator( -1 );
+ xPopupMenu->insertSeparator( -1 );
- if( !bHasDataLabelsAtSeries )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabels" );
-
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendline" );
-
- if( !xMeanValue.is() )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMeanValue" );
- if( !bHasXErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertXErrorBars" );
- if( !bHasYErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertYErrorBars" );
- if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabels" );
- if( bHasEquation )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
- if( xMeanValue.is() )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMeanValue" );
- if( bHasXErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteXErrorBars" );
- if( bHasYErrorBars )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteYErrorBars" );
-
- if( bHasFormattedDataPointsOtherThanSelected )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetAllDataPoints" );
+ if( !bHasDataLabelsAtSeries )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabels" );
+
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendline" );
+
+ if( !xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMeanValue" );
+ if( !bHasXErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertXErrorBars" );
+ if( !bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertYErrorBars" );
+ if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabels" );
+ if( bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
+ if( xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMeanValue" );
+ if( bHasXErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteXErrorBars" );
+ if( bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteYErrorBars" );
+
+ if( bHasFormattedDataPointsOtherThanSelected )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:ResetAllDataPoints" );
- xPopupMenu->insertSeparator( -1 );
+ xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId, ".uno:ArrangeRow" );
- uno::Reference< awt::XPopupMenu > xArrangePopupMenu(
- m_xCC->getServiceManager()->createInstanceWithContext(
- "com.sun.star.awt.PopupMenu", m_xCC ), uno::UNO_QUERY );
- if( xArrangePopupMenu.is() )
- {
- sal_Int16 nSubId = nUniqueId + 1;
- lcl_insertMenuCommand( xArrangePopupMenu, nSubId++, ".uno:Forward" );
- lcl_insertMenuCommand( xArrangePopupMenu, nSubId, ".uno:Backward" );
- xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
- nUniqueId = nSubId;
- }
- ++nUniqueId;
- }
- else if( eObjectType == OBJECTTYPE_DATA_CURVE )
- {
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendline" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquation" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquationAndR2" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
- }
- else if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
- {
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
- }
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId, ".uno:ArrangeRow" );
+ rtl::Reference< VCLXPopupMenu > xArrangePopupMenu = new VCLXPopupMenu();
+ sal_Int16 nSubId = nUniqueId + 1;
+ lcl_insertMenuCommand( xArrangePopupMenu, nSubId++, ".uno:Forward" );
+ lcl_insertMenuCommand( xArrangePopupMenu, nSubId, ".uno:Backward" );
+ xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
+ nUniqueId = nSubId;
+ ++nUniqueId;
+ }
+ else if( eObjectType == OBJECTTYPE_DATA_CURVE )
+ {
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendline" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquation" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquationAndR2" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
+ }
+ else if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
+ {
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
+ }
- //some commands for axes: and grids
+ //some commands for axes: and grids
- else if( eObjectType == OBJECTTYPE_AXIS || eObjectType == OBJECTTYPE_GRID || eObjectType == OBJECTTYPE_SUBGRID )
+ else if( eObjectType == OBJECTTYPE_AXIS || eObjectType == OBJECTTYPE_GRID || eObjectType == OBJECTTYPE_SUBGRID )
+ {
+ rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() );
+ if( xAxis.is() && xDiagram.is() )
{
- Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
- if( xAxis.is() && xDiagram.is() )
- {
- sal_Int32 nDimensionIndex = -1;
- sal_Int32 nCooSysIndex = -1;
- sal_Int32 nAxisIndex = -1;
- AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
- bool bIsSecondaryAxis = nAxisIndex!=0;
- bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis );
- bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram );
- bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram );
- bool bHasTitle = false;
- uno::Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY );
- if( xTitled.is())
- bHasTitle = !TitleHelper::getCompleteString( xTitled->getTitleObject() ).isEmpty();
-
- if( eObjectType != OBJECTTYPE_AXIS && bIsAxisVisible )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatAxis" );
- if( eObjectType != OBJECTTYPE_GRID && bIsMajorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMajorGrid" );
- if( eObjectType != OBJECTTYPE_SUBGRID && bIsMinorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMinorGrid" );
-
- xPopupMenu->insertSeparator( -1 );
-
- if( eObjectType != OBJECTTYPE_AXIS && !bIsAxisVisible )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxis" );
- if( eObjectType != OBJECTTYPE_GRID && !bIsMajorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMajorGrid" );
- if( eObjectType != OBJECTTYPE_SUBGRID && !bIsMinorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMinorGrid" );
- if( !bHasTitle )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxisTitle" );
-
- if( bIsAxisVisible )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteAxis" );
- if( bIsMajorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMajorGrid" );
- if( bIsMinorGridVisible && !bIsSecondaryAxis )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMinorGrid" );
- }
- }
-
- if( eObjectType == OBJECTTYPE_DATA_STOCK_LOSS )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" );
- else if( eObjectType == OBJECTTYPE_DATA_STOCK_GAIN )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" );
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nCooSysIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
+ bool bIsSecondaryAxis = nAxisIndex!=0;
+ bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis );
+ bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram );
+ bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram );
+ bool bHasTitle = !TitleHelper::getCompleteString( xAxis->getTitleObject2() ).isEmpty();
+
+ if( eObjectType != OBJECTTYPE_AXIS && bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatAxis" );
+ if( eObjectType != OBJECTTYPE_GRID && bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMajorGrid" );
+ if( eObjectType != OBJECTTYPE_SUBGRID && bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatMinorGrid" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:TransformDialog" );
+ xPopupMenu->insertSeparator( -1 );
- if( eObjectType == OBJECTTYPE_PAGE || eObjectType == OBJECTTYPE_DIAGRAM
- || eObjectType == OBJECTTYPE_DIAGRAM_WALL
- || eObjectType == OBJECTTYPE_DIAGRAM_FLOOR
- || eObjectType == OBJECTTYPE_UNKNOWN )
- {
- if( eObjectType != OBJECTTYPE_UNKNOWN )
- xPopupMenu->insertSeparator( -1 );
- bool bHasLegend = LegendHelper::hasLegend( xDiagram );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTitles" );
- if( !bHasLegend )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertLegend" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertRemoveAxes" );
- if( bHasLegend )
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteLegend" );
+ if( eObjectType != OBJECTTYPE_AXIS && !bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxis" );
+ if( eObjectType != OBJECTTYPE_GRID && !bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMajorGrid" );
+ if( eObjectType != OBJECTTYPE_SUBGRID && !bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMinorGrid" );
+ if( !bHasTitle )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertAxisTitle" );
+
+ if( bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteAxis" );
+ if( bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMajorGrid" );
+ if( bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteMinorGrid" );
+ if (bIsAxisVisible)
+ lcl_insertMenuCommand(xPopupMenu, nUniqueId++, ".uno:InsertDataTable");
}
+ }
+ else if (eObjectType == OBJECTTYPE_DATA_TABLE)
+ {
+ lcl_insertMenuCommand(xPopupMenu, nUniqueId++, ".uno:DeleteDataTable");
+ }
- xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramType" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DataRanges" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramData" );
- lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:View3D" );
+ if( eObjectType == OBJECTTYPE_DATA_STOCK_LOSS )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockGain" );
+ else if( eObjectType == OBJECTTYPE_DATA_STOCK_GAIN )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatStockLoss" );
+
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:TransformDialog" );
+
+ if( eObjectType == OBJECTTYPE_PAGE || eObjectType == OBJECTTYPE_DIAGRAM
+ || eObjectType == OBJECTTYPE_DIAGRAM_WALL
+ || eObjectType == OBJECTTYPE_DIAGRAM_FLOOR
+ || eObjectType == OBJECTTYPE_UNKNOWN )
+ {
+ if( eObjectType != OBJECTTYPE_UNKNOWN )
+ xPopupMenu->insertSeparator( -1 );
+ bool bHasLegend = LegendHelper::hasLegend( xDiagram );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTitles" );
+ if( !bHasLegend )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertLegend" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertRemoveAxes" );
+ if( bHasLegend )
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteLegend" );
}
+
+ xPopupMenu->insertSeparator( -1 );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramType" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DataRanges" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramData" );
+ lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:View3D" );
}
- css::uno::Sequence< css::uno::Any > aArgs( 3 );
- aArgs[0] <<= comphelper::makePropertyValue( "IsContextMenu", true );
- aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_xFrame );
- aArgs[2] <<= comphelper::makePropertyValue( "Value", aMenuName );
+ css::uno::Sequence< css::uno::Any > aArgs{
+ css::uno::Any(comphelper::makePropertyValue( "IsContextMenu", true )),
+ css::uno::Any(comphelper::makePropertyValue( "Frame", m_xFrame )),
+ css::uno::Any(comphelper::makePropertyValue( "Value", aMenuName ))
+ };
css::uno::Reference< css::frame::XPopupMenuController > xPopupController(
m_xCC->getServiceManager()->createInstanceWithArgumentsAndContext(
@@ -1289,26 +1282,25 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
{
if (SfxViewShell* pViewShell = SfxViewShell::Current())
{
- PopupMenu* pPopupMenu = static_cast<PopupMenu*>(comphelper::getUnoTunnelImplementation<VCLXMenu>(xPopupMenu)->GetMenu());
ControllerCommandDispatch* pCommandDispatch = dynamic_cast<ControllerCommandDispatch*>(m_aDispatchContainer.getChartDispatcher().get());
- if(pCommandDispatch)
+ if (pCommandDispatch)
{
- for (sal_uInt16 nPos = 0; nPos < pPopupMenu->GetItemCount(); nPos++)
+ for (int nPos = 0, nCount = xPopupMenu->getItemCount(); nPos < nCount; ++nPos)
{
- const sal_uInt16 nItemId = pPopupMenu->GetItemId(nPos);
- OUString aCommandURL = pPopupMenu->GetItemCommand(nItemId);
- if(!pCommandDispatch->commandAvailable(aCommandURL))
- pPopupMenu->EnableItem(nItemId, false);
+ auto nItemId = xPopupMenu->getItemId(nPos);
+ OUString aCommandURL = xPopupMenu->getCommand(nItemId);
+ if (!pCommandDispatch->commandAvailable(aCommandURL))
+ xPopupMenu->enableItem(nItemId, false);
}
}
- boost::property_tree::ptree aMenu = SfxDispatcher::fillPopupMenu(pPopupMenu);
+ boost::property_tree::ptree aMenu = SfxDispatcher::fillPopupMenu(xPopupMenu);
boost::property_tree::ptree aRoot;
aRoot.add_child("menu", aMenu);
std::stringstream aStream;
boost::property_tree::write_json(aStream, aRoot, true);
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str());
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, OString(aStream.str()));
}
}
else
@@ -1328,8 +1320,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
( rCEvt.GetCommand() == CommandEventId::InputContextChange ) )
{
//#i84417# enable editing with IME
- if( m_pDrawViewWrapper )
- m_pDrawViewWrapper->Command( rCEvt, pChartWindow );
+ m_pDrawViewWrapper->Command( rCEvt, pChartWindow );
}
}
@@ -1381,8 +1372,8 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
if( ! bReturn )
{
// Navigation (Tab/F3/Home/End)
- uno::Reference< XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
- ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView ));
+ rtl::Reference<::chart::ChartModel> xChartDoc( getChartModel() );
+ ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, m_xChartView.get() );
awt::KeyEvent aKeyEvent( ::svt::AcceleratorExecute::st_VCLKey2AWTKey( aKeyCode ));
bReturn = aObjNav.handleKeyEvent( aKeyEvent );
if( bReturn )
@@ -1393,7 +1384,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
{
aNewSelection = aNewOID.getAny();
}
- if ( m_eDragMode == SdrDragMode::Rotate && !SelectionHelper::isRotateableObject( aNewOID.getObjectCID(), getModel() ) )
+ if ( m_eDragMode == SdrDragMode::Rotate && !SelectionHelper::isRotateableObject( aNewOID.getObjectCID(), getChartModel() ) )
{
m_eDragMode = SdrDragMode::Move;
}
@@ -1425,7 +1416,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
nCode == KEY_DOWN )
{
bDrag = true;
- OUString aParameter( ObjectIdentifier::getDragParameterString( m_aSelection.getSelectedCID() ));
+ std::u16string_view aParameter( ObjectIdentifier::getDragParameterString( m_aSelection.getSelectedCID() ));
sal_Int32 nOffsetPercentDummy( 0 );
awt::Point aMinimumPosition( 0, 0 );
awt::Point aMaximumPosition( 0, 0 );
@@ -1521,17 +1512,17 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
if (pObj)
{
tools::Rectangle aRect = pObj->GetSnapRect();
- awt::Size aPageSize(ChartModelHelper::getPageSize(getModel()));
- if ((fShiftAmountX > 0.0 && (aRect.getX() + fShiftAmountX + aRect.getWidth() > aPageSize.Width)) ||
- (fShiftAmountX < 0.0 && (aRect.getX() + fShiftAmountX < 0)) ||
- (fShiftAmountY > 0.0 && (aRect.getY() + fShiftAmountY + aRect.getHeight() > aPageSize.Height)) ||
- (fShiftAmountY < 0.0 && (aRect.getY() + fShiftAmountY < 0)))
+ awt::Size aPageSize(ChartModelHelper::getPageSize(getChartModel()));
+ if ((fShiftAmountX > 0.0 && (aRect.Right() + fShiftAmountX > aPageSize.Width)) ||
+ (fShiftAmountX < 0.0 && (aRect.Left() + fShiftAmountX < 0)) ||
+ (fShiftAmountY > 0.0 && (aRect.Bottom() + fShiftAmountY > aPageSize.Height)) ||
+ (fShiftAmountY < 0.0 && (aRect.Top() + fShiftAmountY < 0)))
bReturn = false;
else
bReturn = PositionAndSizeHelper::moveObject(
- m_aSelection.getSelectedCID(), getModel(),
- awt::Rectangle(aRect.getX() + fShiftAmountX, aRect.getY() + fShiftAmountY, aRect.getWidth(), aRect.getHeight()),
- awt::Rectangle(aRect.getX(), aRect.getY(), 0, 0),
+ m_aSelection.getSelectedCID(), getChartModel(),
+ awt::Rectangle(aRect.Left() + fShiftAmountX, aRect.Top() + fShiftAmountY, aRect.getOpenWidth(), aRect.getOpenHeight()),
+ awt::Rectangle(aRect.Left(), aRect.Top(), 0, 0),
awt::Rectangle(0, 0, aPageSize.Width, aPageSize.Height));
}
}
@@ -1547,7 +1538,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
{
awt::Point aPos( xShape->getPosition() );
awt::Size aSize( xShape->getSize() );
- awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+ awt::Size aPageSize( ChartModelHelper::getPageSize( getChartModel() ) );
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 )
@@ -1570,10 +1561,10 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
// dumping the shape
if( !bReturn && bCtrl && nCode == KEY_F12)
{
- uno::Reference< qa::XDumper > xChartModel( getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xChartModel = getChartModel();
if(xChartModel.is())
{
- OUString aDump = xChartModel->dump();
+ OUString aDump = xChartModel->dump("shapes");
SAL_WARN("chart2", aDump);
}
}
@@ -1611,10 +1602,10 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
bReturn = executeDispatch_Delete();
if( ! bReturn )
{
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pChartWindow->GetFrameWeld(),
+ std::shared_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pChartWindow->GetFrameWeld(),
VclMessageType::Info, VclButtonsType::Ok,
SchResId(STR_ACTION_NOTPOSSIBLE)));
- xInfoBox->run();
+ xInfoBox->runAsync(xInfoBox, [] (int) {});
}
}
@@ -1627,9 +1618,9 @@ bool ChartController::requestQuickHelp(
OUString & rOutQuickHelpText,
awt::Rectangle & rOutEqualRect )
{
- uno::Reference< frame::XModel > xChartModel;
+ rtl::Reference<::chart::ChartModel> xChartModel;
if( m_aModel.is())
- xChartModel.set( getModel() );
+ xChartModel = getChartModel();
if( !xChartModel.is())
return false;
@@ -1648,10 +1639,8 @@ bool ChartController::requestQuickHelp(
rOutQuickHelpText = ObjectNameProvider::getHelpText( aCID, xChartModel, bIsBalloonHelp /* bVerbose */ );
// set rectangle
- ExplicitValueProvider * pValueProvider(
- comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView ));
- if( pValueProvider )
- rOutEqualRect = pValueProvider->getRectangleOfObject( aCID, true );
+ if( m_xChartView )
+ rOutEqualRect = m_xChartView->getRectangleOfObject( aCID, true );
}
return bResult;
@@ -1736,7 +1725,8 @@ void SAL_CALL ChartController::addSelectionChangeListener( const uno::Reference<
return; //behave passive if already disposed or suspended
//--add listener
- m_aLifeTimeManager.m_aListenerContainer.addInterface( cppu::UnoType<view::XSelectionChangeListener>::get(), xListener );
+ std::unique_lock aGuard2(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aSelectionChangeListeners.addInterface( aGuard2, xListener );
}
void SAL_CALL ChartController::removeSelectionChangeListener( const uno::Reference<view::XSelectionChangeListener> & xListener )
@@ -1746,24 +1736,18 @@ void SAL_CALL ChartController::removeSelectionChangeListener( const uno::Referen
return; //behave passive if already disposed or suspended
//--remove listener
- m_aLifeTimeManager.m_aListenerContainer.removeInterface( cppu::UnoType<view::XSelectionChangeListener>::get(), xListener );
+ std::unique_lock aGuard2(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aSelectionChangeListeners.removeInterface( aGuard2, xListener );
}
void ChartController::impl_notifySelectionChangeListeners()
{
- ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
- .getContainer( cppu::UnoType<view::XSelectionChangeListener>::get() );
- if( pIC )
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ if( m_aLifeTimeManager.m_aSelectionChangeListeners.getLength(aGuard) )
{
uno::Reference< view::XSelectionSupplier > xSelectionSupplier(this);
lang::EventObject aEvent( xSelectionSupplier );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- uno::Reference< view::XSelectionChangeListener > xListener( aIt.next(), uno::UNO_QUERY );
- if( xListener.is() )
- xListener->selectionChanged( aEvent );
- }
+ m_aLifeTimeManager.m_aSelectionChangeListeners.notifyEach(aGuard, &view::XSelectionChangeListener::selectionChanged, aEvent);
}
}
@@ -1790,7 +1774,7 @@ bool ChartController::impl_moveOrResizeObject(
bool bResult = false;
bool bNeedResize = ( eType == CENTERED_RESIZE_OBJECT );
- uno::Reference< frame::XModel > xChartModel( getModel() );
+ rtl::Reference<::chart::ChartModel> xChartModel( getChartModel() );
uno::Reference< beans::XPropertySet > xObjProp(
ObjectIdentifier::getObjectPropertySet( rCID, xChartModel ));
if( xObjProp.is())
@@ -1805,8 +1789,7 @@ bool ChartController::impl_moveOrResizeObject(
if( ( bDeterminePos || bDetermineSize ) &&
( aRefSize.Width > 0 && aRefSize.Height > 0 ) )
{
- ExplicitValueProvider * pValueProvider(
- comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView ));
+ ExplicitValueProvider * pValueProvider( m_xChartView.get() );
if( pValueProvider )
{
awt::Rectangle aRect( pValueProvider->getRectangleOfObject( rCID ));
@@ -1863,15 +1846,15 @@ bool ChartController::impl_moveOrResizeObject(
return bResult;
}
-bool ChartController::impl_DragDataPoint( const OUString & rCID, double fAdditionalOffset )
+bool ChartController::impl_DragDataPoint( std::u16string_view rCID, double fAdditionalOffset )
{
bool bResult = false;
if( fAdditionalOffset < -1.0 || fAdditionalOffset > 1.0 || fAdditionalOffset == 0.0 )
return bResult;
sal_Int32 nDataPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( rCID );
- uno::Reference< chart2::XDataSeries > xSeries(
- ObjectIdentifier::getDataSeriesForCID( rCID, getModel() ));
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID( rCID, getChartModel() );
if( xSeries.is())
{
try
@@ -1925,7 +1908,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
if( m_pDrawViewWrapper->IsTextEditHit( aMousePos ) )
{
pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferredPointer(
- aMousePos, pChartWindow, nModifier, bLeftDown ) );
+ aMousePos, pChartWindow->GetOutDev(), nModifier, bLeftDown ) );
return;
}
}
@@ -1941,7 +1924,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
if( pHitSelectionHdl )
{
PointerStyle aPointer = m_pDrawViewWrapper->GetPreferredPointer(
- aMousePos, pChartWindow, nModifier, bLeftDown );
+ aMousePos, pChartWindow->GetOutDev(), nModifier, bLeftDown );
bool bForceArrowPointer = false;
ObjectIdentifier aOID( m_aSelection.getSelectedOID() );
@@ -1989,33 +1972,33 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
SdrObjKind eKind = m_pDrawViewWrapper->GetCurrentObjIdentifier();
switch ( eKind )
{
- case OBJ_LINE:
+ case SdrObjKind::Line:
{
ePointerStyle = PointerStyle::DrawLine;
}
break;
- case OBJ_RECT:
- case OBJ_CUSTOMSHAPE:
+ case SdrObjKind::Rectangle:
+ case SdrObjKind::CustomShape:
{
ePointerStyle = PointerStyle::DrawRect;
}
break;
- case OBJ_CIRC:
+ case SdrObjKind::CircleOrEllipse:
{
ePointerStyle = PointerStyle::DrawEllipse;
}
break;
- case OBJ_FREELINE:
+ case SdrObjKind::FreehandLine:
{
ePointerStyle = PointerStyle::DrawPolygon;
}
break;
- case OBJ_TEXT:
+ case SdrObjKind::Text:
{
ePointerStyle = PointerStyle::DrawText;
}
break;
- case OBJ_CAPTION:
+ case SdrObjKind::Caption:
{
ePointerStyle = PointerStyle::DrawCaption;
}
@@ -2052,7 +2035,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
{
if( (m_eDragMode == SdrDragMode::Rotate)
&& SelectionHelper::isRotateableObject( aHitObjectCID
- , getModel() ) )
+ , getChartModel() ) )
pChartWindow->SetPointer( PointerStyle::Rotate );
else
{
@@ -2073,14 +2056,9 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
pChartWindow->SetPointer( PointerStyle::Arrow );
}
-css::uno::Reference<css::uno::XInterface> const & ChartController::getChartView() const
-{
- return m_xChartView;
-}
-
-void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle aRectangle)
+void ChartController::sendPopupRequest(std::u16string_view rCID, tools::Rectangle aRectangle)
{
- ChartModel* pChartModel = dynamic_cast<ChartModel*>(m_aModel->getModel().get());
+ ChartModel* pChartModel = m_aModel->getModel().get();
if (!pChartModel)
return;
@@ -2091,16 +2069,17 @@ void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle a
OUString sPivotTableName = xPivotTableDataProvider->getPivotTableName();
- PopupRequest* pPopupRequest = dynamic_cast<PopupRequest*>(pChartModel->getPopupRequest().get());
+ css::uno::Reference<css::awt::XRequestCallback> xPopupRequest = pChartModel->getPopupRequest();
+ PopupRequest* pPopupRequest = dynamic_cast<PopupRequest*>(xPopupRequest.get());
if (!pPopupRequest)
return;
// Get dimension index from CID
- sal_Int32 nStartPos = rCID.lastIndexOf('.');
+ size_t nStartPos = rCID.rfind('.');
nStartPos++;
- sal_Int32 nEndPos = rCID.getLength();
- OUString sDimensionIndex = rCID.copy(nStartPos, nEndPos - nStartPos);
- sal_Int32 nDimensionIndex = sDimensionIndex.toInt32();
+ sal_Int32 nEndPos = rCID.size();
+ std::u16string_view sDimensionIndex = rCID.substr(nStartPos, nEndPos - nStartPos);
+ sal_Int32 nDimensionIndex = o3tl::toInt32(sDimensionIndex);
awt::Rectangle xRectangle {
sal_Int32(aRectangle.Left()),
@@ -2111,12 +2090,12 @@ void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle a
uno::Sequence<beans::PropertyValue> aCallbackData = comphelper::InitPropertySequence(
{
- {"Rectangle", uno::makeAny<awt::Rectangle>(xRectangle)},
- {"DimensionIndex", uno::makeAny<sal_Int32>(nDimensionIndex)},
- {"PivotTableName", uno::makeAny<OUString>(sPivotTableName)},
+ {"Rectangle", uno::Any(xRectangle)},
+ {"DimensionIndex", uno::Any(sal_Int32(nDimensionIndex))},
+ {"PivotTableName", uno::Any(sPivotTableName)},
});
- pPopupRequest->getCallback()->notify(uno::makeAny(aCallbackData));
+ pPopupRequest->getCallback()->notify(uno::Any(aCallbackData));
}
} //namespace chart
diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx
index 15272dfc5963..fc6762598a68 100644
--- a/chart2/source/controller/main/ChartDropTargetHelper.cxx
+++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx
@@ -18,13 +18,15 @@
*/
#include "ChartDropTargetHelper.hxx"
+#include <DataSource.hxx>
#include <DataSourceHelper.hxx>
+#include <ChartModel.hxx>
+#include <Diagram.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
-#include <com/sun/star/container/XChild.hpp>
#include <sot/formats.hxx>
+#include <utility>
#include <vector>
using namespace ::com::sun::star;
@@ -60,9 +62,9 @@ namespace chart
ChartDropTargetHelper::ChartDropTargetHelper(
const Reference< datatransfer::dnd::XDropTarget >& rxDropTarget,
- const Reference< chart2::XChartDocument > & xChartDocument ) :
+ rtl::Reference<::chart::ChartModel> xChartDocument ) :
DropTargetHelper( rxDropTarget ),
- m_xChartDocument( xChartDocument )
+ m_xChartDocument(std::move( xChartDocument ))
{}
ChartDropTargetHelper::~ChartDropTargetHelper()
@@ -109,25 +111,24 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt )
if( aStrings.size() >= 3 && aStrings[0] == "soffice" )
{
OUString aRangeString( aStrings[2] );
- Reference< container::XChild > xChild( m_xChartDocument, uno::UNO_QUERY );
- if( xChild.is())
+ if( m_xChartDocument.is())
{
- Reference< frame::XModel > xParentModel( xChild->getParent(), uno::UNO_QUERY );
+ Reference< frame::XModel > xParentModel( m_xChartDocument->getParent(), uno::UNO_QUERY );
if( xParentModel.is() &&
m_xChartDocument.is())
{
// @todo: get the title somehow and compare it to
// aDocName if successful (the document is the
// parent)
- Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() );
+ rtl::Reference< Diagram > xDiagram = m_xChartDocument->getFirstChartDiagram();
Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
if( xDataProvider.is() && xDiagram.is() &&
DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument ))
{
- Reference< chart2::data::XDataSource > xDataSource(
- DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument ));
+ rtl::Reference< DataSource > xDataSource1 =
+ DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument );
Sequence< beans::PropertyValue > aArguments(
- xDataProvider->detectArguments( xDataSource ));
+ xDataProvider->detectArguments( xDataSource1 ));
OUString aOldRange;
beans::PropertyValue * pCellRange = nullptr;
@@ -155,8 +156,9 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt )
pCellRange->Value <<= aRangeString;
}
- xDataSource.set( xDataProvider->createDataSource( aArguments ));
- xDiagram->setDiagramData( xDataSource, aArguments );
+ Reference< chart2::data::XDataSource > xDataSource2 =
+ xDataProvider->createDataSource( aArguments );
+ xDiagram->setDiagramData( xDataSource2, aArguments );
// always return copy state to avoid deletion of the dragged range
nResult = DND_ACTION_COPY;
diff --git a/chart2/source/controller/main/ChartDropTargetHelper.hxx b/chart2/source/controller/main/ChartDropTargetHelper.hxx
index 84c8dfe98f45..ab573f1cd694 100644
--- a/chart2/source/controller/main/ChartDropTargetHelper.hxx
+++ b/chart2/source/controller/main/ChartDropTargetHelper.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <vcl/transfer.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star {
namespace chart2 {
@@ -28,6 +29,7 @@ namespace com::sun::star {
namespace chart
{
+class ChartModel;
class ChartDropTargetHelper : public DropTargetHelper
{
@@ -35,7 +37,7 @@ public:
ChartDropTargetHelper() = delete;
explicit ChartDropTargetHelper(
const css::uno::Reference< css::datatransfer::dnd::XDropTarget >& rxDropTarget,
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument );
+ rtl::Reference<::chart::ChartModel> xChartDocument );
virtual ~ChartDropTargetHelper() override;
protected:
@@ -46,7 +48,7 @@ protected:
private:
bool satisfiesPrerequisites() const;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument;
+ rtl::Reference<::chart::ChartModel> m_xChartDocument;
};
} // namespace chart
diff --git a/chart2/source/controller/main/ChartFrameloader.cxx b/chart2/source/controller/main/ChartFrameloader.cxx
index c03a3f6b619e..2ff45588002b 100644
--- a/chart2/source/controller/main/ChartFrameloader.cxx
+++ b/chart2/source/controller/main/ChartFrameloader.cxx
@@ -20,11 +20,14 @@
#include "ChartFrameloader.hxx"
#include <servicenames.hxx>
#include <MediaDescriptorHelper.hxx>
+#include <ChartController.hxx>
+#include <ChartModel.hxx>
+#include <unotools/fcm.hxx>
#include <unotools/mediadescriptor.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -81,7 +84,7 @@ sal_Bool SAL_CALL ChartFrameLoader::load( const uno::Sequence< beans::PropertyVa
utl::MediaDescriptor aMediaDescriptor(rMediaDescriptor);
{
- utl::MediaDescriptor::const_iterator aIt( aMediaDescriptor.find( utl::MediaDescriptor::PROP_MODEL()));
+ utl::MediaDescriptor::const_iterator aIt( aMediaDescriptor.find( utl::MediaDescriptor::PROP_MODEL));
if( aIt != aMediaDescriptor.end())
{
xModel.set( (*aIt).second.get< uno::Reference< frame::XModel > >());
@@ -93,90 +96,71 @@ sal_Bool SAL_CALL ChartFrameLoader::load( const uno::Sequence< beans::PropertyVa
if( ! xModel.is())
{
//@todo?? load mechanism to cancel during loading of document
- xModel.set(
- m_xCC->getServiceManager()->createInstanceWithContext(
- CHART_MODEL_SERVICE_IMPLEMENTATION_NAME, m_xCC )
- , uno::UNO_QUERY );
+ xModel = new ChartModel(m_xCC);
if( impl_checkCancel() )
return false;
}
//create the controller(+XWindow)
- uno::Reference< frame::XController > xController;
- uno::Reference< awt::XWindow > xComponentWindow;
- {
- xController.set(
- m_xCC->getServiceManager()->createInstanceWithContext(
- CHART_CONTROLLER_SERVICE_IMPLEMENTATION_NAME,m_xCC )
- , uno::UNO_QUERY );
-
- //!!!it is a special characteristic of the example application
- //that the controller simultaneously provides the XWindow controller functionality
- xComponentWindow =
- uno::Reference< awt::XWindow >( xController, uno::UNO_QUERY );
+ rtl::Reference< ChartController > xController = new ChartController(m_xCC);
- if( impl_checkCancel() )
- return false;
- }
+ if( impl_checkCancel() )
+ return false;
//connect frame, controller and model one to each other:
- if(xController.is()&&xModel.is())
+ if(xModel.is())
{
- xModel->connectController(xController);
- xModel->setCurrentController(xController);
- xController->attachModel(xModel);
- if(xFrame.is())
- xFrame->setComponent(xComponentWindow,xController);
- //creates the view and menu
- //for correct menu creation the initialized component must be already set into the frame
- xController->attachFrame(xFrame);
+ utl::ConnectFrameControllerModel(xFrame, xController, xModel);
}
// call initNew() or load() at XLoadable
- if(!bHaveLoadedModel)
- try
+ if(bHaveLoadedModel)
+ return true;
+
+ try
+ {
+ utl::MediaDescriptor::const_iterator aIt( aMediaDescriptor.find( utl::MediaDescriptor::PROP_URL));
+ if( aIt != aMediaDescriptor.end())
{
- utl::MediaDescriptor::const_iterator aIt( aMediaDescriptor.find( utl::MediaDescriptor::PROP_URL()));
- if( aIt != aMediaDescriptor.end())
+ OUString aURL( (*aIt).second.get< OUString >());
+ if( aURL.startsWith( "private:factory/schart" ) )
+ {
+ // create new file
+ uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY_THROW );
+ xLoadable->initNew();
+ }
+ else
{
- OUString aURL( (*aIt).second.get< OUString >());
- if( aURL.startsWith( "private:factory/schart" ) )
+ // use the URL as BaseURL, similar to what SfxBaseModel effectively does
+ if (!aURL.isEmpty())
{
- // create new file
- uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY_THROW );
- xLoadable->initNew();
+ aMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTBASEURL] <<= aURL;
}
- else
+ aMediaDescriptor.addInputStream();
+ uno::Sequence< beans::PropertyValue > aCompleteMediaDescriptor;
+ aMediaDescriptor >> aCompleteMediaDescriptor;
+ apphelper::MediaDescriptorHelper aMDHelper( aCompleteMediaDescriptor );
+
+ // load file
+ // @todo: replace: aMediaDescriptorHelper.getReducedForModel()
+ uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY_THROW );
+ xLoadable->load( aCompleteMediaDescriptor );
+
+ //resize standalone files to get correct size:
+ if( aMDHelper.ISSET_FilterName && aMDHelper.FilterName == "StarChart 5.0" )
{
- // use the URL as BaseURL, similar to what SfxBaseModel effectively does
- if (!aURL.isEmpty())
- {
- aMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTBASEURL()] <<= aURL;
- }
- aMediaDescriptor.addInputStream();
- uno::Sequence< beans::PropertyValue > aCompleteMediaDescriptor;
- aMediaDescriptor >> aCompleteMediaDescriptor;
- apphelper::MediaDescriptorHelper aMDHelper( aCompleteMediaDescriptor );
-
- // load file
- // @todo: replace: aMediaDescriptorHelper.getReducedForModel()
- uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY_THROW );
- xLoadable->load( aCompleteMediaDescriptor );
-
- //resize standalone files to get correct size:
- if( xComponentWindow.is() && aMDHelper.ISSET_FilterName && aMDHelper.FilterName == "StarChart 5.0" )
- {
- awt::Rectangle aRect( xComponentWindow->getPosSize() );
- xComponentWindow->setPosSize( aRect.X, aRect.Y, aRect.Width, aRect.Height, 0 );
- }
+ uno::Reference<awt::XWindow> xComponentWindow = xController->getComponentWindow();
+ awt::Rectangle aRect( xComponentWindow->getPosSize() );
+ xComponentWindow->setPosSize( aRect.X, aRect.Y, aRect.Width, aRect.Height, 0 );
}
}
}
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
return true;
}
diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx
index 6348aee6e6f9..b1228cd383a3 100644
--- a/chart2/source/controller/main/ChartModelClone.cxx
+++ b/chart2/source/controller/main/ChartModelClone.cxx
@@ -21,6 +21,7 @@
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
#include <ControllerLockGuard.hxx>
+#include <DataSource.hxx>
#include <DataSourceHelper.hxx>
#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
@@ -28,14 +29,10 @@
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/chart2/XTitled.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
#include <comphelper/property.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -51,45 +48,38 @@ namespace chart
using ::com::sun::star::chart2::XInternalDataProvider;
using ::com::sun::star::chart2::XAnyDescriptionAccess;
using ::com::sun::star::view::XSelectionSupplier;
- using ::com::sun::star::lang::XComponent;
- using ::com::sun::star::chart2::XTitled;
- using ::com::sun::star::util::XModifiable;
- using ::com::sun::star::chart2::data::XDataSource;
using ::com::sun::star::chart2::data::XLabeledDataSequence;
// = helper
namespace
{
- Reference< XModel > lcl_cloneModel( const Reference< XModel > & xModel )
+ rtl::Reference<::chart::ChartModel> lcl_cloneModel( const rtl::Reference<::chart::ChartModel> & xModel )
{
- Reference< XModel > xResult;
try
{
- const Reference< XCloneable > xCloneable( xModel, UNO_QUERY_THROW );
- xResult.set( xCloneable->createClone(), UNO_QUERY_THROW );
+ return new ChartModel(*xModel);
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
- return xResult;
+ return nullptr;
}
}
// = ChartModelClone
- ChartModelClone::ChartModelClone( const Reference< XModel >& i_model, const ModelFacet i_facet )
+ ChartModelClone::ChartModelClone( const rtl::Reference<::chart::ChartModel>& i_model, const ModelFacet i_facet )
{
- m_xModelClone.set( lcl_cloneModel( i_model ) );
+ m_xModelClone = lcl_cloneModel( i_model );
try
{
if ( i_facet == E_MODEL_WITH_DATA )
{
- const Reference< XChartDocument > xChartDoc( m_xModelClone, UNO_QUERY_THROW );
- ENSURE_OR_THROW( xChartDoc->hasInternalDataProvider(), "invalid chart model" );
+ ENSURE_OR_THROW( m_xModelClone && m_xModelClone->hasInternalDataProvider(), "invalid chart model" );
- const Reference< XCloneable > xCloneable( xChartDoc->getDataProvider(), UNO_QUERY_THROW );
+ const Reference< XCloneable > xCloneable( m_xModelClone->getDataProvider(), UNO_QUERY_THROW );
m_xDataClone.set( xCloneable->createClone(), UNO_QUERY_THROW );
}
@@ -116,15 +106,6 @@ namespace chart
if ( impl_isDisposed() )
return;
- try
- {
- Reference< XComponent > xComp( m_xModelClone, UNO_QUERY_THROW );
- xComp->dispose();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
m_xModelClone.clear();
m_xDataClone.clear();
m_aSelection.clear();
@@ -139,7 +120,7 @@ namespace chart
return E_MODEL;
}
- void ChartModelClone::applyToModel( const Reference< XModel >& i_model ) const
+ void ChartModelClone::applyToModel( const rtl::Reference<::chart::ChartModel>& i_model ) const
{
applyModelContentToModel( i_model, m_xModelClone, m_xDataClone );
@@ -179,8 +160,9 @@ namespace chart
}
}
- void ChartModelClone::applyModelContentToModel( const Reference< XModel >& i_model,
- const Reference< XModel >& i_modelToCopyFrom, const Reference< XInternalDataProvider >& i_data )
+ void ChartModelClone::applyModelContentToModel( const rtl::Reference<::chart::ChartModel>& i_model,
+ const rtl::Reference<::chart::ChartModel>& i_modelToCopyFrom,
+ const Reference< XInternalDataProvider >& i_data )
{
ENSURE_OR_RETURN_VOID( i_model.is(), "ChartModelElement::applyModelContentToModel: invalid source model!" );
ENSURE_OR_RETURN_VOID( i_modelToCopyFrom.is(), "ChartModelElement::applyModelContentToModel: invalid source model!" );
@@ -188,25 +170,20 @@ namespace chart
{
// locked controllers of destination
ControllerLockGuardUNO aLockedControllers( i_model );
- Reference< XChartDocument > xSource( i_modelToCopyFrom, UNO_QUERY_THROW );
- Reference< XChartDocument > xDestination( i_model, UNO_QUERY_THROW );
// propagate the correct flag for plotting of hidden values to the data provider and all used sequences
- ChartModel& rModel = dynamic_cast<ChartModel&>(*i_model);
- ChartModelHelper::setIncludeHiddenCells(ChartModelHelper::isIncludeHiddenCells( i_modelToCopyFrom ), rModel);
+ ChartModelHelper::setIncludeHiddenCells(ChartModelHelper::isIncludeHiddenCells( i_modelToCopyFrom ), *i_model);
// diagram
- xDestination->setFirstDiagram( xSource->getFirstDiagram() );
+ i_model->setFirstDiagram( i_modelToCopyFrom->getFirstDiagram() );
// main title
- Reference< XTitled > xDestinationTitled( xDestination, UNO_QUERY_THROW );
- Reference< XTitled > xSourceTitled( xSource, UNO_QUERY_THROW );
- xDestinationTitled->setTitleObject( xSourceTitled->getTitleObject() );
+ i_model->setTitleObject( i_modelToCopyFrom->getTitleObject() );
// page background
::comphelper::copyProperties(
- xSource->getPageBackground(),
- xDestination->getPageBackground() );
+ i_modelToCopyFrom->getPageBackground(),
+ i_model->getPageBackground() );
// apply data (not applied in standard Undo)
if ( i_data.is() )
@@ -214,10 +191,10 @@ namespace chart
// register all sequences at the internal data provider to get adapted
// indexes when columns are added/removed
- if ( xDestination->hasInternalDataProvider() )
+ if ( i_model->hasInternalDataProvider() )
{
- Reference< XInternalDataProvider > xNewDataProvider( xDestination->getDataProvider(), UNO_QUERY );
- Reference< XDataSource > xUsedData( DataSourceHelper::getUsedData( i_model ) );
+ Reference< XInternalDataProvider > xNewDataProvider( i_model->getDataProvider(), UNO_QUERY );
+ rtl::Reference< DataSource > xUsedData = DataSourceHelper::getUsedData( *i_model );
if ( xUsedData.is() && xNewDataProvider.is() )
{
const Sequence< Reference< XLabeledDataSequence > > aData( xUsedData->getDataSequences() );
@@ -230,11 +207,9 @@ namespace chart
}
// restore modify status
- Reference< XModifiable > xSourceMod( xSource, UNO_QUERY );
- Reference< XModifiable > xDestMod( xDestination, UNO_QUERY );
- if ( xSourceMod.is() && xDestMod.is() && !xSourceMod->isModified() )
+ if ( !i_modelToCopyFrom->isModified() )
{
- xDestMod->setModified( false );
+ i_model->setModified( false );
}
// \-- locked controllers of destination
}
diff --git a/chart2/source/controller/main/ChartModelClone.hxx b/chart2/source/controller/main/ChartModelClone.hxx
index e5f052eb7046..41cf7fc10924 100644
--- a/chart2/source/controller/main/ChartModelClone.hxx
+++ b/chart2/source/controller/main/ChartModelClone.hxx
@@ -21,12 +21,14 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Reference.h>
+#include <rtl/ref.hxx>
namespace com::sun::star::chart2 { class XInternalDataProvider; }
namespace com::sun::star::frame { class XModel; }
namespace chart
{
+class ChartModel;
enum ModelFacet
{
@@ -39,7 +41,7 @@ namespace chart
{
public:
ChartModelClone(
- const css::uno::Reference< css::frame::XModel >& i_model,
+ const rtl::Reference<::chart::ChartModel>& i_model,
const ModelFacet i_facet
);
@@ -50,11 +52,11 @@ namespace chart
ModelFacet getFacet() const;
- void applyToModel( const css::uno::Reference< css::frame::XModel >& i_model ) const;
+ void applyToModel( const rtl::Reference<::chart::ChartModel>& i_model ) const;
static void applyModelContentToModel(
- const css::uno::Reference< css::frame::XModel > & i_model,
- const css::uno::Reference< css::frame::XModel > & i_modelToCopyFrom,
+ const rtl::Reference<::chart::ChartModel> & i_model,
+ const rtl::Reference<::chart::ChartModel> & i_modelToCopyFrom,
const css::uno::Reference< css::chart2::XInternalDataProvider > & i_data );
void dispose();
@@ -63,7 +65,7 @@ namespace chart
bool impl_isDisposed() const { return !m_xModelClone.is(); }
private:
- css::uno::Reference< css::frame::XModel > m_xModelClone;
+ rtl::Reference<::chart::ChartModel> m_xModelClone;
css::uno::Reference< css::chart2::XInternalDataProvider > m_xDataClone;
css::uno::Any m_aSelection;
};
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
index 03e8eaef2509..7c8eb12041f6 100644
--- a/chart2/source/controller/main/ChartTransferable.cxx
+++ b/chart2/source/controller/main/ChartTransferable.cxx
@@ -34,6 +34,7 @@
#include <svx/svdmodel.hxx>
#include <svx/unomodel.hxx>
#include <svx/svdview.hxx>
+#include <osl/diagnose.h>
constexpr sal_uInt32 CHARTTRANSFER_OBJECTTYPE_DRAWMODEL = 1;
@@ -48,20 +49,19 @@ ChartTransferable::ChartTransferable(
SdrModel& rSdrModel,
SdrObject* pSelectedObj,
bool bDrawing)
-: m_pMarkedObjModel( nullptr )
- ,m_bDrawing( bDrawing )
+ : m_bDrawing(bDrawing)
{
- std::unique_ptr<SdrExchangeView> pExchgView(std::make_unique<SdrView>( rSdrModel ));
- SdrPageView* pPv = pExchgView->ShowSdrPage( rSdrModel.GetPage( 0 ));
+ SdrView aExchgView( rSdrModel );
+ SdrPageView* pPv = aExchgView.ShowSdrPage( rSdrModel.GetPage( 0 ));
if( pSelectedObj )
- pExchgView->MarkObj( pSelectedObj, pPv );
+ aExchgView.MarkObj( pSelectedObj, pPv );
else
- pExchgView->MarkAllObj( pPv );
- Graphic aGraphic( pExchgView->GetMarkedObjMetaFile(true));
+ aExchgView.MarkAllObj( pPv );
+ Graphic aGraphic( aExchgView.GetMarkedObjMetaFile(true));
m_xMetaFileGraphic.set( aGraphic.GetXGraphic());
if ( m_bDrawing )
{
- m_pMarkedObjModel = pExchgView->CreateMarkedObjModel().release();
+ m_xMarkedObjModel = aExchgView.CreateMarkedObjModel();
}
}
@@ -88,7 +88,7 @@ bool ChartTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, c
{
if ( nFormat == SotClipboardFormatId::DRAWING )
{
- bResult = SetObject( m_pMarkedObjModel, CHARTTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor );
+ bResult = SetObject(m_xMarkedObjModel.get(), CHARTTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor);
}
else if ( nFormat == SotClipboardFormatId::GDIMETAFILE )
{
@@ -105,7 +105,7 @@ bool ChartTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, c
return bResult;
}
-bool ChartTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+bool ChartTransferable::WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 nUserObjectId,
const datatransfer::DataFlavor& /* rFlavor */ )
{
// called from SetObject, put data into stream
@@ -118,12 +118,12 @@ bool ChartTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void*
SdrModel* pMarkedObjModel = static_cast< SdrModel* >( pUserObject );
if ( pMarkedObjModel )
{
- rxOStm->SetBufferSize( 0xff00 );
+ rOStm.SetBufferSize( 0xff00 );
// for the changed pool defaults from drawing layer pool set those
// attributes as hard attributes to preserve them for saving
const SfxItemPool& rItemPool = pMarkedObjModel->GetItemPool();
- const SvxFontHeightItem& rDefaultFontHeight = rItemPool.GetDefaultItem( EE_CHAR_FONTHEIGHT );
+ const SvxFontHeightItem& rDefaultFontHeight = rItemPool.GetUserOrPoolDefaultItem( EE_CHAR_FONTHEIGHT );
sal_uInt16 nCount = pMarkedObjModel->GetPageCount();
for ( sal_uInt16 i = 0; i < nCount; ++i )
{
@@ -140,10 +140,10 @@ bool ChartTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void*
}
}
- Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) );
+ Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( rOStm ) );
SvxDrawingLayerExport( pMarkedObjModel, xDocOut );
- bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+ bRet = ( rOStm.GetError() == ERRCODE_NONE );
}
}
break;
diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx
index 34567dceb6a9..486fdb48c5a9 100644
--- a/chart2/source/controller/main/ChartTransferable.hxx
+++ b/chart2/source/controller/main/ChartTransferable.hxx
@@ -46,12 +46,12 @@ protected:
// implementation of TransferableHelper methods
virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
- virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+ virtual bool WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 nUserObjectId,
const css::datatransfer::DataFlavor& rFlavor ) override;
private:
css::uno::Reference< css::graphic::XGraphic > m_xMetaFileGraphic;
- SdrModel* m_pMarkedObjModel;
+ std::unique_ptr<SdrModel> m_xMarkedObjModel;
bool m_bDrawing;
};
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 6ab1fae77b99..60ab7eb0ed2d 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_wasm_strip.h>
#include <ChartWindow.hxx>
#include <ChartController.hxx>
#include <helpids.h>
@@ -30,17 +31,13 @@
#include <sfx2/lokhelper.hxx>
#include <comphelper/lok.hxx>
-#define TWIPS_PER_PIXEL 15
-
using namespace ::com::sun::star;
namespace
{
::tools::Rectangle lcl_AWTRectToVCLRect( const css::awt::Rectangle & rAWTRect )
{
- ::tools::Rectangle aResult;
- aResult.setX( rAWTRect.X );
- aResult.setY( rAWTRect.Y );
+ ::tools::Rectangle aResult(rAWTRect.X, rAWTRect.Y);
aResult.setWidth( rAWTRect.Width );
aResult.setHeight( rAWTRect.Height );
return aResult;
@@ -61,7 +58,7 @@ ChartWindow::ChartWindow( ChartController* pController, vcl::Window* pParent, Wi
SetMapMode( MapMode(MapUnit::Map100thMM) );
adjustHighContrastMode();
// chart does not depend on exact pixel painting => enable antialiased drawing
- SetAntialiasing( AntialiasingFlags::Enable | GetAntialiasing() );
+ GetOutDev()->SetAntialiasing( AntialiasingFlags::Enable | GetOutDev()->GetAntialiasing() );
EnableRTL( false );
if( pParent )
pParent->EnableRTL( false );// #i96215# necessary for a correct position of the context menu in rtl mode
@@ -185,10 +182,14 @@ void ChartWindow::KeyInput( const KeyEvent& rKEvt )
uno::Reference< css::accessibility::XAccessible > ChartWindow::CreateAccessible()
{
+#if !ENABLE_WASM_STRIP_ACCESSIBILITY
if( m_pWindowController )
return m_pWindowController->CreateAccessible();
else
return Window::CreateAccessible();
+#else
+ return uno::Reference< css::accessibility::XAccessible >();
+#endif
}
void ChartWindow::DataChanged( const DataChangedEvent& rDCEvt )
@@ -208,7 +209,6 @@ void ChartWindow::RequestHelp( const HelpEvent& rHEvt )
if( ( rHEvt.GetMode() & HelpEventMode::QUICK ) &&
m_pWindowController )
{
-// Point aLogicHitPos = PixelToLogic( rHEvt.GetMousePosPixel()); // old chart: GetPointerPosPixel()
Point aLogicHitPos = PixelToLogic( GetPointerPosPixel());
OUString aQuickHelpText;
awt::Rectangle aHelpRect;
@@ -217,12 +217,14 @@ void ChartWindow::RequestHelp( const HelpEvent& rHEvt )
if( bHelpHandled )
{
+ tools::Rectangle aPixelRect(LogicToPixel(lcl_AWTRectToVCLRect(aHelpRect)));
+ tools::Rectangle aScreenRect(OutputToScreenPixel(aPixelRect.TopLeft()),
+ OutputToScreenPixel(aPixelRect.BottomRight()));
+
if( bIsBalloonHelp )
- Help::ShowBalloon(
- this, rHEvt.GetMousePosPixel(), lcl_AWTRectToVCLRect( aHelpRect ), aQuickHelpText );
+ Help::ShowBalloon(this, rHEvt.GetMousePosPixel(), aScreenRect, aQuickHelpText);
else
- Help::ShowQuickHelp(
- this, lcl_AWTRectToVCLRect( aHelpRect ), aQuickHelpText );
+ Help::ShowQuickHelp(this, aScreenRect, aQuickHelpText);
}
}
@@ -230,21 +232,6 @@ void ChartWindow::RequestHelp( const HelpEvent& rHEvt )
vcl::Window::RequestHelp( rHEvt );
}
-void ChartWindow::LogicMouseButtonDown(const MouseEvent& rEvent)
-{
- MouseButtonDown(rEvent);
-}
-
-void ChartWindow::LogicMouseButtonUp(const MouseEvent& rEvent)
-{
- MouseButtonUp(rEvent);
-}
-
-void ChartWindow::LogicMouseMove(const MouseEvent& rEvent)
-{
- MouseMove(rEvent);
-}
-
void ChartWindow::adjustHighContrastMode()
{
static const DrawModeFlags nContrastMode =
@@ -252,30 +239,18 @@ void ChartWindow::adjustHighContrastMode()
DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient;
bool bUseContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
- SetDrawMode( bUseContrast ? nContrastMode : DrawModeFlags::Default );
+ GetOutDev()->SetDrawMode( bUseContrast ? nContrastMode : DrawModeFlags::Default );
}
void ChartWindow::ForceInvalidate()
{
vcl::Window::Invalidate();
}
-void ChartWindow::Invalidate( InvalidateFlags nFlags )
+void ChartWindow::ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags nFlags )
{
if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
return;
- vcl::Window::Invalidate( nFlags );
-}
-void ChartWindow::Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags )
-{
- if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
- return;
- vcl::Window::Invalidate( rRect, nFlags );
-}
-void ChartWindow::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
-{
- if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
- return;
- vcl::Window::Invalidate( rRegion, nFlags );
+ vcl::Window::ImplInvalidate( rRegion, nFlags );
}
void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
@@ -283,11 +258,11 @@ void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
SfxViewShell* pCurrentShell = SfxViewShell::Current();
if ( nullptr == pCurrentShell )
return;
- OString sRectangle;
+ tools::Rectangle aResultRectangle;
if (!pRectangle)
{
// we have to invalidate the whole chart area not the whole document
- sRectangle = GetBoundingBox().toString();
+ aResultRectangle = GetBoundingBox();
}
else
{
@@ -296,7 +271,9 @@ void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
if (IsMapModeEnabled())
{
if (GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ {
+ aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
+ }
}
else
{
@@ -307,27 +284,28 @@ void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
if (pEditWin)
{
MapMode aCWMapMode = GetMapMode();
- double fXScale( aCWMapMode.GetScaleX() );
- double fYScale( aCWMapMode.GetScaleY() );
+ constexpr auto p = o3tl::getConversionMulDiv(o3tl::Length::px, o3tl::Length::twip);
+ const auto& scaleX = aCWMapMode.GetScaleX();
+ const auto& scaleY = aCWMapMode.GetScaleY();
+ const auto nXNum = p.first * scaleX.GetDenominator();
+ const auto nXDen = p.second * scaleX.GetNumerator();
+ const auto nYNum = p.first * scaleY.GetDenominator();
+ const auto nYDen = p.second * scaleY.GetNumerator();
if (!IsMapModeEnabled())
{
- aRectangle.SetLeft( aRectangle.Left() / fXScale );
- aRectangle.SetRight( aRectangle.Right() / fXScale );
- aRectangle.SetTop( aRectangle.Top() / fYScale );
- aRectangle.SetBottom( aRectangle.Bottom() / fYScale );
+ aRectangle = aRectangle.scale(scaleX.GetDenominator(), scaleX.GetNumerator(),
+ scaleY.GetDenominator(), scaleY.GetNumerator());
}
- Point aOffset = this->GetOffsetPixelFrom(*pEditWin);
- aOffset.setX( aOffset.X() * (TWIPS_PER_PIXEL / fXScale) );
- aOffset.setY( aOffset.Y() * (TWIPS_PER_PIXEL / fYScale) );
+ Point aOffset = this->GetOffsetPixelFrom(*pEditWin).scale(nXNum, nXDen, nYNum, nYDen);
aRectangle = tools::Rectangle(aRectangle.TopLeft() + aOffset, aRectangle.GetSize());
}
- sRectangle = aRectangle.toString();
+ aResultRectangle = aRectangle;
}
- SfxLokHelper::notifyInvalidation(pCurrentShell, sRectangle);
+ SfxLokHelper::notifyInvalidation(pCurrentShell, &aResultRectangle);
}
FactoryFunction ChartWindow::GetUITestFactory() const
@@ -374,14 +352,20 @@ tools::Rectangle ChartWindow::GetBoundingBox()
// In all cases, the following code fragment
// returns the chart bounding box in twips.
MapMode aCWMapMode = GetMapMode();
- double fXScale( aCWMapMode.GetScaleX() );
- double fYScale( aCWMapMode.GetScaleY() );
+ constexpr auto p = o3tl::getConversionMulDiv(o3tl::Length::px, o3tl::Length::twip);
+ const auto& scaleX = aCWMapMode.GetScaleX();
+ const auto& scaleY = aCWMapMode.GetScaleY();
+ const auto nXNum = p.first * scaleX.GetDenominator();
+ const auto nXDen = p.second * scaleX.GetNumerator();
+ const auto nYNum = p.first * scaleY.GetDenominator();
+ const auto nYDen = p.second * scaleY.GetNumerator();
+
Point aOffset = GetOffsetPixelFrom(*pRootWin);
- aOffset.setX( aOffset.X() * (TWIPS_PER_PIXEL / fXScale) );
- aOffset.setY( aOffset.Y() * (TWIPS_PER_PIXEL / fYScale) );
+ aOffset.setX( o3tl::convert(aOffset.X(), nXNum, nXDen) );
+ aOffset.setY( o3tl::convert(aOffset.Y(), nYNum, nYDen) );
Size aSize = GetSizePixel();
- aSize.setWidth( aSize.Width() * (TWIPS_PER_PIXEL / fXScale) );
- aSize.setHeight( aSize.Height() * (TWIPS_PER_PIXEL / fYScale) );
+ aSize.setWidth( o3tl::convert(aSize.Width(), nXNum, nXDen) );
+ aSize.setHeight( o3tl::convert(aSize.Height(), nYNum, nYDen) );
aBBox = tools::Rectangle(aOffset, aSize);
}
return aBBox;
diff --git a/chart2/source/controller/main/CommandDispatch.cxx b/chart2/source/controller/main/CommandDispatch.cxx
index 22e0a52c204f..2cb25f68d5bf 100644
--- a/chart2/source/controller/main/CommandDispatch.cxx
+++ b/chart2/source/controller/main/CommandDispatch.cxx
@@ -19,38 +19,17 @@
#include "CommandDispatch.hxx"
#include <com/sun/star/util/URLTransformer.hpp>
-#include <tools/diagnose_ex.h>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
-namespace
-{
-template< class Map >
- void lcl_DisposeAndClearAndDeleteAllMapElements(
- Map & rMap,
- const Reference< uno::XInterface > & xEventSource )
-{
- for( const auto& rElement : rMap )
- {
- if( rElement.second )
- {
- rElement.second->disposeAndClear( xEventSource );
- delete rElement.second;
- }
- }
-}
-
-} // anonymous namespace
-
namespace chart
{
CommandDispatch::CommandDispatch(
const Reference< uno::XComponentContext > & xContext ) :
- impl::CommandDispatch_Base( m_aMutex ),
m_xContext( xContext )
{
}
@@ -63,9 +42,11 @@ void CommandDispatch::initialize()
// ____ WeakComponentImplHelperBase ____
/// is called when this is disposed
-void SAL_CALL CommandDispatch::disposing()
+void CommandDispatch::disposing(std::unique_lock<std::mutex>& rGuard)
{
- lcl_DisposeAndClearAndDeleteAllMapElements( m_aListeners, static_cast< cppu::OWeakObject* >( this ));
+ Reference< uno::XInterface > xEventSource(static_cast< cppu::OWeakObject* >( this ));
+ for( auto& rElement : m_aListeners )
+ rElement.second.disposeAndClear( rGuard, xEventSource );
m_aListeners.clear();
}
@@ -75,24 +56,29 @@ void SAL_CALL CommandDispatch::dispatch( const util::URL& /* URL */, const Seque
void SAL_CALL CommandDispatch::addStatusListener( const Reference< frame::XStatusListener >& Control, const util::URL& URL )
{
- tListenerMap::iterator aIt( m_aListeners.find( URL.Complete ));
- if( aIt == m_aListeners.end())
{
- aIt = m_aListeners.insert(
- m_aListeners.begin(),
- tListenerMap::value_type( URL.Complete, new ::comphelper::OInterfaceContainerHelper2( m_aMutex )));
- }
- OSL_ASSERT( aIt != m_aListeners.end());
+ std::unique_lock g(m_aMutex);
+ tListenerMap::iterator aIt( m_aListeners.find( URL.Complete ));
+ if( aIt == m_aListeners.end())
+ {
+ aIt = m_aListeners.emplace(
+ std::piecewise_construct,
+ std::forward_as_tuple(URL.Complete),
+ std::forward_as_tuple()).first;
+ }
+ assert( aIt != m_aListeners.end());
- aIt->second->addInterface( Control );
+ aIt->second.addInterface( g, Control );
+ }
fireStatusEvent( URL.Complete, Control );
}
void SAL_CALL CommandDispatch::removeStatusListener( const Reference< frame::XStatusListener >& Control, const util::URL& URL )
{
+ std::unique_lock g(m_aMutex);
tListenerMap::iterator aIt( m_aListeners.find( URL.Complete ));
if( aIt != m_aListeners.end())
- (*aIt).second->removeInterface( Control );
+ (*aIt).second.removeInterface( g, Control );
}
// ____ XModifyListener ____
@@ -143,24 +129,8 @@ void CommandDispatch::fireStatusEventForURL(
tListenerMap::iterator aIt( m_aListeners.find( aURL.Complete ));
if( aIt != m_aListeners.end())
{
- if( aIt->second )
- {
- ::comphelper::OInterfaceIteratorHelper2 aIntfIt( *((*aIt).second) );
-
- while( aIntfIt.hasMoreElements())
- {
- Reference< frame::XStatusListener > xListener( aIntfIt.next(), uno::UNO_QUERY );
- try
- {
- if( xListener.is())
- xListener->statusChanged( aEventToSend );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- }
- }
+ std::unique_lock g(m_aMutex);
+ aIt->second.notifyEach(g, &css::frame::XStatusListener::statusChanged, aEventToSend);
}
}
}
diff --git a/chart2/source/controller/main/CommandDispatch.hxx b/chart2/source/controller/main/CommandDispatch.hxx
index 1c7295186038..feb1c2183af5 100644
--- a/chart2/source/controller/main/CommandDispatch.hxx
+++ b/chart2/source/controller/main/CommandDispatch.hxx
@@ -18,9 +18,8 @@
*/
#pragma once
-#include <MutexContainer.hxx>
-#include <cppuhelper/compbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/compbase.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
@@ -34,7 +33,7 @@ namespace chart
namespace impl
{
-typedef ::cppu::WeakComponentImplHelper<
+typedef ::comphelper::WeakComponentImplHelper<
css::frame::XDispatch,
css::util::XModifyListener >
CommandDispatch_Base;
@@ -42,9 +41,7 @@ typedef ::cppu::WeakComponentImplHelper<
/** This is the base class for an XDispatch.
*/
-class CommandDispatch :
- public MutexContainer,
- public impl::CommandDispatch_Base
+class CommandDispatch : public impl::CommandDispatch_Base
{
public:
explicit CommandDispatch( const css::uno::Reference< css::uno::XComponentContext > & xContext );
@@ -106,7 +103,7 @@ protected:
// ____ WeakComponentImplHelperBase ____
/// is called when this is disposed
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
// ____ XModifyListener ____
virtual void SAL_CALL modified(
@@ -120,7 +117,7 @@ private:
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer;
- typedef std::map< OUString, ::comphelper::OInterfaceContainerHelper2* >
+ typedef std::map< OUString, ::comphelper::OInterfaceContainerHelper4<css::frame::XStatusListener> >
tListenerMap;
tListenerMap m_aListeners;
diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx
index b007ebe5c652..c16a0e45be37 100644
--- a/chart2/source/controller/main/CommandDispatchContainer.cxx
+++ b/chart2/source/controller/main/CommandDispatchContainer.cxx
@@ -23,10 +23,12 @@
#include <DisposeHelper.hxx>
#include "DrawCommandDispatch.hxx"
#include "ShapeController.hxx"
+#include <ChartModel.hxx>
#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <osl/diagnose.h>
+#include <rtl/ref.hxx>
#include <o3tl/sorted_vector.hxx>
@@ -47,22 +49,22 @@ CommandDispatchContainer::CommandDispatchContainer(
}
void CommandDispatchContainer::setModel(
- const Reference< frame::XModel > & xModel )
+ const rtl::Reference<::chart::ChartModel> & xModel )
{
// remove all existing dispatcher that base on the old model
m_aCachedDispatches.clear();
DisposeHelper::DisposeAllElements( m_aToBeDisposedDispatches );
m_aToBeDisposedDispatches.clear();
- m_xModel = xModel;
+ m_xModel = xModel.get();
}
void CommandDispatchContainer::setChartDispatch(
const Reference< frame::XDispatch >& rChartDispatch,
- const o3tl::sorted_vector< OUString > & rChartCommands )
+ o3tl::sorted_vector< OUString > && rChartCommands )
{
OSL_ENSURE(rChartDispatch.is(),"Invalid fall back dispatcher!");
m_xChartDispatcher.set( rChartDispatch );
- m_aChartCommands = rChartCommands;
+ m_aChartCommands = std::move(rChartCommands);
m_aToBeDisposedDispatches.push_back( m_xChartDispatcher );
}
@@ -82,12 +84,12 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL(
}
else
{
- uno::Reference< frame::XModel > xModel( m_xModel );
+ rtl::Reference< ::chart::ChartModel > xModel( m_xModel );
if( xModel.is() && ( rURL.Path == "Undo" || rURL.Path == "Redo" ||
rURL.Path == "GetUndoStrings" || rURL.Path == "GetRedoStrings" ) )
{
- CommandDispatch * pDispatch = new UndoCommandDispatch( m_xContext, xModel );
+ rtl::Reference<CommandDispatch> pDispatch = new UndoCommandDispatch( m_xContext, xModel );
xResult.set( pDispatch );
pDispatch->initialize();
m_aCachedDispatches[ ".uno:Undo" ].set( xResult );
@@ -99,7 +101,7 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL(
else if( xModel.is() && ( rURL.Path == "Context" || rURL.Path == "ModifiedStatus" ) )
{
Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), uno::UNO_QUERY );
- CommandDispatch * pDispatch = new StatusBarCommandDispatch( m_xContext, xModel, xSelSupp );
+ rtl::Reference<CommandDispatch> pDispatch = new StatusBarCommandDispatch( m_xContext, xModel, xSelSupp );
xResult.set( pDispatch );
pDispatch->initialize();
m_aCachedDispatches[ ".uno:Context" ].set( xResult );
@@ -143,11 +145,12 @@ Sequence< Reference< frame::XDispatch > > CommandDispatchContainer::getDispatche
{
sal_Int32 nCount = aDescriptors.getLength();
uno::Sequence< uno::Reference< frame::XDispatch > > aRet( nCount );
+ auto aRetRange = asNonConstRange(aRet);
for( sal_Int32 nPos = 0; nPos < nCount; ++nPos )
{
if ( aDescriptors[ nPos ].FrameName == "_self" )
- aRet[ nPos ] = getDispatchForURL( aDescriptors[ nPos ].FeatureURL );
+ aRetRange[ nPos ] = getDispatchForURL( aDescriptors[ nPos ].FeatureURL );
}
return aRet;
}
diff --git a/chart2/source/controller/main/ConfigurationAccess.cxx b/chart2/source/controller/main/ConfigurationAccess.cxx
deleted file mode 100644
index 2d1dcfcf9b6e..000000000000
--- a/chart2/source/controller/main/ConfigurationAccess.cxx
+++ /dev/null
@@ -1,99 +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 <ConfigurationAccess.hxx>
-
-#include <unotools/syslocale.hxx>
-#include <unotools/configitem.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <rtl/instance.hxx>
-
-namespace chart
-{
-using namespace ::com::sun::star;
-
-namespace
-{
-bool lcl_IsMetric()
-{
- SvtSysLocale aSysLocale;
- const LocaleDataWrapper* pLocWrapper = aSysLocale.GetLocaleDataPtr();
- MeasurementSystem eSys = pLocWrapper->getMeasurementSystemEnum();
-
- return ( eSys == MeasurementSystem::Metric );
-}
-
-class CalcConfigItem : public ::utl::ConfigItem
-{
-private:
- virtual void ImplCommit() override;
-
-public:
- CalcConfigItem();
-
- FieldUnit getFieldUnit();
- virtual void Notify( const uno::Sequence<OUString>& aPropertyNames) override;
-};
-
-}//end anonymous namespace
-
-CalcConfigItem::CalcConfigItem()
- : ConfigItem( "Office.Calc/Layout" )
-{
-}
-
-void CalcConfigItem::ImplCommit() {}
-void CalcConfigItem::Notify( const uno::Sequence<OUString>& ) {}
-
-FieldUnit CalcConfigItem::getFieldUnit()
-{
- FieldUnit eResult( FieldUnit::CM );
-
- uno::Sequence< OUString > aNames( 1 );
- if( lcl_IsMetric() )
- aNames[ 0 ] = "Other/MeasureUnit/Metric";
- else
- aNames[ 0 ] = "Other/MeasureUnit/NonMetric";
-
- uno::Sequence< uno::Any > aResult( GetProperties( aNames ));
- sal_Int32 nValue = 0;
- if( aResult[ 0 ] >>= nValue )
- eResult = static_cast< FieldUnit >( nValue );
-
- return eResult;
-}
-
-namespace
-{
- //a CalcConfigItem Singleton
- struct theCalcConfigItem : public rtl::Static< CalcConfigItem, theCalcConfigItem > {};
-}
-
-namespace ConfigurationAccess
-{
- FieldUnit getFieldUnit()
- {
- FieldUnit aUnit( theCalcConfigItem::get().getFieldUnit() );
- return aUnit;
- }
-} //namespace ConfigurationAccess
-
-} //namespace chart
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index 6edaaff79592..8d7bc490e569 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -18,16 +18,18 @@
*/
#include "ControllerCommandDispatch.hxx"
-#include <ChartModelHelper.hxx>
#include <ChartModel.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <TitleHelper.hxx>
#include <LegendHelper.hxx>
#include <ObjectIdentifier.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <ChartController.hxx>
#include <RegressionCurveHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <StatisticsHelper.hxx>
#include <ReferenceSizeProvider.hxx>
@@ -35,16 +37,12 @@
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/lok.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/objsh.hxx>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XRegressionCurve.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/chart2/XDataProviderAccess.hpp>
// only needed until #i68864# is fixed
@@ -106,7 +104,7 @@ struct ControllerState
ControllerState();
void update( const Reference< frame::XController > & xController,
- const Reference< frame::XModel > & xModel );
+ const rtl::Reference<::chart::ChartModel> & xModel );
// -- State variables -------
bool bHasSelectedObject;
@@ -173,7 +171,7 @@ ControllerState::ControllerState() :
void ControllerState::update(
const Reference< frame::XController > & xController,
- const Reference< frame::XModel > & xModel )
+ const rtl::Reference<::chart::ChartModel> & xModel )
{
Reference< view::XSelectionSupplier > xSelectionSupplier(
xController, uno::UNO_QUERY );
@@ -193,24 +191,22 @@ void ControllerState::update(
bIsPositionableObject = (aObjectType != OBJECTTYPE_DATA_POINT) && aSelOID.isDragableObject();
bIsTextObject = aObjectType == OBJECTTYPE_TITLE;
- uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
+ rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram();
bIsFormateableObjectSelected = bHasSelectedObject && aSelOID.isAutoGeneratedObject();
if( aObjectType==OBJECTTYPE_DIAGRAM || aObjectType==OBJECTTYPE_DIAGRAM_WALL || aObjectType==OBJECTTYPE_DIAGRAM_FLOOR )
- bIsFormateableObjectSelected = DiagramHelper::isSupportingFloorAndWall( xDiagram );
+ bIsFormateableObjectSelected = xDiagram->isSupportingFloorAndWall();
- uno::Reference< chart2::XDataSeries > xGivenDataSeries(
+ rtl::Reference< DataSeries > xGivenDataSeries =
ObjectIdentifier::getDataSeriesForCID(
- aSelObjCID, xModel ) );
+ aSelObjCID, xModel );
bIsDeleteableObjectSelected = ChartController::isObjectDeleteable( aSelObj );
- bMayMoveSeriesForward = (aObjectType!=OBJECTTYPE_DATA_POINT) && DiagramHelper::isSeriesMoveable(
- ChartModelHelper::findDiagram( xModel ),
+ bMayMoveSeriesForward = (aObjectType!=OBJECTTYPE_DATA_POINT) && xDiagram && xDiagram->isSeriesMoveable(
xGivenDataSeries,
MOVE_SERIES_FORWARD );
- bMayMoveSeriesBackward = (aObjectType!=OBJECTTYPE_DATA_POINT) && DiagramHelper::isSeriesMoveable(
- ChartModelHelper::findDiagram( xModel ),
+ bMayMoveSeriesBackward = (aObjectType!=OBJECTTYPE_DATA_POINT) && xDiagram && xDiagram->isSeriesMoveable(
xGivenDataSeries,
MOVE_SERIES_BACKWARD );
@@ -238,24 +234,20 @@ void ControllerState::update(
if( xGivenDataSeries.is())
{
bMayAddMenuTrendline = true;
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
- uno::Reference< chart2::XChartType > xFirstChartType(
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
+ rtl::Reference< ::chart::ChartType > xFirstChartType(
DataSeriesHelper::getChartTypeOfSeries( xGivenDataSeries, xDiagram ));
// trend lines/mean value line
if( (aObjectType == OBJECTTYPE_DATA_SERIES || aObjectType == OBJECTTYPE_DATA_POINT)
&& ChartTypeHelper::isSupportingRegressionProperties( xFirstChartType, nDimensionCount ))
{
- uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xGivenDataSeries, uno::UNO_QUERY );
- if( xRegCurveCnt.is())
- {
- // Trendline
- bMayAddTrendline = true;
+ // Trendline
+ bMayAddTrendline = true;
- // Mean Value
- bMayFormatMeanValue = bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xRegCurveCnt );
- bMayAddMeanValue = ! bMayDeleteMeanValue;
- }
+ // Mean Value
+ bMayFormatMeanValue = bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xGivenDataSeries );
+ bMayAddMeanValue = ! bMayDeleteMeanValue;
}
// error bars
@@ -289,23 +281,28 @@ void ControllerState::update(
// Trendline Equation
bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve );
bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
+ bMayAddR2Value = RegressionCurveHelper::MayHaveCorrelationCoefficient( xRegCurve ) && bMayAddTrendlineEquation;
}
else if( aObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
{
bMayFormatTrendlineEquation = true;
bool bHasR2Value = false;
+ bool bMayHaveR2 = true;
try
{
uno::Reference< beans::XPropertySet > xEquationProperties =
ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel );
if( xEquationProperties.is() )
+ {
xEquationProperties->getPropertyValue( "ShowCorrelationCoefficient" ) >>= bHasR2Value;
+ xEquationProperties->getPropertyValue( "MayHaveCorrelationCoefficient" ) >>= bMayHaveR2;
+ }
}
catch(const uno::RuntimeException&)
{
TOOLS_WARN_EXCEPTION("chart2", "" );
}
- bMayAddR2Value = !bHasR2Value;
+ bMayAddR2Value = !bHasR2Value && bMayHaveR2;
bMayDeleteR2Value = bHasR2Value;
}
}
@@ -325,7 +322,7 @@ struct ModelState
{
ModelState();
- void update( const Reference< frame::XModel > & xModel );
+ void update( const rtl::Reference<::chart::ChartModel> & xModel );
bool HasAnyAxis() const;
bool HasAnyGrid() const;
@@ -364,6 +361,8 @@ struct ModelState
bool bSupportsStatistics;
bool bSupportsAxes;
+
+ bool bDataTable = false;
};
ModelState::ModelState() :
@@ -397,28 +396,27 @@ ModelState::ModelState() :
bSupportsAxes(false)
{}
-void ModelState::update( const Reference< frame::XModel > & xModel )
+void ModelState::update( const rtl::Reference<::chart::ChartModel> & xModel )
{
- Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
+ rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram();
- bIsReadOnly = true;
- Reference< frame::XStorable > xStorable( xModel, uno::UNO_QUERY );
- if( xStorable.is())
- bIsReadOnly = xStorable->isReadonly();
+ bIsReadOnly = xModel->isReadonly();
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ sal_Int32 nDimensionCount = 0;
+ if (xDiagram)
+ nDimensionCount = xDiagram->getDimension();
- uno::Reference< chart2::XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ rtl::Reference< ChartType > xFirstChartType;
+ if (xDiagram)
+ xFirstChartType = xDiagram->getChartTypeByIndex( 0 );
bSupportsStatistics = ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount );
bSupportsAxes = ChartTypeHelper::isSupportingMainAxis( xFirstChartType, nDimensionCount, 0 );
bIsThreeD = (nDimensionCount == 3);
- if (xChartDoc.is())
+ if (xModel.is())
{
- ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartDoc);
- bHasOwnData = rModel.hasInternalDataProvider();
- bHasDataFromPivotTable = !bHasOwnData && rModel.isDataFromPivotTable();
+ bHasOwnData = xModel->hasInternalDataProvider();
+ bHasDataFromPivotTable = !bHasOwnData && xModel->isDataFromPivotTable();
}
bHasMainTitle = TitleHelper::getTitle( TitleHelper::MAIN_TITLE, xModel ).is();
@@ -443,12 +441,14 @@ void ModelState::update( const Reference< frame::XModel > & xModel )
bHasHelpZGrid = bSupportsAxes && AxisHelper::isGridShown( 2, 0, false, xDiagram );
bHasAutoScaledText =
- (ReferenceSizeProvider::getAutoResizeState( xChartDoc ) ==
+ (ReferenceSizeProvider::getAutoResizeState( xModel ) ==
ReferenceSizeProvider::AUTO_RESIZE_YES);
bHasLegend = LegendHelper::hasLegend( xDiagram );
- bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram );
+ bHasWall = xDiagram && xDiagram->isSupportingFloorAndWall();
bHasFloor = bHasWall && bIsThreeD;
+
+ bDataTable = xDiagram.is() && xDiagram->getDataTable().is();
}
bool ModelState::HasAnyAxis() const
@@ -491,11 +491,10 @@ void ControllerCommandDispatch::initialize()
if( !m_xChartController.is())
return;
- Reference< frame::XModel > xModel( m_xChartController->getModel());
- Reference< util::XModifyBroadcaster > xModifyBroadcaster( xModel, uno::UNO_QUERY );
- OSL_ASSERT( xModifyBroadcaster.is());
- if( xModifyBroadcaster.is())
- xModifyBroadcaster->addModifyListener( this );
+ rtl::Reference<::chart::ChartModel> xModel( m_xChartController->getChartModel());
+ OSL_ASSERT( xModel.is());
+ if( xModel.is())
+ xModel->addModifyListener( this );
// Listen selection modifications (Arrangement feature - issue 63017).
if( m_xSelectionSupplier.is() )
@@ -505,7 +504,7 @@ void ControllerCommandDispatch::initialize()
m_apModelState->update( xModel );
if( m_apControllerState && xModel.is())
- m_apControllerState->update( m_xChartController.get(), xModel );
+ m_apControllerState->update( m_xChartController, xModel );
updateCommandAvailability();
}
@@ -532,6 +531,7 @@ void ControllerCommandDispatch::updateCommandAvailability()
// read-only
bool bIsWritable = bModelStateIsValid && (! m_apModelState->bIsReadOnly);
bool bShapeContext = m_xChartController.is() && m_xChartController->isShapeContext();
+ bool bIsTextEdit = m_xChartController.is() && m_xChartController->IsTextEdit();
bool bEnableDataTableDialog = false;
bool bCanCreateDataProvider = false;
@@ -551,12 +551,11 @@ void ControllerCommandDispatch::updateCommandAvailability()
}
}
- Reference< chart2::XChartDocument > xChartDoc(m_xChartController->getModel(), uno::UNO_QUERY);
- OSL_ENSURE(xChartDoc.is(), "Invalid XChartDocument");
- if ( xChartDoc.is() )
+ rtl::Reference< ChartModel > xChartModel = m_xChartController->getChartModel();
+ OSL_ENSURE(xChartModel.is(), "Invalid XChartDocument");
+ if ( xChartModel.is() )
{
- ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartDoc);
- css::uno::Reference< com::sun::star::chart2::XDataProviderAccess > xCreatorDoc(rModel.getParent(), uno::UNO_QUERY);
+ css::uno::Reference< com::sun::star::chart2::XDataProviderAccess > xCreatorDoc(xChartModel->getParent(), uno::UNO_QUERY);
bCanCreateDataProvider = xCreatorDoc.is();
}
}
@@ -568,12 +567,12 @@ void ControllerCommandDispatch::updateCommandAvailability()
// toolbar commands
m_aCommandAvailability[ ".uno:ToggleGridHorizontal" ] = bIsWritable;
- m_aCommandArguments[ ".uno:ToggleGridHorizontal" ] <<= m_apModelState->bHasMainYGrid;
+ m_aCommandArguments[ ".uno:ToggleGridHorizontal" ] <<= bModelStateIsValid && m_apModelState->bHasMainYGrid;
m_aCommandAvailability[ ".uno:ToggleGridVertical" ] = bIsWritable;
- m_aCommandArguments[ ".uno:ToggleGridVertical" ] <<= m_apModelState->bHasMainXGrid;
+ m_aCommandArguments[ ".uno:ToggleGridVertical" ] <<= bModelStateIsValid && m_apModelState->bHasMainXGrid;
m_aCommandAvailability[ ".uno:ToggleLegend" ] = bIsWritable;
- m_aCommandArguments[ ".uno:ToggleLegend" ] <<= m_apModelState->bHasLegend;
+ m_aCommandArguments[ ".uno:ToggleLegend" ] <<= bModelStateIsValid && m_apModelState->bHasLegend;
m_aCommandAvailability[ ".uno:NewArrangement" ] = bIsWritable;
m_aCommandAvailability[ ".uno:Update" ] = bIsWritable;
@@ -590,17 +589,19 @@ void ControllerCommandDispatch::updateCommandAvailability()
m_aCommandAvailability[ ".uno:InsertMenuDataLabels" ] = bIsWritable;
m_aCommandAvailability[ ".uno:InsertRemoveAxes" ] = m_aCommandAvailability[ ".uno:InsertMenuAxes" ] = bIsWritable && m_apModelState->bSupportsAxes;
m_aCommandAvailability[ ".uno:InsertMenuGrids" ] = bIsWritable && m_apModelState->bSupportsAxes;
- m_aCommandAvailability[ ".uno:InsertMenuTrendlines" ] = bIsWritable && m_apModelState->bSupportsStatistics && m_apControllerState->bMayAddMenuTrendline;
+ m_aCommandAvailability[ ".uno:InsertMenuTrendlines" ] = bIsWritable && m_apModelState->bSupportsStatistics && bControllerStateIsValid && m_apControllerState->bMayAddMenuTrendline;
m_aCommandAvailability[ ".uno:InsertMenuMeanValues" ] = bIsWritable && m_apModelState->bSupportsStatistics;
m_aCommandAvailability[ ".uno:InsertMenuXErrorBars" ] = bIsWritable && m_apModelState->bSupportsStatistics;
m_aCommandAvailability[ ".uno:InsertMenuYErrorBars" ] = bIsWritable && m_apModelState->bSupportsStatistics;
- m_aCommandAvailability[ ".uno:InsertSymbol" ] = bIsWritable && m_apControllerState->bIsTextObject;
+ m_aCommandAvailability[ ".uno:InsertSymbol" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsTextObject;
+ m_aCommandAvailability[ ".uno:InsertMenuDataTable" ] = bIsWritable;
// format objects
bool bFormatObjectAvailable = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected;
- m_aCommandAvailability[ ".uno:FormatSelection" ] = bFormatObjectAvailable;
+ m_aCommandAvailability[ ".uno:FormatSelection" ] = bFormatObjectAvailable && !bIsTextEdit;
+ m_aCommandAvailability[ ".uno:FontDialog" ] = bFormatObjectAvailable && bIsTextEdit;
m_aCommandAvailability[ ".uno:FormatAxis" ] = bFormatObjectAvailable;
- m_aCommandAvailability[ ".uno:FormatTitle" ] = bFormatObjectAvailable;
+ m_aCommandAvailability[ ".uno:FormatTitle" ] = bFormatObjectAvailable && !bIsTextEdit;
m_aCommandAvailability[ ".uno:FormatDataSeries" ] = bFormatObjectAvailable;
m_aCommandAvailability[ ".uno:FormatDataPoint" ] = bFormatObjectAvailable;
m_aCommandAvailability[ ".uno:FormatDataLabels" ] = bFormatObjectAvailable;
@@ -647,7 +648,7 @@ void ControllerCommandDispatch::updateCommandAvailability()
// text
m_aCommandAvailability[ ".uno:ScaleText" ] = bIsWritable && bModelStateIsValid ;
- m_aCommandArguments[ ".uno:ScaleText" ] <<= m_apModelState->bHasAutoScaledText;
+ m_aCommandArguments[ ".uno:ScaleText" ] <<= bModelStateIsValid && m_apModelState->bHasAutoScaledText;
// axes
m_aCommandAvailability[ ".uno:DiagramAxisX" ] = bIsWritable && bModelStateIsValid && m_apModelState->bHasXAxis;
@@ -677,9 +678,11 @@ void ControllerCommandDispatch::updateCommandAvailability()
m_aCommandAvailability[ ".uno:InsertDataLabel" ] = bIsWritable;
m_aCommandAvailability[ ".uno:InsertMeanValue" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddMeanValue;
m_aCommandAvailability[ ".uno:InsertTrendline" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendline;
- m_aCommandAvailability[ ".uno:InsertTrendlineEquation" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendlineEquation;
- m_aCommandAvailability[ ".uno:InsertTrendlineEquationAndR2" ] = m_aCommandAvailability[ ".uno:InsertTrendlineEquation" ];
- m_aCommandAvailability[ ".uno:InsertR2Value" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddR2Value;
+ const bool bInsertTrendlineEquation = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendlineEquation;
+ m_aCommandAvailability[ ".uno:InsertTrendlineEquation" ] = bInsertTrendlineEquation;
+ m_aCommandAvailability[ ".uno:InsertTrendlineEquationAndR2" ] = bInsertTrendlineEquation && m_apControllerState->bMayAddR2Value;
+ m_aCommandAvailability[ ".uno:InsertR2Value" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddR2Value
+ && !m_apControllerState->bMayAddTrendlineEquation;
m_aCommandAvailability[ ".uno:DeleteR2Value" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteR2Value;
m_aCommandAvailability[ ".uno:InsertXErrorBars" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddXErrorBars;
@@ -705,6 +708,10 @@ void ControllerCommandDispatch::updateCommandAvailability()
m_aCommandAvailability[ ".uno:FormatMinorGrid" ] = bIsWritable;
m_aCommandAvailability[ ".uno:InsertMinorGrid" ] = bIsWritable;
m_aCommandAvailability[ ".uno:DeleteMinorGrid" ] = bIsWritable;
+
+ // data table
+ m_aCommandAvailability[ ".uno:InsertDataTable" ] = bIsWritable && bModelStateIsValid && !m_apModelState->bDataTable;
+ m_aCommandAvailability[ ".uno:DeleteDataTable" ] = bIsWritable && bModelStateIsValid && m_apModelState->bDataTable;
}
bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand )
@@ -740,7 +747,7 @@ void ControllerCommandDispatch::fireStatusEvent(
if( rURL.isEmpty() || bIsChartSelectorURL )
{
uno::Any aArg;
- aArg <<= Reference< frame::XController >(m_xChartController.get());
+ aArg <<= Reference< frame::XController >(m_xChartController);
fireStatusEventForURL( ".uno:ChartElementSelector", aArg, true, xSingleListener );
}
@@ -756,7 +763,7 @@ void ControllerCommandDispatch::fireStatusEvent(
// @todo: remove if Issue 68864 is fixed
if( rURL.isEmpty() || rURL == ".uno:StatusBarVisible" )
{
- bool bIsStatusBarVisible( lcl_isStatusBarVisible( m_xChartController.get() ));
+ bool bIsStatusBarVisible( lcl_isStatusBarVisible( m_xChartController ));
fireStatusEventForURL( ".uno:StatusBarVisible", uno::Any( bIsStatusBarVisible ), true, xSingleListener );
}
}
@@ -772,7 +779,7 @@ void SAL_CALL ControllerCommandDispatch::dispatch(
// ____ WeakComponentImplHelperBase ____
/// is called when this is disposed
-void SAL_CALL ControllerCommandDispatch::disposing()
+void ControllerCommandDispatch::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
m_xChartController.clear();
m_xDispatch.clear();
@@ -795,14 +802,14 @@ void SAL_CALL ControllerCommandDispatch::modified( const lang::EventObject& aEve
// Update the "ModelState" Struct.
if( m_apModelState && m_xChartController.is())
{
- m_apModelState->update( m_xChartController->getModel());
+ m_apModelState->update( m_xChartController->getChartModel());
bUpdateCommandAvailability = true;
}
// Update the "ControllerState" Struct.
if( m_apControllerState && m_xChartController.is())
{
- m_apControllerState->update( m_xChartController.get(), m_xChartController->getModel());
+ m_apControllerState->update( m_xChartController, m_xChartController->getChartModel());
bUpdateCommandAvailability = true;
}
@@ -825,7 +832,7 @@ void SAL_CALL ControllerCommandDispatch::selectionChanged( const lang::EventObje
// Update the "ControllerState" Struct.
if( m_apControllerState && m_xChartController.is())
{
- m_apControllerState->update( m_xChartController.get(), m_xChartController->getModel());
+ m_apControllerState->update( m_xChartController, m_xChartController->getChartModel());
updateCommandAvailability();
}
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.hxx b/chart2/source/controller/main/ControllerCommandDispatch.hxx
index 38b00c48d8f0..6a5e441e8e3c 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.hxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.hxx
@@ -74,7 +74,7 @@ protected:
// ____ WeakComponentImplHelperBase ____
/// is called when this is disposed
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
// ____ XEventListener (base of XModifyListener) ____
virtual void SAL_CALL disposing(
diff --git a/chart2/source/controller/main/DragMethod_Base.cxx b/chart2/source/controller/main/DragMethod_Base.cxx
index 9e01d5c3bd7b..5e46dc327b19 100644
--- a/chart2/source/controller/main/DragMethod_Base.cxx
+++ b/chart2/source/controller/main/DragMethod_Base.cxx
@@ -19,30 +19,28 @@
#include "DragMethod_Base.hxx"
#include <DrawViewWrapper.hxx>
-
+#include <ChartModel.hxx>
#include <ObjectNameProvider.hxx>
#include <ObjectIdentifier.hxx>
#include <svx/ActionDescriptionProvider.hxx>
-#include <com/sun/star/frame/XModel.hpp>
+#include <utility>
#include <vcl/ptrstyle.hxx>
namespace chart
{
using namespace ::com::sun::star;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::WeakReference;
DragMethod_Base::DragMethod_Base( DrawViewWrapper& rDrawViewWrapper
- , const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel
+ , OUString aObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, ActionDescriptionProvider::ActionType eActionType )
: SdrDragMethod( rDrawViewWrapper )
, m_rDrawViewWrapper(rDrawViewWrapper)
- , m_aObjectCID(rObjectCID)
+ , m_aObjectCID(std::move(aObjectCID))
, m_eActionType( eActionType )
- , m_xChartModel( WeakReference< frame::XModel >(xChartModel) )
+ , m_xChartModel( xChartModel.get() )
{
setMoveOnly(true);
}
@@ -50,9 +48,9 @@ DragMethod_Base::~DragMethod_Base()
{
}
-Reference< frame::XModel > DragMethod_Base::getChartModel() const
+rtl::Reference<::chart::ChartModel> DragMethod_Base::getChartModel() const
{
- return Reference< frame::XModel >( m_xChartModel );
+ return m_xChartModel.get();
}
OUString DragMethod_Base::getUndoDescription() const
diff --git a/chart2/source/controller/main/DragMethod_Base.hxx b/chart2/source/controller/main/DragMethod_Base.hxx
index b036da0e9fdf..1a6593889066 100644
--- a/chart2/source/controller/main/DragMethod_Base.hxx
+++ b/chart2/source/controller/main/DragMethod_Base.hxx
@@ -20,19 +20,20 @@
#include <svx/ActionDescriptionProvider.hxx>
#include <svx/svddrgmt.hxx>
-#include <cppuhelper/weakref.hxx>
+#include <unotools/weakref.hxx>
namespace chart { class DrawViewWrapper; }
namespace com::sun::star::frame { class XModel; }
namespace chart
{
+class ChartModel;
class DragMethod_Base : public SdrDragMethod
{
public:
- DragMethod_Base( DrawViewWrapper& rDrawViewWrapper, const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel
+ DragMethod_Base( DrawViewWrapper& rDrawViewWrapper, OUString aObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, ActionDescriptionProvider::ActionType eActionType = ActionDescriptionProvider::ActionType::Move );
virtual ~DragMethod_Base() override;
@@ -42,7 +43,7 @@ public:
virtual PointerStyle GetSdrDragPointer() const override;
protected:
- css::uno::Reference< css::frame::XModel > getChartModel() const;
+ rtl::Reference<::chart::ChartModel> getChartModel() const;
protected:
DrawViewWrapper& m_rDrawViewWrapper;
@@ -50,7 +51,7 @@ protected:
ActionDescriptionProvider::ActionType m_eActionType;
private:
- css::uno::WeakReference< css::frame::XModel > m_xChartModel;
+ unotools::WeakReference<::chart::ChartModel> m_xChartModel;
};
} // namespace chart
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx
index 100846ba9357..5bd85faaf959 100644
--- a/chart2/source/controller/main/DragMethod_PieSegment.cxx
+++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx
@@ -19,15 +19,14 @@
#include "DragMethod_PieSegment.hxx"
#include <DrawViewWrapper.hxx>
-
+#include <ChartModel.hxx>
#include <strings.hrc>
#include <ResId.hxx>
#include <ObjectIdentifier.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/Point.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -38,7 +37,7 @@ using ::basegfx::B2DVector;
DragMethod_PieSegment::DragMethod_PieSegment( DrawViewWrapper& rDrawViewWrapper
, const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel )
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
: DragMethod_Base( rDrawViewWrapper, rObjectCID, xChartModel )
, m_aStartVector(100.0,100.0)
, m_fInitialOffset(0.0)
@@ -46,7 +45,7 @@ DragMethod_PieSegment::DragMethod_PieSegment( DrawViewWrapper& rDrawViewWrapper
, m_aDragDirection(1000.0,1000.0)
, m_fDragRange( 1.0 )
{
- OUString aParameter( ObjectIdentifier::getDragParameterString( m_aObjectCID ) );
+ std::u16string_view aParameter( ObjectIdentifier::getDragParameterString( m_aObjectCID ) );
sal_Int32 nOffsetPercent(0);
awt::Point aMinimumPosition(0,0);
@@ -112,7 +111,7 @@ bool DragMethod_PieSegment::EndSdrDrag(bool /*bCopy*/)
try
{
- Reference< frame::XModel > xChartModel( getChartModel() );
+ rtl::Reference<::chart::ChartModel> xChartModel( getChartModel() );
if( xChartModel.is() )
{
Reference< beans::XPropertySet > xPointProperties(
@@ -128,7 +127,7 @@ bool DragMethod_PieSegment::EndSdrDrag(bool /*bCopy*/)
return true;
}
-basegfx::B2DHomMatrix DragMethod_PieSegment::getCurrentTransformation()
+basegfx::B2DHomMatrix DragMethod_PieSegment::getCurrentTransformation() const
{
basegfx::B2DHomMatrix aRetval;
@@ -143,8 +142,8 @@ void DragMethod_PieSegment::createSdrDragEntries()
if( pObj && pPV )
{
- const basegfx::B2DPolyPolygon aNewPolyPolygon(pObj->TakeXorPoly());
- addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aNewPolyPolygon)));
+ basegfx::B2DPolyPolygon aNewPolyPolygon(pObj->TakeXorPoly());
+ addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(std::move(aNewPolyPolygon))));
}
}
} //namespace chart
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.hxx b/chart2/source/controller/main/DragMethod_PieSegment.hxx
index 14090203272f..8cb498373f33 100644
--- a/chart2/source/controller/main/DragMethod_PieSegment.hxx
+++ b/chart2/source/controller/main/DragMethod_PieSegment.hxx
@@ -28,7 +28,7 @@ class DragMethod_PieSegment : public DragMethod_Base
{
public:
DragMethod_PieSegment( DrawViewWrapper& rDrawViewWrapper, const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
virtual ~DragMethod_PieSegment() override;
virtual OUString GetSdrDragComment() const override;
@@ -36,7 +36,7 @@ public:
virtual void MoveSdrDrag(const Point& rPnt) override;
virtual bool EndSdrDrag(bool bCopy) override;
- virtual basegfx::B2DHomMatrix getCurrentTransformation() override;
+ virtual basegfx::B2DHomMatrix getCurrentTransformation() const override;
protected:
virtual void createSdrDragEntries() override;
diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
index 7501f0bf7204..6172a25edad2 100644
--- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
@@ -21,8 +21,9 @@
#include <DrawViewWrapper.hxx>
#include <SelectionHelper.hxx>
-#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartModel.hxx>
+#include <Diagram.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <ThreeDHelper.hxx>
#include <defines.hxx>
@@ -30,8 +31,6 @@
#include <svx/scene3d.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
#include <drawinglayer/geometry/viewinformation3d.hxx>
@@ -40,17 +39,15 @@ namespace chart
{
using namespace ::com::sun::star;
-using ::com::sun::star::uno::Reference;
DragMethod_RotateDiagram::DragMethod_RotateDiagram( DrawViewWrapper& rDrawViewWrapper
, const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, RotationDirection eRotationDirection )
: DragMethod_Base( rDrawViewWrapper, rObjectCID, xChartModel, ActionDescriptionProvider::ActionType::Rotate )
, m_pScene(nullptr)
, m_aReferenceRect(100,100,100,100)
, m_aStartPos(0,0)
- , m_aWireframePolyPolygon()
, m_fInitialXAngleRad(0.0)
, m_fInitialYAngleRad(0.0)
, m_fInitialZAngleRad(0.0)
@@ -73,20 +70,19 @@ DragMethod_RotateDiagram::DragMethod_RotateDiagram( DrawViewWrapper& rDrawViewWr
m_aWireframePolyPolygon = m_pScene->CreateWireframe();
- uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram(getChartModel()) );
- uno::Reference< beans::XPropertySet > xDiagramProperties( xDiagram, uno::UNO_QUERY );
- if( !xDiagramProperties.is() )
+ rtl::Reference< Diagram > xDiagram = getChartModel()->getFirstChartDiagram();
+ if( !xDiagram.is() )
return;
- ThreeDHelper::getRotationFromDiagram( xDiagramProperties
- , m_nInitialHorizontalAngleDegree, m_nInitialVerticalAngleDegree );
+ xDiagram->getRotation(
+ m_nInitialHorizontalAngleDegree, m_nInitialVerticalAngleDegree );
- ThreeDHelper::getRotationAngleFromDiagram( xDiagramProperties
- , m_fInitialXAngleRad, m_fInitialYAngleRad, m_fInitialZAngleRad );
+ xDiagram->getRotationAngle(
+ m_fInitialXAngleRad, m_fInitialYAngleRad, m_fInitialZAngleRad );
if( ChartTypeHelper::isSupportingRightAngledAxes(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
- xDiagramProperties->getPropertyValue("RightAngledAxes") >>= m_bRightAngledAxes;
+ xDiagram->getChartTypeByIndex( 0 ) ) )
+ xDiagram->getPropertyValue("RightAngledAxes") >>= m_bRightAngledAxes;
if(m_bRightAngledAxes)
{
if( m_eRotationDirection==ROTATIONDIRECTION_Z )
@@ -115,9 +111,9 @@ void DragMethod_RotateDiagram::MoveSdrDrag(const Point& rPnt)
Hide();
//calculate new angle
- double fX = F_PI2 * static_cast<double>(rPnt.Y() - m_aStartPos.Y())
+ double fX = M_PI_2 * static_cast<double>(rPnt.Y() - m_aStartPos.Y())
/ (m_aReferenceRect.GetHeight() > 0 ? static_cast<double>(m_aReferenceRect.GetHeight()) : 1.0);
- double fY = F_PI * static_cast<double>(rPnt.X() - m_aStartPos.X())
+ double fY = M_PI * static_cast<double>(rPnt.X() - m_aStartPos.X())
/ (m_aReferenceRect.GetWidth() > 0 ? static_cast<double>(m_aReferenceRect.GetWidth()) : 1.0);
if( m_eRotationDirection != ROTATIONDIRECTION_Y )
@@ -161,13 +157,16 @@ bool DragMethod_RotateDiagram::EndSdrDrag(bool /*bCopy*/)
if(m_bRightAngledAxes)
ThreeDHelper::adaptRadAnglesForRightAngledAxes( fResultX, fResultY );
- ThreeDHelper::setRotationAngleToDiagram( uno::Reference< beans::XPropertySet >( ChartModelHelper::findDiagram( getChartModel() ), uno::UNO_QUERY )
- , fResultX, fResultY, fResultZ );
+ rtl::Reference<Diagram> xDiagram = getChartModel()->getFirstChartDiagram();
+ if (xDiagram)
+ xDiagram->setRotationAngle( fResultX, fResultY, fResultZ );
}
else
{
- ThreeDHelper::setRotationToDiagram( ( uno::Reference< beans::XPropertySet >( ChartModelHelper::findDiagram( getChartModel() ), uno::UNO_QUERY ) )
- , m_nInitialHorizontalAngleDegree+m_nAdditionalHorizontalAngleDegree, m_nInitialVerticalAngleDegree+m_nAdditionalVerticalAngleDegree );
+ rtl::Reference<Diagram> xDiagram = getChartModel()->getFirstChartDiagram();
+ if (xDiagram)
+ xDiagram->setRotation(
+ m_nInitialHorizontalAngleDegree+m_nAdditionalHorizontalAngleDegree, m_nInitialVerticalAngleDegree+m_nAdditionalVerticalAngleDegree );
}
return true;
@@ -217,7 +216,7 @@ void DragMethod_RotateDiagram::CreateOverlayGeometry(
std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew(
new sdr::overlay::OverlayPolyPolygonStripedAndFilled(
- aPolyPolygon));
+ std::move(aPolyPolygon)));
insertNewlyCreatedOverlayObjectForSdrDragMethod(
std::move(pNew),
diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.hxx b/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
index c4fe814b0e11..69e9050eeb4e 100644
--- a/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
@@ -41,7 +41,7 @@ public:
DragMethod_RotateDiagram( DrawViewWrapper& rDrawViewWrapper
, const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, RotationDirection eRotationDirection
);
virtual ~DragMethod_RotateDiagram() override;
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index ef0bdfd5af5b..516c2d2ec5f3 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -18,15 +18,14 @@
*/
#include "DrawCommandDispatch.hxx"
-#include "DrawCommandDispatch.h"
#include <ChartController.hxx>
#include <DrawViewWrapper.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include <com/sun/star/frame/CommandGroup.hpp>
#include <o3tl/unsafe_downcast.hxx>
+#include <o3tl/string_view.hxx>
#include <vcl/svapp.hxx>
-#include <svl/itempool.hxx>
#include <editeng/eeitem.hxx>
#include <svx/strings.hrc>
#include <svx/dialmgr.hxx>
@@ -67,13 +66,13 @@ DrawCommandDispatch::~DrawCommandDispatch()
bool DrawCommandDispatch::isFeatureSupported( const OUString& rCommandURL )
{
- sal_uInt16 nFeatureId = 0;
+ ChartCommandID nFeatureId = ChartCommandID::NONE;
OUString aBaseCommand;
OUString aCustomShapeType;
return parseCommandURL( rCommandURL, &nFeatureId, &aBaseCommand, &aCustomShapeType );
}
-static ::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
+static ::basegfx::B2DPolyPolygon getPolygon(TranslateId pResId, const SdrModel& rModel)
{
::basegfx::B2DPolyPolygon aReturn;
XLineEndListRef pLineEndList = rModel.GetLineEndList();
@@ -101,7 +100,7 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
- if ( !(pDrawModelWrapper && pDrawViewWrapper && pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CUSTOMSHAPE) )
+ if ( !(pDrawModelWrapper && pDrawViewWrapper && pDrawViewWrapper->GetCurrentObjIdentifier() == SdrObjKind::CustomShape) )
return;
bool bAttributesAppliedFromGallery = false;
@@ -115,8 +114,6 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
if ( aObjList[ i ].equalsIgnoreAsciiCase( m_aCustomShapeType ) )
{
FmFormModel aModel;
- SfxItemPool& rPool(aModel.GetItemPool());
- rPool.FreezeIdRanges();
if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aModel ) )
{
@@ -124,9 +121,7 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
if ( pSourceObj )
{
const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
- SfxItemSet aDest(
- pObj->getSdrModelFromSdrObject().GetItemPool(),
- svl::Items<
+ SfxItemSetFixed<
// Ranges from SdrAttrObj:
SDRATTR_START, SDRATTR_SHADOW_LAST,
SDRATTR_MISC_FIRST,
@@ -139,7 +134,8 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
SDRATTR_GRAF_FIRST,
SDRATTR_CUSTOMSHAPE_LAST,
// Range from SdrTextObj:
- EE_ITEMS_START, EE_ITEMS_END>{});
+ EE_ITEMS_START, EE_ITEMS_END>
+ aDest(pObj->getSdrModelFromSdrObject().GetItemPool());
aDest.Set( rSource );
pObj->SetMergedItemSet( aDest );
Degree100 nAngle = pSourceObj->GetRotateAngle();
@@ -165,7 +161,7 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr )
{
- if ( !(m_nFeatureId == COMMAND_ID_LINE_ARROW_END && m_pChartController) )
+ if ( !(m_nFeatureId == ChartCommandID::DrawLineArrowEnd && m_pChartController) )
return;
DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
@@ -184,11 +180,11 @@ void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr )
aArrow.append( aNewArrow );
}
- SfxItemSet aSet( pDrawViewWrapper->GetModel()->GetItemPool() );
+ SfxItemSet aSet(pDrawViewWrapper->GetModel().GetItemPool());
pDrawViewWrapper->GetAttributes( aSet );
tools::Long nWidth = 300; // (1/100th mm)
- if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
+ if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::INVALID )
{
tools::Long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue();
if ( nValue > 0 )
@@ -202,7 +198,7 @@ void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr )
}
// WeakComponentImplHelperBase
-void DrawCommandDispatch::disposing()
+void DrawCommandDispatch::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
}
@@ -217,27 +213,27 @@ FeatureState DrawCommandDispatch::getState( const OUString& rCommand )
aReturn.bEnabled = false;
aReturn.aState <<= false;
- sal_uInt16 nFeatureId = 0;
+ ChartCommandID nFeatureId = ChartCommandID::NONE;
OUString aBaseCommand;
OUString aCustomShapeType;
if ( parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) )
{
switch ( nFeatureId )
{
- case COMMAND_ID_OBJECT_SELECT:
- case COMMAND_ID_DRAW_LINE:
- case COMMAND_ID_LINE_ARROW_END:
- case COMMAND_ID_DRAW_RECT:
- case COMMAND_ID_DRAW_ELLIPSE:
- case COMMAND_ID_DRAW_FREELINE_NOFILL:
- case COMMAND_ID_DRAW_TEXT:
- case COMMAND_ID_DRAW_CAPTION:
- case COMMAND_ID_DRAWTBX_CS_BASIC:
- case COMMAND_ID_DRAWTBX_CS_SYMBOL:
- case COMMAND_ID_DRAWTBX_CS_ARROW:
- case COMMAND_ID_DRAWTBX_CS_FLOWCHART:
- case COMMAND_ID_DRAWTBX_CS_CALLOUT:
- case COMMAND_ID_DRAWTBX_CS_STAR:
+ case ChartCommandID::DrawObjectSelect:
+ case ChartCommandID::DrawLine:
+ case ChartCommandID::DrawLineArrowEnd:
+ case ChartCommandID::DrawRect:
+ case ChartCommandID::DrawEllipse:
+ case ChartCommandID::DrawFreelineNoFill:
+ case ChartCommandID::DrawText:
+ case ChartCommandID::DrawCaption:
+ case ChartCommandID::DrawToolboxCsBasic:
+ case ChartCommandID::DrawToolboxCsSymbol:
+ case ChartCommandID::DrawToolboxCsArrow:
+ case ChartCommandID::DrawToolboxCsFlowchart:
+ case ChartCommandID::DrawToolboxCsCallout:
+ case ChartCommandID::DrawToolboxCsStar:
{
aReturn.bEnabled = true;
aReturn.aState <<= false;
@@ -258,9 +254,9 @@ FeatureState DrawCommandDispatch::getState( const OUString& rCommand )
void DrawCommandDispatch::execute( const OUString& rCommand, const Sequence< beans::PropertyValue>& rArgs )
{
ChartDrawMode eDrawMode = CHARTDRAW_SELECT;
- SdrObjKind eKind = OBJ_NONE;
+ SdrObjKind eKind = SdrObjKind::NONE;
- sal_uInt16 nFeatureId = 0;
+ ChartCommandID nFeatureId = ChartCommandID::NONE;
OUString aBaseCommand;
OUString aCustomShapeType;
if ( !parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) )
@@ -272,65 +268,65 @@ void DrawCommandDispatch::execute( const OUString& rCommand, const Sequence< bea
switch ( nFeatureId )
{
- case COMMAND_ID_OBJECT_SELECT:
+ case ChartCommandID::DrawObjectSelect:
{
eDrawMode = CHARTDRAW_SELECT;
- eKind = OBJ_NONE;
+ eKind = SdrObjKind::NONE;
}
break;
- case COMMAND_ID_DRAW_LINE:
- case COMMAND_ID_LINE_ARROW_END:
+ case ChartCommandID::DrawLine:
+ case ChartCommandID::DrawLineArrowEnd:
{
eDrawMode = CHARTDRAW_INSERT;
- eKind = OBJ_LINE;
+ eKind = SdrObjKind::Line;
}
break;
- case COMMAND_ID_DRAW_RECT:
+ case ChartCommandID::DrawRect:
{
eDrawMode = CHARTDRAW_INSERT;
- eKind = OBJ_RECT;
+ eKind = SdrObjKind::Rectangle;
}
break;
- case COMMAND_ID_DRAW_ELLIPSE:
+ case ChartCommandID::DrawEllipse:
{
eDrawMode = CHARTDRAW_INSERT;
- eKind = OBJ_CIRC;
+ eKind = SdrObjKind::CircleOrEllipse;
}
break;
- case COMMAND_ID_DRAW_FREELINE_NOFILL:
+ case ChartCommandID::DrawFreelineNoFill:
{
eDrawMode = CHARTDRAW_INSERT;
- eKind = OBJ_FREELINE;
+ eKind = SdrObjKind::FreehandLine;
}
break;
- case COMMAND_ID_DRAW_TEXT:
+ case ChartCommandID::DrawText:
{
eDrawMode = CHARTDRAW_INSERT;
- eKind = OBJ_TEXT;
+ eKind = SdrObjKind::Text;
bCreate = true;
}
break;
- case COMMAND_ID_DRAW_CAPTION:
+ case ChartCommandID::DrawCaption:
{
eDrawMode = CHARTDRAW_INSERT;
- eKind = OBJ_CAPTION;
+ eKind = SdrObjKind::Caption;
}
break;
- case COMMAND_ID_DRAWTBX_CS_BASIC:
- case COMMAND_ID_DRAWTBX_CS_SYMBOL:
- case COMMAND_ID_DRAWTBX_CS_ARROW:
- case COMMAND_ID_DRAWTBX_CS_FLOWCHART:
- case COMMAND_ID_DRAWTBX_CS_CALLOUT:
- case COMMAND_ID_DRAWTBX_CS_STAR:
+ case ChartCommandID::DrawToolboxCsBasic:
+ case ChartCommandID::DrawToolboxCsSymbol:
+ case ChartCommandID::DrawToolboxCsArrow:
+ case ChartCommandID::DrawToolboxCsFlowchart:
+ case ChartCommandID::DrawToolboxCsCallout:
+ case ChartCommandID::DrawToolboxCsStar:
{
eDrawMode = CHARTDRAW_INSERT;
- eKind = OBJ_CUSTOMSHAPE;
+ eKind = SdrObjKind::CustomShape;
}
break;
default:
{
eDrawMode = CHARTDRAW_SELECT;
- eKind = OBJ_NONE;
+ eKind = SdrObjKind::NONE;
}
break;
}
@@ -350,26 +346,23 @@ void DrawCommandDispatch::execute( const OUString& rCommand, const Sequence< bea
pDrawViewWrapper->SetCreateMode();
}
- const OUString sKeyModifier( "KeyModifier" );
- const beans::PropertyValue* pIter = rArgs.getConstArray();
- const beans::PropertyValue* pEnd = pIter + rArgs.getLength();
- const beans::PropertyValue* pKeyModifier = std::find_if(pIter, pEnd,
- [&sKeyModifier](const beans::PropertyValue& lhs)
- {return lhs.Name == sKeyModifier;} );
+ const beans::PropertyValue* pKeyModifier = std::find_if(rArgs.begin(), rArgs.end(),
+ [](const beans::PropertyValue& lhs)
+ {return lhs.Name == "KeyModifier";} );
sal_Int16 nKeyModifier = 0;
- if ( !(pKeyModifier != pEnd && ( pKeyModifier->Value >>= nKeyModifier ) && nKeyModifier == KEY_MOD1) )
+ if ( !(pKeyModifier != rArgs.end() && ( pKeyModifier->Value >>= nKeyModifier ) && nKeyModifier == KEY_MOD1) )
return;
if ( eDrawMode != CHARTDRAW_INSERT )
return;
- SdrObject* pObj = createDefaultObject( nFeatureId );
+ rtl::Reference<SdrObject> pObj = createDefaultObject( nFeatureId );
if ( pObj )
{
SdrPageView* pPageView = pDrawViewWrapper->GetSdrPageView();
- if (pDrawViewWrapper->InsertObjectAtView(pObj, *pPageView))
+ if (pDrawViewWrapper->InsertObjectAtView(pObj.get(), *pPageView))
m_pChartController->SetAndApplySelection(Reference<drawing::XShape>(pObj->getUnoShape(), uno::UNO_QUERY));
- if ( nFeatureId == COMMAND_ID_DRAW_TEXT )
+ if ( nFeatureId == ChartCommandID::DrawText )
{
m_pChartController->StartTextEdit();
}
@@ -378,20 +371,20 @@ void DrawCommandDispatch::execute( const OUString& rCommand, const Sequence< bea
void DrawCommandDispatch::describeSupportedFeatures()
{
- implDescribeSupportedFeature( ".uno:SelectObject", COMMAND_ID_OBJECT_SELECT, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:Line", COMMAND_ID_DRAW_LINE, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:LineArrowEnd", COMMAND_ID_LINE_ARROW_END, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:Rect", COMMAND_ID_DRAW_RECT, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:Ellipse", COMMAND_ID_DRAW_ELLIPSE, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:Freeline_Unfilled", COMMAND_ID_DRAW_FREELINE_NOFILL, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DrawText", COMMAND_ID_DRAW_TEXT, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DrawCaption", COMMAND_ID_DRAW_CAPTION, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:BasicShapes", COMMAND_ID_DRAWTBX_CS_BASIC, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:SymbolShapes", COMMAND_ID_DRAWTBX_CS_SYMBOL, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:ArrowShapes", COMMAND_ID_DRAWTBX_CS_ARROW, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:FlowChartShapes", COMMAND_ID_DRAWTBX_CS_FLOWCHART, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:CalloutShapes", COMMAND_ID_DRAWTBX_CS_CALLOUT, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:StarShapes", COMMAND_ID_DRAWTBX_CS_STAR, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SelectObject", ChartCommandID::DrawObjectSelect, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:Line", ChartCommandID::DrawLine, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:LineArrowEnd", ChartCommandID::DrawLineArrowEnd, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:Rect", ChartCommandID::DrawRect, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:Ellipse", ChartCommandID::DrawEllipse, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:Freeline_Unfilled", ChartCommandID::DrawFreelineNoFill, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:DrawText", ChartCommandID::DrawText, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:DrawCaption", ChartCommandID::DrawCaption, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes", ChartCommandID::DrawToolboxCsBasic, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes", ChartCommandID::DrawToolboxCsSymbol, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes", ChartCommandID::DrawToolboxCsArrow, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes", ChartCommandID::DrawToolboxCsFlowchart, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:CalloutShapes", ChartCommandID::DrawToolboxCsCallout, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes", ChartCommandID::DrawToolboxCsStar, CommandGroup::INSERT );
}
void DrawCommandDispatch::setInsertObj(SdrObjKind eObj)
@@ -403,9 +396,9 @@ void DrawCommandDispatch::setInsertObj(SdrObjKind eObj)
}
}
-SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
+rtl::Reference<SdrObject> DrawCommandDispatch::createDefaultObject( const ChartCommandID nID )
{
- SdrObject* pObj = nullptr;
+ rtl::Reference<SdrObject> pObj;
DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : nullptr );
DrawModelWrapper* pDrawModelWrapper = ( m_pChartController ? m_pChartController->GetDrawModelWrapper() : nullptr );
@@ -433,10 +426,10 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
switch ( nID )
{
- case COMMAND_ID_DRAW_LINE:
- case COMMAND_ID_LINE_ARROW_END:
+ case ChartCommandID::DrawLine:
+ case ChartCommandID::DrawLineArrowEnd:
{
- if ( auto const pathObj = dynamic_cast<SdrPathObj*>( pObj) )
+ if ( auto const pathObj = dynamic_cast<SdrPathObj*>( pObj.get()) )
{
Point aStart = aRect.TopLeft();
Point aEnd = aRect.BottomRight();
@@ -451,9 +444,9 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
}
}
break;
- case COMMAND_ID_DRAW_FREELINE_NOFILL:
+ case ChartCommandID::DrawFreelineNoFill:
{
- if ( auto const pathObj = dynamic_cast<SdrPathObj*>( pObj) )
+ if ( auto const pathObj = dynamic_cast<SdrPathObj*>( pObj.get()) )
{
basegfx::B2DPolygon aInnerPoly;
aInnerPoly.append( basegfx::B2DPoint( aRect.Left(), aRect.Bottom() ) );
@@ -471,13 +464,13 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
}
}
break;
- case COMMAND_ID_DRAW_TEXT:
- case COMMAND_ID_DRAW_TEXT_VERTICAL:
+ case ChartCommandID::DrawText:
+ case ChartCommandID::DrawTextVertical:
{
- if ( SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pObj) )
+ if ( SdrTextObj* pTextObj = DynCastSdrTextObj( pObj.get()) )
{
pTextObj->SetLogicRect( aRect );
- bool bVertical = ( nID == COMMAND_ID_DRAW_TEXT_VERTICAL );
+ bool bVertical = ( nID == ChartCommandID::DrawTextVertical );
pTextObj->SetVerticalWriting( bVertical );
if ( bVertical )
{
@@ -491,12 +484,12 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
}
}
break;
- case COMMAND_ID_DRAW_CAPTION:
- case COMMAND_ID_DRAW_CAPTION_VERTICAL:
+ case ChartCommandID::DrawCaption:
+ case ChartCommandID::DrawCaptionVertical:
{
- if ( SdrCaptionObj* pCaptionObj = dynamic_cast<SdrCaptionObj*>( pObj) )
+ if ( SdrCaptionObj* pCaptionObj = dynamic_cast<SdrCaptionObj*>( pObj.get()) )
{
- bool bIsVertical( nID == COMMAND_ID_DRAW_CAPTION_VERTICAL );
+ bool bIsVertical( nID == ChartCommandID::DrawCaptionVertical );
pCaptionObj->SetVerticalWriting( bIsVertical );
if ( bIsVertical )
{
@@ -515,7 +508,7 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
{
pObj->SetLogicRect( aRect );
SfxItemSet aSet( pDrawModelWrapper->GetItemPool() );
- setAttributes( pObj );
+ setAttributes( pObj.get() );
pObj->SetMergedItemSet( aSet );
}
break;
@@ -527,17 +520,17 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
return pObj;
}
-bool DrawCommandDispatch::parseCommandURL( const OUString& rCommandURL, sal_uInt16* pnFeatureId,
+bool DrawCommandDispatch::parseCommandURL( const OUString& rCommandURL, ChartCommandID* pnFeatureId,
OUString* pBaseCommand, OUString* pCustomShapeType )
{
bool bFound = true;
- sal_uInt16 nFeatureId = 0;
+ ChartCommandID nFeatureId = ChartCommandID::NONE;
OUString aBaseCommand;
OUString aType;
- sal_Int32 nIndex = 1;
- OUString aToken = rCommandURL.getToken( 0, '.', nIndex );
- if ( nIndex == -1 || aToken.isEmpty() )
+ sal_Int32 nIndex = std::min(sal_Int32(1), rCommandURL.getLength());
+ std::u16string_view aToken = o3tl::getToken(rCommandURL, 0, '.', nIndex );
+ if ( nIndex == -1 || aToken.empty() )
{
aBaseCommand = rCommandURL;
SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( aBaseCommand );
@@ -547,32 +540,32 @@ bool DrawCommandDispatch::parseCommandURL( const OUString& rCommandURL, sal_uInt
switch ( nFeatureId )
{
- case COMMAND_ID_DRAWTBX_CS_BASIC:
+ case ChartCommandID::DrawToolboxCsBasic:
{
aType = "diamond";
}
break;
- case COMMAND_ID_DRAWTBX_CS_SYMBOL:
+ case ChartCommandID::DrawToolboxCsSymbol:
{
aType = "smiley";
}
break;
- case COMMAND_ID_DRAWTBX_CS_ARROW:
+ case ChartCommandID::DrawToolboxCsArrow:
{
aType = "left-right-arrow";
}
break;
- case COMMAND_ID_DRAWTBX_CS_FLOWCHART:
+ case ChartCommandID::DrawToolboxCsFlowchart:
{
aType = "flowchart-internal-storage";
}
break;
- case COMMAND_ID_DRAWTBX_CS_CALLOUT:
+ case ChartCommandID::DrawToolboxCsCallout:
{
aType = "round-rectangular-callout";
}
break;
- case COMMAND_ID_DRAWTBX_CS_STAR:
+ case ChartCommandID::DrawToolboxCsStar:
{
aType = "star5";
}
diff --git a/chart2/source/controller/main/DrawCommandDispatch.h b/chart2/source/controller/main/DrawCommandDispatch.h
deleted file mode 100644
index faf70bde1047..000000000000
--- a/chart2/source/controller/main/DrawCommandDispatch.h
+++ /dev/null
@@ -1,42 +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 .
- */
-#ifndef CHART_DRAWCOMMANDDISPATCH_HRC
-#define CHART_DRAWCOMMANDDISPATCH_HRC
-
-//Command Ids:
-#define COMMAND_ID_OBJECT_SELECT 1
-#define COMMAND_ID_DRAW_LINE 2
-#define COMMAND_ID_LINE_ARROW_END 3
-#define COMMAND_ID_DRAW_RECT 4
-#define COMMAND_ID_DRAW_ELLIPSE 5
-#define COMMAND_ID_DRAW_FREELINE_NOFILL 6
-#define COMMAND_ID_DRAW_TEXT 7
-#define COMMAND_ID_DRAW_TEXT_VERTICAL 8
-#define COMMAND_ID_DRAW_CAPTION 9
-#define COMMAND_ID_DRAW_CAPTION_VERTICAL 10
-#define COMMAND_ID_DRAWTBX_CS_BASIC 11
-#define COMMAND_ID_DRAWTBX_CS_SYMBOL 12
-#define COMMAND_ID_DRAWTBX_CS_ARROW 13
-#define COMMAND_ID_DRAWTBX_CS_FLOWCHART 14
-#define COMMAND_ID_DRAWTBX_CS_CALLOUT 15
-#define COMMAND_ID_DRAWTBX_CS_STAR 16
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/DrawCommandDispatch.hxx b/chart2/source/controller/main/DrawCommandDispatch.hxx
index febfa8338d40..65200cca6323 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.hxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.hxx
@@ -20,6 +20,7 @@
#include <svx/svdobjkind.hxx>
#include "FeatureCommandDispatchBase.hxx"
+#include <rtl/ref.hxx>
class SfxItemSet;
class SdrObject;
@@ -44,7 +45,7 @@ public:
protected:
// WeakComponentImplHelperBase
- virtual void SAL_CALL disposing() override;
+ virtual void disposing( std::unique_lock<std::mutex>& rGuard ) override;
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
@@ -60,9 +61,9 @@ protected:
private:
void setInsertObj(SdrObjKind eObj);
- SdrObject* createDefaultObject( const sal_uInt16 nID );
+ rtl::Reference<SdrObject> createDefaultObject( const ChartCommandID nID );
- bool parseCommandURL( const OUString& rCommandURL, sal_uInt16* pnFeatureId, OUString* pBaseCommand, OUString* pCustomShapeType );
+ bool parseCommandURL( const OUString& rCommandURL, ChartCommandID* pnFeatureId, OUString* pBaseCommand, OUString* pCustomShapeType );
ChartController* m_pChartController;
OUString m_aCustomShapeType;
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index aea893a66ffa..d538108ae8e9 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -25,16 +25,14 @@
#include <ResId.hxx>
#include <strings.hrc>
#include <ObjectIdentifier.hxx>
+#include <ChartController.hxx>
+#include <ChartModel.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/safeint.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/svapp.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
namespace chart { class ExplicitValueProvider; }
namespace chart
@@ -81,7 +79,7 @@ SelectorListBox::~SelectorListBox()
}
static void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectIdentifier & rParent, std::vector< ListBoxEntryData >& rEntries
- , const sal_Int32 nHierarchyDepth, const Reference< chart2::XChartDocument >& xChartDoc )
+ , const sal_Int32 nHierarchyDepth, const rtl::Reference<::chart::ChartModel>& xChartDoc )
{
ObjectHierarchy::tChildContainer aChildren( rHierarchy.getChildren(rParent) );
for (auto const& child : aChildren)
@@ -95,9 +93,9 @@ static void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const Obje
}
}
-void SelectorListBox::SetChartController( const Reference< frame::XController >& xChartController )
+void SelectorListBox::SetChartController( const rtl::Reference< ::chart::ChartController >& xChartController )
{
- m_xChartController = xChartController;
+ m_xChartController = xChartController.get();
}
void SelectorListBox::UpdateChartElementsListAndSelection()
@@ -105,26 +103,20 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
m_xWidget->clear();
m_aEntries.clear();
- Reference< frame::XController > xChartController( m_xChartController );
+ rtl::Reference< ::chart::ChartController > xChartController = m_xChartController.get();
if( xChartController.is() )
{
- Reference< view::XSelectionSupplier > xSelectionSupplier( xChartController, uno::UNO_QUERY);
- ObjectIdentifier aSelectedOID;
- OUString aSelectedCID;
- if( xSelectionSupplier.is() )
- {
- aSelectedOID = ObjectIdentifier( xSelectionSupplier->getSelection() );
- aSelectedCID = aSelectedOID.getObjectCID();
- }
+ ObjectIdentifier aSelectedOID( xChartController->getSelection() );
+ OUString aSelectedCID = aSelectedOID.getObjectCID();
- Reference< chart2::XChartDocument > xChartDoc( xChartController->getModel(), uno::UNO_QUERY );
+ rtl::Reference<::chart::ChartModel> xChartDoc = xChartController->getChartModel();
ObjectType eType( aSelectedOID.getObjectType() );
bool bAddSelectionToList = false;
if ( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL || eType == OBJECTTYPE_SHAPE )
bAddSelectionToList = true;
Reference< uno::XInterface > xChartView;
- Reference< lang::XMultiServiceFactory > xFact( xChartController->getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xFact = xChartController->getChartModel();
if( xFact.is() )
xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME );
ExplicitValueProvider* pExplicitValueProvider = nullptr; //ExplicitValueProvider::getExplicitValueProvider(xChartView); this creates all visible data points, that's too much
@@ -166,7 +158,8 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
sal_uInt16 nN=0;
for (auto const& entry : m_aEntries)
{
- m_xWidget->append_text(entry.UIName);
+ // tdf#152087 strip any newlines from the entry
+ m_xWidget->append_text(entry.UIName.replaceAll("\n", " "));
if ( !bSelectionFound && aSelectedOID == entry.OID )
{
nEntryPosToSelect = nN;
@@ -190,7 +183,7 @@ void SelectorListBox::ReleaseFocus_Impl()
return;
}
- Reference< frame::XController > xController( m_xChartController );
+ rtl::Reference< ::chart::ChartController > xController = m_xChartController.get();
Reference< frame::XFrame > xFrame( xController->getFrame() );
if ( xFrame.is() && xFrame->getContainerWindow().is() )
xFrame->getContainerWindow()->setFocus();
@@ -204,9 +197,9 @@ IMPL_LINK(SelectorListBox, SelectHdl, weld::ComboBox&, rComboBox, void)
if (o3tl::make_unsigned(nPos) < m_aEntries.size())
{
ObjectIdentifier aOID = m_aEntries[nPos].OID;
- Reference< view::XSelectionSupplier > xSelectionSupplier( m_xChartController.get(), uno::UNO_QUERY );
- if( xSelectionSupplier.is() )
- xSelectionSupplier->select( aOID.getAny() );
+ rtl::Reference< ::chart::ChartController > xController = m_xChartController.get();
+ if( xController.is() )
+ xController->select( aOID.getAny() );
}
ReleaseFocus_Impl();
}
@@ -274,11 +267,11 @@ Any SAL_CALL ElementSelectorToolbarController::queryInterface( const Type& _rTyp
aReturn = ElementSelectorToolbarController_BASE::queryInterface(_rType);
return aReturn;
}
-void SAL_CALL ElementSelectorToolbarController::acquire() throw ()
+void SAL_CALL ElementSelectorToolbarController::acquire() noexcept
{
ToolboxController::acquire();
}
-void SAL_CALL ElementSelectorToolbarController::release() throw ()
+void SAL_CALL ElementSelectorToolbarController::release() noexcept
{
ToolboxController::release();
}
@@ -291,7 +284,9 @@ void SAL_CALL ElementSelectorToolbarController::statusChanged( const frame::Feat
{
Reference< frame::XController > xChartController;
rEvent.State >>= xChartController;
- m_apSelectorListBox->SetChartController( xChartController );
+ ::chart::ChartController* pController = dynamic_cast<::chart::ChartController*>(xChartController.get());
+ assert(!xChartController || pController);
+ m_apSelectorListBox->SetChartController( pController );
m_apSelectorListBox->UpdateChartElementsListAndSelection();
}
}
diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx
index 83e605819f41..fb1e4e0527ff 100644
--- a/chart2/source/controller/main/ElementSelector.hxx
+++ b/chart2/source/controller/main/ElementSelector.hxx
@@ -20,15 +20,15 @@
#include <ObjectIdentifier.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/frame/XController.hpp>
#include <cppuhelper/implbase1.hxx>
#include <svtools/toolboxcontroller.hxx>
#include <vcl/InterimItemWindow.hxx>
-#include <cppuhelper/weakref.hxx>
+#include <unotools/weakref.hxx>
namespace chart
{
+class ChartController;
struct ListBoxEntryData
{
@@ -50,11 +50,11 @@ public:
void ReleaseFocus_Impl();
- void SetChartController( const css::uno::Reference< css::frame::XController >& xChartController );
+ void SetChartController( const rtl::Reference< ::chart::ChartController >& xChartController );
void UpdateChartElementsListAndSelection();
private:
- css::uno::WeakReference<css::frame::XController> m_xChartController;
+ unotools::WeakReference<::chart::ChartController> m_xChartController;
std::unique_ptr<weld::ComboBox> m_xWidget;
std::vector<ListBoxEntryData> m_aEntries;
@@ -82,8 +82,8 @@ public:
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
- virtual void SAL_CALL acquire() throw () override;
- virtual void SAL_CALL release() throw () override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// XStatusListener
virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx
index 90dcf77b2482..b1c5f72d1d5b 100644
--- a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx
+++ b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx
@@ -29,7 +29,7 @@ namespace chart
FeatureCommandDispatchBase::FeatureCommandDispatchBase( const Reference< uno::XComponentContext >& rxContext )
:CommandDispatch( rxContext )
- ,m_nFeatureId( 0 )
+ ,m_nFeatureId( ChartCommandID::NONE )
{
}
@@ -79,7 +79,7 @@ void FeatureCommandDispatchBase::dispatch( const util::URL& URL,
}
void FeatureCommandDispatchBase::implDescribeSupportedFeature( const char* pAsciiCommandURL,
- sal_uInt16 nId, sal_Int16 nGroup )
+ ChartCommandID nId, sal_Int16 nGroup )
{
ControllerFeature aFeature;
aFeature.Command = OUString::createFromAscii( pAsciiCommandURL );
diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
index 0c291a684d79..3ceb35ad1268 100644
--- a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
+++ b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
@@ -22,12 +22,50 @@
#include <com/sun/star/frame/DispatchInformation.hpp>
+enum class ChartCommandID
+{
+ NONE = 0,
+
+ //Draw Command Ids:
+ DrawObjectSelect = 1,
+ DrawLine = 2,
+ DrawLineArrowEnd = 3,
+ DrawRect = 4,
+ DrawEllipse = 5,
+ DrawFreelineNoFill = 6,
+ DrawText = 7,
+ DrawTextVertical = 8,
+ DrawCaption = 9,
+ DrawCaptionVertical = 10,
+ DrawToolboxCsBasic = 11,
+ DrawToolboxCsSymbol = 12,
+ DrawToolboxCsArrow = 13,
+ DrawToolboxCsFlowchart = 14,
+ DrawToolboxCsCallout = 15,
+ DrawToolboxCsStar = 16,
+
+ //Shape Controller Command Ids:
+ ShapeFormatLine = 21,
+ ShapeFormatArea = 22,
+ ShapeTextAttributes = 23,
+ ShapeTransformDialog = 24,
+ ShapeObjectTitleDescription = 25,
+ ShapeRenameObject = 26,
+ ShapeBringToFront = 28,
+ ShapeForward = 29,
+ ShapeBackward = 30,
+ ShapeSendToBack = 31,
+ ShapeFontDialog = 35,
+ ShapeParagraphDialog = 36
+};
+
+
namespace chart
{
struct ControllerFeature: public css::frame::DispatchInformation
{
- sal_uInt16 nFeatureId;
+ ChartCommandID nFeatureId;
};
typedef std::map< OUString,
@@ -84,12 +122,12 @@ protected:
the command group of the feature. This is important for configuring the controller UI
by the user, see also <type scope="css::frame">CommandGroup</type>.
*/
- void implDescribeSupportedFeature( const char* pAsciiCommandURL, sal_uInt16 nId,
+ void implDescribeSupportedFeature( const char* pAsciiCommandURL, ChartCommandID nId,
sal_Int16 nGroup );
mutable SupportedFeatures m_aSupportedFeatures;
- sal_uInt16 m_nFeatureId;
+ ChartCommandID m_nFeatureId;
};
} // namespace chart
diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx
index 32762762e827..3a215ac99522 100644
--- a/chart2/source/controller/main/ObjectHierarchy.cxx
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -19,37 +19,35 @@
#include <ObjectHierarchy.hxx>
#include <ObjectIdentifier.hxx>
-#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <chartview/ExplicitValueProvider.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
+#include <ChartModel.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
+#include <GridProperties.hxx>
#include <LegendHelper.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <map>
#include <algorithm>
-#include <iterator>
+#include <cstddef>
-#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/chart2/XTitled.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/awt/Key.hpp>
-#include <com/sun/star/awt/KeyEvent.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -60,21 +58,6 @@ using ::com::sun::star::uno::Sequence;
namespace
{
-struct lcl_ObjectToOID
-{
- explicit lcl_ObjectToOID( const Reference< chart2::XChartDocument > & xChartDoc ) :
- m_xModel( xChartDoc )
- {}
-
- ::chart::ObjectIdentifier operator() ( const Reference< uno::XInterface > & xObj )
- {
- return ::chart::ObjectIdentifier( ::chart::ObjectIdentifier::createClassifiedIdentifierForObject( xObj, m_xModel ) );
- }
-
-private:
- Reference< frame::XModel > m_xModel;
-};
-
void lcl_getChildOIDs(
::chart::ObjectHierarchy::tChildContainer& rOutChildren,
const Reference< container::XIndexAccess >& xShapes )
@@ -105,12 +88,11 @@ void lcl_getChildOIDs(
}
}
-void lcl_addAxisTitle( const Reference< XAxis >& xAxis, ::chart::ObjectHierarchy::tChildContainer& rContainer, const Reference< frame::XModel >& xChartModel )
+void lcl_addAxisTitle( const rtl::Reference< ::chart::Axis >& xAxis, ::chart::ObjectHierarchy::tChildContainer& rContainer, const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- Reference< XTitled > xAxisTitled( xAxis, uno::UNO_QUERY );
- if( xAxisTitled.is())
+ if( xAxis.is())
{
- Reference< XTitle > xAxisTitle( xAxisTitled->getTitleObject());
+ Reference< XTitle > xAxisTitle( xAxis->getTitleObject());
if( xAxisTitle.is())
rContainer.emplace_back( ::chart::ObjectIdentifier::createClassifiedIdentifierForObject( xAxisTitle, xChartModel ) );
}
@@ -121,92 +103,26 @@ void lcl_addAxisTitle( const Reference< XAxis >& xAxis, ::chart::ObjectHierarchy
namespace chart
{
-namespace impl
-{
-
-class ImplObjectHierarchy
-{
-public:
- explicit ImplObjectHierarchy(
- const Reference< XChartDocument >& xChartDocument,
- ExplicitValueProvider* pExplicitValueProvider,
- bool bFlattenDiagram, bool bOrderingForElementSelector );
-
- bool hasChildren( const ObjectIdentifier& rParent );
- ObjectHierarchy::tChildContainer getChildren( const ObjectIdentifier& rParent );
- ObjectHierarchy::tChildContainer getSiblings( const ObjectIdentifier& rNode );
-
- ObjectIdentifier getParent( const ObjectIdentifier& rOID );
-
-private:
- void createTree( const Reference< XChartDocument > & xChartDocument );
- void createAxesTree(
- ObjectHierarchy::tChildContainer & rContainer,
- const Reference< XChartDocument > & xChartDoc,
- const Reference< XDiagram > & xDiagram );
- void createDiagramTree(
- ObjectHierarchy::tChildContainer& rContainer,
- const Reference< XChartDocument >& xChartDoc,
- const Reference< XDiagram >& xDiagram );
- void createDataSeriesTree(
- ObjectHierarchy::tChildContainer & rOutDiagramSubContainer,
- const Reference< XDiagram > & xDiagram );
- static void createWallAndFloor(
- ObjectHierarchy::tChildContainer & rContainer,
- const Reference< XDiagram > & xDiagram );
- void createLegendTree(
- ObjectHierarchy::tChildContainer & rContainer,
- const Reference< XChartDocument > & xChartDoc,
- const Reference< XDiagram > & xDiagram );
- void createAdditionalShapesTree( ObjectHierarchy::tChildContainer& rContainer );
-
- ObjectIdentifier getParentImpl(
- const ObjectIdentifier& rParentOID,
- const ObjectIdentifier& rOID );
-
- typedef std::map< ObjectIdentifier, ObjectHierarchy::tChildContainer >
- tChildMap;
- tChildMap m_aChildMap;
- ExplicitValueProvider* m_pExplicitValueProvider;
- bool m_bFlattenDiagram;
- bool m_bOrderingForElementSelector;
-};
-
-ImplObjectHierarchy::ImplObjectHierarchy(
- const Reference< XChartDocument >& xChartDocument,
- ExplicitValueProvider* pExplicitValueProvider,
- bool bFlattenDiagram,
- bool bOrderingForElementSelector ) :
- m_pExplicitValueProvider( pExplicitValueProvider ),
- m_bFlattenDiagram( bFlattenDiagram ),
- m_bOrderingForElementSelector( bOrderingForElementSelector )
-{
- createTree( xChartDocument );
- // don't remember this helper to avoid access after lifetime
- m_pExplicitValueProvider = nullptr;
-}
-
-void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartDocument )
+void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xChartDocument )
{
- m_aChildMap = tChildMap();//clear tree
+ m_aChildMap.clear();
if( !xChartDocument.is() )
return;
//@todo: change ObjectIdentifier to take an XChartDocument rather than XModel
- Reference< frame::XModel > xModel = xChartDocument;
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDocument ) );
+ rtl::Reference< Diagram > xDiagram = xChartDocument->getFirstChartDiagram();
ObjectIdentifier aDiaOID;
if( xDiagram.is() )
- aDiaOID = ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram, xModel ) );
- ObjectHierarchy::tChildContainer aTopLevelContainer;
+ aDiaOID = ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( static_cast<cppu::OWeakObject*>(xDiagram.get()), xChartDocument ) );
+ tChildContainer aTopLevelContainer;
// First Level
// Chart Area
if( m_bOrderingForElementSelector )
{
- aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) );
+ aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) );
if( xDiagram.is() )
{
aTopLevelContainer.push_back( aDiaOID );
@@ -216,31 +132,23 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD
}
// Main Title
- Reference< XTitled > xDocTitled( xChartDocument, uno::UNO_QUERY );
- if( xDocTitled.is())
- {
- Reference< XTitle > xMainTitle( xDocTitled->getTitleObject());
- if( xMainTitle.is())
- aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForObject( xMainTitle, xModel ) );
- }
+ Reference< XTitle > xMainTitle( xChartDocument->getTitleObject());
+ if( xMainTitle.is())
+ aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForObject( xMainTitle, xChartDocument ) );
if( xDiagram.is())
{
// Sub Title. Note: This is interpreted of being top level
- Reference< XTitled > xDiaTitled( xDiagram, uno::UNO_QUERY );
- if( xDiaTitled.is())
- {
- Reference< XTitle > xSubTitle( xDiaTitled->getTitleObject());
- if( xSubTitle.is())
- aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForObject( xSubTitle, xModel ) );
- }
+ Reference< XTitle > xSubTitle( xDiagram->getTitleObject());
+ if( xSubTitle.is())
+ aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForObject( xSubTitle, xChartDocument ) );
if( !m_bOrderingForElementSelector )
{
// Axis Titles. Note: These are interpreted of being top level
- const Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
- for( Reference< XAxis > const & axis : aAxes )
- lcl_addAxisTitle( axis, aTopLevelContainer, xModel );
+ const std::vector< rtl::Reference< Axis > > aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
+ for( rtl::Reference< Axis > const & axis : aAxes )
+ lcl_addAxisTitle( axis, aTopLevelContainer, xChartDocument );
// Diagram
aTopLevelContainer.push_back( aDiaOID );
@@ -250,7 +158,7 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD
createDiagramTree( aTopLevelContainer, xChartDocument, xDiagram );
else
{
- ObjectHierarchy::tChildContainer aSubContainer;
+ tChildContainer aSubContainer;
createDiagramTree( aSubContainer, xChartDocument, xDiagram );
if( !aSubContainer.empty() )
m_aChildMap[ aDiaOID ] = aSubContainer;
@@ -268,16 +176,16 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD
// Chart Area
if( !m_bOrderingForElementSelector )
- aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) );
+ aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) );
if( ! aTopLevelContainer.empty())
- m_aChildMap[ ObjectHierarchy::getRootNodeOID() ] = aTopLevelContainer;
+ m_aChildMap[ObjectHierarchy::getRootNodeOID()] = aTopLevelContainer;
}
-void ImplObjectHierarchy::createLegendTree(
- ObjectHierarchy::tChildContainer & rContainer,
- const Reference< XChartDocument > & xChartDoc,
- const Reference< XDiagram > & xDiagram )
+void ObjectHierarchy::createLegendTree(
+ tChildContainer & rContainer,
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
+ const rtl::Reference< Diagram > & xDiagram )
{
if( !(xDiagram.is() && LegendHelper::hasLegend( xDiagram )) )
return;
@@ -288,38 +196,46 @@ void ImplObjectHierarchy::createLegendTree(
// iterate over child shapes of legend and search for matching CIDs
if( m_pExplicitValueProvider )
{
- Reference< container::XIndexAccess > xLegendShapeContainer(
- m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ), uno::UNO_QUERY );
- ObjectHierarchy::tChildContainer aLegendEntryOIDs;
+ rtl::Reference< SvxShapeGroupAnyD > xLegendShapeContainer =
+ dynamic_cast<SvxShapeGroupAnyD*>(
+ m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ).get() );
+ tChildContainer aLegendEntryOIDs;
lcl_getChildOIDs( aLegendEntryOIDs, xLegendShapeContainer );
m_aChildMap[ aLegendOID ] = aLegendEntryOIDs;
}
}
-void ImplObjectHierarchy::createAxesTree(
- ObjectHierarchy::tChildContainer & rContainer,
- const Reference< XChartDocument > & xChartDoc,
- const Reference< XDiagram > & xDiagram )
+void ObjectHierarchy::createAxesTree(
+ tChildContainer & rContainer,
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
+ const rtl::Reference< Diagram > & xDiagram )
{
- Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
- uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) );
bool bSupportsAxesGrids = ChartTypeHelper::isSupportingMainAxis( xChartType, nDimensionCount, 0 );
if( !bSupportsAxesGrids )
return;
- Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true ) );
+ // Data Table
+ uno::Reference<chart2::XDataTable> xDataTable = xDiagram->getDataTable();
+ if (xDataTable.is())
+ {
+ rContainer.push_back(ObjectIdentifier::createClassifiedIdentifierForObject(xDataTable, xChartDoc));
+ }
+
+ // Axes
+ std::vector< rtl::Reference< Axis > > aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true );
if( !m_bOrderingForElementSelector )
- std::transform( aAxes.begin(), aAxes.end(),
- std::back_inserter( rContainer ),
- lcl_ObjectToOID( xChartDoc ));
+ {
+ for (const auto& rAxis : aAxes)
+ rContainer.push_back( ObjectIdentifier::createClassifiedIdentifierForObject( rAxis, xChartDoc ) );
+ }
// get all axes, also invisible ones
aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
// Grids
- Reference< frame::XModel > xChartModel = xChartDoc;
- for( Reference< XAxis > const & xAxis : std::as_const(aAxes) )
+ for( rtl::Reference< Axis > const & xAxis : aAxes )
{
if(!xAxis.is())
continue;
@@ -335,55 +251,53 @@ void ImplObjectHierarchy::createAxesTree(
{
// axis
if( AxisHelper::isAxisVisible( xAxis ) )
- rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, xChartModel ) );
+ rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, xChartDoc ) );
// axis title
- lcl_addAxisTitle( xAxis, rContainer, xChartModel );
+ lcl_addAxisTitle( xAxis, rContainer, xChartDoc );
}
- Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() );
+ rtl::Reference< ::chart::GridProperties > xGridProperties( xAxis->getGridProperties2() );
if( AxisHelper::isGridVisible( xGridProperties ) )
{
//main grid
- rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel ) );
+ rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartDoc ) );
}
- Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
- sal_Int32 nSubGrid = 0;
- for( nSubGrid = 0; nSubGrid < aSubGrids.getLength(); ++nSubGrid )
+ std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
+ for( size_t nSubGrid = 0; nSubGrid < aSubGrids.size(); ++nSubGrid )
{
- Reference< beans::XPropertySet > xSubGridProperties( aSubGrids[nSubGrid] );
- if( AxisHelper::isGridVisible( xSubGridProperties ) )
+ if( AxisHelper::isGridVisible( aSubGrids[nSubGrid] ) )
{
//sub grid
- rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGrid ) );
+ rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartDoc, nSubGrid ) );
}
}
}
}
-void ImplObjectHierarchy::createWallAndFloor(
- ObjectHierarchy::tChildContainer & rContainer,
- const Reference< XDiagram > & xDiagram )
+void ObjectHierarchy::createWallAndFloor(
+ tChildContainer & rContainer,
+ const rtl::Reference< Diagram > & xDiagram )
{
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
bool bIsThreeD = ( nDimensionCount == 3 );
- bool bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram );
+ bool bHasWall = xDiagram->isSupportingFloorAndWall();
if( bHasWall && bIsThreeD )
{
- rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, OUString() ) );
+ rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" ) );
Reference< beans::XPropertySet > xFloor( xDiagram->getFloor());
if( xFloor.is())
- rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, OUString() ) );
+ rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, u"" ) );
}
}
-void ImplObjectHierarchy::createDiagramTree(
- ObjectHierarchy::tChildContainer & rContainer,
- const Reference< XChartDocument > & xChartDoc,
- const Reference< XDiagram > & xDiagram )
+void ObjectHierarchy::createDiagramTree(
+ tChildContainer & rContainer,
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
+ const rtl::Reference< Diagram > & xDiagram )
{
if( !m_bOrderingForElementSelector )
{
@@ -398,28 +312,24 @@ void ImplObjectHierarchy::createDiagramTree(
}
}
-void ImplObjectHierarchy::createDataSeriesTree(
- ObjectHierarchy::tChildContainer & rOutDiagramSubContainer,
- const Reference< XDiagram > & xDiagram )
+void ObjectHierarchy::createDataSeriesTree(
+ tChildContainer & rOutDiagramSubContainer,
+ const rtl::Reference< Diagram > & xDiagram )
{
- Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
-
try
{
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
- Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
+ std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq(
+ xDiagram->getBaseCoordinateSystems());
+ for( std::size_t nCooSysIdx=0; nCooSysIdx<aCooSysSeq.size(); ++nCooSysIdx )
{
- Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
- Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
- for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypeSeq.getLength(); ++nCTIdx )
+ std::vector< rtl::Reference< ChartType > > aChartTypeSeq( aCooSysSeq[nCooSysIdx]->getChartTypes2());
+ for( std::size_t nCTIdx=0; nCTIdx<aChartTypeSeq.size(); ++nCTIdx )
{
- Reference< XChartType > xChartType( aChartTypeSeq[nCTIdx] );
- Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() );
+ rtl::Reference< ChartType > xChartType( aChartTypeSeq[nCTIdx] );
+ std::vector< rtl::Reference< DataSeries > > aSeriesSeq( xChartType->getDataSeries2() );
const sal_Int32 nNumberOfSeries =
- ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.getLength());
+ ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.size());
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<nNumberOfSeries; ++nSeriesIdx )
{
@@ -430,9 +340,9 @@ void ImplObjectHierarchy::createDataSeriesTree(
ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForParticle( aSeriesParticle ) ) );
rOutDiagramSubContainer.push_back( aSeriesOID );
- ObjectHierarchy::tChildContainer aSeriesSubContainer;
+ tChildContainer aSeriesSubContainer;
- Reference< chart2::XDataSeries > const & xSeries = aSeriesSeq[nSeriesIdx];
+ rtl::Reference< DataSeries > const & xSeries = aSeriesSeq[nSeriesIdx];
// data labels
if( DataSeriesHelper::hasDataLabelsAtSeries( xSeries ) )
@@ -444,45 +354,38 @@ void ImplObjectHierarchy::createDataSeriesTree(
// Statistics
if( ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount ) )
{
- Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
- if( xCurveCnt.is())
+ const std::vector< rtl::Reference< RegressionCurveModel > > & rCurves( xSeries->getRegressionCurves2());
+ for( size_t nCurveIdx=0; nCurveIdx<rCurves.size(); ++nCurveIdx )
{
- Sequence< Reference< chart2::XRegressionCurve > > aCurves( xCurveCnt->getRegressionCurves());
- for( sal_Int32 nCurveIdx=0; nCurveIdx<aCurves.getLength(); ++nCurveIdx )
+ bool bIsAverageLine = RegressionCurveHelper::isMeanValueLine( rCurves[nCurveIdx] );
+ aSeriesSubContainer.emplace_back( ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, bIsAverageLine ) );
+ if( RegressionCurveHelper::hasEquation( rCurves[nCurveIdx] ) )
{
- bool bIsAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] );
- aSeriesSubContainer.emplace_back( ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, bIsAverageLine ) );
- if( RegressionCurveHelper::hasEquation( aCurves[nCurveIdx] ) )
- {
- aSeriesSubContainer.emplace_back( ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) );
- }
+ aSeriesSubContainer.emplace_back( ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) );
}
- Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
- Reference< beans::XPropertySet > xErrorBarProp;
- if( xSeriesProp.is() &&
- (xSeriesProp->getPropertyValue( CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarProp) &&
- xErrorBarProp.is())
+ }
+ Reference< beans::XPropertySet > xErrorBarProp;
+ if( (xSeries->getPropertyValue( CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarProp) &&
+ xErrorBarProp.is())
+ {
+ sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
+ if( ( xErrorBarProp->getPropertyValue( "ErrorBarStyle") >>= nStyle ) &&
+ ( nStyle != css::chart::ErrorBarStyle::NONE ) )
{
- sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
- if( ( xErrorBarProp->getPropertyValue( "ErrorBarStyle") >>= nStyle ) &&
- ( nStyle != css::chart::ErrorBarStyle::NONE ) )
- {
- aSeriesSubContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierWithParent(
- OBJECTTYPE_DATA_ERRORS_Y, OUString(), aSeriesParticle ) );
- }
+ aSeriesSubContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS_Y, u"", aSeriesParticle ) );
}
+ }
- if( xSeriesProp.is() &&
- (xSeriesProp->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarProp) &&
- xErrorBarProp.is())
+ if( (xSeries->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarProp) &&
+ xErrorBarProp.is())
+ {
+ sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
+ if( ( xErrorBarProp->getPropertyValue( "ErrorBarStyle") >>= nStyle ) &&
+ ( nStyle != css::chart::ErrorBarStyle::NONE ) )
{
- sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
- if( ( xErrorBarProp->getPropertyValue( "ErrorBarStyle") >>= nStyle ) &&
- ( nStyle != css::chart::ErrorBarStyle::NONE ) )
- {
- aSeriesSubContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierWithParent(
- OBJECTTYPE_DATA_ERRORS_X, OUString(), aSeriesParticle ) );
- }
+ aSeriesSubContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS_X, u"", aSeriesParticle ) );
}
}
}
@@ -491,8 +394,9 @@ void ImplObjectHierarchy::createDataSeriesTree(
// iterate over child shapes of legend and search for matching CIDs
if( m_pExplicitValueProvider )
{
- Reference< container::XIndexAccess > xSeriesShapeContainer(
- m_pExplicitValueProvider->getShapeForCID( aSeriesOID.getObjectCID() ), uno::UNO_QUERY );
+ rtl::Reference< SvxShapeGroupAnyD > xSeriesShapeContainer =
+ dynamic_cast<SvxShapeGroupAnyD*>(
+ m_pExplicitValueProvider->getShapeForCID( aSeriesOID.getObjectCID() ).get() );
lcl_getChildOIDs( aSeriesSubContainer, xSeriesShapeContainer );
}
@@ -508,20 +412,19 @@ void ImplObjectHierarchy::createDataSeriesTree(
}
}
-void ImplObjectHierarchy::createAdditionalShapesTree( ObjectHierarchy::tChildContainer& rContainer )
+void ObjectHierarchy::createAdditionalShapesTree(tChildContainer& rContainer)
{
try
{
if ( m_pExplicitValueProvider )
{
- Reference< drawing::XDrawPage > xDrawPage( m_pExplicitValueProvider->getDrawModelWrapper()->getMainDrawPage() );
- Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY_THROW );
+ rtl::Reference<SvxDrawPage> xDrawPage( m_pExplicitValueProvider->getDrawModelWrapper()->getMainDrawPage() );
Reference< drawing::XShapes > xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
- sal_Int32 nCount = xDrawPageShapes->getCount();
+ sal_Int32 nCount = xDrawPage->getCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
Reference< drawing::XShape > xShape;
- if ( xDrawPageShapes->getByIndex( i ) >>= xShape )
+ if ( xDrawPage->getByIndex( i ) >>= xShape )
{
if ( xShape.is() && xShape != xChartRoot )
{
@@ -537,7 +440,7 @@ void ImplObjectHierarchy::createAdditionalShapesTree( ObjectHierarchy::tChildCon
}
}
-bool ImplObjectHierarchy::hasChildren( const ObjectIdentifier& rParent )
+bool ObjectHierarchy::hasChildren( const ObjectIdentifier& rParent ) const
{
if ( rParent.isValid() )
{
@@ -548,7 +451,7 @@ bool ImplObjectHierarchy::hasChildren( const ObjectIdentifier& rParent )
return false;
}
-ObjectHierarchy::tChildContainer ImplObjectHierarchy::getChildren( const ObjectIdentifier& rParent )
+const ObjectHierarchy::tChildContainer & ObjectHierarchy::getChildren( const ObjectIdentifier& rParent ) const
{
if ( rParent.isValid() )
{
@@ -556,31 +459,33 @@ ObjectHierarchy::tChildContainer ImplObjectHierarchy::getChildren( const ObjectI
if( aIt != m_aChildMap.end())
return aIt->second;
}
- return ObjectHierarchy::tChildContainer();
+ static const tChildContainer EMPTY;
+ return EMPTY;
}
-ObjectHierarchy::tChildContainer ImplObjectHierarchy::getSiblings( const ObjectIdentifier& rNode )
+const ObjectHierarchy::tChildContainer & ObjectHierarchy::getSiblings( const ObjectIdentifier& rNode ) const
{
if ( rNode.isValid() && !ObjectHierarchy::isRootNode( rNode ) )
{
for (auto const& child : m_aChildMap)
{
- ObjectHierarchy::tChildContainer::const_iterator aElemIt(
+ tChildContainer::const_iterator aElemIt(
std::find( child.second.begin(), child.second.end(), rNode ));
if( aElemIt != child.second.end())
return child.second;
}
}
- return ObjectHierarchy::tChildContainer();
+ static const tChildContainer EMPTY;
+ return EMPTY;
}
-ObjectIdentifier ImplObjectHierarchy::getParentImpl(
+ObjectIdentifier ObjectHierarchy::getParentImpl(
const ObjectIdentifier & rParentOID,
- const ObjectIdentifier & rOID )
+ const ObjectIdentifier & rOID ) const
{
// search children
- ObjectHierarchy::tChildContainer aChildren( getChildren( rParentOID ));
- ObjectHierarchy::tChildContainer::const_iterator aIt(
+ tChildContainer aChildren( getChildren( rParentOID ));
+ tChildContainer::const_iterator aIt(
std::find( aChildren.begin(), aChildren.end(), rOID ));
// recursion end
if( aIt != aChildren.end())
@@ -601,21 +506,25 @@ ObjectIdentifier ImplObjectHierarchy::getParentImpl(
return ObjectIdentifier();
}
-ObjectIdentifier ImplObjectHierarchy::getParent(
- const ObjectIdentifier & rOID )
+ObjectIdentifier ObjectHierarchy::getParent(
+ const ObjectIdentifier & rOID ) const
{
return getParentImpl( ObjectHierarchy::getRootNodeOID(), rOID );
}
-} // namespace impl
-
ObjectHierarchy::ObjectHierarchy(
- const Reference< XChartDocument > & xChartDocument,
+ const rtl::Reference<::chart::ChartModel> & xChartDocument,
ExplicitValueProvider * pExplicitValueProvider /* = 0 */,
bool bFlattenDiagram /* = false */,
bool bOrderingForElementSelector /* = false */) :
- m_apImpl( new impl::ImplObjectHierarchy( xChartDocument, pExplicitValueProvider, bFlattenDiagram, bOrderingForElementSelector ))
-{}
+ m_pExplicitValueProvider( pExplicitValueProvider ),
+ m_bFlattenDiagram( bFlattenDiagram ),
+ m_bOrderingForElementSelector( bOrderingForElementSelector )
+{
+ createTree( xChartDocument );
+ // don't remember this helper to avoid access after lifetime
+ m_pExplicitValueProvider = nullptr;
+}
ObjectHierarchy::~ObjectHierarchy()
{}
@@ -630,45 +539,16 @@ bool ObjectHierarchy::isRootNode( const ObjectIdentifier& rOID )
return ( rOID == ObjectHierarchy::getRootNodeOID() );
}
-ObjectHierarchy::tChildContainer ObjectHierarchy::getTopLevelChildren() const
-{
- return m_apImpl->getChildren( ObjectHierarchy::getRootNodeOID());
-}
-
-bool ObjectHierarchy::hasChildren( const ObjectIdentifier& rParent ) const
-{
- return m_apImpl->hasChildren( rParent );
-}
-
-ObjectHierarchy::tChildContainer ObjectHierarchy::getChildren(
- const ObjectIdentifier& rParent ) const
-{
- if ( rParent.isValid() )
- return m_apImpl->getChildren( rParent );
-
- return ObjectHierarchy::tChildContainer();
-}
-
-ObjectHierarchy::tChildContainer ObjectHierarchy::getSiblings(
- const ObjectIdentifier& rNode ) const
-{
- if ( rNode.isValid() && !isRootNode( rNode ) )
- return m_apImpl->getSiblings( rNode );
-
- return ObjectHierarchy::tChildContainer();
-}
-
-ObjectIdentifier ObjectHierarchy::getParent(
- const ObjectIdentifier& rNode ) const
+const ObjectHierarchy::tChildContainer & ObjectHierarchy::getTopLevelChildren() const
{
- return m_apImpl->getParent( rNode );
+ return getChildren( ObjectHierarchy::getRootNodeOID());
}
sal_Int32 ObjectHierarchy::getIndexInParent(
const ObjectIdentifier& rNode ) const
{
- ObjectIdentifier aParentOID( m_apImpl->getParent( rNode ));
- tChildContainer aChildren( m_apImpl->getChildren( aParentOID ) );
+ ObjectIdentifier aParentOID( getParent( rNode ));
+ const tChildContainer & aChildren( getChildren( aParentOID ) );
sal_Int32 nIndex = 0;
for (auto const& child : aChildren)
{
@@ -680,11 +560,11 @@ sal_Int32 ObjectHierarchy::getIndexInParent(
}
ObjectKeyNavigation::ObjectKeyNavigation(
- const ObjectIdentifier & rCurrentOID,
- const Reference< chart2::XChartDocument > & xChartDocument,
+ ObjectIdentifier aCurrentOID,
+ rtl::Reference<::chart::ChartModel> xChartDocument,
ExplicitValueProvider * pExplicitValueProvider /* = 0 */ ) :
- m_aCurrentOID( rCurrentOID ),
- m_xChartDocument( xChartDocument ),
+ m_aCurrentOID(std::move( aCurrentOID )),
+ m_xChartDocument(std::move( xChartDocument )),
m_pExplicitValueProvider( pExplicitValueProvider )
{
if ( !m_aCurrentOID.isValid() )
diff --git a/chart2/source/controller/main/PositionAndSizeHelper.cxx b/chart2/source/controller/main/PositionAndSizeHelper.cxx
index 63ddb818fd0d..8cad36404fdc 100644
--- a/chart2/source/controller/main/PositionAndSizeHelper.cxx
+++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx
@@ -20,13 +20,12 @@
#include <PositionAndSizeHelper.hxx>
#include <ControllerLockGuard.hxx>
#include <com/sun/star/chart/ChartLegendExpansion.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <tools/gen.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
+#include <ChartModel.hxx>
+#include <Diagram.hxx>
namespace chart
{
@@ -46,7 +45,7 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
tools::Rectangle aPageRect( Point(rPageRectangle.X,rPageRectangle.Y), Size(rPageRectangle.Width,rPageRectangle.Height) );
// every following branch divides by width and height
- if (aPageRect.getWidth() == 0 || aPageRect.getHeight() == 0)
+ if (aPageRect.getOpenWidth() == 0 || aPageRect.getOpenHeight() == 0)
return false;
if( eObjectType==OBJECTTYPE_TITLE )
@@ -56,16 +55,16 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
aRelativePosition.Anchor = drawing::Alignment_CENTER;
//the anchor point at the title object is top/middle
Point aPos = aObjectRect.TopLeft();
- aRelativePosition.Primary = (double(aPos.X())+double(aObjectRect.getWidth())/2.0)/double(aPageRect.getWidth());
- aRelativePosition.Secondary = (double(aPos.Y())+double(aObjectRect.getHeight())/2.0)/double(aPageRect.getHeight());
+ aRelativePosition.Primary = (double(aPos.X())+double(aObjectRect.getOpenWidth())/2.0)/double(aPageRect.getOpenWidth());
+ aRelativePosition.Secondary = (double(aPos.Y())+double(aObjectRect.getOpenHeight())/2.0)/double(aPageRect.getOpenHeight());
xObjectProp->setPropertyValue( "RelativePosition", uno::Any(aRelativePosition) );
}
else if( eObjectType == OBJECTTYPE_DATA_LABEL )
{
RelativePosition aAbsolutePosition;
RelativePosition aCustomLabelPosition;
- aAbsolutePosition.Primary = double(rOldPositionAndSize.X) / double(aPageRect.getWidth());
- aAbsolutePosition.Secondary = double(rOldPositionAndSize.Y) / double(aPageRect.getHeight());
+ aAbsolutePosition.Primary = double(rOldPositionAndSize.X) / double(aPageRect.getOpenWidth());
+ aAbsolutePosition.Secondary = double(rOldPositionAndSize.Y) / double(aPageRect.getOpenHeight());
if( xObjectProp->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition )
{
@@ -82,8 +81,8 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
else if( fRotation == 270.0 )
aPos = aObjectRect.TopRight();
- aCustomLabelPosition.Primary = double(aPos.X()) / double(aPageRect.getWidth()) - aAbsolutePosition.Primary;
- aCustomLabelPosition.Secondary = double(aPos.Y()) / double(aPageRect.getHeight()) - aAbsolutePosition.Secondary;
+ aCustomLabelPosition.Primary = double(aPos.X()) / double(aPageRect.getOpenWidth()) - aAbsolutePosition.Primary;
+ aCustomLabelPosition.Secondary = double(aPos.Y()) / double(aPageRect.getOpenHeight()) - aAbsolutePosition.Secondary;
xObjectProp->setPropertyValue("CustomLabelPosition", uno::Any(aCustomLabelPosition));
}
else if( eObjectType==OBJECTTYPE_DATA_CURVE_EQUATION )
@@ -93,8 +92,8 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
//the anchor point at the title object is top/middle
Point aPos = aObjectRect.TopLeft();
- aRelativePosition.Primary = double(aPos.X())/double(aPageRect.getWidth());
- aRelativePosition.Secondary = double(aPos.Y())/double(aPageRect.getHeight());
+ aRelativePosition.Primary = double(aPos.X())/double(aPageRect.getOpenWidth());
+ aRelativePosition.Secondary = double(aPos.Y())/double(aPageRect.getOpenHeight());
xObjectProp->setPropertyValue( "RelativePosition", uno::Any(aRelativePosition) );
}
else if(eObjectType==OBJECTTYPE_LEGEND)
@@ -106,21 +105,21 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
aRelativePosition.Primary =
static_cast< double >( aAnchor.X()) /
- static_cast< double >( aPageRect.getWidth() );
+ static_cast< double >( aPageRect.getOpenWidth() );
aRelativePosition.Secondary =
static_cast< double >( aAnchor.Y()) /
- static_cast< double >( aPageRect.getHeight());
+ static_cast< double >( aPageRect.getOpenHeight());
xObjectProp->setPropertyValue( "RelativePosition", uno::Any(aRelativePosition) );
aRelativeSize.Primary =
- static_cast< double >( aObjectRect.getWidth()) /
- static_cast< double >( aPageRect.getWidth() );
+ static_cast< double >( aObjectRect.getOpenWidth()) /
+ static_cast< double >( aPageRect.getOpenWidth() );
if (aRelativeSize.Primary > 1.0)
aRelativeSize.Primary = 1.0;
aRelativeSize.Secondary =
- static_cast< double >( aObjectRect.getHeight()) /
- static_cast< double >( aPageRect.getHeight());
+ static_cast< double >( aObjectRect.getOpenHeight()) /
+ static_cast< double >( aPageRect.getOpenHeight());
if (aRelativeSize.Secondary > 1.0)
aRelativeSize.Secondary = 1.0;
@@ -135,16 +134,16 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
aRelativePosition.Anchor = drawing::Alignment_CENTER;
Point aPos = aObjectRect.Center();
- aRelativePosition.Primary = double(aPos.X())/double(aPageRect.getWidth());
- aRelativePosition.Secondary = double(aPos.Y())/double(aPageRect.getHeight());
+ aRelativePosition.Primary = double(aPos.X())/double(aPageRect.getOpenWidth());
+ aRelativePosition.Secondary = double(aPos.Y())/double(aPageRect.getOpenHeight());
xObjectProp->setPropertyValue( "RelativePosition", uno::Any(aRelativePosition) );
//set size:
RelativeSize aRelativeSize;
//the anchor points for the diagram are in the middle of the diagram
//and in the middle of the page
- aRelativeSize.Primary = double(aObjectRect.getWidth())/double(aPageRect.getWidth());
- aRelativeSize.Secondary = double(aObjectRect.getHeight())/double(aPageRect.getHeight());
+ aRelativeSize.Primary = double(aObjectRect.getOpenWidth())/double(aPageRect.getOpenWidth());
+ aRelativeSize.Secondary = double(aObjectRect.getOpenHeight())/double(aPageRect.getOpenHeight());
xObjectProp->setPropertyValue( "RelativeSize", uno::Any(aRelativeSize) );
}
else
@@ -152,8 +151,8 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
return true;
}
-bool PositionAndSizeHelper::moveObject( const OUString& rObjectCID
- , const uno::Reference< frame::XModel >& xChartModel
+bool PositionAndSizeHelper::moveObject( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, const awt::Rectangle& rNewPositionAndSize
, const awt::Rectangle& rOldPositionAndSize
, const awt::Rectangle& rPageRectangle
@@ -167,7 +166,7 @@ bool PositionAndSizeHelper::moveObject( const OUString& rObjectCID
ObjectType eObjectType( ObjectIdentifier::getObjectType( rObjectCID ) );
if(eObjectType==OBJECTTYPE_DIAGRAM || eObjectType==OBJECTTYPE_DIAGRAM_WALL || eObjectType==OBJECTTYPE_DIAGRAM_FLOOR)
{
- xObjectProp.set( ObjectIdentifier::getDiagramForCID( rObjectCID, xChartModel ), uno::UNO_QUERY );
+ xObjectProp = ObjectIdentifier::getDiagramForCID( rObjectCID, xChartModel );
if(!xObjectProp.is())
return false;
}
diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx
index 29c71c5c1097..de2ad664abe5 100644
--- a/chart2/source/controller/main/SelectionHelper.cxx
+++ b/chart2/source/controller/main/SelectionHelper.cxx
@@ -19,16 +19,16 @@
#include <SelectionHelper.hxx>
#include <ObjectIdentifier.hxx>
-#include <DiagramHelper.hxx>
-#include <ChartModelHelper.hxx>
+#include <Diagram.hxx>
+#include <ChartModel.hxx>
-#include <com/sun/star/frame/XModel.hpp>
#include <svx/svdpage.hxx>
#include <svx/svditer.hxx>
#include <svx/obj3d.hxx>
#include <svx/svdopath.hxx>
#include <vcl/svapp.hxx>
#include <basegfx/point/b2dpoint.hxx>
+#include <osl/diagnose.h>
namespace chart
{
@@ -242,7 +242,7 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper
if ( !m_aSelectedOID.isAdditionalShape() )
{
- OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) );//@todo read CID from model
+ OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) );//@todo read CID from model
if ( !m_aSelectedOID.isAutoGeneratedObject() )
{
@@ -251,7 +251,7 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper
//check whether the diagram was hit but not selected (e.g. because it has no filling):
OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) );
- OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, OUString() ) );//@todo read CID from model
+ OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" ) );//@todo read CID from model
bool bBackGroundHit = m_aSelectedOID.getObjectCID() == aPageCID || m_aSelectedOID.getObjectCID() == aWallCID || !m_aSelectedOID.isAutoGeneratedObject();
if( bBackGroundHit )
{
@@ -302,7 +302,7 @@ bool Selection::isResizeableObjectSelected() const
}
}
-bool Selection::isRotateableObjectSelected( const uno::Reference< frame::XModel >& xChartModel ) const
+bool Selection::isRotateableObjectSelected( const rtl::Reference<::chart::ChartModel>& xChartModel ) const
{
return SelectionHelper::isRotateableObject( m_aSelectedOID.getObjectCID(), xChartModel );
}
@@ -312,6 +312,11 @@ bool Selection::isDragableObjectSelected() const
return m_aSelectedOID.isDragableObject();
}
+bool Selection::isTitleObjectSelected() const
+{
+ return m_aSelectedOID.getObjectType() == OBJECTTYPE_TITLE;
+}
+
bool Selection::isAdditionalShapeSelected() const
{
return m_aSelectedOID.isAdditionalShape();
@@ -401,7 +406,7 @@ OUString SelectionHelper::getHitObjectCID(
aRet.clear();
}
- OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) );//@todo read CID from model
+ OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) );//@todo read CID from model
//get page when nothing was hit
if( aRet.isEmpty() && !pNewObj )
{
@@ -426,12 +431,11 @@ OUString SelectionHelper::getHitObjectCID(
}
else if( bGetDiagramInsteadOf_Wall )
{
- OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, OUString() ) );//@todo read CID from model
+ OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" ) );//@todo read CID from model
if( aRet == aWallCID )
{
- OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) );
- aRet = aDiagramCID;
+ aRet = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) );
}
}
}
@@ -440,13 +444,13 @@ OUString SelectionHelper::getHitObjectCID(
// \\- solar mutex
}
-bool SelectionHelper::isRotateableObject( const OUString& rCID
- , const uno::Reference< frame::XModel >& xChartModel )
+bool SelectionHelper::isRotateableObject( std::u16string_view rCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
if( !ObjectIdentifier::isRotateableObject( rCID ) )
return false;
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( ChartModelHelper::findDiagram( xChartModel ) );
+ sal_Int32 nDimensionCount = xChartModel->getFirstChartDiagram()->getDimension();
return nDimensionCount == 3;
}
@@ -463,7 +467,7 @@ SelectionHelper::~SelectionHelper()
bool SelectionHelper::getFrameDragSingles()
{
//true == green == surrounding handles
- return dynamic_cast<const E3dObject*>( m_pSelectedObj) == nullptr;
+ return DynCastE3dObject( m_pSelectedObj) == nullptr;
}
SdrObject* SelectionHelper::getMarkHandlesObject( SdrObject* pObj )
@@ -530,7 +534,7 @@ E3dScene* SelectionHelper::getSceneToRotate( SdrObject* pObj )
if(pObj)
{
- pRotateable = dynamic_cast<E3dObject*>(pObj);
+ pRotateable = DynCastE3dObject(pObj);
if( !pRotateable )
{
SolarMutexGuard aSolarGuard;
@@ -540,8 +544,7 @@ E3dScene* SelectionHelper::getSceneToRotate( SdrObject* pObj )
SdrObjListIter aIterator(pSubList, SdrIterMode::DeepWithGroups);
while( aIterator.IsMore() && !pRotateable )
{
- SdrObject* pSubObj = aIterator.Next();
- pRotateable = dynamic_cast<E3dObject*>(pSubObj);
+ pRotateable = DynCastE3dObject(aIterator.Next());
}
}
}
@@ -595,7 +598,7 @@ bool SelectionHelper::getMarkHandles( SdrHdlList& rHdlList )
for( sal_uInt32 nM = 0; nM < aPolygon.count(); nM++)
{
const ::basegfx::B2DPoint aPoint(aPolygon.getB2DPoint(nM));
- rHdlList.AddHdl(std::make_unique<SdrHdl>(Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY())), SdrHdlKind::Poly));
+ rHdlList.AddHdl(std::make_unique<SdrHdl>(Point(basegfx::fround<tools::Long>(aPoint.getX()), basegfx::fround<tools::Long>(aPoint.getY())), SdrHdlKind::Poly));
}
}
return true;
diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index 8161717fe339..c440a7d97925 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -18,16 +18,14 @@
*/
#include "ShapeController.hxx"
-#include <ShapeController.h>
#include <ChartController.hxx>
#include <ViewElementListProvider.hxx>
#include <dlg_ShapeFont.hxx>
#include <dlg_ShapeParagraph.hxx>
+#include <ChartModel.hxx>
#include <chartview/DrawModelWrapper.hxx>
-#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/frame/CommandGroup.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
#include <vcl/svapp.hxx>
#include <editeng/formatbreakitem.hxx>
@@ -38,7 +36,7 @@
#include <editeng/spltitem.hxx>
#include <svx/svxdlg.hxx>
#include <editeng/widwitem.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::frame;
@@ -61,7 +59,7 @@ ShapeController::~ShapeController()
}
// WeakComponentImplHelperBase
-void ShapeController::disposing()
+void ShapeController::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
}
@@ -79,7 +77,7 @@ FeatureState ShapeController::getState( const OUString& rCommand )
bool bWritable = false;
if ( m_pChartController )
{
- Reference< frame::XStorable > xStorable( m_pChartController->getModel(), uno::UNO_QUERY );
+ rtl::Reference< ChartModel > xStorable = m_pChartController->getChartModel();
if ( xStorable.is() )
{
bWritable = !xStorable->isReadonly();
@@ -89,37 +87,37 @@ FeatureState ShapeController::getState( const OUString& rCommand )
SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommand );
if ( aIter != m_aSupportedFeatures.end() )
{
- sal_uInt16 nFeatureId = aIter->second.nFeatureId;
+ ChartCommandID nFeatureId = aIter->second.nFeatureId;
switch ( nFeatureId )
{
- case COMMAND_ID_FORMAT_LINE:
- case COMMAND_ID_FORMAT_AREA:
- case COMMAND_ID_TEXT_ATTRIBUTES:
- case COMMAND_ID_TRANSFORM_DIALOG:
- case COMMAND_ID_OBJECT_TITLE_DESCRIPTION:
- case COMMAND_ID_RENAME_OBJECT:
+ case ChartCommandID::ShapeFormatLine:
+ case ChartCommandID::ShapeFormatArea:
+ case ChartCommandID::ShapeTextAttributes:
+ case ChartCommandID::ShapeTransformDialog:
+ case ChartCommandID::ShapeObjectTitleDescription:
+ case ChartCommandID::ShapeRenameObject:
{
aReturn.bEnabled = bWritable;
aReturn.aState <<= false;
}
break;
- case COMMAND_ID_BRING_TO_FRONT:
- case COMMAND_ID_FORWARD:
+ case ChartCommandID::ShapeBringToFront:
+ case ChartCommandID::ShapeForward:
{
aReturn.bEnabled = ( bWritable && isForwardPossible() );
aReturn.aState <<= false;
}
break;
- case COMMAND_ID_BACKWARD:
- case COMMAND_ID_SEND_TO_BACK:
+ case ChartCommandID::ShapeBackward:
+ case ChartCommandID::ShapeSendToBack:
{
aReturn.bEnabled = ( bWritable && isBackwardPossible() );
aReturn.aState <<= false;
}
break;
- case COMMAND_ID_FONT_DIALOG:
- case COMMAND_ID_PARAGRAPH_DIALOG:
+ case ChartCommandID::ShapeFontDialog:
+ case ChartCommandID::ShapeParagraphDialog:
{
aReturn.bEnabled = bWritable;
aReturn.aState <<= false;
@@ -143,53 +141,53 @@ void ShapeController::execute( const OUString& rCommand, const Sequence< beans::
if ( aIter == m_aSupportedFeatures.end() )
return;
- sal_uInt16 nFeatureId = aIter->second.nFeatureId;
+ ChartCommandID nFeatureId = aIter->second.nFeatureId;
switch ( nFeatureId )
{
- case COMMAND_ID_FORMAT_LINE:
+ case ChartCommandID::ShapeFormatLine:
{
executeDispatch_FormatLine();
}
break;
- case COMMAND_ID_FORMAT_AREA:
+ case ChartCommandID::ShapeFormatArea:
{
executeDispatch_FormatArea();
}
break;
- case COMMAND_ID_TEXT_ATTRIBUTES:
+ case ChartCommandID::ShapeTextAttributes:
{
executeDispatch_TextAttributes();
}
break;
- case COMMAND_ID_TRANSFORM_DIALOG:
+ case ChartCommandID::ShapeTransformDialog:
{
executeDispatch_TransformDialog();
}
break;
- case COMMAND_ID_OBJECT_TITLE_DESCRIPTION:
+ case ChartCommandID::ShapeObjectTitleDescription:
{
executeDispatch_ObjectTitleDescription();
}
break;
- case COMMAND_ID_RENAME_OBJECT:
+ case ChartCommandID::ShapeRenameObject:
{
executeDispatch_RenameObject();
}
break;
- case COMMAND_ID_BRING_TO_FRONT:
- case COMMAND_ID_FORWARD:
- case COMMAND_ID_BACKWARD:
- case COMMAND_ID_SEND_TO_BACK:
+ case ChartCommandID::ShapeBringToFront:
+ case ChartCommandID::ShapeForward:
+ case ChartCommandID::ShapeBackward:
+ case ChartCommandID::ShapeSendToBack:
{
executeDispatch_ChangeZOrder( nFeatureId );
}
break;
- case COMMAND_ID_FONT_DIALOG:
+ case ChartCommandID::ShapeFontDialog:
{
executeDispatch_FontDialog();
}
break;
- case COMMAND_ID_PARAGRAPH_DIALOG:
+ case ChartCommandID::ShapeParagraphDialog:
{
executeDispatch_ParagraphDialog();
}
@@ -203,24 +201,23 @@ void ShapeController::execute( const OUString& rCommand, const Sequence< beans::
void ShapeController::describeSupportedFeatures()
{
- implDescribeSupportedFeature( ".uno:FormatLine", COMMAND_ID_FORMAT_LINE, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:FormatArea", COMMAND_ID_FORMAT_AREA, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:TextAttributes", COMMAND_ID_TEXT_ATTRIBUTES, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:TransformDialog", COMMAND_ID_TRANSFORM_DIALOG, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:ObjectTitleDescription", COMMAND_ID_OBJECT_TITLE_DESCRIPTION, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:RenameObject", COMMAND_ID_RENAME_OBJECT, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:BringToFront", COMMAND_ID_BRING_TO_FRONT, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:Forward", COMMAND_ID_FORWARD, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:Backward", COMMAND_ID_BACKWARD, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:SendToBack", COMMAND_ID_SEND_TO_BACK, CommandGroup::FORMAT );
- implDescribeSupportedFeature( ".uno:FontDialog", COMMAND_ID_FONT_DIALOG, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:ParagraphDialog", COMMAND_ID_PARAGRAPH_DIALOG, CommandGroup::EDIT );
+ implDescribeSupportedFeature( ".uno:FormatLine", ChartCommandID::ShapeFormatLine, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:FormatArea", ChartCommandID::ShapeFormatArea, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:TextAttributes", ChartCommandID::ShapeTextAttributes, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:TransformDialog", ChartCommandID::ShapeTransformDialog, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:ObjectTitleDescription", ChartCommandID::ShapeObjectTitleDescription, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:RenameObject", ChartCommandID::ShapeRenameObject, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:BringToFront", ChartCommandID::ShapeBringToFront, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:Forward", ChartCommandID::ShapeForward, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:Backward", ChartCommandID::ShapeBackward, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SendToBack", ChartCommandID::ShapeSendToBack, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:FontDialog", ChartCommandID::ShapeFontDialog, CommandGroup::EDIT );
+ implDescribeSupportedFeature( ".uno:ParagraphDialog", ChartCommandID::ShapeParagraphDialog, CommandGroup::EDIT );
}
IMPL_LINK( ShapeController, CheckNameHdl, AbstractSvxObjectNameDialog&, rDialog, bool )
{
- OUString aName;
- rDialog.GetName( aName );
+ OUString aName = rDialog.GetName();
if ( !aName.isEmpty() )
{
@@ -290,7 +287,7 @@ void ShapeController::executeDispatch_FormatArea()
}
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr< AbstractSvxAreaTabDialog > pDlg(
- pFact->CreateSvxAreaTabDialog(pChartWindow, &aAttr, &pDrawModelWrapper->getSdrModel(), true));
+ pFact->CreateSvxAreaTabDialog(pChartWindow, &aAttr, &pDrawModelWrapper->getSdrModel(), true, false));
if ( pDlg->Execute() == RET_OK )
{
const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
@@ -323,20 +320,26 @@ void ShapeController::executeDispatch_TextAttributes()
pDrawViewWrapper->MergeAttrFromMarked( aAttr, false );
}
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr< SfxAbstractTabDialog > pDlg(
+ VclPtr< SfxAbstractTabDialog > pDlg(
pFact->CreateTextTabDialog(pChartWindow, &aAttr, pDrawViewWrapper));
- if ( pDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
- if ( bHasMarked )
- {
- pDrawViewWrapper->SetAttributes( *pOutAttr );
- }
- else
+ pDlg->StartExecuteAsync(
+ [pDlg, bHasMarked, pDrawViewWrapper] (sal_Int32 nResult)->void
{
- pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false );
+ if ( RET_OK == nResult )
+ {
+ const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
+ if ( bHasMarked )
+ {
+ pDrawViewWrapper->SetAttributes( *pOutAttr );
+ }
+ else
+ {
+ pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false );
+ }
+ }
+ pDlg->disposeOnce();
}
- }
+ );
}
void ShapeController::executeDispatch_TransformDialog()
@@ -351,17 +354,17 @@ void ShapeController::executeDispatch_TransformDialog()
return;
SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
- if ( pSelectedObj && pSelectedObj->GetObjIdentifier() == OBJ_CAPTION )
+ if ( pSelectedObj && pSelectedObj->GetObjIdentifier() == SdrObjKind::Caption )
{
// item set for caption
- SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() );
+ SfxItemSet aAttr(pDrawViewWrapper->GetModel().GetItemPool());
pDrawViewWrapper->GetAttributes( aAttr );
// item set for position and size
SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr< SfxAbstractTabDialog > pDlg(
pFact->CreateCaptionDialog(pChartWindow, pDrawViewWrapper));
- const sal_uInt16* pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
+ const WhichRangesContainer& pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
SfxItemSet aCombAttr( *aAttr.GetPool(), pRange );
aCombAttr.Put( aAttr );
aCombAttr.Put( aGeoAttr );
@@ -403,17 +406,23 @@ void ShapeController::executeDispatch_ObjectTitleDescription()
OUString aTitle( pSelectedObj->GetTitle() );
OUString aDescription( pSelectedObj->GetDescription() );
+ bool isDecorative(pSelectedObj->IsDecorative());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
weld::Window* pChartWindow(m_pChartController->GetChartFrame());
- ScopedVclPtr< AbstractSvxObjectTitleDescDialog > pDlg(
- pFact->CreateSvxObjectTitleDescDialog(pChartWindow, aTitle, aDescription));
- if ( pDlg->Execute() == RET_OK )
- {
- pDlg->GetTitle( aTitle );
- pDlg->GetDescription( aDescription );
- pSelectedObj->SetTitle( aTitle );
- pSelectedObj->SetDescription( aDescription );
- }
+ VclPtr< AbstractSvxObjectTitleDescDialog > pDlg(
+ pFact->CreateSvxObjectTitleDescDialog(pChartWindow, aTitle, aDescription, isDecorative));
+ pDlg->StartExecuteAsync(
+ [pDlg, pSelectedObj] (sal_Int32 nResult)->void
+ {
+ if (nResult == RET_OK)
+ {
+ pSelectedObj->SetTitle( pDlg->GetTitle() );
+ pSelectedObj->SetDescription( pDlg->GetDescription() );
+ pSelectedObj->SetDecorative(pDlg->IsDecorative());
+ }
+ pDlg->disposeOnce();
+ }
+ );
}
void ShapeController::executeDispatch_RenameObject()
@@ -430,23 +439,28 @@ void ShapeController::executeDispatch_RenameObject()
if ( !pSelectedObj )
return;
- OUString aName = pSelectedObj->GetName();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
weld::Window* pChartWindow(m_pChartController->GetChartFrame());
- ScopedVclPtr< AbstractSvxObjectNameDialog > pDlg(
- pFact->CreateSvxObjectNameDialog(pChartWindow, aName));
+ VclPtr< AbstractSvxObjectNameDialog > pDlg(
+ pFact->CreateSvxObjectNameDialog(pChartWindow, pSelectedObj->GetName()));
pDlg->SetCheckNameHdl( LINK( this, ShapeController, CheckNameHdl ) );
- if ( pDlg->Execute() == RET_OK )
- {
- pDlg->GetName(aName);
- if (pSelectedObj->GetName() == aName)
+ pDlg->StartExecuteAsync(
+ [pDlg, pSelectedObj] (sal_Int32 nResult)->void
{
- pSelectedObj->SetName( aName );
+ if (nResult == RET_OK)
+ {
+ OUString aName = pDlg->GetName();
+ if (pSelectedObj->GetName() != aName)
+ {
+ pSelectedObj->SetName( aName );
+ }
+ }
+ pDlg->disposeOnce();
}
- }
+ );
}
-void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId )
+void ShapeController::executeDispatch_ChangeZOrder( ChartCommandID nId )
{
SolarMutexGuard aGuard;
DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : nullptr );
@@ -455,7 +469,7 @@ void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId )
switch ( nId )
{
- case COMMAND_ID_BRING_TO_FRONT:
+ case ChartCommandID::ShapeBringToFront:
{
if ( isForwardPossible() )
{
@@ -463,7 +477,7 @@ void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId )
}
}
break;
- case COMMAND_ID_FORWARD:
+ case ChartCommandID::ShapeForward:
{
if ( isForwardPossible() )
{
@@ -471,7 +485,7 @@ void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId )
}
}
break;
- case COMMAND_ID_BACKWARD:
+ case ChartCommandID::ShapeBackward:
{
if ( isBackwardPossible() )
{
@@ -479,7 +493,7 @@ void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId )
}
}
break;
- case COMMAND_ID_SEND_TO_BACK:
+ case ChartCommandID::ShapeSendToBack:
{
if ( isBackwardPossible() )
{
@@ -506,7 +520,7 @@ void ShapeController::executeDispatch_FontDialog()
DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
if ( pChartWindow && pDrawModelWrapper && pDrawViewWrapper )
{
- SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() );
+ SfxItemSet aAttr(pDrawViewWrapper->GetModel().GetItemPool());
pDrawViewWrapper->GetAttributes( aAttr );
ViewElementListProvider aViewElementListProvider( pDrawModelWrapper );
ShapeFontDialog aDlg(pChartWindow, &aAttr, &aViewElementListProvider);
@@ -529,15 +543,13 @@ void ShapeController::executeDispatch_ParagraphDialog()
if ( !(pChartWindow && pDrawViewWrapper) )
return;
- SfxItemPool& rPool = pDrawViewWrapper->GetModel()->GetItemPool();
+ SfxItemPool& rPool = pDrawViewWrapper->GetModel().GetItemPool();
SfxItemSet aAttr( rPool );
pDrawViewWrapper->GetAttributes( aAttr );
- SfxItemSet aNewAttr(
- rPool,
- svl::Items<
+ SfxItemSetFixed<
EE_ITEMS_START, EE_ITEMS_END,
- SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS>{});
+ SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS> aNewAttr(rPool);
aNewAttr.Put( aAttr );
aNewAttr.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE ) );
aNewAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, SID_ATTR_PARA_PAGEBREAK ) );
@@ -563,14 +575,13 @@ SdrObject* ShapeController::getFirstAdditionalShape()
if ( pDrawModelWrapper )
{
Reference< drawing::XShape > xFirstShape;
- Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() );
- Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY_THROW );
+ rtl::Reference<SvxDrawPage> xDrawPage( pDrawModelWrapper->getMainDrawPage() );
Reference< drawing::XShapes > xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
- sal_Int32 nCount = xDrawPageShapes->getCount();
+ sal_Int32 nCount = xDrawPage->getCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
Reference< drawing::XShape > xShape;
- if ( xDrawPageShapes->getByIndex( i ) >>= xShape )
+ if ( xDrawPage->getByIndex( i ) >>= xShape )
{
if ( xShape.is() && xShape != xChartRoot )
{
@@ -603,14 +614,13 @@ SdrObject* ShapeController::getLastAdditionalShape()
if ( pDrawModelWrapper )
{
Reference< drawing::XShape > xLastShape;
- Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() );
- Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY_THROW );
+ rtl::Reference<SvxDrawPage> xDrawPage( pDrawModelWrapper->getMainDrawPage() );
Reference< drawing::XShapes > xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
- sal_Int32 nCount = xDrawPageShapes->getCount();
+ sal_Int32 nCount = xDrawPage->getCount();
for ( sal_Int32 i = nCount - 1; i >= 0; --i )
{
Reference< drawing::XShape > xShape;
- if ( xDrawPageShapes->getByIndex( i ) >>= xShape )
+ if ( xDrawPage->getByIndex( i ) >>= xShape )
{
if ( xShape.is() && xShape != xChartRoot )
{
diff --git a/chart2/source/controller/main/ShapeController.hxx b/chart2/source/controller/main/ShapeController.hxx
index 3d65c49e504c..cdd8002ce2d8 100644
--- a/chart2/source/controller/main/ShapeController.hxx
+++ b/chart2/source/controller/main/ShapeController.hxx
@@ -41,7 +41,7 @@ public:
protected:
// WeakComponentImplHelperBase
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
@@ -64,7 +64,7 @@ private:
void executeDispatch_TransformDialog();
void executeDispatch_ObjectTitleDescription();
void executeDispatch_RenameObject();
- void executeDispatch_ChangeZOrder( sal_uInt16 nId );
+ void executeDispatch_ChangeZOrder( ChartCommandID nId );
void executeDispatch_FontDialog();
void executeDispatch_ParagraphDialog();
diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.cxx b/chart2/source/controller/main/StatusBarCommandDispatch.cxx
index 1e6c06c35b6f..e3c1f038b0ac 100644
--- a/chart2/source/controller/main/StatusBarCommandDispatch.cxx
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.cxx
@@ -19,9 +19,9 @@
#include "StatusBarCommandDispatch.hxx"
#include <ObjectNameProvider.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
+#include <ChartModel.hxx>
+#include <utility>
using namespace ::com::sun::star;
@@ -33,10 +33,10 @@ namespace chart
StatusBarCommandDispatch::StatusBarCommandDispatch(
const Reference< uno::XComponentContext > & xContext,
- const Reference< frame::XModel > & xModel,
+ rtl::Reference<::chart::ChartModel> xModel,
const Reference< view::XSelectionSupplier > & xSelSupp ) :
impl::StatusBarCommandDispatch_Base( xContext ),
- m_xModifiable( xModel, uno::UNO_QUERY ),
+ m_xChartModel(std::move( xModel )),
m_xSelectionSupplier( xSelSupp ),
m_bIsModified( false )
{}
@@ -46,9 +46,9 @@ StatusBarCommandDispatch::~StatusBarCommandDispatch()
void StatusBarCommandDispatch::initialize()
{
- if( m_xModifiable.is())
+ if( m_xChartModel.is())
{
- m_xModifiable->addModifyListener( this );
+ m_xChartModel->addModifyListener( this );
}
if( m_xSelectionSupplier.is())
@@ -65,11 +65,10 @@ void StatusBarCommandDispatch::fireStatusEvent(
bool bFireContext( bFireAll || rURL == ".uno:Context" );
bool bFireModified( bFireAll || rURL == ".uno:ModifiedStatus" );
- if( bFireContext )
+ if( bFireContext && m_xChartModel.is())
{
uno::Any aArg;
- Reference< chart2::XChartDocument > xDoc( m_xModifiable, uno::UNO_QUERY );
- aArg <<= ObjectNameProvider::getSelectedObjectText( m_aSelectedOID.getObjectCID(), xDoc );
+ aArg <<= ObjectNameProvider::getSelectedObjectText( m_aSelectedOID.getObjectCID(), m_xChartModel );
fireStatusEventForURL( ".uno:Context", aArg, true, xSingleListener );
}
if( bFireModified )
@@ -91,24 +90,24 @@ void SAL_CALL StatusBarCommandDispatch::dispatch(
// ____ WeakComponentImplHelperBase ____
/// is called when this is disposed
-void SAL_CALL StatusBarCommandDispatch::disposing()
+void StatusBarCommandDispatch::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
- m_xModifiable.clear();
+ m_xChartModel.clear();
m_xSelectionSupplier.clear();
}
// ____ XEventListener (base of XModifyListener) ____
void SAL_CALL StatusBarCommandDispatch::disposing( const lang::EventObject& /* Source */ )
{
- m_xModifiable.clear();
+ m_xChartModel.clear();
m_xSelectionSupplier.clear();
}
// ____ XModifyListener ____
void SAL_CALL StatusBarCommandDispatch::modified( const lang::EventObject& aEvent )
{
- if( m_xModifiable.is())
- m_bIsModified = m_xModifiable->isModified();
+ if( m_xChartModel.is())
+ m_bIsModified = m_xChartModel->isModified();
CommandDispatch::modified( aEvent );
}
diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.hxx b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
index 4551eb5a0c57..ae9dcaf4f67a 100644
--- a/chart2/source/controller/main/StatusBarCommandDispatch.hxx
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
@@ -22,6 +22,7 @@
#include <ObjectIdentifier.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <rtl/ref.hxx>
namespace com::sun::star::frame { class XModel; }
namespace com::sun::star::util { class XModifiable; }
@@ -48,7 +49,7 @@ class StatusBarCommandDispatch : public impl::StatusBarCommandDispatch_Base
public:
explicit StatusBarCommandDispatch(
const css::uno::Reference< css::uno::XComponentContext > & xContext,
- const css::uno::Reference< css::frame::XModel > & xModel,
+ rtl::Reference<::chart::ChartModel> xModel,
const css::uno::Reference< css::view::XSelectionSupplier > & xSelSupp );
virtual ~StatusBarCommandDispatch() override;
@@ -63,7 +64,7 @@ protected:
// ____ WeakComponentImplHelperBase ____
/// is called when this is disposed
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
// ____ XModifyListener (override from CommandDispatch) ____
virtual void SAL_CALL modified(
@@ -82,7 +83,7 @@ protected:
const css::lang::EventObject& aEvent ) override;
private:
- css::uno::Reference< css::util::XModifiable > m_xModifiable;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
css::uno::Reference< css::view::XSelectionSupplier > m_xSelectionSupplier;
bool m_bIsModified;
ObjectIdentifier m_aSelectedOID;
diff --git a/chart2/source/controller/main/ToolbarController.cxx b/chart2/source/controller/main/ToolbarController.cxx
index b985558a3a0b..17df7c7c8b14 100644
--- a/chart2/source/controller/main/ToolbarController.cxx
+++ b/chart2/source/controller/main/ToolbarController.cxx
@@ -19,21 +19,18 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace chart {
-ChartToolbarController::ChartToolbarController(const css::uno::Sequence<css::uno::Any>& rProperties):
- ChartToolbarControllerBase(m_aMutex)
+ChartToolbarController::ChartToolbarController(const css::uno::Sequence<css::uno::Any>& rProperties)
{
- css::uno::Reference<css::frame::XFrame> xFrame;
- sal_Int32 nLength = rProperties.getLength();
- for (sal_Int32 i = 0; i < nLength; ++i)
+ for (const auto& rProperty : rProperties)
{
css::beans::PropertyValue aPropValue;
- rProperties[i] >>= aPropValue;
+ rProperty >>= aPropValue;
if (aPropValue.Name == "Frame")
- aPropValue.Value >>= xFrame;
+ {
+ mxFramesSupplier.set(aPropValue.Value, css::uno::UNO_QUERY);
+ break;
+ }
}
-
- css::uno::Reference<css::frame::XFramesSupplier> xFramesSupplier(xFrame, css::uno::UNO_QUERY);
- mxFramesSupplier = xFramesSupplier;
}
ChartToolbarController::~ChartToolbarController()
diff --git a/chart2/source/controller/main/UndoActions.cxx b/chart2/source/controller/main/UndoActions.cxx
index 78bc1f6b0ef4..a3c899253295 100644
--- a/chart2/source/controller/main/UndoActions.cxx
+++ b/chart2/source/controller/main/UndoActions.cxx
@@ -19,27 +19,25 @@
#include "UndoActions.hxx"
#include "ChartModelClone.hxx"
+#include <ChartModel.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <svx/svdundo.hxx>
#include <memory>
+#include <utility>
using namespace ::com::sun::star;
namespace chart::impl
{
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::frame::XModel;
using ::com::sun::star::lang::DisposedException;
-UndoElement::UndoElement( const OUString& i_actionString, const Reference< XModel >& i_documentModel, const std::shared_ptr< ChartModelClone >& i_modelClone )
- :UndoElement_MBase()
- ,UndoElement_TBase( m_aMutex )
- ,m_sActionString( i_actionString )
- ,m_xDocumentModel( i_documentModel )
- ,m_pModelClone( i_modelClone )
+UndoElement::UndoElement( OUString i_actionString, rtl::Reference<::chart::ChartModel> i_documentModel, std::shared_ptr< ChartModelClone > i_modelClone )
+ :m_sActionString(std::move( i_actionString ))
+ ,m_xDocumentModel(std::move( i_documentModel ))
+ ,m_pModelClone(std::move( i_modelClone ))
{
}
@@ -47,7 +45,7 @@ UndoElement::~UndoElement()
{
}
-void SAL_CALL UndoElement::disposing()
+void UndoElement::disposing(std::unique_lock<std::mutex>&)
{
if ( m_pModelClone )
m_pModelClone->dispose();
@@ -67,7 +65,7 @@ void UndoElement::impl_toggleModelState()
// apply the previous snapshot to our model
m_pModelClone->applyToModel( m_xDocumentModel );
// remember the new snapshot, for the next toggle
- m_pModelClone = pNewClone;
+ m_pModelClone = std::move(pNewClone);
}
void SAL_CALL UndoElement::undo( )
@@ -83,9 +81,7 @@ void SAL_CALL UndoElement::redo( )
// = ShapeUndoElement
ShapeUndoElement::ShapeUndoElement( std::unique_ptr<SdrUndoAction> xSdrUndoAction )
- :ShapeUndoElement_MBase()
- ,ShapeUndoElement_TBase( m_aMutex )
- ,m_xAction( std::move(xSdrUndoAction) )
+ :m_xAction( std::move(xSdrUndoAction) )
{
}
@@ -114,10 +110,6 @@ void SAL_CALL ShapeUndoElement::redo( )
m_xAction->Redo();
}
-void SAL_CALL ShapeUndoElement::disposing()
-{
-}
-
} // namespace chart::impl
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/UndoActions.hxx b/chart2/source/controller/main/UndoActions.hxx
index 81b4121047a9..a86479e167ce 100644
--- a/chart2/source/controller/main/UndoActions.hxx
+++ b/chart2/source/controller/main/UndoActions.hxx
@@ -20,9 +20,9 @@
#include <com/sun/star/document/XUndoAction.hpp>
+#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
+#include <comphelper/compbase.hxx>
#include <memory>
@@ -32,16 +32,15 @@ class SdrUndoAction;
namespace chart
{
+class ChartModel;
class ChartModelClone;
namespace impl
{
-typedef ::cppu::BaseMutex UndoElement_MBase;
-typedef ::cppu::WeakComponentImplHelper< css::document::XUndoAction > UndoElement_TBase;
+typedef comphelper::WeakComponentImplHelper< css::document::XUndoAction > UndoElement_TBase;
-class UndoElement :public UndoElement_MBase
- ,public UndoElement_TBase
+class UndoElement final : public UndoElement_TBase
{
public:
/** creates a new undo action
@@ -54,10 +53,11 @@ public:
is the cloned model from before the changes, which the Undo action represents, have been applied.
Upon <member>invoking</member>, the clone model is applied to the document model.
*/
- UndoElement( const OUString & i_actionString,
- const css::uno::Reference< css::frame::XModel >& i_documentModel,
- const std::shared_ptr< ChartModelClone >& i_modelClone
+ UndoElement( OUString i_actionString,
+ rtl::Reference<::chart::ChartModel> i_documentModel,
+ std::shared_ptr< ChartModelClone > i_modelClone
);
+ virtual ~UndoElement() override;
UndoElement(const UndoElement&) = delete;
const UndoElement& operator=(const UndoElement&) = delete;
@@ -67,40 +67,30 @@ public:
virtual void SAL_CALL undo( ) override;
virtual void SAL_CALL redo( ) override;
- // OComponentHelper
- virtual void SAL_CALL disposing() override;
-
-protected:
- virtual ~UndoElement() override;
+ // WeakComponentImplHelper
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
private:
void impl_toggleModelState();
private:
OUString m_sActionString;
- css::uno::Reference< css::frame::XModel > m_xDocumentModel;
+ rtl::Reference<::chart::ChartModel> m_xDocumentModel;
std::shared_ptr< ChartModelClone > m_pModelClone;
};
-typedef ::cppu::BaseMutex ShapeUndoElement_MBase;
-typedef ::cppu::WeakComponentImplHelper< css::document::XUndoAction > ShapeUndoElement_TBase;
-class ShapeUndoElement :public ShapeUndoElement_MBase
- ,public ShapeUndoElement_TBase
+typedef comphelper::WeakComponentImplHelper< css::document::XUndoAction > ShapeUndoElement_TBase;
+class ShapeUndoElement final : public ShapeUndoElement_TBase
{
public:
explicit ShapeUndoElement( std::unique_ptr<SdrUndoAction> xSdrUndoAction );
+ virtual ~ShapeUndoElement() override;
// XUndoAction
virtual OUString SAL_CALL getTitle() override;
virtual void SAL_CALL undo( ) override;
virtual void SAL_CALL redo( ) override;
- // OComponentHelper
- virtual void SAL_CALL disposing() override;
-
-protected:
- virtual ~ShapeUndoElement() override;
-
private:
std::unique_ptr<SdrUndoAction> m_xAction;
};
diff --git a/chart2/source/controller/main/UndoCommandDispatch.cxx b/chart2/source/controller/main/UndoCommandDispatch.cxx
index e4bd85a3be34..c90fac3f4045 100644
--- a/chart2/source/controller/main/UndoCommandDispatch.cxx
+++ b/chart2/source/controller/main/UndoCommandDispatch.cxx
@@ -18,14 +18,14 @@
*/
#include "UndoCommandDispatch.hxx"
+#include <ChartModel.hxx>
-#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/document/UndoFailedException.hpp>
-#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+#include <utility>
#include <vcl/svapp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <svtools/strings.hrc>
#include <svtools/svtresid.hxx>
@@ -40,12 +40,11 @@ namespace chart
UndoCommandDispatch::UndoCommandDispatch(
const Reference< uno::XComponentContext > & xContext,
- const Reference< frame::XModel > & xModel ) :
+ rtl::Reference<::chart::ChartModel> xModel ) :
CommandDispatch( xContext ),
- m_xModel( xModel )
+ m_xModel(std::move( xModel ))
{
- uno::Reference< document::XUndoManagerSupplier > xSuppUndo( m_xModel, uno::UNO_QUERY_THROW );
- m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_SET_THROW );
+ m_xUndoManager.set( m_xModel->getUndoManager(), uno::UNO_SET_THROW );
}
UndoCommandDispatch::~UndoCommandDispatch()
@@ -122,7 +121,7 @@ void SAL_CALL UndoCommandDispatch::dispatch(
// ____ WeakComponentImplHelperBase ____
/// is called when this is disposed
-void SAL_CALL UndoCommandDispatch::disposing()
+void UndoCommandDispatch::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY );
OSL_ENSURE( xBroadcaster.is(), "UndoCommandDispatch::initialize: missing modification broadcaster interface!" );
diff --git a/chart2/source/controller/main/UndoCommandDispatch.hxx b/chart2/source/controller/main/UndoCommandDispatch.hxx
index cfb0e11078df..f872387c761b 100644
--- a/chart2/source/controller/main/UndoCommandDispatch.hxx
+++ b/chart2/source/controller/main/UndoCommandDispatch.hxx
@@ -19,12 +19,14 @@
#pragma once
#include "CommandDispatch.hxx"
+#include <rtl/ref.hxx>
namespace com::sun::star::document { class XUndoManager; }
namespace com::sun::star::frame { class XModel; }
namespace chart
{
+class ChartModel;
/** This is a CommandDispatch implementation for Undo and Redo.
*/
@@ -33,7 +35,7 @@ class UndoCommandDispatch : public CommandDispatch
public:
explicit UndoCommandDispatch(
const css::uno::Reference< css::uno::XComponentContext > & xContext,
- const css::uno::Reference< css::frame::XModel > & xModel );
+ rtl::Reference<::chart::ChartModel> xModel );
virtual ~UndoCommandDispatch() override;
// late initialisation, especially for adding as listener
@@ -47,7 +49,7 @@ protected:
// ____ WeakComponentImplHelperBase ____
/// is called when this is disposed
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
// ____ XEventListener (base of XModifyListener) ____
virtual void SAL_CALL disposing(
@@ -58,7 +60,7 @@ protected:
const css::uno::Reference< css::frame::XStatusListener > & xSingleListener ) override;
private:
- css::uno::Reference< css::frame::XModel > m_xModel;
+ rtl::Reference<::chart::ChartModel> m_xModel;
css::uno::Reference< css::document::XUndoManager > m_xUndoManager;
};
diff --git a/chart2/source/controller/main/UndoGuard.cxx b/chart2/source/controller/main/UndoGuard.cxx
index 91687aebd28f..4e870c36d07d 100644
--- a/chart2/source/controller/main/UndoGuard.cxx
+++ b/chart2/source/controller/main/UndoGuard.cxx
@@ -20,11 +20,12 @@
#include "UndoGuard.hxx"
#include "ChartModelClone.hxx"
#include "UndoActions.hxx"
+#include <ChartModel.hxx>
#include <com/sun/star/document/XUndoManager.hpp>
-#include <com/sun/star/frame/XModel.hpp>
+#include <utility>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
@@ -33,14 +34,14 @@ using ::com::sun::star::uno::Reference;
namespace chart
{
-UndoGuard::UndoGuard( const OUString& i_undoString, const uno::Reference< document::XUndoManager > & i_undoManager,
+UndoGuard::UndoGuard( OUString i_undoString, const uno::Reference< document::XUndoManager > & i_undoManager,
const ModelFacet i_facet )
- :m_xChartModel( i_undoManager->getParent(), uno::UNO_QUERY_THROW )
- ,m_xUndoManager( i_undoManager )
- ,m_pDocumentSnapshot()
- ,m_aUndoString( i_undoString )
+ :m_xUndoManager( i_undoManager )
+ ,m_aUndoString(std::move( i_undoString ))
,m_bActionPosted( false )
{
+ m_xChartModel = dynamic_cast<::chart::ChartModel*>(i_undoManager->getParent().get());
+ assert(m_xChartModel);
m_pDocumentSnapshot = std::make_shared<ChartModelClone>( m_xChartModel, i_facet );
}
diff --git a/chart2/source/controller/main/UndoGuard.hxx b/chart2/source/controller/main/UndoGuard.hxx
index c983854e2fcd..90443a247af4 100644
--- a/chart2/source/controller/main/UndoGuard.hxx
+++ b/chart2/source/controller/main/UndoGuard.hxx
@@ -37,7 +37,7 @@ class UndoGuard
{
public:
explicit UndoGuard(
- const OUString& i_undoMessage,
+ OUString i_undoMessage,
const css::uno::Reference< css::document::XUndoManager > & i_undoManager,
const ModelFacet i_facet = E_MODEL
);
@@ -53,7 +53,7 @@ private:
void discardSnapshot();
private:
- const css::uno::Reference< css::frame::XModel > m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
const css::uno::Reference< css::document::XUndoManager > m_xUndoManager;
std::shared_ptr< ChartModelClone > m_pDocumentSnapshot;
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index 3ae73588075c..081322b09408 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -20,12 +20,11 @@
#include "Chart2PanelFactory.hxx"
#include <sfx2/sidebar/SidebarPanelBase.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <vcl/window.hxx>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <vcl/weldutils.hxx>
#include "ChartElementsPanel.hxx"
#include "ChartTypePanel.hxx"
@@ -41,7 +40,6 @@ using namespace css::uno;
namespace chart::sidebar {
ChartPanelFactory::ChartPanelFactory()
- : PanelFactoryInterfaceBase(m_aMutex)
{
}
@@ -62,8 +60,11 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
Reference<css::awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<css::awt::XWindow>()));
Reference<css::frame::XController> xController (aArguments.getOrDefault("Controller", Reference<css::frame::XController>()));
- VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
- if ( ! xParentWindow.is() || pParentWindow==nullptr)
+ weld::Widget* pParent(nullptr);
+ if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(xParentWindow.get()))
+ pParent = pTunnel->getWidget();
+
+ if (!pParent)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow",
nullptr);
@@ -82,35 +83,27 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
"ChartPanelFactory::createUIElement called without valid ChartController",
nullptr);
- VclPtr<vcl::Window> pPanel;
+ std::unique_ptr<PanelLayout> xPanel;
if (rsResourceURL.endsWith("/ElementsPanel"))
- pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pController );
+ xPanel = ChartElementsPanel::Create( pParent, pController );
else if (rsResourceURL.endsWith("/TypePanel"))
- {
- //pPanel = ChartTypePanel::Create( pParentWindow, xFrame, pController );
- VclPtrInstance<ChartTypePanel> ppPanel(pParentWindow, xFrame, pController);
- xElement = sfx2::sidebar::SidebarPanelBase::Create(
- rsResourceURL,
- xFrame,
- ppPanel,
- css::ui::LayoutSize(-1,-1,-1));
- }
+ xPanel = std::make_unique<ChartTypePanel>(pParent, pController);
else if (rsResourceURL.endsWith("/SeriesPanel"))
- pPanel = ChartSeriesPanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartSeriesPanel::Create(pParent, pController);
else if (rsResourceURL.endsWith("/AxisPanel"))
- pPanel = ChartAxisPanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartAxisPanel::Create(pParent, pController);
else if (rsResourceURL.endsWith("/ErrorBarPanel"))
- pPanel = ChartErrorBarPanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartErrorBarPanel::Create(pParent, pController);
else if (rsResourceURL.endsWith("/AreaPanel"))
- pPanel = ChartAreaPanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartAreaPanel::Create(pParent, xFrame, pController);
else if (rsResourceURL.endsWith("/LinePanel"))
- pPanel = ChartLinePanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartLinePanel::Create(pParent, xFrame, pController);
- if (pPanel)
+ if (xPanel)
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
- pPanel,
+ std::move(xPanel),
css::ui::LayoutSize(-1,-1,-1));
}
catch (const css::uno::RuntimeException &)
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.hxx b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
index b218f4e41ebc..87619f647d70 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
@@ -18,21 +18,19 @@
*/
#pragma once
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
+#include <comphelper/compbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/ui/XUIElementFactory.hpp>
namespace chart::sidebar {
-typedef ::cppu::WeakComponentImplHelper <
+typedef comphelper::WeakComponentImplHelper <
css::ui::XUIElementFactory, css::lang::XServiceInfo
> PanelFactoryInterfaceBase;
-class ChartPanelFactory
- : private ::cppu::BaseMutex,
- public PanelFactoryInterfaceBase
+class ChartPanelFactory final
+ : public PanelFactoryInterfaceBase
{
public:
ChartPanelFactory();
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 55a756c6edf3..cb660661c140 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -14,11 +14,11 @@
#include "ChartAreaPanel.hxx"
#include <ChartController.hxx>
+#include <ChartModel.hxx>
#include <ViewElementListProvider.hxx>
#include <PropertyHelper.hxx>
#include <chartview/DrawModelWrapper.hxx>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <sfx2/weldutils.hxx>
@@ -41,7 +41,7 @@ SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rColo
return pToolBoxColorControl;
}
-OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
+OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel)
{
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
@@ -55,7 +55,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
ChartController* pController = dynamic_cast<ChartController*>(xController.get());
if (pController)
{
- pController->select( css::uno::Any( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ) );
+ pController->select( css::uno::Any( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) ) );
xSelectionSupplier = css::uno::Reference<css::view::XSelectionSupplier>(xController, css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
aAny = xSelectionSupplier->getSelection();
@@ -72,7 +72,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
css::uno::Reference<css::beans::XPropertySet> getPropSet(
- const css::uno::Reference<css::frame::XModel>& xModel)
+ const rtl::Reference<::chart::ChartModel>& xModel)
{
OUString aCID = getCID(xModel);
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -256,8 +256,8 @@ private:
}
-VclPtr<vcl::Window> ChartAreaPanel::Create(
- vcl::Window* pParent,
+std::unique_ptr<PanelLayout> ChartAreaPanel::Create(
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController)
{
@@ -266,15 +266,14 @@ VclPtr<vcl::Window> ChartAreaPanel::Create(
if (!rxFrame.is())
throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1);
- return VclPtr<ChartAreaPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartAreaPanel>(pParent, rxFrame, pController);
}
-ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
+ChartAreaPanel::ChartAreaPanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController):
svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame),
- mxModel(pController->getModel()),
+ mxModel(pController->getChartModel()),
mxListener(new ChartSidebarModifyListener(this)),
mxSelectionListener(new ChartSidebarSelectionListener(this)),
mbUpdate(true),
@@ -284,35 +283,22 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM,
OBJECTTYPE_DATA_SERIES, OBJECTTYPE_DATA_POINT,
OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND};
- mxSelectionListener->setAcceptedTypes(aAcceptedTypes);
+ mxSelectionListener->setAcceptedTypes(std::move(aAcceptedTypes));
Initialize();
}
ChartAreaPanel::~ChartAreaPanel()
{
- disposeOnce();
-}
-
-void ChartAreaPanel::dispose()
-{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
-
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener.get());
-
- AreaPropertyPanelBase::dispose();
+ doUpdateModel(nullptr);
}
void ChartAreaPanel::Initialize()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addModifyListener(mxListener);
+ mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
- xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
SvxColorToolBoxControl* pToolBoxColor = getColorToolBoxControl(*mxColorDispatch);
pToolBoxColor->setColorSelectFunction(maFillColorWrapper);
@@ -347,7 +333,7 @@ void ChartAreaPanel::setFillFloatTransparence(
const OUString& aName = rItem.GetName();
css::uno::Any aGradientVal;
rItem.QueryValue(aGradientVal, MID_FILLGRADIENT);
- OUString aNewName = PropertyHelper::addTransparencyGradientUniqueNameToTable(aGradientVal, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aName);
+ OUString aNewName = PropertyHelper::addTransparencyGradientUniqueNameToTable(aGradientVal, mxModel, aName);
xPropSet->setPropertyValue("FillTransparenceGradientName", css::uno::Any(aNewName));
}
@@ -387,7 +373,7 @@ void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
const OUString& aName = rGradientItem.GetName();
css::uno::Any aGradientVal;
rGradientItem.QueryValue(aGradientVal, MID_FILLGRADIENT);
- OUString aNewName = PropertyHelper::addGradientUniqueNameToTable(aGradientVal, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aName);
+ OUString aNewName = PropertyHelper::addGradientUniqueNameToTable(aGradientVal, mxModel, aName);
xPropSet->setPropertyValue("FillGradientName", css::uno::Any(aNewName));
}
@@ -418,10 +404,16 @@ void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
css::uno::Any aBitmap;
rBitmapItem.QueryValue(aBitmap, MID_BITMAP);
const OUString& aPreferredName = rBitmapItem.GetName();
- aBitmap <<= PropertyHelper::addBitmapUniqueNameToTable(aBitmap, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aPreferredName);
+ aBitmap <<= PropertyHelper::addBitmapUniqueNameToTable(aBitmap, mxModel, aPreferredName);
xPropSet->setPropertyValue("FillBitmapName", aBitmap);
}
+void ChartAreaPanel::setFillUseBackground(const XFillStyleItem* pStyleItem,
+ const XFillUseSlideBackgroundItem& /*rItem*/)
+{
+ setFillStyle(*pStyleItem);
+}
+
void ChartAreaPanel::updateData()
{
if (!mbUpdate || !mbModelValid)
@@ -520,30 +512,37 @@ void ChartAreaPanel::selectionChanged(bool bCorrectType)
updateData();
}
-void ChartAreaPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartAreaPanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
if (mbModelValid)
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
- }
+ mxModel->removeModifyListener(mxListener);
- css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
- mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (oldSelectionSupplier.is()) {
- oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener.get());
+ css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
+ mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (oldSelectionSupplier.is()) {
+ oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ }
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->addModifyListener(mxListener);
+ mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
- xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
+}
+
+void ChartAreaPanel::updateModel( css::uno::Reference<css::frame::XModel> xModel)
+{
+ ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
+ assert(!xModel || pModel);
+ doUpdateModel(pModel);
}
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index fb9a80e15342..e1edd3d832e8 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -37,14 +37,14 @@ class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase,
public ChartSidebarSelectionListenerParent
{
public:
- static VclPtr<vcl::Window> Create(
- vcl::Window* pParent,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController);
// constructor/destructor
ChartAreaPanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController);
@@ -57,23 +57,23 @@ public:
virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, const XFillGradientItem& rGradientItem) override;
virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& rHatchItem) override;
virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& rBitmapItem) override;
+ virtual void setFillUseBackground(const XFillStyleItem* pStyleItem, const XFillUseSlideBackgroundItem& rItem) override;
virtual void updateData() override;
virtual void modelInvalid() override;
virtual void selectionChanged(bool bCorrectType) override;
- virtual void dispose() override;
-
virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) override;
private:
- css::uno::Reference<css::frame::XModel> mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
rtl::Reference<ChartSidebarSelectionListener> mxSelectionListener;
void Initialize();
+ void doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel);
bool mbUpdate;
bool mbModelValid;
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 63807f37c9ec..48a4620684b3 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -17,17 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
#include <com/sun/star/chart2/AxisOrientation.hpp>
-#include <com/sun/star/chart2/XAxis.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
#include "ChartAxisPanel.hxx"
#include <ChartController.hxx>
+#include <ChartModel.hxx>
+#include <Axis.hxx>
using namespace css;
using namespace css::uno;
@@ -36,11 +35,10 @@ namespace chart::sidebar {
namespace {
-bool isLabelShown(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+bool isLabelShown(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
- css::uno::Reference< css::beans::XPropertySet > xAxis(
- ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Axis > xAxis = ObjectIdentifier::getAxisForCID(rCID, xModel);
if (!xAxis.is())
return false;
@@ -54,11 +52,10 @@ bool isLabelShown(const css::uno::Reference<css::frame::XModel>& xModel,
return bVisible;
}
-void setLabelShown(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, bool bVisible)
+void setLabelShown(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, bool bVisible)
{
- css::uno::Reference< css::beans::XPropertySet > xAxis(
- ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Axis > xAxis = ObjectIdentifier::getAxisForCID(rCID, xModel);
if (!xAxis.is())
return;
@@ -79,11 +76,10 @@ AxisLabelPosMap const aLabelPosMap[] = {
{ 3, css::chart::ChartAxisLabelPosition_OUTSIDE_END }
};
-sal_Int32 getLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+sal_Int32 getLabelPosition(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
- css::uno::Reference< css::beans::XPropertySet > xAxis(
- ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Axis > xAxis = ObjectIdentifier::getAxisForCID(rCID, xModel);
if (!xAxis.is())
return 0;
@@ -103,11 +99,10 @@ sal_Int32 getLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel
return 0;
}
-void setLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, sal_Int32 nPos)
+void setLabelPosition(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, sal_Int32 nPos)
{
- css::uno::Reference< css::beans::XPropertySet > xAxis(
- ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Axis > xAxis = ObjectIdentifier::getAxisForCID(rCID, xModel);
if (!xAxis.is())
return;
@@ -122,10 +117,10 @@ void setLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel,
xAxis->setPropertyValue("LabelPosition", css::uno::Any(ePos));
}
-bool isReverse(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+bool isReverse(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
- css::uno::Reference< css::chart2::XAxis > xAxis =
+ rtl::Reference< Axis > xAxis =
ObjectIdentifier::getAxisForCID(rCID, xModel);
if (!xAxis.is())
@@ -136,10 +131,10 @@ bool isReverse(const css::uno::Reference<css::frame::XModel>& xModel,
return aData.Orientation == css::chart2::AxisOrientation_REVERSE;
}
-void setReverse(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, bool bReverse)
+void setReverse(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, bool bReverse)
{
- css::uno::Reference< css::chart2::XAxis > xAxis =
+ rtl::Reference< Axis > xAxis =
ObjectIdentifier::getAxisForCID(rCID, xModel);
if (!xAxis.is())
@@ -174,11 +169,11 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
return aCID;
}
-void setAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, double nVal)
+void setAxisRotation(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, double nVal)
{
- css::uno::Reference< css::beans::XPropertySet > xAxis(
- ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Axis > xAxis =
+ ObjectIdentifier::getAxisForCID(rCID, xModel);
if (!xAxis.is())
return;
@@ -186,11 +181,11 @@ void setAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel,
xAxis->setPropertyValue("TextRotation", css::uno::Any(nVal));
}
-double getAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+double getAxisRotation(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
- css::uno::Reference< css::beans::XPropertySet > xAxis(
- ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< ::chart::Axis > xAxis =
+ ObjectIdentifier::getAxisForCID(rCID, xModel);
if (!xAxis.is())
return 0;
@@ -204,16 +199,15 @@ double getAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel,
}
ChartAxisPanel::ChartAxisPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController)
- : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui", rxFrame)
+ : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui")
, mxCBShowLabel(m_xBuilder->weld_check_button("checkbutton_show_label"))
, mxCBReverse(m_xBuilder->weld_check_button("checkbutton_reverse"))
, mxLBLabelPos(m_xBuilder->weld_combo_box("comboboxtext_label_position"))
, mxGridLabel(m_xBuilder->weld_widget("label_props"))
, mxNFRotation(m_xBuilder->weld_metric_spin_button("spinbutton1", FieldUnit::DEGREE))
- , mxModel(pController->getModel())
+ , mxModel(pController->getChartModel())
, mxModifyListener(new ChartSidebarModifyListener(this))
, mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_AXIS))
, mbModelValid(true)
@@ -223,17 +217,7 @@ ChartAxisPanel::ChartAxisPanel(
ChartAxisPanel::~ChartAxisPanel()
{
- disposeOnce();
-}
-
-void ChartAxisPanel::dispose()
-{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxModifyListener);
-
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ doUpdateModel(nullptr);
mxCBShowLabel.reset();
mxCBReverse.reset();
@@ -242,14 +226,11 @@ void ChartAxisPanel::dispose()
mxGridLabel.reset();
mxNFRotation.reset();
-
- PanelLayout::dispose();
}
void ChartAxisPanel::Initialize()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addModifyListener(mxModifyListener);
+ mxModel->addModifyListener(mxModifyListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
@@ -257,7 +238,7 @@ void ChartAxisPanel::Initialize()
updateData();
- Link<weld::ToggleButton&,void> aLink = LINK(this, ChartAxisPanel, CheckBoxHdl);
+ Link<weld::Toggleable&,void> aLink = LINK(this, ChartAxisPanel, CheckBoxHdl);
mxCBShowLabel->connect_toggled(aLink);
mxCBReverse->connect_toggled(aLink);
@@ -286,23 +267,18 @@ void ChartAxisPanel::updateData()
mxNFRotation->set_value(getAxisRotation(mxModel, aCID), FieldUnit::DEGREE);
}
-VclPtr<vcl::Window> ChartAxisPanel::Create (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+std::unique_ptr<PanelLayout> ChartAxisPanel::Create (
+ weld::Widget* pParent,
ChartController* pController)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", nullptr, 0);
- if ( ! rxFrame.is())
- throw lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1);
-
- return VclPtr<ChartAxisPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartAxisPanel>(pParent, pController);
}
-void ChartAxisPanel::DataChanged(
- const DataChangedEvent& )
+void ChartAxisPanel::DataChanged(const DataChangedEvent& rEvent)
{
+ PanelLayout::DataChanged(rEvent);
updateData();
}
@@ -324,39 +300,46 @@ void ChartAxisPanel::modelInvalid()
mbModelValid = false;
}
-void ChartAxisPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartAxisPanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
if (mbModelValid)
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxModifyListener);
- }
+ mxModel->removeModifyListener(mxModifyListener);
- css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
- mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (oldSelectionSupplier.is()) {
- oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener.get());
+ css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
+ mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (oldSelectionSupplier.is()) {
+ oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ }
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->addModifyListener(mxModifyListener);
+ mxModel->addModifyListener(mxModifyListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
+void ChartAxisPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
+ assert(!xModel || pModel);
+ doUpdateModel(pModel);
+}
+
void ChartAxisPanel::selectionChanged(bool bCorrectType)
{
if (bCorrectType)
updateData();
}
-IMPL_LINK(ChartAxisPanel, CheckBoxHdl, weld::ToggleButton&, rCheckbox, void)
+IMPL_LINK(ChartAxisPanel, CheckBoxHdl, weld::Toggleable&, rCheckbox, void)
{
OUString aCID = getCID(mxModel);
bool bChecked = rCheckbox.get_active();
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index f44192a26e15..e5ed4b5ebcc6 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -14,17 +14,12 @@
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <sfx2/sidebar/PanelLayout.hxx>
-
#include "ChartSidebarModifyListener.hxx"
#include "ChartSidebarSelectionListener.hxx"
namespace com::sun::star::util { class XModifyListener; }
namespace com::sun::star::view { class XSelectionChangeListener; }
-class Edit;
-class ListBox;
-class MetricField;
-
namespace chart {
class ChartController;
@@ -39,9 +34,8 @@ class ChartAxisPanel : public PanelLayout,
public ChartSidebarSelectionListenerParent
{
public:
- static VclPtr<vcl::Window> Create(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
ChartController* pController);
virtual void DataChanged(
@@ -61,11 +55,9 @@ public:
// constructor/destructor
ChartAxisPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController);
virtual ~ChartAxisPanel() override;
- virtual void dispose() override;
virtual void updateData() override;
virtual void modelInvalid() override;
@@ -82,15 +74,16 @@ private:
std::unique_ptr<weld::Widget> mxGridLabel;
std::unique_ptr<weld::MetricSpinButton> mxNFRotation;
- css::uno::Reference<css::frame::XModel> mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxModifyListener;
css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
bool mbModelValid;
void Initialize();
+ void doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel);
- DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
+ DECL_LINK(CheckBoxHdl, weld::Toggleable&, void);
DECL_LINK(ListBoxHdl, weld::ComboBox&, void);
DECL_LINK(TextRotationHdl, weld::MetricSpinButton&, void);
};
diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
index 613407a827e7..f5c79133434c 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
@@ -12,6 +12,7 @@
#include <string_view>
#include "ChartColorWrapper.hxx"
+#include <ChartModel.hxx>
#include <ObjectIdentifier.hxx>
#include <PropertyHelper.hxx>
@@ -27,7 +28,9 @@
#include <svx/unomid.hxx>
#include <comphelper/lok.hxx>
+#include <sal/log.hxx>
#include <sfx2/viewsh.hxx>
+#include <utility>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
namespace chart::sidebar {
@@ -36,6 +39,9 @@ namespace {
OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
{
+ if (!xModel.is())
+ return OUString();
+
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
if (!xSelectionSupplier.is())
@@ -52,7 +58,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
css::uno::Reference<css::beans::XPropertySet> getPropSet(
- const css::uno::Reference<css::frame::XModel>& xModel)
+ const rtl::Reference<::chart::ChartModel>& xModel)
{
OUString aCID = getCID(xModel);
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -75,12 +81,12 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
}
ChartColorWrapper::ChartColorWrapper(
- css::uno::Reference<css::frame::XModel> const & xModel,
+ rtl::Reference<::chart::ChartModel> xModel,
SvxColorToolBoxControl* pControl,
- const OUString& rName):
- mxModel(xModel),
+ OUString aName):
+ mxModel(std::move(xModel)),
mpControl(pControl),
- maPropertyName(rName)
+ maPropertyName(std::move(aName))
{
}
@@ -94,17 +100,17 @@ void ChartColorWrapper::operator()([[maybe_unused]] const OUString& , const Name
return;
}
- xPropSet->setPropertyValue(maPropertyName, css::uno::makeAny(rColor.first));
+ xPropSet->setPropertyValue(maPropertyName, css::uno::Any(rColor.m_aColor));
}
-void ChartColorWrapper::updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
+void ChartColorWrapper::updateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
mxModel = xModel;
}
void ChartColorWrapper::updateData()
{
- static constexpr OUStringLiteral aLineColor = u"LineColor";
+ static constexpr OUString aLineColor = u"LineColor"_ustr;
static const std::u16string_view aCommands[2] = {u".uno:XLineColor", u".uno:FillColor"};
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
@@ -123,23 +129,23 @@ void ChartColorWrapper::updateData()
SfxViewShell* pViewShell = SfxViewShell::Current();
if (comphelper::LibreOfficeKit::isActive() && pViewShell && (maPropertyName == aLineColor))
{
- std::string sCommand = OUStringToOString(aUrl.Complete, RTL_TEXTENCODING_ASCII_US).getStr();
+ OString sCommand = OUStringToOString(aUrl.Complete, RTL_TEXTENCODING_ASCII_US);
sal_Int32 nColor = -1;
aEvent.State >>= nColor;
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- (sCommand + "=" + std::to_string(nColor)).c_str());
+ sCommand + "=" + OString::number(nColor));
}
}
ChartLineStyleWrapper::ChartLineStyleWrapper(
- css::uno::Reference<css::frame::XModel> const & xModel,
+ rtl::Reference<::chart::ChartModel> xModel,
SvxLineStyleToolBoxControl* pControl)
- : mxModel(xModel)
+ : mxModel(std::move(xModel))
, mpControl(pControl)
{
}
-void ChartLineStyleWrapper::updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
+void ChartLineStyleWrapper::updateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
mxModel = xModel;
}
@@ -217,7 +223,7 @@ bool ChartLineStyleWrapper::operator()(std::u16string_view rCommand, const css::
css::uno::Any aAny;
aDashItem.QueryValue(aAny, MID_LINEDASH);
OUString aDashName = PropertyHelper::addLineDashUniqueNameToTable(aAny,
- css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY),
+ mxModel,
"");
xPropSet->setPropertyValue("LineDash", aAny);
xPropSet->setPropertyValue("LineDashName", css::uno::Any(aDashName));
diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.hxx b/chart2/source/controller/sidebar/ChartColorWrapper.hxx
index 66c880ae3ca2..70b3ce8fa47c 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx
@@ -9,11 +9,13 @@
#pragma once
-#include <com/sun/star/uno/Reference.hxx>
-#include <svx/Palette.hxx>
+#include <ChartModel.hxx>
-namespace com::sun::star::frame { class XModel; }
+#include <sfx2/namedcolor.hxx>
+#include <rtl/ref.hxx>
+namespace com::sun::star::frame { class XModel; }
+namespace chart { class ChartModel; }
class SvxColorToolBoxControl;
class SvxLineStyleToolBoxControl;
@@ -22,20 +24,20 @@ namespace chart::sidebar {
class ChartColorWrapper
{
public:
- ChartColorWrapper(css::uno::Reference<css::frame::XModel> const & xModel,
+ ChartColorWrapper(rtl::Reference<::chart::ChartModel> xModel,
SvxColorToolBoxControl* pControl,
- const OUString& rPropertyName);
+ OUString rPropertyName);
void operator()(const OUString& rCommand, const NamedColor& rColor);
// ColorSelectFunction signature
- void updateModel(const css::uno::Reference<css::frame::XModel>& xModel);
+ void updateModel(const rtl::Reference<::chart::ChartModel>& xModel);
void updateData();
private:
- css::uno::Reference<css::frame::XModel> mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
SvxColorToolBoxControl* mpControl;
@@ -45,18 +47,18 @@ private:
class ChartLineStyleWrapper
{
public:
- ChartLineStyleWrapper(css::uno::Reference<css::frame::XModel> const & xModel,
+ ChartLineStyleWrapper(rtl::Reference<::chart::ChartModel> xModel,
SvxLineStyleToolBoxControl* pControl);
bool operator()(std::u16string_view rCommand, const css::uno::Any& rValue);
- void updateModel(const css::uno::Reference<css::frame::XModel>& xModel);
+ void updateModel(const rtl::Reference<::chart::ChartModel>& xModel);
void updateData();
private:
- css::uno::Reference<css::frame::XModel> mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
SvxLineStyleToolBoxControl* mpControl;
};
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 27b96dc74007..1e5e6e9403fa 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -19,8 +19,6 @@
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/chart/ChartLegendExpansion.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <vcl/svapp.hxx>
@@ -28,13 +26,14 @@
#include <ChartController.hxx>
#include <comphelper/processfactory.hxx>
+#include <Legend.hxx>
#include <LegendHelper.hxx>
-#include <ChartModelHelper.hxx>
#include <AxisHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
-
#include <ChartModel.hxx>
+#include <BaseCoordinateSystem.hxx>
using namespace css;
@@ -74,7 +73,7 @@ bool isLegendVisible(const css::uno::Reference<css::frame::XModel>& xModel)
if (!pModel)
return false;
- Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY );
+ rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*pModel);
if( xLegendProp.is())
{
try
@@ -111,7 +110,7 @@ bool isLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel)
if (!pModel)
return false;
- Reference< beans::XPropertySet > xLegendProp(LegendHelper::getLegend(*pModel), uno::UNO_QUERY);
+ rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*pModel);
if( xLegendProp.is())
{
try
@@ -136,28 +135,27 @@ void setLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel, boo
if (!pModel)
return;
- Reference<beans::XPropertySet> xLegendProp(LegendHelper::getLegend(*pModel), uno::UNO_QUERY);
+ rtl::Reference<Legend> xLegendProp = LegendHelper::getLegend(*pModel);
if (!xLegendProp.is())
return;
xLegendProp->setPropertyValue("Overlay", css::uno::Any(bOverlay));
}
-bool isTitleVisible(const css::uno::Reference<css::frame::XModel>& xModel, TitleHelper::eTitleType eTitle)
+bool isTitleVisible(const rtl::Reference<::chart::ChartModel>& xModel, TitleHelper::eTitleType eTitle)
{
- css::uno::Reference<css::uno::XInterface> xTitle = TitleHelper::getTitle(eTitle, xModel);
+ rtl::Reference<Title> xTitle = TitleHelper::getTitle(eTitle, xModel);
if (!xTitle.is())
return false;
- css::uno::Reference<css::beans::XPropertySet> xPropSet(xTitle, css::uno::UNO_QUERY_THROW);
- css::uno::Any aAny = xPropSet->getPropertyValue("Visible");
+ css::uno::Any aAny = xTitle->getPropertyValue("Visible");
bool bVisible = aAny.get<bool>();
return bVisible;
}
-bool isGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridType eType)
+bool isGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType eType)
{
- Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram());
if(xDiagram.is())
{
sal_Int32 nDimensionIndex = 0;
@@ -172,9 +170,9 @@ bool isGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridTy
return false;
}
-void setGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridType eType, bool bVisible)
+void setGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType eType, bool bVisible)
{
- Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram());
if(!xDiagram.is())
return;
@@ -192,9 +190,9 @@ void setGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridT
AxisHelper::hideGrid(nDimensionIndex, nCooSysIndex, bMajor, xDiagram);
}
-bool isAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisType eType)
+bool isAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType eType)
{
- Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram());
if(xDiagram.is())
{
sal_Int32 nDimensionIndex = 0;
@@ -211,9 +209,9 @@ bool isAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisTy
return false;
}
-void setAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisType eType, bool bVisible)
+void setAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType eType, bool bVisible)
{
- Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram());
if(!xDiagram.is())
return;
@@ -237,7 +235,7 @@ sal_Int32 getLegendPos(const css::uno::Reference<css::frame::XModel>& xModel)
if (!pModel)
return -1;
- Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY );
+ rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*pModel);
if (!xLegendProp.is())
return -1;
@@ -264,7 +262,7 @@ void setLegendPos(const css::uno::Reference<css::frame::XModel>& xModel, sal_Int
if (!pModel)
return;
- Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY );
+ rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*pModel);
if (!xLegendProp.is())
return;
@@ -298,9 +296,8 @@ void setLegendPos(const css::uno::Reference<css::frame::XModel>& xModel, sal_Int
}
ChartElementsPanel::ChartElementsPanel(
- vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame,
- ChartController* pController)
- : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui", rxFrame)
+ weld::Widget* pParent, ChartController* pController)
+ : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui")
, mxCBTitle(m_xBuilder->weld_check_button("checkbutton_title"))
, mxEditTitle(m_xBuilder->weld_entry("edit_title"))
, mxCBSubtitle(m_xBuilder->weld_check_button("checkbutton_subtitle"))
@@ -327,8 +324,7 @@ ChartElementsPanel::ChartElementsPanel(
, mxLBGrid(m_xBuilder->weld_label("label_gri"))
, mxLBLegendPosition(m_xBuilder->weld_combo_box("comboboxtext_legend"))
, mxBoxLegend(m_xBuilder->weld_widget("box_legend"))
- , maContext()
- , mxModel(pController->getModel())
+ , mxModel(pController->getChartModel())
, mxListener(new ChartSidebarModifyListener(this))
, mbModelValid(true)
{
@@ -340,13 +336,8 @@ ChartElementsPanel::ChartElementsPanel(
ChartElementsPanel::~ChartElementsPanel()
{
- disposeOnce();
-}
+ doUpdateModel(nullptr);
-void ChartElementsPanel::dispose()
-{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
mxCBTitle.reset();
mxEditTitle.reset();
mxCBSubtitle.reset();
@@ -376,17 +367,14 @@ void ChartElementsPanel::dispose()
mxTextTitle.reset();
mxTextSubTitle.reset();
-
- PanelLayout::dispose();
}
void ChartElementsPanel::Initialize()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addModifyListener(mxListener);
+ mxModel->addModifyListener(mxListener);
updateData();
- Link<weld::ToggleButton&,void> aLink = LINK(this, ChartElementsPanel, CheckBoxHdl);
+ Link<weld::Toggleable&,void> aLink = LINK(this, ChartElementsPanel, CheckBoxHdl);
mxCBTitle->connect_toggled(aLink);
mxCBSubtitle->connect_toggled(aLink);
mxCBXAxis->connect_toggled(aLink);
@@ -415,27 +403,21 @@ void ChartElementsPanel::Initialize()
namespace {
-css::uno::Reference<css::chart2::XChartType> getChartType(const css::uno::Reference<css::frame::XModel>& xModel)
+rtl::Reference<ChartType> getChartType(const rtl::Reference<ChartModel>& xModel)
{
- css::uno::Reference<css::chart2::XChartDocument> xChartDoc(xModel, css::uno::UNO_QUERY_THROW);
- css::uno::Reference<chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();
- if (!xDiagram.is()) {
- return css::uno::Reference<css::chart2::XChartType>();
- }
-
- css::uno::Reference<css::chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, css::uno::UNO_QUERY_THROW );
-
- css::uno::Sequence<css::uno::Reference<css::chart2::XCoordinateSystem>> xCooSysSequence(xCooSysContainer->getCoordinateSystems());
+ rtl::Reference<Diagram > xDiagram = xModel->getFirstChartDiagram();
+ if (!xDiagram.is())
+ return nullptr;
- if (!xCooSysSequence.hasElements())
- return css::uno::Reference<css::chart2::XChartType>();
+ const std::vector<rtl::Reference<BaseCoordinateSystem>> & xCooSysSequence(xDiagram->getBaseCoordinateSystems());
- css::uno::Reference<css::chart2::XChartTypeContainer> xChartTypeContainer(xCooSysSequence[0], css::uno::UNO_QUERY_THROW);
+ if (xCooSysSequence.empty())
+ return nullptr;
- css::uno::Sequence<css::uno::Reference<css::chart2::XChartType>> xChartTypeSequence(xChartTypeContainer->getChartTypes());
+ const std::vector<rtl::Reference<ChartType>> & xChartTypeSequence(xCooSysSequence[0]->getChartTypes2());
- if (!xChartTypeSequence.hasElements())
- return css::uno::Reference<css::chart2::XChartType>();
+ if (xChartTypeSequence.empty())
+ return nullptr;
return xChartTypeSequence[0];
}
@@ -447,8 +429,10 @@ void ChartElementsPanel::updateData()
if (!mbModelValid)
return;
- Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(mxModel));
- sal_Int32 nDimension = DiagramHelper::getDimension(xDiagram);
+ rtl::Reference< Diagram > xDiagram(mxModel->getFirstChartDiagram());
+ sal_Int32 nDimension = 0;
+ if (xDiagram)
+ nDimension = xDiagram->getDimension();
SolarMutexGuard aGuard;
mxCBLegend->set_active(isLegendVisible(mxModel));
@@ -538,22 +522,18 @@ void ChartElementsPanel::updateData()
mxLBLegendPosition->set_active(getLegendPos(mxModel));
}
-VclPtr<vcl::Window> ChartElementsPanel::Create (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+std::unique_ptr<PanelLayout> ChartElementsPanel::Create (
+ weld::Widget* pParent,
ChartController* pController)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException("no parent Window given to ChartElementsPanel::Create", nullptr, 0);
- if ( ! rxFrame.is())
- throw lang::IllegalArgumentException("no XFrame given to ChartElementsPanel::Create", nullptr, 1);
- return VclPtr<ChartElementsPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartElementsPanel>(pParent, pController);
}
-void ChartElementsPanel::DataChanged(
- const DataChangedEvent& )
+void ChartElementsPanel::DataChanged(const DataChangedEvent& rEvent)
{
+ PanelLayout::DataChanged(rEvent);
updateData();
}
@@ -575,23 +555,30 @@ void ChartElementsPanel::modelInvalid()
mbModelValid = false;
}
-void ChartElementsPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartElementsPanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
if (mbModelValid)
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ mxModel->removeModifyListener(mxListener);
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->addModifyListener(mxListener);
+ if (!mbModelValid)
+ return;
+
+ mxModel->addModifyListener(mxListener);
+}
+
+void ChartElementsPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
+ assert(!xModel || pModel);
+ doUpdateModel(pModel);
}
-IMPL_LINK(ChartElementsPanel, CheckBoxHdl, weld::ToggleButton&, rCheckBox, void)
+IMPL_LINK(ChartElementsPanel, CheckBoxHdl, weld::Toggleable&, rCheckBox, void)
{
bool bChecked = rCheckBox.get_active();
if (&rCheckBox == mxCBTitle.get())
@@ -634,6 +621,8 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, weld::ToggleButton&, rCheckBox, void)
setGridVisible(mxModel, GridType::VERT_MINOR, bChecked);
else if (&rCheckBox == mxCBGridHorizontalMinor.get())
setGridVisible(mxModel, GridType::HOR_MINOR, bChecked);
+
+ updateData();
}
IMPL_LINK(ChartElementsPanel, EditHdl, weld::Entry&, rEdit, void)
@@ -645,7 +634,8 @@ IMPL_LINK(ChartElementsPanel, EditHdl, weld::Entry&, rEdit, void)
// set it
OUString aText(rEdit.get_text());
- TitleHelper::setCompleteString(aText, TitleHelper::getTitle(aTitleType, mxModel), comphelper::getProcessComponentContext());
+ TitleHelper::setCompleteString(aText, TitleHelper::getTitle(aTitleType, mxModel),
+ comphelper::getProcessComponentContext(), nullptr, true);
}
IMPL_LINK_NOARG(ChartElementsPanel, LegendPosHdl, weld::ComboBox&, void)
@@ -663,9 +653,7 @@ void ChartElementsPanel::setTitleVisible(TitleHelper::eTitleType eTitle, bool bV
}
else
{
- // TODO tdf#92768 use TitleHelper::hideTitle() here once there is
- // rendering support for the property "Visible"
- TitleHelper::removeTitle(eTitle, mxModel);
+ TitleHelper::hideTitle(eTitle, mxModel);
}
}
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 059e7c4fe122..2e0dee28b68f 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -39,9 +39,8 @@ class ChartElementsPanel : public PanelLayout,
public ChartSidebarModifyListenerParent
{
public:
- static VclPtr<vcl::Window> Create(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
ChartController* pController);
virtual void DataChanged(
@@ -52,14 +51,11 @@ public:
// constructor/destructor
ChartElementsPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController);
virtual ~ChartElementsPanel() override;
- virtual void dispose() override;
-
virtual void updateData() override;
virtual void modelInvalid() override;
@@ -97,7 +93,7 @@ private:
vcl::EnumContext maContext;
- css::uno::Reference<css::frame::XModel> mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
bool mbModelValid;
@@ -106,10 +102,11 @@ private:
OUString maTextSubTitle;
void Initialize();
+ void doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel);
void setTitleVisible(TitleHelper::eTitleType eTitle, bool bVisible);
- DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
+ DECL_LINK(CheckBoxHdl, weld::Toggleable&, void);
DECL_LINK(EditHdl, weld::Entry&, void);
DECL_LINK(LegendPosHdl, weld::ComboBox&, void);
};
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index cb768d34dd15..c9430791b3c9 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -18,11 +18,11 @@
*/
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include "ChartErrorBarPanel.hxx"
#include <ChartController.hxx>
+#include <ChartModel.hxx>
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
@@ -41,13 +41,13 @@ enum class ErrorBarDirection
};
css::uno::Reference<css::beans::XPropertySet> getErrorBarPropSet(
- const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID)
+ const rtl::Reference<::chart::ChartModel>& xModel, std::u16string_view rCID)
{
return ObjectIdentifier::getObjectPropertySet(rCID, xModel);
}
-bool showPositiveError(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+bool showPositiveError(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getErrorBarPropSet(xModel, rCID);
@@ -65,8 +65,8 @@ bool showPositiveError(const css::uno::Reference<css::frame::XModel>& xModel,
return bShow;
}
-bool showNegativeError(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+bool showNegativeError(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getErrorBarPropSet(xModel, rCID);
@@ -84,8 +84,8 @@ bool showNegativeError(const css::uno::Reference<css::frame::XModel>& xModel,
return bShow;
}
-void setShowPositiveError(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, bool bShow)
+void setShowPositiveError(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, bool bShow)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getErrorBarPropSet(xModel, rCID);
@@ -96,8 +96,8 @@ void setShowPositiveError(const css::uno::Reference<css::frame::XModel>& xModel,
xPropSet->setPropertyValue("ShowPositiveError", css::uno::Any(bShow));
}
-void setShowNegativeError(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, bool bShow)
+void setShowNegativeError(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, bool bShow)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getErrorBarPropSet(xModel, rCID);
@@ -124,8 +124,8 @@ ErrorBarTypeMap const aErrorBarType[] = {
{ 6, css::chart::ErrorBarStyle::ERROR_MARGIN },
};
-sal_Int32 getTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+sal_Int32 getTypePos(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getErrorBarPropSet(xModel, rCID);
@@ -150,8 +150,8 @@ sal_Int32 getTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
return 0;
}
-void setTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, sal_Int32 nPos)
+void setTypePos(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, sal_Int32 nPos)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getErrorBarPropSet(xModel, rCID);
@@ -169,8 +169,8 @@ void setTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
xPropSet->setPropertyValue("ErrorBarStyle", css::uno::Any(nApi));
}
-double getValue(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, ErrorBarDirection eDir)
+double getValue(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, ErrorBarDirection eDir)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getErrorBarPropSet(xModel, rCID);
@@ -193,8 +193,8 @@ double getValue(const css::uno::Reference<css::frame::XModel>& xModel,
return nVal;
}
-void setValue(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, double nVal, ErrorBarDirection eDir)
+void setValue(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, double nVal, ErrorBarDirection eDir)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getErrorBarPropSet(xModel, rCID);
@@ -209,7 +209,7 @@ void setValue(const css::uno::Reference<css::frame::XModel>& xModel,
xPropSet->setPropertyValue(aName, css::uno::Any(nVal));
}
-OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
+OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel)
{
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
@@ -234,17 +234,15 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
-ChartErrorBarPanel::ChartErrorBarPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController)
- : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui", rxFrame)
+ChartErrorBarPanel::ChartErrorBarPanel(weld::Widget* pParent, ChartController* pController)
+ : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui")
, mxRBPosAndNeg(m_xBuilder->weld_radio_button("radiobutton_positive_negative"))
, mxRBPos(m_xBuilder->weld_radio_button("radiobutton_positive"))
, mxRBNeg(m_xBuilder->weld_radio_button("radiobutton_negative"))
, mxLBType(m_xBuilder->weld_combo_box("comboboxtext_type"))
, mxMFPos(m_xBuilder->weld_spin_button("spinbutton_pos"))
, mxMFNeg(m_xBuilder->weld_spin_button("spinbutton_neg"))
- , mxModel(pController->getModel())
+ , mxModel(pController->getChartModel())
, mxListener(new ChartSidebarModifyListener(this))
, mbModelValid(true)
{
@@ -253,13 +251,7 @@ ChartErrorBarPanel::ChartErrorBarPanel(
ChartErrorBarPanel::~ChartErrorBarPanel()
{
- disposeOnce();
-}
-
-void ChartErrorBarPanel::dispose()
-{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ doUpdateModel(nullptr);
mxRBPosAndNeg.reset();
mxRBPos.reset();
@@ -269,21 +261,18 @@ void ChartErrorBarPanel::dispose()
mxMFPos.reset();
mxMFNeg.reset();
-
- PanelLayout::dispose();
}
void ChartErrorBarPanel::Initialize()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addModifyListener(mxListener);
+ mxModel->addModifyListener(mxListener);
mxRBNeg->set_active(false);
mxRBPos->set_active(false);
mxRBPosAndNeg->set_active(false);
updateData();
- Link<weld::ToggleButton&,void> aLink = LINK(this, ChartErrorBarPanel, RadioBtnHdl);
+ Link<weld::Toggleable&,void> aLink = LINK(this, ChartErrorBarPanel, RadioBtnHdl);
mxRBPosAndNeg->connect_toggled(aLink);
mxRBPos->connect_toggled(aLink);
mxRBNeg->connect_toggled(aLink);
@@ -347,23 +336,18 @@ void ChartErrorBarPanel::updateData()
}
}
-VclPtr<vcl::Window> ChartErrorBarPanel::Create (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+std::unique_ptr<PanelLayout> ChartErrorBarPanel::Create (
+ weld::Widget* pParent,
ChartController* pController)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException("no parent Window given to ChartErrorBarPanel::Create", nullptr, 0);
- if ( ! rxFrame.is())
- throw lang::IllegalArgumentException("no XFrame given to ChartErrorBarPanel::Create", nullptr, 1);
-
- return VclPtr<ChartErrorBarPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartErrorBarPanel>(pParent, pController);
}
-void ChartErrorBarPanel::DataChanged(
- const DataChangedEvent& )
+void ChartErrorBarPanel::DataChanged(const DataChangedEvent& rEvent)
{
+ PanelLayout::DataChanged(rEvent);
updateData();
}
@@ -385,23 +369,30 @@ void ChartErrorBarPanel::modelInvalid()
mbModelValid = false;
}
-void ChartErrorBarPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartErrorBarPanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
if (mbModelValid)
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ mxModel->removeModifyListener(mxListener);
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->addModifyListener(mxListener);
+ if (!mbModelValid)
+ return;
+
+ mxModel->addModifyListener(mxListener);
+}
+
+void ChartErrorBarPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
+ assert(!xModel || pModel);
+ doUpdateModel(pModel);
}
-IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl, weld::Toggleable&, void)
{
OUString aCID = getCID(mxModel);
bool bPos = mxRBPosAndNeg->get_active() || mxRBPos->get_active();
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
index 7111ce83717c..92f7afb0ad53 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -14,7 +14,6 @@
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <sfx2/sidebar/PanelLayout.hxx>
-
#include "ChartSidebarModifyListener.hxx"
namespace com::sun::star::util { class XModifyListener; }
@@ -22,6 +21,7 @@ namespace com::sun::star::util { class XModifyListener; }
namespace chart {
class ChartController;
+class ChartModel;
namespace sidebar {
@@ -32,9 +32,8 @@ class ChartErrorBarPanel : public PanelLayout,
public ChartSidebarModifyListenerParent
{
public:
- static VclPtr<vcl::Window> Create(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
ChartController* pController);
virtual void DataChanged(
@@ -54,11 +53,9 @@ public:
// constructor/destructor
ChartErrorBarPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController);
virtual ~ChartErrorBarPanel() override;
- virtual void dispose() override;
virtual void updateData() override;
virtual void modelInvalid() override;
@@ -76,14 +73,15 @@ private:
std::unique_ptr<weld::SpinButton> mxMFPos;
std::unique_ptr<weld::SpinButton> mxMFNeg;
- css::uno::Reference<css::frame::XModel> mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
bool mbModelValid;
void Initialize();
+ void doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel);
- DECL_LINK(RadioBtnHdl, weld::ToggleButton&, void);
+ DECL_LINK(RadioBtnHdl, weld::Toggleable&, void);
DECL_LINK(ListBoxHdl, weld::ComboBox&, void);
DECL_LINK(NumericFieldHdl, weld::SpinButton&, void);
};
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index 9a54f913dca9..46cec9695f4d 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -10,9 +10,9 @@
#include "ChartLinePanel.hxx"
#include <ChartController.hxx>
+#include <ChartModel.hxx>
#include <svx/xlnwtit.hxx>
-#include <svx/xlinjoit.hxx>
#include <svx/xlntrit.hxx>
#include <svx/linectrl.hxx>
@@ -21,7 +21,6 @@
#include <vcl/svapp.hxx>
#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <comphelper/lok.hxx>
@@ -46,7 +45,7 @@ SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rTool
return pToolBoxColorControl;
}
-OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
+OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel)
{
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
@@ -55,10 +54,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
css::uno::Any aAny = xSelectionSupplier->getSelection();
if (!aAny.hasValue())
- {
- xSelectionSupplier->select(css::uno::makeAny(OUString("CID/Page=")));
- aAny = xSelectionSupplier->getSelection();
- }
+ return OUString();
OUString aCID;
aAny >>= aCID;
@@ -67,7 +63,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
css::uno::Reference<css::beans::XPropertySet> getPropSet(
- const css::uno::Reference<css::frame::XModel>& xModel)
+ const rtl::Reference<::chart::ChartModel>& xModel)
{
OUString aCID = getCID(xModel);
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -107,8 +103,8 @@ private:
}
-VclPtr<vcl::Window> ChartLinePanel::Create(
- vcl::Window* pParent,
+std::unique_ptr<PanelLayout> ChartLinePanel::Create(
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController)
{
@@ -117,15 +113,14 @@ VclPtr<vcl::Window> ChartLinePanel::Create(
if (!rxFrame.is())
throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1);
- return VclPtr<ChartLinePanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartLinePanel>(pParent, rxFrame, pController);
}
-ChartLinePanel::ChartLinePanel(vcl::Window* pParent,
+ChartLinePanel::ChartLinePanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController):
svx::sidebar::LinePropertyPanelBase(pParent, rxFrame),
- mxModel(pController->getModel()),
+ mxModel(pController->getChartModel()),
mxListener(new ChartSidebarModifyListener(this)),
mxSelectionListener(new ChartSidebarSelectionListener(this)),
mbUpdate(true),
@@ -138,35 +133,22 @@ ChartLinePanel::ChartLinePanel(vcl::Window* pParent,
OBJECTTYPE_DATA_SERIES, OBJECTTYPE_DATA_POINT,
OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND, OBJECTTYPE_DATA_CURVE,
OBJECTTYPE_DATA_AVERAGE_LINE, OBJECTTYPE_AXIS};
- mxSelectionListener->setAcceptedTypes(aAcceptedTypes);
+ mxSelectionListener->setAcceptedTypes(std::move(aAcceptedTypes));
Initialize();
}
ChartLinePanel::~ChartLinePanel()
{
- disposeOnce();
-}
-
-void ChartLinePanel::dispose()
-{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
-
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener.get());
-
- LinePropertyPanelBase::dispose();
+ doUpdateModel(nullptr);
}
void ChartLinePanel::Initialize()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addModifyListener(mxListener);
+ mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
- xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
SvxColorToolBoxControl* pToolBoxColor = getColorToolBoxControl(*mxColorDispatch);
pToolBoxColor->setColorSelectFunction(maLineColorWrapper);
@@ -213,50 +195,40 @@ void ChartLinePanel::selectionChanged(bool bCorrectType)
updateData();
}
-void ChartLinePanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartLinePanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
if (mbModelValid)
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
- }
+ mxModel->removeModifyListener(mxListener);
- css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
- mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (oldSelectionSupplier.is()) {
- oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener.get());
+ css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
+ mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (oldSelectionSupplier.is()) {
+ oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ }
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
maLineStyleWrapper.updateModel(mxModel);
maLineColorWrapper.updateModel(mxModel);
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->addModifyListener(mxListener);
+ mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
- xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
-}
-
-void ChartLinePanel::setLineJoint(const XLineJointItem* pItem)
-{
- css::uno::Reference<css::beans::XPropertySet> xPropSet =
- getPropSet(mxModel);
-
- if (!xPropSet.is())
- return;
-
- PreventUpdate aPreventUpdate(mbUpdate);
- if (pItem)
- xPropSet->setPropertyValue("LineJoint", css::uno::Any(pItem->GetValue()));
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
-void ChartLinePanel::setLineCap(const XLineCapItem* /*pItem*/)
+void ChartLinePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
{
+ ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
+ assert(!xModel || pModel);
+ doUpdateModel(pModel);
}
void ChartLinePanel::setLineTransparency(const XLineTransparenceItem& rItem)
@@ -291,7 +263,7 @@ void ChartLinePanel::updateLineWidth(bool bDisabled, bool bSetOrDefault, const S
if (comphelper::LibreOfficeKit::isActive() && pViewShell)
{
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- (".uno:LineWidth=" + std::to_string(mnWidthCoreValue)).c_str());
+ ".uno:LineWidth=" + OString::number(mnWidthCoreValue));
}
}
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx
index ef174a5ee3a9..ca3d8be14244 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx
@@ -16,10 +16,8 @@
#include "ChartSidebarSelectionListener.hxx"
#include "ChartColorWrapper.hxx"
-class XLineCapItem;
class XLineDashItem;
class XLineEndItem;
-class XLineJointItem;
class XLineStartItem;
class XLineStyleItem;
class XLineTransparenceItem;
@@ -37,14 +35,14 @@ class ChartLinePanel : public svx::sidebar::LinePropertyPanelBase,
public ChartSidebarSelectionListenerParent
{
public:
- static VclPtr<vcl::Window> Create(
- vcl::Window* pParent,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController);
// constructor/destructor
ChartLinePanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController);
@@ -55,8 +53,6 @@ public:
virtual void selectionChanged(bool bCorrectType) override;
- virtual void dispose() override;
-
virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) override;
virtual void setLineWidth(const XLineWidthItem& rItem) override;
@@ -64,18 +60,17 @@ public:
protected:
virtual void setLineTransparency(const XLineTransparenceItem& rItem) override;
- virtual void setLineJoint(const XLineJointItem* pItem) override;
- virtual void setLineCap(const XLineCapItem* pItem) override;
virtual void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem) override;
private:
- css::uno::Reference<css::frame::XModel> mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
rtl::Reference<ChartSidebarSelectionListener> mxSelectionListener;
void Initialize();
+ void doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel);
bool mbUpdate;
bool mbModelValid;
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 8a0c0d787db3..9e94ac005ecb 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -18,24 +18,24 @@
*/
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XDataSeries.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
#include "ChartSeriesPanel.hxx"
#include <ChartController.hxx>
-
+#include <ChartModel.hxx>
+#include <ChartType.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
+#include <Diagram.hxx>
#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <StatisticsHelper.hxx>
+#include <BaseCoordinateSystem.hxx>
+
+#include <comphelper/processfactory.hxx>
using namespace css;
using namespace css::uno;
@@ -44,9 +44,9 @@ namespace chart::sidebar {
namespace {
-bool isDataLabelVisible(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID)
+bool isDataLabelVisible(const rtl::Reference<::chart::ChartModel>& xModel, std::u16string_view rCID)
{
- css::uno::Reference< css::chart2::XDataSeries > xSeries =
+ rtl::Reference< DataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xSeries.is())
@@ -55,9 +55,9 @@ bool isDataLabelVisible(const css::uno::Reference<css::frame::XModel>& xModel, c
return DataSeriesHelper::hasDataLabelsAtSeries(xSeries);
}
-void setDataLabelVisible(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID, bool bVisible)
+void setDataLabelVisible(const rtl::Reference<::chart::ChartModel>& xModel, std::u16string_view rCID, bool bVisible)
{
- css::uno::Reference< css::chart2::XDataSeries > xSeries =
+ rtl::Reference< DataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xSeries.is())
@@ -84,11 +84,11 @@ LabelPlacementMap const aLabelPlacementMap[] = {
{ 5, css::chart::DataLabelPlacement::NEAR_ORIGIN }
};
-sal_Int32 getDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+sal_Int32 getDataLabelPlacement(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
- css::uno::Reference< css::beans::XPropertySet > xSeries(
- ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xSeries.is())
return 0;
@@ -109,11 +109,11 @@ sal_Int32 getDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& x
return 0;
}
-void setDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, sal_Int32 nPos)
+void setDataLabelPlacement(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, sal_Int32 nPos)
{
- css::uno::Reference< css::beans::XPropertySet > xSeries(
- ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries =
+ ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xSeries.is())
return;
@@ -131,23 +131,23 @@ void setDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& xModel
xSeries->setPropertyValue("LabelPlacement", css::uno::Any(nApi));
}
-bool isTrendlineVisible(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID)
+bool isTrendlineVisible(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID)
{
- css::uno::Reference< css::chart2::XRegressionCurveContainer > xRegressionCurveContainer(
- ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegressionCurveContainer =
+ ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xRegressionCurveContainer.is())
return false;
- return xRegressionCurveContainer->getRegressionCurves().hasElements();
+ return !xRegressionCurveContainer->getRegressionCurves2().empty();
}
-void setTrendlineVisible(const css::uno::Reference<css::frame::XModel>&
- xModel, const OUString& rCID, bool bVisible)
+void setTrendlineVisible(const rtl::Reference<::chart::ChartModel>&
+ xModel, std::u16string_view rCID, bool bVisible)
{
- css::uno::Reference< css::chart2::XRegressionCurveContainer > xRegressionCurveContainer(
- ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegressionCurveContainer =
+ ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xRegressionCurveContainer.is())
return;
@@ -164,10 +164,10 @@ void setTrendlineVisible(const css::uno::Reference<css::frame::XModel>&
}
-bool isErrorBarVisible(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rCID, bool bYError)
+bool isErrorBarVisible(const rtl::Reference<::chart::ChartModel>& xModel,
+ std::u16string_view rCID, bool bYError)
{
- css::uno::Reference< css::chart2::XDataSeries > xSeries =
+ rtl::Reference< DataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xSeries.is())
@@ -176,10 +176,10 @@ bool isErrorBarVisible(const css::uno::Reference<css::frame::XModel>& xModel,
return StatisticsHelper::hasErrorBars(xSeries, bYError);
}
-void setErrorBarVisible(const css::uno::Reference<css::frame::XModel>&
- xModel, const OUString& rCID, bool bYError, bool bVisible)
+void setErrorBarVisible(const rtl::Reference<::chart::ChartModel>&
+ xModel, std::u16string_view rCID, bool bYError, bool bVisible)
{
- css::uno::Reference< css::chart2::XDataSeries > xSeries =
+ rtl::Reference< DataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xSeries.is())
@@ -197,10 +197,10 @@ void setErrorBarVisible(const css::uno::Reference<css::frame::XModel>&
}
}
-bool isPrimaryAxis(const css::uno::Reference<css::frame::XModel>&
- xModel, const OUString& rCID)
+bool isPrimaryAxis(const rtl::Reference<::chart::ChartModel>&
+ xModel, std::u16string_view rCID)
{
- css::uno::Reference< css::chart2::XDataSeries > xSeries =
+ rtl::Reference< DataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xSeries.is())
@@ -209,41 +209,36 @@ bool isPrimaryAxis(const css::uno::Reference<css::frame::XModel>&
return DataSeriesHelper::getAttachedAxisIndex(xSeries) == 0;
}
-void setAttachedAxisType(const css::uno::Reference<css::frame::XModel>&
- xModel, const OUString& rCID, bool bPrimary)
+void setAttachedAxisType(const rtl::Reference<::chart::ChartModel>&
+ xModel, std::u16string_view rCID, bool bPrimary)
{
- css::uno::Reference< css::beans::XPropertySet > xSeries(
- ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY );
+ const rtl::Reference<DataSeries> xDataSeries = ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
- if (!xSeries.is())
+ if (!xDataSeries.is())
return;
- sal_Int32 nIndex = bPrimary ? 0 : 1;
- xSeries->setPropertyValue("AttachedAxisIndex", css::uno::Any(nIndex));
+ rtl::Reference<Diagram> xDiagram = xModel->getFirstChartDiagram();
+ xDiagram->attachSeriesToAxis(bPrimary, xDataSeries, comphelper::getProcessComponentContext());
}
-css::uno::Reference<css::chart2::XChartType> getChartType(
- const css::uno::Reference<css::frame::XModel>& xModel)
+rtl::Reference<ChartType> getChartType(
+ const rtl::Reference<::chart::ChartModel>& xModel)
{
- css::uno::Reference<css::chart2::XChartDocument> xChartDoc (xModel, css::uno::UNO_QUERY);
- css::uno::Reference<css::chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram();
- css::uno::Reference< css::chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW );
- css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
- css::uno::Reference< css::chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[0], UNO_QUERY_THROW );
- css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
- return xChartTypeSequence[0];
+ rtl::Reference<Diagram> xDiagram = xModel->getFirstChartDiagram();
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & xCooSysSequence( xDiagram->getBaseCoordinateSystems());
+ return xCooSysSequence[0]->getChartTypes2()[0];
}
-OUString getSeriesLabel(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID)
+OUString getSeriesLabel(const rtl::Reference<::chart::ChartModel>& xModel, std::u16string_view rCID)
{
- css::uno::Reference< css::chart2::XDataSeries > xSeries =
+ rtl::Reference< DataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
if (!xSeries.is())
return OUString();
- css::uno::Reference<css::chart2::XChartType> xChartType = getChartType(xModel);
- return DataSeriesHelper::getDataSeriesLabel(xSeries, xChartType->getRoleOfSequenceForSeriesLabel());
+ rtl::Reference<ChartType> xChartType = getChartType(xModel);
+ return xSeries->getLabelForRole(xChartType->getRoleOfSequenceForSeriesLabel());
}
OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
@@ -277,10 +272,9 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
ChartSeriesPanel::ChartSeriesPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController)
- : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui", rxFrame)
+ : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui")
, mxCBLabel(m_xBuilder->weld_check_button("checkbutton_label"))
, mxCBTrendline(m_xBuilder->weld_check_button("checkbutton_trendline"))
, mxCBXError(m_xBuilder->weld_check_button("checkbutton_x_error"))
@@ -291,7 +285,7 @@ ChartSeriesPanel::ChartSeriesPanel(
, mxLBLabelPlacement(m_xBuilder->weld_combo_box("comboboxtext_label"))
, mxFTSeriesName(m_xBuilder->weld_label("label_series_name"))
, mxFTSeriesTemplate(m_xBuilder->weld_label("label_series_tmpl"))
- , mxModel(pController->getModel())
+ , mxModel(pController->getChartModel())
, mxListener(new ChartSidebarModifyListener(this))
, mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_DATA_SERIES))
, mbModelValid(true)
@@ -301,16 +295,7 @@ ChartSeriesPanel::ChartSeriesPanel(
ChartSeriesPanel::~ChartSeriesPanel()
{
- disposeOnce();
-}
-
-void ChartSeriesPanel::dispose()
-{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ doUpdateModel(nullptr);
mxCBLabel.reset();
mxCBTrendline.reset();
@@ -325,27 +310,24 @@ void ChartSeriesPanel::dispose()
mxFTSeriesName.reset();
mxFTSeriesTemplate.reset();
-
- PanelLayout::dispose();
}
void ChartSeriesPanel::Initialize()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addModifyListener(mxListener);
+ mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
updateData();
- Link<weld::ToggleButton&,void> aLink = LINK(this, ChartSeriesPanel, CheckBoxHdl);
+ Link<weld::Toggleable&,void> aLink = LINK(this, ChartSeriesPanel, CheckBoxHdl);
mxCBLabel->connect_toggled(aLink);
mxCBTrendline->connect_toggled(aLink);
mxCBXError->connect_toggled(aLink);
mxCBYError->connect_toggled(aLink);
- Link<weld::ToggleButton&,void> aLink2 = LINK(this, ChartSeriesPanel, RadioBtnHdl);
+ Link<weld::Toggleable&,void> aLink2 = LINK(this, ChartSeriesPanel, RadioBtnHdl);
mxRBPrimaryAxis->connect_toggled(aLink2);
mxRBSecondaryAxis->connect_toggled(aLink2);
@@ -383,23 +365,19 @@ void ChartSeriesPanel::updateData()
mxFTSeriesName->set_label(aFrameLabel);
}
-VclPtr<vcl::Window> ChartSeriesPanel::Create (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+std::unique_ptr<PanelLayout> ChartSeriesPanel::Create (
+ weld::Widget* pParent,
ChartController* pController)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException("no parent Window given to ChartSeriesPanel::Create", nullptr, 0);
- if ( ! rxFrame.is())
- throw lang::IllegalArgumentException("no XFrame given to ChartSeriesPanel::Create", nullptr, 1);
- return VclPtr<ChartSeriesPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartSeriesPanel>(pParent, pController);
}
-void ChartSeriesPanel::DataChanged(
- const DataChangedEvent& )
+void ChartSeriesPanel::DataChanged(const DataChangedEvent& rEvent)
{
+ PanelLayout::DataChanged(rEvent);
updateData();
}
@@ -421,39 +399,46 @@ void ChartSeriesPanel::modelInvalid()
mbModelValid = false;
}
-void ChartSeriesPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartSeriesPanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
if (mbModelValid)
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ mxModel->removeModifyListener(mxListener);
}
css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (oldSelectionSupplier.is()) {
- oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener.get());
+ oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->addModifyListener(mxListener);
+ if (!mbModelValid)
+ return;
+
+ mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
+void ChartSeriesPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
+ assert(!xModel || pModel);
+ doUpdateModel(pModel);
+}
+
void ChartSeriesPanel::selectionChanged(bool bCorrectType)
{
if (bCorrectType)
updateData();
}
-IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, weld::ToggleButton&, rCheckBox, void)
+IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, weld::Toggleable&, rCheckBox, void)
{
bool bChecked = rCheckBox.get_active();
OUString aCID = getCID(mxModel);
@@ -467,7 +452,7 @@ IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, weld::ToggleButton&, rCheckBox, void)
setErrorBarVisible(mxModel, aCID, true, bChecked);
}
-IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl, weld::Toggleable&, void)
{
OUString aCID = getCID(mxModel);
bool bChecked = mxRBPrimaryAxis->get_active();
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
index 72be7b208b9b..5b69cc3b959f 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -43,9 +43,8 @@ class ChartSeriesPanel : public PanelLayout,
public ChartSidebarSelectionListenerParent
{
public:
- static VclPtr<vcl::Window> Create(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
ChartController* pController);
virtual void DataChanged(
@@ -65,11 +64,9 @@ public:
// constructor/destructor
ChartSeriesPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController);
virtual ~ChartSeriesPanel() override;
- virtual void dispose() override;
virtual void updateData() override;
virtual void modelInvalid() override;
@@ -94,16 +91,17 @@ private:
std::unique_ptr<weld::Label> mxFTSeriesName;
std::unique_ptr<weld::Label> mxFTSeriesTemplate;
- css::uno::Reference<css::frame::XModel> mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
bool mbModelValid;
void Initialize();
+ void doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel);
- DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
- DECL_LINK(RadioBtnHdl, weld::ToggleButton&, void);
+ DECL_LINK(CheckBoxHdl, weld::Toggleable&, void);
+ DECL_LINK(RadioBtnHdl, weld::Toggleable&, void);
DECL_LINK(ListBoxHdl, weld::ComboBox&, void);
};
diff --git a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx
index 0c8018eb09c3..c3757a3b877a 100644
--- a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx
+++ b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx
@@ -74,9 +74,9 @@ void ChartSidebarSelectionListener::disposing(const css::lang::EventObject& /*rE
mpParent = nullptr;
}
-void ChartSidebarSelectionListener::setAcceptedTypes(const std::vector<ObjectType>& aTypes)
+void ChartSidebarSelectionListener::setAcceptedTypes(std::vector<ObjectType>&& aTypes)
{
- maTypes = aTypes;
+ maTypes = std::move(aTypes);
}
}
diff --git a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx
index 44bae13651e1..e8cea5003fa0 100644
--- a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx
+++ b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx
@@ -40,7 +40,7 @@ public:
virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override;
- void setAcceptedTypes(const std::vector<ObjectType>& aTypes);
+ void setAcceptedTypes(std::vector<ObjectType>&& aTypes);
private:
ChartSidebarSelectionListenerParent* mpParent;
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx
index 74a8e7bd0983..40423aa62ea1 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx
@@ -21,30 +21,24 @@
#include <TimerTriggeredControllerLock.hxx>
#include <ChartController.hxx>
-#include <ChartModelHelper.hxx>
+#include <ChartModel.hxx>
#include <ChartResourceGroups.hxx>
#include <ChartTypeDialogController.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartTypeManager.hxx>
+#include <ChartTypeTemplate.hxx>
+#include <Diagram.hxx>
#include <unonames.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-
#include <svtools/valueset.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace css;
using namespace css::uno;
namespace chart::sidebar
{
-ChartTypePanel::ChartTypePanel(vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- ::chart::ChartController* pController)
- : PanelLayout(pParent, "ChartTypePanel", "modules/schart/ui/sidebartype.ui", rxFrame)
- , maContext()
- , mxModel(pController->getModel())
+ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* pController)
+ : PanelLayout(pParent, "ChartTypePanel", "modules/schart/ui/sidebartype.ui")
, mxListener(new ChartSidebarModifyListener(this))
, mbModelValid(true)
, m_pDim3DLookResourceGroup(new Dim3DLookResourceGroup(m_xBuilder.get()))
@@ -53,7 +47,7 @@ ChartTypePanel::ChartTypePanel(vcl::Window* pParent,
new SplineResourceGroup(m_xBuilder.get(), pController->GetChartFrame()))
, m_pGeometryResourceGroup(new GeometryResourceGroup(m_xBuilder.get()))
, m_pSortByXValuesResourceGroup(new SortByXValuesResourceGroup(m_xBuilder.get()))
- , m_xChartModel(mxModel, css::uno::UNO_QUERY_THROW)
+ , m_xChartModel(pController->getChartModel())
, m_aChartTypeDialogControllerList(0)
, m_pCurrentMainType(nullptr)
, m_nChangingCalls(0)
@@ -75,7 +69,8 @@ ChartTypePanel::ChartTypePanel(vcl::Window* pParent,
m_xSubTypeList->SetLineCount(1);
bool bEnableComplexChartTypes = true;
- uno::Reference<beans::XPropertySet> xProps(m_xChartModel, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xProps(static_cast<cppu::OWeakObject*>(m_xChartModel.get()),
+ uno::UNO_QUERY);
if (xProps.is())
{
try
@@ -121,13 +116,9 @@ ChartTypePanel::ChartTypePanel(vcl::Window* pParent,
Initialize();
}
-ChartTypePanel::~ChartTypePanel() { disposeOnce(); }
-
-void ChartTypePanel::dispose()
+ChartTypePanel::~ChartTypePanel()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel,
- css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ doUpdateModel(nullptr);
//delete all dialog controller
m_aChartTypeDialogControllerList.clear();
@@ -144,8 +135,6 @@ void ChartTypePanel::dispose()
m_xSubTypeListWin.reset();
m_xSubTypeList.reset();
m_xMainTypeList.reset();
-
- PanelLayout::dispose();
}
IMPL_LINK_NOARG(ChartTypePanel, SelectMainTypeHdl, weld::ComboBox&, void) { selectMainType(); }
@@ -165,12 +154,12 @@ void ChartTypePanel::Initialize()
{
if (!m_xChartModel.is())
return;
- uno::Reference<lang::XMultiServiceFactory> xTemplateManager(
- m_xChartModel->getChartTypeManager(), uno::UNO_QUERY);
- uno::Reference<css::chart2::XDiagram> xDiagram(ChartModelHelper::findDiagram(m_xChartModel));
- DiagramHelper::tTemplateWithServiceName aTemplate
- = DiagramHelper::getTemplateForDiagram(xDiagram, xTemplateManager);
- OUString aServiceName(aTemplate.second);
+ rtl::Reference<::chart::ChartTypeManager> xChartTypeManager = m_xChartModel->getTypeManager();
+ rtl::Reference<Diagram> xDiagram = m_xChartModel->getFirstChartDiagram();
+ Diagram::tTemplateWithServiceName aTemplate;
+ if (xDiagram)
+ aTemplate = xDiagram->getTemplate(xChartTypeManager);
+ OUString aServiceName(aTemplate.sServiceName);
bool bFound = false;
@@ -183,20 +172,22 @@ void ChartTypePanel::Initialize()
m_xMainTypeList->set_active(nM);
showAllControls(*elem);
- uno::Reference<beans::XPropertySet> xTemplateProps(aTemplate.first, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xTemplateProps(
+ static_cast<cppu::OWeakObject*>(aTemplate.xChartTypeTemplate.get()),
+ uno::UNO_QUERY);
ChartTypeParameter aParameter
= elem->getChartTypeParameterForService(aServiceName, xTemplateProps);
m_pCurrentMainType = getSelectedMainType();
//set ThreeDLookScheme
- aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
- if (!aParameter.b3DLook && aParameter.eThreeDLookScheme != ThreeDLookScheme_Realistic)
- aParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
+ aParameter.eThreeDLookScheme = xDiagram->detectScheme();
+ if (!aParameter.b3DLook
+ && aParameter.eThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
try
{
- uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES)
+ xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES)
>>= aParameter.bSortByXValues;
}
catch (const uno::Exception&)
@@ -228,15 +219,14 @@ void ChartTypePanel::updateData()
// Chart Type related
if (!m_xChartModel.is())
return;
- uno::Reference<lang::XMultiServiceFactory> xTemplateManager(
- m_xChartModel->getChartTypeManager(), uno::UNO_QUERY);
- uno::Reference<frame::XModel> xModel(m_xChartModel);
- uno::Reference<css::chart2::XDiagram> xDiagram(ChartModelHelper::findDiagram(xModel));
- DiagramHelper::tTemplateWithServiceName aTemplate
- = DiagramHelper::getTemplateForDiagram(xDiagram, xTemplateManager);
- OUString aServiceName(aTemplate.second);
-
- sal_uInt16 nM = 0;
+ rtl::Reference<::chart::ChartTypeManager> xChartTypeManager = m_xChartModel->getTypeManager();
+ rtl::Reference<Diagram> xDiagram = m_xChartModel->getFirstChartDiagram();
+ Diagram::tTemplateWithServiceName aTemplate;
+ if (xDiagram)
+ aTemplate = xDiagram->getTemplate(xChartTypeManager);
+ OUString aServiceName(aTemplate.sServiceName);
+
+ //sal_uInt16 nM = 0;
for (auto const& elem : m_aChartTypeDialogControllerList)
{
if (elem->isSubType(aServiceName))
@@ -245,11 +235,15 @@ void ChartTypePanel::updateData()
//m_pMainTypeList->select_entry_region(nM, nM);
break;
}
- ++nM;
+ //++nM;
}
}
-void ChartTypePanel::DataChanged(const DataChangedEvent&) { updateData(); }
+void ChartTypePanel::DataChanged(const DataChangedEvent& rEvent)
+{
+ PanelLayout::DataChanged(rEvent);
+ updateData();
+}
void ChartTypePanel::HandleContextChange(const vcl::EnumContext& rContext)
{
@@ -265,32 +259,38 @@ void ChartTypePanel::HandleContextChange(const vcl::EnumContext& rContext)
void ChartTypePanel::modelInvalid() { mbModelValid = false; }
-void ChartTypePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+void ChartTypePanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
if (mbModelValid)
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel,
- css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ m_xChartModel->removeModifyListener(mxListener);
}
- mxModel = xModel;
- mbModelValid = true;
+ m_xChartModel = xModel;
+ mbModelValid = m_xChartModel.is();
+
+ if (!mbModelValid)
+ return;
+
+ m_xChartModel->addModifyListener(mxListener);
+}
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel,
- css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->addModifyListener(mxListener);
+void ChartTypePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
+ assert(!xModel || pModel);
+ doUpdateModel(pModel);
}
-uno::Reference<css::chart2::XChartTypeTemplate> ChartTypePanel::getCurrentTemplate() const
+rtl::Reference<::chart::ChartTypeTemplate> ChartTypePanel::getCurrentTemplate() const
{
if (m_pCurrentMainType && m_xChartModel.is())
{
ChartTypeParameter aParameter(getCurrentParameter());
m_pCurrentMainType->adjustParameterToSubType(aParameter);
- uno::Reference<lang::XMultiServiceFactory> xTemplateManager(
- m_xChartModel->getChartTypeManager(), uno::UNO_QUERY);
- return m_pCurrentMainType->getCurrentTemplate(aParameter, xTemplateManager);
+ rtl::Reference<::chart::ChartTypeManager> xChartTypeManager
+ = m_xChartModel->getTypeManager();
+ return m_pCurrentMainType->getCurrentTemplate(aParameter, xChartTypeManager);
}
return nullptr;
}
@@ -367,12 +367,11 @@ void ChartTypePanel::stateChanged()
commitToModel(aParameter);
//detect the new ThreeDLookScheme
- uno::Reference<css::chart2::XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
- aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
+ rtl::Reference<Diagram> xDiagram = m_xChartModel->getFirstChartDiagram();
+ aParameter.eThreeDLookScheme = xDiagram->detectScheme();
try
{
- uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
}
catch (const uno::Exception&)
{
@@ -412,16 +411,15 @@ void ChartTypePanel::selectMainType()
m_pCurrentMainType->adjustParameterToMainType(aParameter);
commitToModel(aParameter);
//detect the new ThreeDLookScheme
- aParameter.eThreeDLookScheme
- = ThreeDHelper::detectScheme(ChartModelHelper::findDiagram(m_xChartModel));
- if (!aParameter.b3DLook && aParameter.eThreeDLookScheme != ThreeDLookScheme_Realistic)
- aParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
+ aParameter.eThreeDLookScheme = m_xChartModel->getFirstChartDiagram()->detectScheme();
+ if (!aParameter.b3DLook
+ && aParameter.eThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
- uno::Reference<css::chart2::XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
+ rtl::Reference<Diagram> xDiagram = m_xChartModel->getFirstChartDiagram();
try
{
- uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
}
catch (const uno::Exception&)
{
@@ -429,7 +427,8 @@ void ChartTypePanel::selectMainType()
}
fillAllControls(aParameter);
- uno::Reference<beans::XPropertySet> xTemplateProps(getCurrentTemplate(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xTemplateProps(
+ static_cast<cppu::OWeakObject*>(getCurrentTemplate().get()), uno::UNO_QUERY);
m_pCurrentMainType->fillExtraControls(m_xChartModel, xTemplateProps);
}
} // end of namespace ::chart::sidebar
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.hxx b/chart2/source/controller/sidebar/ChartTypePanel.hxx
index 7c4e27246ca3..8df0020431db 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.hxx
@@ -62,20 +62,16 @@ public:
virtual void HandleContextChange(const vcl::EnumContext& rContext) override;
// constructor/destructor
- ChartTypePanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame,
- ::chart::ChartController* pController);
+ ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* pController);
virtual ~ChartTypePanel() override;
- virtual void dispose() override;
-
virtual void updateData() override;
virtual void modelInvalid() override;
virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) override;
- virtual css::uno::Reference<css::chart2::XChartTypeTemplate>
- getCurrentTemplate() const override;
+ virtual rtl::Reference<::chart::ChartTypeTemplate> getCurrentTemplate() const override;
private:
ChartTypeDialogController* getSelectedMainType();
@@ -93,12 +89,12 @@ private:
vcl::EnumContext maContext;
- css::uno::Reference<css::frame::XModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
bool mbModelValid;
void Initialize();
+ void doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel);
std::unique_ptr<Dim3DLookResourceGroup> m_pDim3DLookResourceGroup;
std::unique_ptr<StackingResourceGroup> m_pStackingResourceGroup;
@@ -106,7 +102,7 @@ private:
std::unique_ptr<GeometryResourceGroup> m_pGeometryResourceGroup;
std::unique_ptr<SortByXValuesResourceGroup> m_pSortByXValuesResourceGroup;
- css::uno::Reference<css::chart2::XChartDocument> m_xChartModel;
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
std::vector<std::unique_ptr<ChartTypeDialogController>> m_aChartTypeDialogControllerList;
ChartTypeDialogController* m_pCurrentMainType;
diff --git a/chart2/source/controller/uitest/uiobject.cxx b/chart2/source/controller/uitest/uiobject.cxx
index 651c407565d7..c75f15c3885c 100644
--- a/chart2/source/controller/uitest/uiobject.cxx
+++ b/chart2/source/controller/uitest/uiobject.cxx
@@ -11,21 +11,21 @@
#include <uiobject.hxx>
#include <ChartWindow.hxx>
+#include <ChartView.hxx>
#include <ChartController.hxx>
+#include <ChartModel.hxx>
#include <ObjectHierarchy.hxx>
#include <chartview/ExplicitValueProvider.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-
-#include <comphelper/servicehelper.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <algorithm>
#include <iterator>
ChartUIObject::ChartUIObject(const VclPtr<chart::ChartWindow>& xChartWindow,
- const OUString& rCID):
- maCID(rCID),
+ OUString aCID):
+ maCID(std::move(aCID)),
mxChartWindow(xChartWindow)
{
}
@@ -95,6 +95,14 @@ OUString ChartUIObject::get_type() const
return "ChartUIObject for type: ";
}
+bool ChartUIObject::equals(const UIObject& rOther) const
+{
+ const ChartUIObject* pOther = dynamic_cast<const ChartUIObject*>(&rOther);
+ if (!pOther)
+ return false;
+ return mxChartWindow.get() == pOther->mxChartWindow.get();
+}
+
ChartWindowUIObject::ChartWindowUIObject(const VclPtr<chart::ChartWindow>& xChartWindow):
WindowUIObject(xChartWindow),
mxChartWindow(xChartWindow)
@@ -172,10 +180,9 @@ std::set<OUString> ChartWindowUIObject::get_children() const
if (!pController)
return aChildren;
- css::uno::Reference< css::chart2::XChartDocument > xChartDoc( pController->getModel(), css::uno::UNO_QUERY );
-
- css::uno::Reference<css::uno::XInterface> xChartView = pController->getChartView();
- chart::ExplicitValueProvider* pValueProvider = comphelper::getUnoTunnelImplementation<chart::ExplicitValueProvider>( xChartView );
+ rtl::Reference<::chart::ChartModel> xChartDoc = pController->getChartModel();
+ rtl::Reference<::chart::ChartView> xChartView = pController->getChartView();
+ chart::ExplicitValueProvider* pValueProvider = xChartView.get();
chart::ObjectHierarchy aHierarchy(xChartDoc, pValueProvider);
chart::ObjectIdentifier aIdentifier = chart::ObjectHierarchy::getRootNodeOID();
aChildren.insert(aIdentifier.getObjectCID());