summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/chartcore.component7
-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.hxx12
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartShape.cxx9
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartShape.hxx9
-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/AccessibleViewForwarder.hxx23
-rw-r--r--chart2/source/controller/accessibility/ChartElementFactory.cxx14
-rw-r--r--chart2/source/controller/accessibility/ChartElementFactory.hxx12
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.cxx66
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.hxx20
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.cxx85
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.hxx19
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx125
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx36
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx150
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx27
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx359
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx116
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx29
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx426
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx19
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.cxx68
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.hxx19
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.cxx68
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.hxx20
-rw-r--r--chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx181
-rw-r--r--chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx25
-rw-r--r--chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.cxx173
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.hxx19
-rw-r--r--chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx154
-rw-r--r--chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx25
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx67
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx20
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx22
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx50
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx12
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx15
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx8
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx71
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx19
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx10
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx15
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx23
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx15
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx11
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx7
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx10
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx15
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx10
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx15
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx67
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx40
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx23
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx114
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx16
-rw-r--r--chart2/source/controller/chartcontroller.component5
-rw-r--r--chart2/source/controller/dialogs/ChangingResource.cxx13
-rw-r--r--chart2/source/controller/dialogs/ChartResourceGroups.cxx146
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx86
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx185
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.hxx23
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx411
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.hxx35
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx386
-rw-r--r--chart2/source/controller/dialogs/DialogModel.hxx55
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx286
-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.cxx25
-rw-r--r--chart2/source/controller/dialogs/TitleDialogData.cxx58
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.cxx20
-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.cxx31
-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.cxx11
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTitle.cxx7
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.cxx15
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.hxx18
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx112
-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.cxx19
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx153
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.hxx29
-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.cxx104
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.cxx90
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.hxx14
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx47
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx14
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx36
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx15
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx89
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx61
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.cxx43
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.hxx17
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.cxx49
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.hxx40
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx81
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hxx10
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.hxx15
-rw-r--r--chart2/source/controller/dialogs/tp_DataPointOption.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_DataPointOption.hxx5
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx137
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hxx16
-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.hxx9
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.cxx16
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.hxx10
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.hxx12
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx25
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hxx5
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.cxx18
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hxx14
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx99
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.hxx10
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx48
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hxx7
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.cxx20
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.hxx12
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.hxx5
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx29
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx12
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx98
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx40
-rw-r--r--chart2/source/controller/inc/AccessibleBase.hxx52
-rw-r--r--chart2/source/controller/inc/AccessibleChartView.hxx28
-rw-r--r--chart2/source/controller/inc/AccessibleTextHelper.hxx40
-rw-r--r--chart2/source/controller/inc/AxisItemConverter.hxx25
-rw-r--r--chart2/source/controller/inc/CharacterPropertyItemConverter.hxx11
-rw-r--r--chart2/source/controller/inc/ChartController.hxx118
-rw-r--r--chart2/source/controller/inc/ChartDocumentWrapper.hxx26
-rw-r--r--chart2/source/controller/inc/ChartToolbarController.hxx15
-rw-r--r--chart2/source/controller/inc/ChartWindow.hxx16
-rw-r--r--chart2/source/controller/inc/CommandDispatchContainer.hxx18
-rw-r--r--chart2/source/controller/inc/ConfigurationAccess.hxx44
-rw-r--r--chart2/source/controller/inc/DataPointItemConverter.hxx25
-rw-r--r--chart2/source/controller/inc/DataTableItemConverter.hxx56
-rw-r--r--chart2/source/controller/inc/DrawViewWrapper.hxx6
-rw-r--r--chart2/source/controller/inc/ErrorBarItemConverter.hxx18
-rw-r--r--chart2/source/controller/inc/GraphicPropertyItemConverter.hxx19
-rw-r--r--chart2/source/controller/inc/ItemConverter.hxx21
-rw-r--r--chart2/source/controller/inc/ItemPropertyMap.hxx13
-rw-r--r--chart2/source/controller/inc/LegendItemConverter.hxx23
-rw-r--r--chart2/source/controller/inc/MultipleChartConverters.hxx44
-rw-r--r--chart2/source/controller/inc/ObjectHierarchy.hxx65
-rw-r--r--chart2/source/controller/inc/ObjectNameProvider.hxx29
-rw-r--r--chart2/source/controller/inc/PositionAndSizeHelper.hxx8
-rw-r--r--chart2/source/controller/inc/RangeSelectionHelper.hxx14
-rw-r--r--chart2/source/controller/inc/RangeSelectionListener.hxx33
-rw-r--r--chart2/source/controller/inc/RegressionCurveItemConverter.hxx24
-rw-r--r--chart2/source/controller/inc/RegressionEquationItemConverter.hxx15
-rw-r--r--chart2/source/controller/inc/SelectionHelper.hxx13
-rw-r--r--chart2/source/controller/inc/SeriesOptionsItemConverter.hxx31
-rw-r--r--chart2/source/controller/inc/ShapeController.h38
-rw-r--r--chart2/source/controller/inc/StatisticsItemConverter.hxx23
-rw-r--r--chart2/source/controller/inc/TabPageNotifiable.hxx15
-rw-r--r--chart2/source/controller/inc/TextDirectionListBox.hxx9
-rw-r--r--chart2/source/controller/inc/TextLabelItemConverter.hxx24
-rw-r--r--chart2/source/controller/inc/TimerTriggeredControllerLock.hxx23
-rw-r--r--chart2/source/controller/inc/TitleDialogData.hxx17
-rw-r--r--chart2/source/controller/inc/TitleItemConverter.hxx14
-rw-r--r--chart2/source/controller/inc/dlg_ChartType.hxx21
-rw-r--r--chart2/source/controller/inc/dlg_ChartType_UNO.hxx10
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard.hxx36
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx20
-rw-r--r--chart2/source/controller/inc/dlg_DataEditor.hxx16
-rw-r--r--chart2/source/controller/inc/dlg_DataSource.hxx26
-rw-r--r--chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx18
-rw-r--r--chart2/source/controller/inc/dlg_InsertDataLabel.hxx7
-rw-r--r--chart2/source/controller/inc/dlg_InsertDataTable.hxx52
-rw-r--r--chart2/source/controller/inc/dlg_InsertErrorBars.hxx29
-rw-r--r--chart2/source/controller/inc/dlg_InsertLegend.hxx13
-rw-r--r--chart2/source/controller/inc/dlg_InsertTitle.hxx7
-rw-r--r--chart2/source/controller/inc/dlg_ObjectProperties.hxx25
-rw-r--r--chart2/source/controller/inc/dlg_ShapeFont.hxx10
-rw-r--r--chart2/source/controller/inc/dlg_ShapeParagraph.hxx10
-rw-r--r--chart2/source/controller/inc/dlg_View3D.hxx18
-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.hxx20
-rw-r--r--chart2/source/controller/inc/res_LegendPosition.hxx22
-rw-r--r--chart2/source/controller/inc/res_Titles.hxx27
-rw-r--r--chart2/source/controller/inc/uiobject.hxx8
-rw-r--r--chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx97
-rw-r--r--chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx11
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx125
-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.cxx30
-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.hxx281
-rw-r--r--chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx120
-rw-r--r--chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx72
-rw-r--r--chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx99
-rw-r--r--chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx22
-rw-r--r--chart2/source/controller/main/ChartController.cxx575
-rw-r--r--chart2/source/controller/main/ChartController_EditData.cxx7
-rw-r--r--chart2/source/controller/main/ChartController_Insert.cxx482
-rw-r--r--chart2/source/controller/main/ChartController_Position.cxx71
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx306
-rw-r--r--chart2/source/controller/main/ChartController_TextEdit.cxx227
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx377
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx683
-rw-r--r--chart2/source/controller/main/ChartDropTargetHelper.cxx28
-rw-r--r--chart2/source/controller/main/ChartDropTargetHelper.hxx12
-rw-r--r--chart2/source/controller/main/ChartFrameloader.cxx114
-rw-r--r--chart2/source/controller/main/ChartFrameloader.hxx5
-rw-r--r--chart2/source/controller/main/ChartModelClone.cxx71
-rw-r--r--chart2/source/controller/main/ChartModelClone.hxx17
-rw-r--r--chart2/source/controller/main/ChartTransferable.cxx33
-rw-r--r--chart2/source/controller/main/ChartTransferable.hxx10
-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.hxx21
-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.hxx8
-rw-r--r--chart2/source/controller/main/DragMethod_Base.cxx18
-rw-r--r--chart2/source/controller/main/DragMethod_Base.hxx17
-rw-r--r--chart2/source/controller/main/DragMethod_PieSegment.cxx19
-rw-r--r--chart2/source/controller/main/DragMethod_PieSegment.hxx10
-rw-r--r--chart2/source/controller/main/DragMethod_RotateDiagram.cxx45
-rw-r--r--chart2/source/controller/main/DragMethod_RotateDiagram.hxx8
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx225
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.h42
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.hxx16
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx59
-rw-r--r--chart2/source/controller/main/ElementSelector.hxx19
-rw-r--r--chart2/source/controller/main/FeatureCommandDispatchBase.cxx4
-rw-r--r--chart2/source/controller/main/FeatureCommandDispatchBase.hxx50
-rw-r--r--chart2/source/controller/main/ObjectHierarchy.cxx432
-rw-r--r--chart2/source/controller/main/PositionAndSizeHelper.cxx50
-rw-r--r--chart2/source/controller/main/SelectionHelper.cxx43
-rw-r--r--chart2/source/controller/main/ShapeController.cxx206
-rw-r--r--chart2/source/controller/main/ShapeController.hxx10
-rw-r--r--chart2/source/controller/main/StatusBarCommandDispatch.cxx27
-rw-r--r--chart2/source/controller/main/StatusBarCommandDispatch.hxx13
-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.hxx46
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.cxx15
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.hxx14
-rw-r--r--chart2/source/controller/main/UndoGuard.cxx15
-rw-r--r--chart2/source/controller/main/UndoGuard.hxx9
-rw-r--r--chart2/source/controller/sidebar/Chart2PanelFactory.cxx39
-rw-r--r--chart2/source/controller/sidebar/Chart2PanelFactory.hxx15
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx111
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.hxx17
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.cxx143
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.hxx24
-rw-r--r--chart2/source/controller/sidebar/ChartColorWrapper.cxx58
-rw-r--r--chart2/source/controller/sidebar/ChartColorWrapper.hxx30
-rw-r--r--chart2/source/controller/sidebar/ChartElementsPanel.cxx190
-rw-r--r--chart2/source/controller/sidebar/ChartElementsPanel.hxx23
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.cxx115
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.hxx21
-rw-r--r--chart2/source/controller/sidebar/ChartLinePanel.cxx112
-rw-r--r--chart2/source/controller/sidebar/ChartLinePanel.hxx22
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.cxx192
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.hxx21
-rw-r--r--chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx15
-rw-r--r--chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx14
-rw-r--r--chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx4
-rw-r--r--chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx19
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.cxx144
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.hxx28
-rw-r--r--chart2/source/controller/uitest/uiobject.cxx31
-rw-r--r--chart2/source/inc/Axis.hxx (renamed from chart2/source/model/main/Axis.hxx)39
-rw-r--r--chart2/source/inc/AxisHelper.hxx146
-rw-r--r--chart2/source/inc/AxisIndexDefines.hxx5
-rw-r--r--chart2/source/inc/BaseCoordinateSystem.hxx (renamed from chart2/source/model/inc/BaseCoordinateSystem.hxx)38
-rw-r--r--chart2/source/inc/BaseGFXHelper.hxx36
-rw-r--r--chart2/source/inc/CachedDataSequence.hxx22
-rw-r--r--chart2/source/inc/ChangingResource.hxx4
-rw-r--r--chart2/source/inc/CharacterProperties.hxx14
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx55
-rw-r--r--chart2/source/inc/ChartResourceGroupDlgs.hxx8
-rw-r--r--chart2/source/inc/ChartResourceGroups.hxx31
-rw-r--r--chart2/source/inc/ChartType.hxx (renamed from chart2/source/model/template/ChartType.hxx)53
-rw-r--r--chart2/source/inc/ChartTypeDialogController.hxx86
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx78
-rw-r--r--chart2/source/inc/ChartTypeTemplate.hxx (renamed from chart2/source/model/template/ChartTypeTemplate.hxx)129
-rw-r--r--chart2/source/inc/ChartTypeTemplateProvider.hxx24
-rw-r--r--chart2/source/inc/ChartViewHelper.hxx24
-rw-r--r--chart2/source/inc/CloneHelper.hxx25
-rw-r--r--chart2/source/inc/ColorPerPointHelper.hxx13
-rw-r--r--chart2/source/inc/CommonConverters.hxx59
-rw-r--r--chart2/source/inc/CommonFunctors.hxx86
-rw-r--r--chart2/source/inc/ConfigColorScheme.hxx10
-rw-r--r--chart2/source/inc/ControllerLockGuard.hxx41
-rw-r--r--chart2/source/inc/DataInterpreter.hxx154
-rw-r--r--chart2/source/inc/DataSeries.hxx (renamed from chart2/source/model/inc/DataSeries.hxx)64
-rw-r--r--chart2/source/inc/DataSeriesHelper.hxx160
-rw-r--r--chart2/source/inc/DataSeriesProperties.hxx (renamed from chart2/source/model/main/DataSeriesProperties.hxx)19
-rw-r--r--chart2/source/inc/DataSource.hxx15
-rw-r--r--chart2/source/inc/DataSourceHelper.hxx43
-rw-r--r--chart2/source/inc/DataTable.hxx87
-rw-r--r--chart2/source/inc/Diagram.hxx381
-rw-r--r--chart2/source/inc/DiagramHelper.hxx238
-rw-r--r--chart2/source/inc/DisposeHelper.hxx25
-rw-r--r--chart2/source/inc/ErrorBar.hxx18
-rw-r--r--chart2/source/inc/EventListenerHelper.hxx16
-rw-r--r--chart2/source/inc/ExplicitCategoriesProvider.hxx29
-rw-r--r--chart2/source/inc/ExponentialRegressionCurveCalculator.hxx8
-rw-r--r--chart2/source/inc/FastPropertyIdRanges.hxx23
-rw-r--r--chart2/source/inc/FillProperties.hxx10
-rw-r--r--chart2/source/inc/FormattedString.hxx (renamed from chart2/source/model/main/FormattedString.hxx)28
-rw-r--r--chart2/source/inc/FormattedStringHelper.hxx19
-rw-r--r--chart2/source/inc/GridProperties.hxx (renamed from chart2/source/model/main/GridProperties.hxx)25
-rw-r--r--chart2/source/inc/InternalData.hxx13
-rw-r--r--chart2/source/inc/InternalDataProvider.hxx23
-rw-r--r--chart2/source/inc/LabeledDataSequence.hxx23
-rw-r--r--chart2/source/inc/Legend.hxx (renamed from chart2/source/model/main/Legend.hxx)27
-rw-r--r--chart2/source/inc/LegendHelper.hxx16
-rw-r--r--chart2/source/inc/LifeTime.hxx60
-rw-r--r--chart2/source/inc/LinePropertiesHelper.hxx13
-rw-r--r--chart2/source/inc/LinearRegressionCurveCalculator.hxx11
-rw-r--r--chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx8
-rw-r--r--chart2/source/inc/MeanValueRegressionCurveCalculator.hxx8
-rw-r--r--chart2/source/inc/MediaDescriptorHelper.hxx8
-rw-r--r--chart2/source/inc/ModifyListenerCallBack.hxx (renamed from chart2/source/inc/TrueGuard.hxx)41
-rw-r--r--chart2/source/inc/ModifyListenerHelper.hxx136
-rw-r--r--chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx10
-rw-r--r--chart2/source/inc/MutexContainer.hxx41
-rw-r--r--chart2/source/inc/NameContainer.hxx19
-rw-r--r--chart2/source/inc/NumberFormatterWrapper.hxx10
-rw-r--r--chart2/source/inc/OPropertySet.hxx91
-rw-r--r--chart2/source/inc/ObjectIdentifier.hxx145
-rw-r--r--chart2/source/inc/PolynomialRegressionCurveCalculator.hxx5
-rw-r--r--chart2/source/inc/PopupRequest.hxx28
-rw-r--r--chart2/source/inc/PotentialRegressionCurveCalculator.hxx8
-rw-r--r--chart2/source/inc/PropertyHelper.hxx23
-rw-r--r--chart2/source/inc/RangeHighlighter.hxx29
-rw-r--r--chart2/source/inc/ReferenceSizeProvider.hxx16
-rw-r--r--chart2/source/inc/RegressionCalculationHelper.hxx16
-rw-r--r--chart2/source/inc/RegressionCurveCalculator.hxx52
-rw-r--r--chart2/source/inc/RegressionCurveHelper.hxx111
-rw-r--r--chart2/source/inc/RegressionCurveModel.hxx (renamed from chart2/source/tools/RegressionCurveModel.hxx)23
-rw-r--r--chart2/source/inc/RelativePositionHelper.hxx7
-rw-r--r--chart2/source/inc/RelativeSizeHelper.hxx15
-rw-r--r--chart2/source/inc/ResId.hxx10
-rw-r--r--chart2/source/inc/Scaling.hxx12
-rw-r--r--chart2/source/inc/SceneProperties.hxx10
-rw-r--r--chart2/source/inc/StackMode.hxx6
-rw-r--r--chart2/source/inc/StatisticsHelper.hxx50
-rw-r--r--chart2/source/inc/ThreeDHelper.hxx59
-rw-r--r--chart2/source/inc/Title.hxx (renamed from chart2/source/model/main/Title.hxx)22
-rw-r--r--chart2/source/inc/TitleHelper.hxx50
-rw-r--r--chart2/source/inc/UncachedDataSequence.hxx35
-rw-r--r--chart2/source/inc/UserDefinedProperties.hxx9
-rw-r--r--chart2/source/inc/WeakListenerAdapter.hxx25
-rw-r--r--chart2/source/inc/WrappedDefaultProperty.hxx8
-rw-r--r--chart2/source/inc/WrappedDirectStateProperty.hxx13
-rw-r--r--chart2/source/inc/WrappedIgnoreProperty.hxx10
-rw-r--r--chart2/source/inc/WrappedProperty.hxx11
-rw-r--r--chart2/source/inc/WrappedPropertySet.hxx18
-rw-r--r--chart2/source/inc/XMLRangeHelper.hxx13
-rw-r--r--chart2/source/inc/charttoolsdllapi.hxx5
-rw-r--r--chart2/source/inc/chartview/ChartSfxItemIds.hxx30
-rw-r--r--chart2/source/inc/chartview/DataPointSymbolSupplier.hxx15
-rw-r--r--chart2/source/inc/chartview/DrawModelWrapper.hxx29
-rw-r--r--chart2/source/inc/chartview/ExplicitScaleValues.hxx39
-rw-r--r--chart2/source/inc/chartview/ExplicitValueProvider.hxx39
-rw-r--r--chart2/source/inc/chartview/chartviewdllapi.hxx5
-rw-r--r--chart2/source/inc/defines.hxx7
-rw-r--r--chart2/source/inc/res_BarGeometry.hxx5
-rw-r--r--chart2/source/inc/servicenames.hxx52
-rw-r--r--chart2/source/inc/servicenames_charttypes.hxx39
-rw-r--r--chart2/source/inc/servicenames_coosystems.hxx13
-rw-r--r--chart2/source/model/filter/XMLFilter.cxx123
-rw-r--r--chart2/source/model/inc/CartesianCoordinateSystem.hxx33
-rw-r--r--chart2/source/model/inc/ChartTypeManager.hxx74
-rw-r--r--chart2/source/model/inc/Diagram.hxx186
-rw-r--r--chart2/source/model/inc/PolarCoordinateSystem.hxx33
-rw-r--r--chart2/source/model/inc/StockBar.hxx18
-rw-r--r--chart2/source/model/inc/XMLFilter.hxx13
-rw-r--r--chart2/source/model/main/Axis.cxx270
-rw-r--r--chart2/source/model/main/BaseCoordinateSystem.cxx206
-rw-r--r--chart2/source/model/main/CartesianCoordinateSystem.cxx2
-rw-r--r--chart2/source/model/main/ChartModel.cxx262
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx174
-rw-r--r--chart2/source/model/main/DataPoint.cxx90
-rw-r--r--chart2/source/model/main/DataPoint.hxx15
-rw-r--r--chart2/source/model/main/DataPointProperties.cxx60
-rw-r--r--chart2/source/model/main/DataPointProperties.hxx9
-rw-r--r--chart2/source/model/main/DataSeries.cxx360
-rw-r--r--chart2/source/model/main/DataSeriesProperties.cxx11
-rw-r--r--chart2/source/model/main/DataTable.cxx209
-rw-r--r--chart2/source/model/main/Diagram.cxx1907
-rw-r--r--chart2/source/model/main/FormattedString.cxx144
-rw-r--r--chart2/source/model/main/GridProperties.cxx126
-rw-r--r--chart2/source/model/main/Legend.cxx150
-rw-r--r--chart2/source/model/main/PageBackground.cxx149
-rw-r--r--chart2/source/model/main/PageBackground.hxx22
-rw-r--r--chart2/source/model/main/PolarCoordinateSystem.cxx3
-rw-r--r--chart2/source/model/main/StockBar.cxx131
-rw-r--r--chart2/source/model/main/Title.cxx168
-rw-r--r--chart2/source/model/main/UndoManager.cxx19
-rw-r--r--chart2/source/model/main/UndoManager.hxx12
-rw-r--r--chart2/source/model/main/Wall.cxx138
-rw-r--r--chart2/source/model/main/Wall.hxx20
-rw-r--r--chart2/source/model/template/AreaChartType.cxx5
-rw-r--r--chart2/source/model/template/AreaChartType.hxx10
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.cxx140
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.hxx30
-rw-r--r--chart2/source/model/template/BarChartType.cxx11
-rw-r--r--chart2/source/model/template/BarChartType.hxx10
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.cxx178
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.hxx40
-rw-r--r--chart2/source/model/template/BubbleChartType.cxx106
-rw-r--r--chart2/source/model/template/BubbleChartType.hxx17
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.cxx125
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.hxx27
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.cxx119
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.hxx22
-rw-r--r--chart2/source/model/template/CandleStickChartType.cxx103
-rw-r--r--chart2/source/model/template/CandleStickChartType.hxx12
-rw-r--r--chart2/source/model/template/ChartType.cxx113
-rw-r--r--chart2/source/model/template/ChartTypeManager.cxx590
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx482
-rw-r--r--chart2/source/model/template/ColumnChartType.cxx110
-rw-r--r--chart2/source/model/template/ColumnChartType.hxx12
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.cxx248
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.hxx52
-rw-r--r--chart2/source/model/template/ColumnLineDataInterpreter.cxx31
-rw-r--r--chart2/source/model/template/ColumnLineDataInterpreter.hxx22
-rw-r--r--chart2/source/model/template/DataInterpreter.cxx131
-rw-r--r--chart2/source/model/template/DataInterpreter.hxx79
-rw-r--r--chart2/source/model/template/FilledNetChartType.cxx6
-rw-r--r--chart2/source/model/template/FilledNetChartType.hxx22
-rw-r--r--chart2/source/model/template/LineChartType.cxx127
-rw-r--r--chart2/source/model/template/LineChartType.hxx12
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.cxx230
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.hxx33
-rw-r--r--chart2/source/model/template/NetChartType.cxx58
-rw-r--r--chart2/source/model/template/NetChartType.hxx19
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx79
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.hxx27
-rw-r--r--chart2/source/model/template/PieChartType.cxx145
-rw-r--r--chart2/source/model/template/PieChartType.hxx18
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx373
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.hxx62
-rw-r--r--chart2/source/model/template/ScatterChartType.cxx144
-rw-r--r--chart2/source/model/template/ScatterChartType.hxx17
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.cxx236
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.hxx34
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.cxx321
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.hxx55
-rw-r--r--chart2/source/model/template/StockDataInterpreter.cxx134
-rw-r--r--chart2/source/model/template/StockDataInterpreter.hxx22
-rw-r--r--chart2/source/model/template/XYDataInterpreter.cxx108
-rw-r--r--chart2/source/model/template/XYDataInterpreter.hxx22
-rw-r--r--chart2/source/tools/AxisHelper.cxx570
-rw-r--r--chart2/source/tools/BaseGFXHelper.cxx38
-rw-r--r--chart2/source/tools/CachedDataSequence.cxx142
-rw-r--r--chart2/source/tools/CharacterProperties.cxx19
-rw-r--r--chart2/source/tools/ChartModelHelper.cxx139
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx103
-rw-r--r--chart2/source/tools/ChartViewHelper.cxx31
-rw-r--r--chart2/source/tools/ColorPerPointHelper.cxx27
-rw-r--r--chart2/source/tools/CommonConverters.cxx217
-rw-r--r--chart2/source/tools/ConfigColorScheme.cxx34
-rw-r--r--chart2/source/tools/ControllerLockGuard.cxx11
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx474
-rw-r--r--chart2/source/tools/DataSource.cxx7
-rw-r--r--chart2/source/tools/DataSourceHelper.cxx176
-rw-r--r--chart2/source/tools/DiagramHelper.cxx1256
-rw-r--r--chart2/source/tools/ErrorBar.cxx62
-rw-r--r--chart2/source/tools/ExplicitCategoriesProvider.cxx73
-rw-r--r--chart2/source/tools/ExponentialRegressionCurveCalculator.cxx43
-rw-r--r--chart2/source/tools/FillProperties.cxx18
-rw-r--r--chart2/source/tools/FormattedStringHelper.cxx31
-rw-r--r--chart2/source/tools/ImplOPropertySet.cxx177
-rw-r--r--chart2/source/tools/ImplOPropertySet.hxx89
-rw-r--r--chart2/source/tools/InternalData.cxx133
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx412
-rw-r--r--chart2/source/tools/LabeledDataSequence.cxx62
-rw-r--r--chart2/source/tools/LegendHelper.cxx45
-rw-r--r--chart2/source/tools/LifeTime.cxx100
-rw-r--r--chart2/source/tools/LinePropertiesHelper.cxx17
-rw-r--r--chart2/source/tools/LinearRegressionCurveCalculator.cxx16
-rw-r--r--chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx36
-rw-r--r--chart2/source/tools/MeanValueRegressionCurveCalculator.cxx34
-rw-r--r--chart2/source/tools/MediaDescriptorHelper.cxx10
-rw-r--r--chart2/source/tools/ModifyListenerCallBack.cxx111
-rw-r--r--chart2/source/tools/ModifyListenerHelper.cxx141
-rw-r--r--chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx109
-rw-r--r--chart2/source/tools/NameContainer.cxx38
-rw-r--r--chart2/source/tools/NumberFormatterWrapper.cxx31
-rw-r--r--chart2/source/tools/OPropertySet.cxx151
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx845
-rw-r--r--chart2/source/tools/PolynomialRegressionCurveCalculator.cxx16
-rw-r--r--chart2/source/tools/PopupRequest.cxx15
-rw-r--r--chart2/source/tools/PotentialRegressionCurveCalculator.cxx35
-rw-r--r--chart2/source/tools/PropertyHelper.cxx117
-rw-r--r--chart2/source/tools/RangeHighlighter.cxx88
-rw-r--r--chart2/source/tools/ReferenceSizeProvider.cxx163
-rw-r--r--chart2/source/tools/RegressionCurveCalculator.cxx43
-rw-r--r--chart2/source/tools/RegressionCurveHelper.cxx374
-rw-r--r--chart2/source/tools/RegressionCurveModel.cxx117
-rw-r--r--chart2/source/tools/RegressionEquation.cxx165
-rw-r--r--chart2/source/tools/RegressionEquation.hxx15
-rw-r--r--chart2/source/tools/RelativePositionHelper.cxx4
-rw-r--r--chart2/source/tools/RelativeSizeHelper.cxx40
-rw-r--r--chart2/source/tools/ResId.cxx5
-rw-r--r--chart2/source/tools/Scaling.cxx44
-rw-r--r--chart2/source/tools/SceneProperties.cxx7
-rw-r--r--chart2/source/tools/StatisticsHelper.cxx95
-rw-r--r--chart2/source/tools/ThreeDHelper.cxx810
-rw-r--r--chart2/source/tools/TitleHelper.cxx357
-rw-r--r--chart2/source/tools/TrueGuard.cxx38
-rw-r--r--chart2/source/tools/UncachedDataSequence.cxx103
-rw-r--r--chart2/source/tools/WeakListenerAdapter.cxx15
-rw-r--r--chart2/source/tools/WrappedDefaultProperty.cxx7
-rw-r--r--chart2/source/tools/WrappedProperty.cxx9
-rw-r--r--chart2/source/tools/WrappedPropertySet.cxx15
-rw-r--r--chart2/source/tools/XMLRangeHelper.cxx7
-rw-r--r--chart2/source/view/axes/DateHelper.cxx2
-rw-r--r--chart2/source/view/axes/DateScaling.cxx66
-rw-r--r--chart2/source/view/axes/DateScaling.hxx4
-rw-r--r--chart2/source/view/axes/MinimumAndMaximumSupplier.cxx41
-rw-r--r--chart2/source/view/axes/ScaleAutomatism.cxx37
-rw-r--r--chart2/source/view/axes/TickmarkProperties.hxx10
-rw-r--r--chart2/source/view/axes/Tickmarks.cxx39
-rw-r--r--chart2/source/view/axes/Tickmarks.hxx34
-rw-r--r--chart2/source/view/axes/Tickmarks_Dates.cxx7
-rw-r--r--chart2/source/view/axes/Tickmarks_Dates.hxx8
-rw-r--r--chart2/source/view/axes/Tickmarks_Equidistant.cxx27
-rw-r--r--chart2/source/view/axes/Tickmarks_Equidistant.hxx8
-rw-r--r--chart2/source/view/axes/VAxisBase.cxx37
-rw-r--r--chart2/source/view/axes/VAxisBase.hxx27
-rw-r--r--chart2/source/view/axes/VAxisOrGridBase.hxx4
-rw-r--r--chart2/source/view/axes/VAxisProperties.cxx100
-rw-r--r--chart2/source/view/axes/VAxisProperties.hxx38
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx397
-rw-r--r--chart2/source/view/axes/VCartesianAxis.hxx15
-rw-r--r--chart2/source/view/axes/VCartesianCoordinateSystem.cxx57
-rw-r--r--chart2/source/view/axes/VCartesianCoordinateSystem.hxx16
-rw-r--r--chart2/source/view/axes/VCartesianGrid.cxx121
-rw-r--r--chart2/source/view/axes/VCartesianGrid.hxx20
-rw-r--r--chart2/source/view/axes/VCoordinateSystem.cxx172
-rw-r--r--chart2/source/view/axes/VPolarAngleAxis.cxx34
-rw-r--r--chart2/source/view/axes/VPolarAngleAxis.hxx6
-rw-r--r--chart2/source/view/axes/VPolarAxis.cxx9
-rw-r--r--chart2/source/view/axes/VPolarAxis.hxx11
-rw-r--r--chart2/source/view/axes/VPolarCoordinateSystem.cxx43
-rw-r--r--chart2/source/view/axes/VPolarCoordinateSystem.hxx16
-rw-r--r--chart2/source/view/axes/VPolarGrid.cxx56
-rw-r--r--chart2/source/view/axes/VPolarGrid.hxx22
-rw-r--r--chart2/source/view/axes/VPolarRadiusAxis.cxx21
-rw-r--r--chart2/source/view/axes/VPolarRadiusAxis.hxx11
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx291
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx28
-rw-r--r--chart2/source/view/charttypes/BarChart.cxx929
-rw-r--r--chart2/source/view/charttypes/BarChart.hxx61
-rw-r--r--chart2/source/view/charttypes/BarPositionHelper.cxx1
-rw-r--r--chart2/source/view/charttypes/BarPositionHelper.hxx13
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx53
-rw-r--r--chart2/source/view/charttypes/BubbleChart.hxx6
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.cxx106
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.hxx10
-rw-r--r--chart2/source/view/charttypes/CategoryPositionHelper.hxx26
-rw-r--r--chart2/source/view/charttypes/ConfigAccess.cxx82
-rw-r--r--chart2/source/view/charttypes/NetChart.cxx85
-rw-r--r--chart2/source/view/charttypes/NetChart.hxx16
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx1324
-rw-r--r--chart2/source/view/charttypes/PieChart.hxx171
-rw-r--r--chart2/source/view/charttypes/Splines.cxx235
-rw-r--r--chart2/source/view/charttypes/Splines.hxx14
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx933
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx218
-rw-r--r--chart2/source/view/inc/Clipping.hxx10
-rw-r--r--chart2/source/view/inc/ConfigAccess.hxx40
-rw-r--r--chart2/source/view/inc/DataTableView.hxx88
-rw-r--r--chart2/source/view/inc/DateHelper.hxx7
-rw-r--r--chart2/source/view/inc/LabelAlignment.hxx13
-rw-r--r--chart2/source/view/inc/LabelPositionHelper.hxx16
-rw-r--r--chart2/source/view/inc/LegendEntryProvider.hxx28
-rw-r--r--chart2/source/view/inc/Linear3DTransformation.hxx26
-rw-r--r--chart2/source/view/inc/MinimumAndMaximumSupplier.hxx15
-rw-r--r--chart2/source/view/inc/PlotterBase.hxx24
-rw-r--r--chart2/source/view/inc/PlottingPositionHelper.hxx85
-rw-r--r--chart2/source/view/inc/PolarLabelPositionHelper.hxx9
-rw-r--r--chart2/source/view/inc/PropertyMapper.hxx30
-rw-r--r--chart2/source/view/inc/ScaleAutomatism.hxx4
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx205
-rw-r--r--chart2/source/view/inc/Stripe.hxx4
-rw-r--r--chart2/source/view/inc/VCoordinateSystem.hxx67
-rw-r--r--chart2/source/view/inc/VDataSeries.hxx75
-rw-r--r--chart2/source/view/inc/VDiagram.hxx34
-rw-r--r--chart2/source/view/inc/VLegendSymbolFactory.hxx19
-rw-r--r--chart2/source/view/inc/VLineProperties.hxx19
-rw-r--r--chart2/source/view/inc/VPolarTransformation.hxx25
-rw-r--r--chart2/source/view/inc/VSeriesPlotter.hxx134
-rw-r--r--chart2/source/view/inc/ViewDefines.hxx13
-rw-r--r--chart2/source/view/main/AxisUsage.hxx143
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx330
-rw-r--r--chart2/source/view/main/ChartItemPool.hxx15
-rw-r--r--chart2/source/view/main/ChartView.cxx1811
-rw-r--r--chart2/source/view/main/Clipping.cxx125
-rw-r--r--chart2/source/view/main/DataPointSymbolSupplier.cxx11
-rw-r--r--chart2/source/view/main/DataTableView.cxx559
-rw-r--r--chart2/source/view/main/DrawModelWrapper.cxx111
-rw-r--r--chart2/source/view/main/ExplicitValueProvider.cxx203
-rw-r--r--chart2/source/view/main/LabelPositionHelper.cxx241
-rw-r--r--chart2/source/view/main/Linear3DTransformation.cxx64
-rw-r--r--chart2/source/view/main/PlotterBase.cxx30
-rw-r--r--chart2/source/view/main/PlottingPositionHelper.cxx92
-rw-r--r--chart2/source/view/main/PolarLabelPositionHelper.cxx41
-rw-r--r--chart2/source/view/main/PropertyMapper.cxx220
-rw-r--r--chart2/source/view/main/SeriesPlotterContainer.cxx759
-rw-r--r--chart2/source/view/main/SeriesPlotterContainer.hxx160
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx2103
-rw-r--r--chart2/source/view/main/VButton.cxx66
-rw-r--r--chart2/source/view/main/VButton.hxx16
-rw-r--r--chart2/source/view/main/VDataSeries.cxx358
-rw-r--r--chart2/source/view/main/VLegend.cxx206
-rw-r--r--chart2/source/view/main/VLegend.hxx26
-rw-r--r--chart2/source/view/main/VLegendSymbolFactory.cxx61
-rw-r--r--chart2/source/view/main/VLineProperties.cxx36
-rw-r--r--chart2/source/view/main/VPolarTransformation.cxx34
-rw-r--r--chart2/source/view/main/VTitle.cxx40
-rw-r--r--chart2/source/view/main/VTitle.hxx20
653 files changed, 27218 insertions, 27355 deletions
diff --git a/chart2/source/chartcore.component b/chart2/source/chartcore.component
index f58ba98ba3ac..d15c808919df 100644
--- a/chart2/source/chartcore.component
+++ b/chart2/source/chartcore.component
@@ -220,6 +220,13 @@
<service name="com.sun.star.layout.LayoutElement"/>
<service name="com.sun.star.style.CharacterProperties"/>
</implementation>
+ <implementation name="com.sun.star.comp.chart2.DataTable"
+ constructor="com_sun_star_comp_chart2_DataTable_get_implementation">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.DataTable"/>
+ <service name="com.sun.star.drawing.FillProperties"/>
+ <service name="com.sun.star.drawing.LineProperties"/>
+ </implementation>
<implementation name="com.sun.star.comp.chart2.PageBackground"
constructor="com_sun_star_comp_chart2_PageBackground_get_implementation">
<service name="com.sun.star.beans.PropertySet"/>
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 3e42ea78463c..283efed69d80 100644
--- a/chart2/source/controller/accessibility/AccessibleChartElement.hxx
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLECHARTELEMENT_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLECHARTELEMENT_HXX
+#pragma once
#include <AccessibleBase.hxx>
#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
@@ -28,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)
@@ -62,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;
@@ -94,7 +94,7 @@ public:
private:
bool m_bHasText;
- css::uno::Reference< css::accessibility::XAccessibleContext >
+ rtl::Reference< ::chart::AccessibleTextHelper >
m_xTextHelper;
void InitTextEdit();
@@ -102,6 +102,4 @@ private:
} // namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.cxx b/chart2/source/controller/accessibility/AccessibleChartShape.cxx
index d9c2f7071338..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;
@@ -51,7 +50,7 @@ AccessibleChartShape::AccessibleChartShape(
m_aShapeTreeInfo.SetSdrView( rAccInfo.m_pSdrView );
m_aShapeTreeInfo.SetController( nullptr );
- m_aShapeTreeInfo.SetDevice( VCLUnoHelper::GetWindow( rAccInfo.m_xWindow ) );
+ m_aShapeTreeInfo.SetWindow( VCLUnoHelper::GetWindow( rAccInfo.m_xWindow ) );
m_aShapeTreeInfo.SetViewForwarder( rAccInfo.m_pViewForwarder );
::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance();
@@ -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 d113c03f8d39..c31204ed3c8a 100644
--- a/chart2/source/controller/accessibility/AccessibleChartShape.hxx
+++ b/chart2/source/controller/accessibility/AccessibleChartShape.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLECHARTSHAPE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLECHARTSHAPE_HXX
+#pragma once
#include <AccessibleBase.hxx>
@@ -51,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;
@@ -81,6 +80,4 @@ private:
} // namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/AccessibleViewForwarder.hxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
index 147b252a6d63..5bfbd06ad6e2 100644
--- a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
@@ -16,42 +16,41 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLEVIEWFORWARDER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLEVIEWFORWARDER_HXX
+#pragma once
#include <vcl/mapmod.hxx>
#include <vcl/vclptr.hxx>
#include <svx/IAccessibleViewForwarder.hxx>
-namespace vcl { class Window; }
+namespace vcl
+{
+class Window;
+}
namespace chart
{
-
class AccessibleChartView;
class AccessibleViewForwarder : public ::accessibility::IAccessibleViewForwarder
{
public:
- AccessibleViewForwarder( AccessibleChartView* pAccChartView, vcl::Window* pWindow );
+ AccessibleViewForwarder(AccessibleChartView* pAccChartView, vcl::Window* pWindow);
virtual ~AccessibleViewForwarder() override;
// ________ IAccessibleViewforwarder ________
virtual tools::Rectangle GetVisibleArea() const override;
- virtual Point LogicToPixel( const Point& rPoint ) const override;
- virtual Size LogicToPixel( const Size& rSize ) const override;
+ virtual Point LogicToPixel(const Point& rPoint) const override;
+ virtual Size LogicToPixel(const Size& rSize) const override;
private:
- AccessibleViewForwarder( AccessibleViewForwarder const & ) = delete;
- AccessibleViewForwarder& operator=( AccessibleViewForwarder const & ) = delete;
+ AccessibleViewForwarder(AccessibleViewForwarder const&) = delete;
+ AccessibleViewForwarder& operator=(AccessibleViewForwarder const&) = delete;
AccessibleChartView* m_pAccChartView;
VclPtr<vcl::Window> m_pWindow;
MapMode m_aMapMode;
};
-} // namespace chart
-
-#endif
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.cxx b/chart2/source/controller/accessibility/ChartElementFactory.cxx
index c935074e4b11..a173ac0f4b18 100644
--- a/chart2/source/controller/accessibility/ChartElementFactory.cxx
+++ b/chart2/source/controller/accessibility/ChartElementFactory.cxx
@@ -23,17 +23,17 @@
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() );
+ ObjectIdentifier aOID(rAccInfo.m_aOID);
+ ObjectType eType(aOID.getObjectType());
- switch( eType )
+ switch (eType)
{
case OBJECTTYPE_DATA_POINT:
case OBJECTTYPE_LEGEND_ENTRY:
- return new AccessibleChartElement( rAccInfo, false );
+ return new AccessibleChartElement(rAccInfo, false);
case OBJECTTYPE_PAGE:
case OBJECTTYPE_TITLE:
case OBJECTTYPE_LEGEND:
@@ -56,7 +56,7 @@ AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElement
case OBJECTTYPE_DATA_STOCK_LOSS:
case OBJECTTYPE_DATA_STOCK_GAIN:
case OBJECTTYPE_DATA_CURVE_EQUATION:
- return new AccessibleChartElement( rAccInfo, true );
+ return new AccessibleChartElement(rAccInfo, true);
case OBJECTTYPE_UNKNOWN:
break;
default:
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.hxx b/chart2/source/controller/accessibility/ChartElementFactory.hxx
index 2d0b29b9cb2a..08ae64598bc7 100644
--- a/chart2/source/controller/accessibility/ChartElementFactory.hxx
+++ b/chart2/source/controller/accessibility/ChartElementFactory.hxx
@@ -16,12 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_CHARTELEMENTFACTORY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_CHARTELEMENTFACTORY_HXX
+#pragma once
+
+#include <rtl/ref.hxx>
namespace chart
{
-
class AccessibleBase;
struct AccessibleElementInfo;
@@ -31,11 +31,9 @@ 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
-
-#endif
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 a0ea50f677e6..c150d5bbfcef 100644
--- a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
@@ -16,22 +16,18 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_AREAWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_AREAWRAPPER_HXX
+#pragma once
#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>
#include <memory>
-namespace chart
-{
-
-namespace wrapper
+namespace chart::wrapper
{
class Chart2ModelContact;
@@ -44,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
@@ -76,13 +72,9 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_AREAWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 b6770a5a2489..e70c85b23ff8 100644
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
@@ -16,13 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_AXISWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_AXISWRAPPER_HXX
+#pragma once
#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>
@@ -33,9 +32,7 @@
namespace com::sun::star::chart2 { class XAxis; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class Chart2ModelContact;
@@ -59,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 );
@@ -112,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;
@@ -121,10 +118,6 @@ private: //member
css::uno::Reference< css::beans::XPropertySet > m_xMinorGrid;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_AXISWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 5f3448edc509..261f2686240a 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -16,14 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
+#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; }
@@ -55,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 );
@@ -131,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;
+ unotools::WeakReference< ChartModel > m_xChartModel;
- ChartModel* mpModel;
-
- 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;
};
@@ -149,7 +146,4 @@ private: //member
} // namespace wrapper
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
index 48a448edfc50..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())
@@ -626,7 +639,7 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator )
bool bHasCategories = true;
uno::Sequence< sal_Int32 > aSequenceMapping;
- DataSourceHelper::detectRangeSegmentation(
+ (void)DataSourceHelper::detectRangeSegmentation(
xChartDoc,
aRangeString, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories );
@@ -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 55bb8c63b3e8..9a44e53b8b12 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
@@ -16,12 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHARTDATAWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHARTDATAWRAPPER_HXX
+#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>
@@ -32,13 +32,15 @@
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,
@@ -47,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;
@@ -57,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;
@@ -110,16 +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 wrapper
+} // namespace chart::wrapper
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHARTDATAWRAPPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index f385c399c6e6..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>
@@ -121,8 +124,8 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
{"com.sun.star.drawing.MarkerTable", SERVICE_NAME_MARKER_TABLE},
{"com.sun.star.xml.NamespaceMap", SERVICE_NAME_NAMESPACE_MAP},
- {"com.sun.star.document.ExportGraphicStoreageHandler", SERVICE_NAME_EXPORT_GRAPHIC_STORAGE_RESOLVER},
- {"com.sun.star.document.ImportGraphicStoreageHandler", SERVICE_NAME_IMPORT_GRAPHIC_STORAGE_RESOLVER}
+ {"com.sun.star.document.ExportGraphicStorageHandler", SERVICE_NAME_EXPORT_GRAPHIC_STORAGE_RESOLVER},
+ {"com.sun.star.document.ImportGraphicStorageHandler", SERVICE_NAME_IMPORT_GRAPHIC_STORAGE_RESOLVER}
};
return aServiceNameMap;
@@ -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 e98ebe65bbbd..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,10 +49,10 @@
#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>
-#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <comphelper/sequence.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -56,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;
@@ -79,6 +84,7 @@ enum
PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
//other series properties
PROP_SERIES_ATTACHED_AXIS,
+ PROP_SERIES_SHOW_CUSTOM_LEADERLINES,
PROP_SERIES_DATAPOINT_TEXT_ROTATION,
PROP_SERIES_DATAPOINT_LABEL_BORDER_STYLE,
PROP_SERIES_DATAPOINT_LABEL_BORDER_WIDTH,
@@ -211,6 +217,12 @@ void lcl_AddPropertiesToVector_SeriesOnly(
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT );
+
+ rOutProperties.emplace_back( "ShowCustomLeaderLines",
+ PROP_SERIES_SHOW_CUSTOM_LEADERLINES,
+ cppu::UnoType<sal_Bool>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
}
uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )
@@ -237,30 +249,16 @@ uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType
return comphelper::containerToSequence( aProperties );
}
-struct StaticSeriesWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
- return &aPropSeq;
- }
-};
-
-struct StaticSeriesWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticSeriesWrapperPropertyArray_Initializer >
+const Sequence< Property >& StaticSeriesWrapperPropertyArray()
{
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
+ return aPropSeq;
};
-struct StaticPointWrapperPropertyArray_Initializer
-{
- Sequence< Property >* operator()()
- {
- static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) );
- 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
@@ -297,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;
@@ -308,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) )
@@ -319,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 );
}
}
@@ -448,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 )
@@ -467,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;
}
@@ -487,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 )
@@ -504,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();
@@ -514,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 ____
@@ -530,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];
}
@@ -558,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() )
@@ -616,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;
}
@@ -677,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 );
@@ -698,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()
@@ -737,6 +741,7 @@ std::vector< std::unique_ptr<WrappedProperty> > DataSeriesPointWrapper::createWr
aWrappedProperties.emplace_back( new WrappedSeriesAreaOrLineProperty("LineDashName","BorderDashName","LineDashName", this ) );
aWrappedProperties.emplace_back( new WrappedSeriesAreaOrLineProperty("LineTransparence","BorderTransparency","Transparency", this ) );
aWrappedProperties.emplace_back( new WrappedSeriesAreaOrLineProperty("LineWidth","BorderWidth","LineWidth", this ) );
+ aWrappedProperties.emplace_back( new WrappedSeriesAreaOrLineProperty("LineCap","LineCap","LineCap", this ) );
aWrappedProperties.emplace_back( new WrappedProperty("FillStyle","FillStyle" ) );
aWrappedProperties.emplace_back( new WrappedProperty("FillTransparence","Transparency") );
@@ -834,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 98317470c1ea..4c79bb25e9bb 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
@@ -16,26 +16,23 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_DATASERIESPOINTWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_DATASERIESPOINTWRAPPER_HXX
+#pragma once
#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
-{
-
-namespace wrapper
+namespace chart::wrapper
{
class Chart2ModelContact;
@@ -58,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;
@@ -104,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;
@@ -119,13 +116,9 @@ 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 wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_DATASERIESPOINTWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 ca7d8ca89acc..3a3a8383de05 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
@@ -16,12 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_DIAGRAMWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_DIAGRAMWRAPPER_HXX
+#pragma once
#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>
@@ -41,9 +40,7 @@
namespace com::sun::star::chart2 { class XDiagram; }
namespace com::sun::star::lang { class XEventListener; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class Chart2ModelContact;
@@ -66,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
@@ -189,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;
@@ -215,10 +212,6 @@ private:
css::beans::XPropertySet > m_xDownBarWrapper;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_DIAGRAMWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 275d28279d0f..c978f3bb8d83 100644
--- a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
@@ -16,20 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_GRIDWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_GRIDWRAPPER_HXX
+#pragma once
#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>
#include <memory>
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class Chart2ModelContact;
@@ -51,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 );
@@ -74,15 +71,11 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
tGridType m_eType;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_GRIDWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 b614b55cae5a..5b4deac2a1f9 100644
--- a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
@@ -16,23 +16,19 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_LEGENDWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_LEGENDWRAPPER_HXX
+#pragma once
#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>
#include <memory>
-namespace chart
-{
-
-namespace wrapper
+namespace chart::wrapper
{
class Chart2ModelContact;
@@ -46,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
@@ -83,13 +79,9 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_LEGENDWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 72966ee04a8f..337ca8bdebd7 100644
--- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
@@ -16,12 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_MINMAXLINEWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_MINMAXLINEWRAPPER_HXX
+#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>
@@ -33,16 +31,12 @@
#include <memory>
-namespace chart
-{
-
-namespace wrapper
+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
@@ -52,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
@@ -97,16 +91,13 @@ 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;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_MINMAXLINEWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx b/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx
index 432f3123c5b8..4451c3cce78e 100644
--- a/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx
+++ b/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx
@@ -16,14 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
+#pragma once
#include <com/sun/star/awt/Size.hpp>
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class ReferenceSizePropertyProvider
{
@@ -36,10 +33,6 @@ protected:
~ReferenceSizePropertyProvider() {}
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 e1e7282af13c..aecf5f304231 100644
--- a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
@@ -16,14 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_TITLEWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_TITLEWRAPPER_HXX
+#pragma once
#include <WrappedPropertySet.hxx>
#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>
@@ -33,9 +32,7 @@
namespace chart::wrapper { class Chart2ModelContact; }
namespace com::sun::star::chart2 { class XTitle; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class TitleWrapper final : public ::cppu::ImplInheritanceHelper<
@@ -48,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
@@ -103,15 +100,11 @@ 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;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_TITLEWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 a1b455bcc888..517a2406fe2c 100644
--- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
@@ -16,11 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_UPDOWNBARWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_UPDOWNBARWRAPPER_HXX
+#pragma once
-#include <MutexContainer.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
@@ -32,16 +30,12 @@
#include <memory>
-namespace chart
-{
-
-namespace wrapper
+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
@@ -51,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
@@ -98,16 +92,13 @@ 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;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_UPDOWNBARWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 2a79c211ea42..4a85bd8d5b37 100644
--- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
@@ -16,21 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WALLFLOORWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WALLFLOORWRAPPER_HXX
+#pragma once
#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>
#include <memory>
-namespace chart
-{
-
-namespace wrapper
+namespace chart::wrapper
{
class Chart2ModelContact;
@@ -42,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
@@ -63,15 +59,11 @@ protected:
private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
- ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
bool m_bWall;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WALLFLOORWRAPPER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx
index 0cf59813467b..b87ab15d765f 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx
@@ -16,16 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDADDINPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDADDINPROPERTY_HXX
+#pragma once
#include <WrappedProperty.hxx>
namespace chart::wrapper { class ChartDocumentWrapper; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedAddInProperty : public WrappedProperty
@@ -84,11 +81,7 @@ private:
ChartDocumentWrapper& m_rChartDocumentWrapper;
};
-} //namespace wrapper
-
-} //namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDADDINPROPERTY_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/WrappedAutomaticPositionProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx
index 35a00856c0df..a98a0aa72bc0 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx
@@ -17,30 +17,30 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDAUTOMATICPOSITIONPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDAUTOMATICPOSITIONPROPERTIES_HXX
+#pragma once
#include <sal/types.h>
#include <memory>
#include <vector>
-namespace chart { class WrappedProperty; }
-namespace com::sun::star::beans { struct Property; }
-
namespace chart
{
-namespace wrapper
+class WrappedProperty;
+}
+namespace com::sun::star::beans
{
+struct Property;
+}
+namespace chart::wrapper
+{
class WrappedAutomaticPositionProperties
{
public:
- static void addProperties( std::vector< css::beans::Property >& rOutProperties );
- static void addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList );
+ static void addProperties(std::vector<css::beans::Property>& rOutProperties);
+ static void addWrappedProperties(std::vector<std::unique_ptr<WrappedProperty>>& rList);
};
-} //namespace wrapper
-} //namespace chart
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
index 7b9d07f002bb..2b047ebfaf82 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
@@ -17,14 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#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;
@@ -40,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;
@@ -76,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 )
@@ -153,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 )
@@ -173,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 );
@@ -200,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;
@@ -226,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 )
@@ -271,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() );
}
}
@@ -283,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;
@@ -306,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;
@@ -333,23 +337,23 @@ 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 )
{
switch( m_nDimensionIndex )
{
case 0:
- m_aOuterName = m_bMain ? OUStringLiteral("HasXAxisDescription") : OUStringLiteral("HasSecondaryXAxisDescription");
+ m_aOuterName = m_bMain ? std::u16string_view(u"HasXAxisDescription") : std::u16string_view(u"HasSecondaryXAxisDescription");
break;
case 2:
OSL_ENSURE(m_bMain,"there is no description available for a secondary z axis");
m_aOuterName = "HasZAxisDescription";
break;
default:
- m_aOuterName = m_bMain ? OUStringLiteral("HasYAxisDescription") : OUStringLiteral("HasSecondaryYAxisDescription");
+ m_aOuterName = m_bMain ? std::u16string_view(u"HasYAxisDescription") : std::u16string_view(u"HasSecondaryYAxisDescription");
break;
}
}
@@ -366,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 ) );
}
@@ -382,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/WrappedAxisAndGridExistenceProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx
index cfc6273454ef..c15bee711309 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDAXISANDGRIDEXISTENCEPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDAXISANDGRIDEXISTENCEPROPERTIES_HXX
+#pragma once
#include <memory>
#include <vector>
@@ -26,9 +25,7 @@
namespace chart { class WrappedProperty; }
namespace chart::wrapper { class Chart2ModelContact; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedAxisAndGridExistenceProperties
@@ -52,9 +49,6 @@ public:
, const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact );
};
-} //namespace wrapper
-} //namespace chart
-
-#endif // INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDAXISANDGRIDEXISTENCEPROPERTIES_HXX
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
index 5e43b37aee17..be9457d0ffd7 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
@@ -16,16 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDCHARACTERHEIGHTPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDCHARACTERHEIGHTPROPERTY_HXX
+#pragma once
#include <WrappedProperty.hxx>
#include <vector>
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class ReferenceSizePropertyProvider;
@@ -48,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;
};
@@ -75,10 +72,6 @@ public:
virtual ~WrappedComplexCharacterHeightProperty() override;
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDCHARACTERHEIGHTPROPERTY_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
index f55540f67db8..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);
+ chart2::DataPointLabel aLabel(false,false,false,false,false,false);
if( nCaption & css::chart::ChartDataCaption::VALUE )
aLabel.ShowNumber = true;
@@ -81,6 +83,10 @@ chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption )
aLabel.ShowCategoryName = true;
if( nCaption & css::chart::ChartDataCaption::SYMBOL )
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/WrappedDataCaptionProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx
index 7180f7e19a43..a2bcaa302c02 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDDATACAPTIONPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDDATACAPTIONPROPERTIES_HXX
+#pragma once
#include <sal/types.h>
#include <memory>
@@ -27,9 +26,7 @@ namespace chart { class WrappedProperty; }
namespace chart::wrapper { class Chart2ModelContact; }
namespace com::sun::star::beans { struct Property; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedDataCaptionProperties
@@ -42,10 +39,6 @@ public:
, const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact );
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDDATACAPTIONPROPERTIES_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
index 63abadee1b85..079d25f63bb4 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
@@ -17,9 +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;
@@ -34,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 ))
{
}
@@ -64,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;
-
- 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 )
{
@@ -107,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;
@@ -115,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 a20a4bbc32b0..6ac43e9f7635 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDGAPWIDTHPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDGAPWIDTHPROPERTY_HXX
+#pragma once
#include <WrappedDefaultProperty.hxx>
@@ -25,9 +24,7 @@
namespace chart::wrapper { class Chart2ModelContact; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedBarPositionProperty_Base : public WrappedDefaultProperty
@@ -35,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;
@@ -46,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;
@@ -71,10 +68,6 @@ public:
virtual ~WrappedBarOverlapProperty() override;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDGAPWIDTHPROPERTY_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 59bb1f3b1dcb..cf2f706c61c7 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDNUMBERFORMATPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDNUMBERFORMATPROPERTY_HXX
+#pragma once
#include <WrappedDirectStateProperty.hxx>
@@ -25,16 +24,14 @@
namespace chart::wrapper { class Chart2ModelContact; }
-namespace chart
-{
-namespace wrapper
+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;
@@ -62,10 +59,6 @@ public:
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDNUMBERFORMATPROPERTY_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 e62b5f7021f8..eca52953552d 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSCALEPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSCALEPROPERTY_HXX
+#pragma once
#include <WrappedProperty.hxx>
@@ -26,9 +25,7 @@
namespace chart::wrapper { class Chart2ModelContact; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedScaleProperty final : public WrappedProperty
@@ -54,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 );
@@ -81,10 +78,6 @@ private:
mutable css::uno::Any m_aOuterValue;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSCALEPROPERTY_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
index 373fec6c8344..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 const char aRefSizeName[] = "ReferencePageSize";
+ static constexpr OUString aRefSizeName = u"ReferencePageSize"_ustr;
if( !xInnerPropertySet.is() )
return;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx
index 85748851a651..958b5f55daab 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx
@@ -27,9 +27,7 @@ namespace chart { class WrappedProperty; }
namespace chart::wrapper { class Chart2ModelContact; }
namespace com::sun::star::beans { struct Property; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedScaleTextProperties
@@ -40,7 +38,6 @@ public:
, const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact );
};
-} //namespace wrapper
-} //namespace chart
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 6b7ae6416d81..31ef35abc566 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSCENEPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSCENEPROPERTY_HXX
+#pragma once
#include <WrappedProperty.hxx>
@@ -26,9 +25,7 @@
namespace chart::wrapper { class Chart2ModelContact; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedSceneProperty
@@ -42,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;
@@ -53,10 +50,6 @@ private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSCENEPROPERTY_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 2c3eff9da827..f3561e7361d4 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
@@ -16,14 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSERIESAREAORLINEPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSERIESAREAORLINEPROPERTY_HXX
+#pragma once
#include <WrappedProperty.hxx>
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class DataSeriesPointWrapper;
@@ -31,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;
@@ -43,10 +40,6 @@ private:
OUString m_aInnerLineTypeName;
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSERIESAREAORLINEPROPERTY_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
index 26c260ffc0b3..8b0b54db3d7a 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
@@ -16,21 +16,19 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSERIESORDIAGRAMPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSERIESORDIAGRAMPROPERTY_HXX
+#pragma once
#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; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
enum tSeriesOrDiagramPropertyType
@@ -49,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 )
@@ -61,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;
}
@@ -93,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 );
}
}
}
@@ -164,10 +159,6 @@ protected:
tSeriesOrDiagramPropertyType m_ePropertyType;
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSERIESORDIAGRAMPROPERTY_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/WrappedSplineProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx
index d52c102c0fca..686a69297945 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSPLINEPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSPLINEPROPERTIES_HXX
+#pragma once
#include <sal/types.h>
#include <memory>
@@ -27,9 +26,7 @@ namespace chart { class WrappedProperty; }
namespace chart::wrapper { class Chart2ModelContact; }
namespace com::sun::star::beans { struct Property; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedSplineProperties
@@ -40,10 +37,6 @@ public:
, const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact );
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSPLINEPROPERTIES_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/WrappedStatisticProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx
index 774d7a6da31b..7831fccf4c36 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSTATISTICPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSTATISTICPROPERTIES_HXX
+#pragma once
#include <sal/types.h>
#include <memory>
@@ -27,9 +26,7 @@ namespace chart { class WrappedProperty; }
namespace chart::wrapper { class Chart2ModelContact; }
namespace com::sun::star::beans { struct Property; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedStatisticProperties
@@ -42,10 +39,6 @@ public:
, const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact );
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSTATISTICPROPERTIES_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/WrappedStockProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx
index 1cc9d579bc1d..e460ba587330 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSTOCKPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSTOCKPROPERTIES_HXX
+#pragma once
#include <sal/types.h>
#include <memory>
@@ -27,9 +26,7 @@ namespace chart { class WrappedProperty; }
namespace chart::wrapper { class Chart2ModelContact; }
namespace com::sun::star::beans { struct Property; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedStockProperties
@@ -40,10 +37,6 @@ public:
, const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact );
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSTOCKPROPERTIES_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/chartapiwrapper/WrappedSymbolProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx
index d8eca1a938f6..f3a0fcd66e2c 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSYMBOLPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSYMBOLPROPERTIES_HXX
+#pragma once
#include <sal/types.h>
#include <memory>
@@ -27,9 +26,7 @@ namespace chart { class WrappedProperty; }
namespace chart::wrapper { class Chart2ModelContact; }
namespace com::sun::star::beans { struct Property; }
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
class WrappedSymbolProperties
@@ -42,10 +39,6 @@ public:
, const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact );
};
-} //namespace wrapper
-} //namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDSYMBOLPROPERTIES_HXX
-#endif
+} //namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx
index 58392f0a7a84..48287dd5927d 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx
@@ -16,32 +16,28 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDTEXTROTATIONPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDTEXTROTATIONPROPERTY_HXX
+#pragma once
#include <WrappedProperty.hxx>
namespace chart
{
-
class WrappedTextRotationProperty final : public WrappedProperty
{
public:
- explicit WrappedTextRotationProperty( bool bDirectState=false );
+ explicit WrappedTextRotationProperty(bool bDirectState = false);
virtual ~WrappedTextRotationProperty() override;
- virtual css::beans::PropertyState getPropertyState( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override;
+ virtual css::beans::PropertyState getPropertyState(
+ const css::uno::Reference<css::beans::XPropertyState>& xInnerPropertyState) const override;
private:
- virtual css::uno::Any convertInnerToOuterValue( const css::uno::Any& rInnerValue ) const override;
- virtual css::uno::Any convertOuterToInnerValue( const css::uno::Any& rOuterValue ) const override;
+ virtual css::uno::Any convertInnerToOuterValue(const css::uno::Any& rInnerValue) const override;
+ virtual css::uno::Any convertOuterToInnerValue(const css::uno::Any& rOuterValue) const override;
bool m_bDirectState;
};
} //namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDTEXTROTATIONPROPERTY_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/ChangingResource.cxx b/chart2/source/controller/dialogs/ChangingResource.cxx
index c50f274dadd4..4cbbe569ccf8 100644
--- a/chart2/source/controller/dialogs/ChangingResource.cxx
+++ b/chart2/source/controller/dialogs/ChangingResource.cxx
@@ -21,19 +21,14 @@
namespace chart
{
-
-ResourceChangeListener::~ResourceChangeListener()
-{
-}
+ResourceChangeListener::~ResourceChangeListener() {}
ChangingResource::ChangingResource()
- : m_pChangeListener(nullptr)
-{
-}
-ChangingResource::~ChangingResource()
+ : m_pChangeListener(nullptr)
{
}
-void ChangingResource::setChangeListener( ResourceChangeListener* pListener )
+ChangingResource::~ChangingResource() {}
+void ChangingResource::setChangeListener(ResourceChangeListener* pListener)
{
m_pChangeListener = pListener;
}
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 6153c03ede8f..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()
@@ -401,7 +403,7 @@ OUString ColumnChartDialogController::getName()
OUString ColumnChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_COLUMN);
+ return BMP_TYPE_COLUMN;
}
const tTemplateServiceChartTypeParameterMap& ColumnChartDialogController::getTemplateMap() const
@@ -478,7 +480,7 @@ OUString BarChartDialogController::getName()
OUString BarChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_BAR);
+ return BMP_TYPE_BAR;
}
const tTemplateServiceChartTypeParameterMap& BarChartDialogController::getTemplateMap() const
@@ -554,7 +556,7 @@ OUString PieChartDialogController::getName()
OUString PieChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_PIE);
+ return BMP_TYPE_PIE;
}
const tTemplateServiceChartTypeParameterMap& PieChartDialogController::getTemplateMap() const
@@ -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
@@ -620,7 +628,7 @@ OUString LineChartDialogController::getName()
OUString LineChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_LINE);
+ return BMP_TYPE_LINE;
}
const tTemplateServiceChartTypeParameterMap& LineChartDialogController::getTemplateMap() const
@@ -767,7 +775,7 @@ OUString XYChartDialogController::getName()
OUString XYChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_XY);
+ return BMP_TYPE_XY;
}
const tTemplateServiceChartTypeParameterMap& XYChartDialogController::getTemplateMap() const
@@ -870,7 +878,7 @@ OUString AreaChartDialogController::getName()
OUString AreaChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_AREA);
+ return BMP_TYPE_AREA;
}
bool AreaChartDialogController::shouldShow_3DLookControl() const
@@ -957,7 +965,7 @@ OUString NetChartDialogController::getName()
OUString NetChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_NET);
+ return BMP_TYPE_NET;
}
bool NetChartDialogController::shouldShow_StackingControl() const
@@ -1052,7 +1060,7 @@ OUString StockChartDialogController::getName()
OUString StockChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_STOCK);
+ return BMP_TYPE_STOCK;
}
const tTemplateServiceChartTypeParameterMap& StockChartDialogController::getTemplateMap() const
@@ -1097,7 +1105,7 @@ OUString CombiColumnLineChartDialogController::getName()
OUString CombiColumnLineChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_COLUMN_LINE);
+ return BMP_TYPE_COLUMN_LINE;
}
const tTemplateServiceChartTypeParameterMap& CombiColumnLineChartDialogController::getTemplateMap() 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);
@@ -1227,7 +1233,7 @@ OUString BubbleChartDialogController::getName()
OUString BubbleChartDialogController::getImage()
{
- return OUStringLiteral(BMP_TYPE_BUBBLE);
+ return BMP_TYPE_BUBBLE;
}
const tTemplateServiceChartTypeParameterMap& BubbleChartDialogController::getTemplateMap() const
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index ab967c92408d..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;
@@ -70,11 +72,6 @@ const BrowserMode BrowserStdFlags = BrowserMode::COLUMNSELECTION |
BrowserMode::AUTO_HSCROLL | BrowserMode::AUTO_VSCROLL |
BrowserMode::HIDESELECT;
-sal_Int32 lcl_getRowInData( long nRow )
-{
- return static_cast< sal_Int32 >( nRow );
-}
-
sal_Int32 lcl_getColumnInData( sal_uInt16 nCol )
{
return static_cast< sal_Int32 >( nCol ) - 1;
@@ -102,11 +99,8 @@ public:
bool HasFocus() const { return m_xControl->has_focus(); }
- void Hide() { m_xControl->hide(); }
- void Show() { m_xControl->show(); }
-
void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
- void set_margin_left(int nLeft) { m_xControl->set_margin_left(nLeft); }
+ void set_margin_start(int nLeft) { m_xControl->set_margin_start(nLeft); }
void SetModifyHdl(const Link<SeriesHeaderEdit&,void>& rLink) { m_aModifyHdl = rLink; }
void SetGetFocusHdl(const Link<SeriesHeaderEdit&,void>& rLink) { m_aFocusInHdl = rLink; }
@@ -176,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 );
@@ -228,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
);
@@ -238,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)
@@ -255,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));
@@ -296,27 +289,17 @@ void SeriesHeader::SetPos()
m_spSymbol->set_size_request(aSize.Width(), aSize.Height());
// series name edit field
- aSize.setWidth(nSymbolDistance);
- aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
- m_spSeriesName->set_margin_left(aSize.Width() + 2);
- aSize.setWidth( m_nWidth - nSymbolHeight - nSymbolDistance );
- sal_Int32 nHeight = 12;
- aSize.setHeight( nHeight );
- aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
- m_spSeriesName->set_size_request(aSize.Width(), aSize.Height());
+ m_spSeriesName->set_margin_start(2);
+
+ 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.setWidth(1);
- aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
- m_spColorBar->set_margin_left(aSize.Width() + 2);
- nHeight = 3;
- aSize.setWidth( m_nWidth - 1 );
- aSize.setHeight( nHeight );
- aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
- 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));
@@ -331,11 +314,11 @@ void SeriesHeader::SetWidth( sal_Int32 nWidth )
void SeriesHeader::SetPixelWidth( sal_Int32 nWidth )
{
- SetWidth( m_xDevice->PixelToLogic(Size(nWidth, 0), MapMode(MapUnit::MapAppFont)).getWidth());
+ SetWidth(nWidth);
}
void SeriesHeader::SetChartType(
- const Reference< chart2::XChartType > & xChartType,
+ const rtl::Reference< ChartType > & xChartType,
bool bSwapXAndYAxis
)
{
@@ -356,16 +339,14 @@ void SeriesHeader::SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol )
void SeriesHeader::Show()
{
- m_spSymbol->show();
- m_spSeriesName->Show();
- m_spColorBar->show();
+ m_xContainer1->show();
+ m_xContainer2->show();
}
void SeriesHeader::Hide()
{
- m_spSymbol->hide();
- m_spSeriesName->Hide();
- m_spColorBar->hide();
+ m_xContainer1->hide();
+ m_xContainer2->hide();
}
void SeriesHeader::SetEditChangedHdl( const Link<SeriesHeaderEdit&,void> & rLink )
@@ -395,7 +376,7 @@ bool SeriesHeader::HasFocus() const
}
OUString SeriesHeader::GetChartTypeImage(
- const Reference< chart2::XChartType > & xChartType,
+ const rtl::Reference< ChartType > & xChartType,
bool bSwapXAndYAxis
)
{
@@ -504,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();
}
@@ -617,7 +596,7 @@ void DataBrowser::RenewTable()
if (!m_apDataBrowserModel)
return;
- long nOldRow = GetCurRow();
+ sal_Int32 nOldRow = GetCurRow();
sal_uInt16 nOldColId = GetCurColumnId();
bool bLastUpdateMode = GetUpdateMode();
@@ -636,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();
@@ -660,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 );
- sal_Int32 nColor = 0;
+ Color nColor;
// @todo: Set "DraftColor", i.e. interpolated colors for gradients, bitmaps, etc.
- if( xSeriesProp.is() &&
- ( xSeriesProp->getPropertyValue( "Color" ) >>= nColor ))
- spHeader->SetColor( 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 );
@@ -694,13 +671,13 @@ OUString DataBrowser::GetColString( sal_Int32 nColumnId ) const
return OUString();
}
-OUString DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const
+OUString DataBrowser::GetCellText( sal_Int32 nRow, sal_uInt16 nColumnId ) const
{
OUString aResult;
if( nColumnId == 0 )
{
- aResult = OUString::number(static_cast< sal_Int32 >( nRow ) + 1);
+ aResult = OUString::number(nRow + 1);
}
else if( nRow >= 0 && m_apDataBrowserModel)
{
@@ -709,12 +686,12 @@ OUString DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const
if( m_apDataBrowserModel->getCellType( nColIndex ) == DataBrowserModel::NUMBER )
{
double fData( m_apDataBrowserModel->getCellNumber( nColIndex, nRow ));
- Color nLabelColor;
if( ! std::isnan( fData ) &&
m_spNumberFormatterWrapper )
{
bool bColorChanged = false;
+ Color nLabelColor;
aResult = m_spNumberFormatterWrapper->getFormattedString(
GetNumberFormatKey( nColumnId ),
fData, nLabelColor, bColorChanged );
@@ -736,7 +713,7 @@ OUString DataBrowser::GetCellText( long 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(
@@ -754,18 +731,15 @@ OUString DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const
return aResult;
}
-double DataBrowser::GetCellNumber( long 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()
@@ -851,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() );
@@ -923,9 +895,9 @@ void DataBrowser::RemoveColumn()
void DataBrowser::InsertRow()
{
- sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+ sal_Int32 nRowIdx = GetCurRow();
- if( nRowIdx >= 0 && m_apDataBrowserModel)
+ if( nRowIdx >= 0 && m_apDataBrowserModel)
{
// save changes made to edit-field
if( IsModified() )
@@ -938,9 +910,9 @@ void DataBrowser::InsertRow()
void DataBrowser::RemoveRow()
{
- sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+ sal_Int32 nRowIdx = GetCurRow();
- if( nRowIdx >= 0 && m_apDataBrowserModel)
+ if( nRowIdx >= 0 && m_apDataBrowserModel)
{
// save changes made to edit-field
if( IsModified() )
@@ -996,7 +968,7 @@ void DataBrowser::MoveRightColumn()
void DataBrowser::MoveUpRow()
{
- sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+ sal_Int32 nRowIdx = GetCurRow();
if( !(nRowIdx > 0 && m_apDataBrowserModel))
return;
@@ -1017,7 +989,7 @@ void DataBrowser::MoveUpRow()
void DataBrowser::MoveDownRow()
{
- sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+ sal_Int32 nRowIdx = GetCurRow();
if( !(nRowIdx >= 0 && m_apDataBrowserModel))
return;
@@ -1073,7 +1045,7 @@ void DataBrowser::PaintCell(
rDev.SetClipRegion();
}
-bool DataBrowser::SeekRow( long nRow )
+bool DataBrowser::SeekRow( sal_Int32 nRow )
{
if( ! EditBrowseBox::SeekRow( nRow ))
return false;
@@ -1088,14 +1060,14 @@ bool DataBrowser::SeekRow( long nRow )
bool DataBrowser::IsTabAllowed( bool bForward ) const
{
- long nRow = GetCurRow();
- long nCol = GetCurColumnId();
+ sal_Int32 nRow = GetCurRow();
+ sal_Int32 nCol = GetCurColumnId();
// column 0 is header-column
- long nBadCol = bForward
+ sal_Int32 nBadCol = bForward
? GetColumnCount() - 1
: 1;
- long nBadRow = bForward
+ sal_Int32 nBadRow = bForward
? GetRowCount() - 1
: 0;
@@ -1109,7 +1081,7 @@ bool DataBrowser::IsTabAllowed( bool bForward ) const
nCol != nBadCol );
}
-::svt::CellController* DataBrowser::GetController( long /*nRow*/, sal_uInt16 nCol )
+::svt::CellController* DataBrowser::GetController( sal_Int32 /*nRow*/, sal_uInt16 nCol )
{
if( m_bIsReadOnly )
return nullptr;
@@ -1126,7 +1098,7 @@ bool DataBrowser::IsTabAllowed( bool bForward ) const
}
void DataBrowser::InitController(
- ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol )
+ ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol )
{
if( rController == m_rTextEditController )
{
@@ -1186,7 +1158,7 @@ bool DataBrowser::SaveModified()
bool bChangeValid = true;
- const sal_Int32 nRow = lcl_getRowInData( GetCurRow());
+ const sal_Int32 nRow = GetCurRow();
const sal_Int32 nCol = lcl_getColumnInData( GetCurColumnId());
OSL_ENSURE( nRow >= 0 || nCol >= 0, "This cell should not be modified!" );
@@ -1292,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);
- sal_Int32 nColor = 0;
- if( xSeriesProp.is() &&
- ( xSeriesProp->getPropertyValue( "Color" ) >>= nColor ))
- spHeader->SetColor( Color( nColor ));
+ 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 );
@@ -1325,8 +1295,8 @@ void DataBrowser::ImplAdjustHeaderControls()
weld::Container* pWin = m_pColumnsWin;
weld::Container* pColorWin = m_pColorsWin;
- pWin->set_margin_left(nCurrentPos);
- pColorWin->set_margin_left(nCurrentPos);
+ pWin->set_margin_start(nCurrentPos);
+ pColorWin->set_margin_start(nCurrentPos);
tSeriesHeaderContainer::iterator aIt( m_aSeriesHeaders.begin());
sal_uInt16 i = GetFirstVisibleColNumber();
@@ -1346,13 +1316,13 @@ void DataBrowser::ImplAdjustHeaderControls()
{
if( nStartPos < nMaxPos )
{
- (*aIt)->SetPixelWidth( nCurrentPos - nStartPos - 3 );
+ (*aIt)->SetPixelWidth( nCurrentPos - nStartPos );
(*aIt)->Show();
if (pWin)
{
- pWin->set_margin_left(nStartPos);
- pColorWin->set_margin_left(nStartPos);
+ pWin->set_margin_start(nStartPos);
+ pColorWin->set_margin_start(nStartPos);
pWin = pColorWin = nullptr;
}
@@ -1380,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 a1991224b454..c1d6a72e6cf8 100644
--- a/chart2/source/controller/dialogs/DataBrowser.hxx
+++ b/chart2/source/controller/dialogs/DataBrowser.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
+#pragma once
#include <svtools/editbrowsebox.hxx>
#include <vcl/weld.hxx>
@@ -44,6 +43,7 @@ namespace chart
class DataBrowserModel;
class NumberFormatterWrapper;
+class ChartModel;
namespace impl
{
@@ -56,10 +56,10 @@ class DataBrowser : public ::svt::EditBrowseBox
protected:
// EditBrowseBox overridables
virtual void PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId ) const override;
- virtual bool SeekRow( long nRow ) override;
+ virtual bool SeekRow( sal_Int32 nRow ) override;
virtual bool IsTabAllowed( bool bForward ) const override;
- virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ) override;
- virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ) override;
+ virtual ::svt::CellController* GetController( sal_Int32 nRow, sal_uInt16 nCol ) override;
+ virtual void InitController( ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol ) override;
virtual bool SaveModified() override;
virtual void CursorMoved() override;
// called whenever the control of the current cell has been modified
@@ -83,12 +83,12 @@ public:
@return
the text out of the cell
*/
- virtual OUString GetCellText(long nRow, sal_uInt16 nColId) const override;
+ virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override;
/** returns the number in the given cell. If a cell is empty or contains a
string, the result will be Nan
*/
- double GetCellNumber( long nRow, sal_uInt16 nColumnId ) const;
+ double GetCellNumber( sal_Int32 nRow, sal_uInt16 nColumnId ) const;
bool isDateTimeString( const OUString& aInputString, double& fOutDateTimeValue );
@@ -98,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
@@ -146,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;
@@ -155,7 +154,7 @@ private:
std::shared_ptr< NumberFormatterWrapper > m_spNumberFormatterWrapper;
/// the row that is currently painted
- long m_nSeekRow;
+ sal_Int32 m_nSeekRow;
bool m_bIsReadOnly;
bool m_bDataValid;
@@ -185,6 +184,4 @@ private:
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 a4ba44987a45..e3254851d002 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.hxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx
@@ -16,12 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSERMODEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSERMODEL_HXX
+#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; }
@@ -36,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
@@ -97,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;
@@ -111,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 )
@@ -131,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:
@@ -140,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;
@@ -161,7 +167,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSERMODEL_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index b4bdbae6501e..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,23 +55,15 @@ using ::com::sun::star::uno::Sequence;
namespace
{
-const OUString lcl_aLabelRole( "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 )
{
OUString aResult( rRoleString );
typedef std::map< OUString, OUString > tTranslationMap;
- static tTranslationMap aTranslationMap =
+ static const tTranslationMap aTranslationMap =
{
{ "categories", ::chart::SchResId( STR_DATA_ROLE_CATEGORIES ) },
{ "error-bars-x", ::chart::SchResId( STR_DATA_ROLE_X_ERROR ) },
@@ -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
+ {
+ 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&)
{
- Reference< data::XDataSequence > xSeq( xLSeq->getValues());
- if( xSeq.is())
- aRange = xSeq->getSourceRangeRepresentation();
+ 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;
}
@@ -677,9 +669,11 @@ void DialogModel::detectArguments(
// Note: unused data is currently not supported in being passed to detectRangeSegmentation
if( m_xChartDocument.is())
- DataSourceHelper::detectRangeSegmentation(
- Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY_THROW ),
+ {
+ (void)DataSourceHelper::detectRangeSegmentation(
+ m_xChartDocument,
rOutRangeString, aSequenceMapping, rOutUseColumns, rOutFirstCellAsLabel, rOutHasCategories );
+ }
}
catch( const uno::Exception & )
{
@@ -716,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 & )
@@ -772,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;
@@ -788,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
@@ -843,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 8b3a2a5c05f3..24b74d6fab3a 100644
--- a/chart2/source/controller/dialogs/DialogModel.hxx
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -16,11 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DIALOGMODEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DIALOGMODEL_HXX
+#pragma once
#include <TimerTriggeredControllerLock.hxx>
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+#include <ChartTypeTemplate.hxx>
#include <map>
#include <memory>
@@ -37,8 +38,6 @@ namespace com::sun::star::chart2 {
class XDataSeriesContainer;
class XDataSeries;
class XChartType;
- class XChartTypeTemplate;
- struct InterpretedData;
namespace data {
class XDataProvider;
class XLabeledDataSequence;
@@ -47,7 +46,10 @@ namespace com::sun::star::chart2 {
namespace chart
{
-
+class ChartType;
+class DataSeries;
+struct InterpretedData;
+class LabeledDataSequence;
class RangeSelectionHelper;
struct DialogModelTimeBasedInfo
@@ -62,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 >
@@ -97,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;
@@ -151,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;
@@ -167,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;
@@ -177,7 +173,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DIALOGMODEL_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 2a3d954a61fa..f06c7af5e777 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -17,28 +17,36 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#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
{
@@ -51,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" );
@@ -80,27 +88,25 @@ OUString lcl_getFullSeriesName( const OUString& rObjectCID, const Reference< fra
return aRet;
}
-void lcl_addText( OUString& rOut, const OUString& rSeparator, const OUString& rNext )
+void lcl_addText( OUString& rOut, std::u16string_view rSeparator, std::u16string_view rNext )
{
- if( !(rOut.isEmpty() || rNext.isEmpty()) )
+ if( !(rOut.isEmpty() || rNext.empty()) )
rOut+=rSeparator;
- if( !rNext.isEmpty() )
+ if( !rNext.empty() )
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;
@@ -110,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;
@@ -170,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", "" );
}
}
@@ -305,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)
{
@@ -387,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 ) )
@@ -406,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);
@@ -459,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) );
@@ -496,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" );
@@ -515,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--;)
{
@@ -549,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
@@ -563,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)");
@@ -570,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 & )
@@ -634,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) + " )";
@@ -654,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
@@ -714,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 );
}
}
@@ -767,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:
@@ -794,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 );
@@ -807,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) + ")";
@@ -837,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
@@ -856,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 166846da6c99..cee4af1fb013 100644
--- a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
+++ b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
@@ -17,35 +17,32 @@
* 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()
-{
- m_aTimer.SetTimeout( 4*EDIT_UPDATEDATA_TIMEOUT );
- m_aTimer.SetInvokeHandler( LINK( this, TimerTriggeredControllerLock, TimerTimeout ) );
-}
-TimerTriggeredControllerLock::~TimerTriggeredControllerLock()
+TimerTriggeredControllerLock::TimerTriggeredControllerLock(
+ rtl::Reference<::chart::ChartModel> xModel)
+ : m_xModel(std::move(xModel))
+ , m_aTimer("chart2 TimerTriggeredControllerLock")
{
- m_aTimer.Stop();
+ m_aTimer.SetTimeout(4 * EDIT_UPDATEDATA_TIMEOUT);
+ m_aTimer.SetInvokeHandler(LINK(this, TimerTriggeredControllerLock, TimerTimeout));
}
+TimerTriggeredControllerLock::~TimerTriggeredControllerLock() { m_aTimer.Stop(); }
void TimerTriggeredControllerLock::startTimer()
{
if (!m_apControllerLockGuard)
- m_apControllerLockGuard.reset( new ControllerLockGuardUNO(m_xModel) );
+ m_apControllerLockGuard.reset(new ControllerLockGuardUNO(m_xModel));
m_aTimer.Start();
}
-IMPL_LINK_NOARG(TimerTriggeredControllerLock, TimerTimeout, Timer *, void)
+IMPL_LINK_NOARG(TimerTriggeredControllerLock, TimerTimeout, Timer*, void)
{
m_apControllerLockGuard.reset();
}
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 d1c2acc3c14d..a1f52f5169a5 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx
@@ -19,32 +19,26 @@
#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();
}
-ChartTypeDialog::~ChartTypeDialog()
-{
- m_xChartTypeTabPage.reset();
-}
+ChartTypeDialog::~ChartTypeDialog() { m_xChartTypeTabPage.reset(); }
} //namespace chart
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 5411277f8f0b..3a1fa1386f7a 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -19,26 +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 <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <tools/diagnose_ex.h>
-#include <comphelper/lok.hxx>
+#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);
@@ -73,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();
}
@@ -167,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);
}
}
@@ -220,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 65dc9010e294..c55ecc3e88d6 100644
--- a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
@@ -22,23 +22,22 @@
namespace chart
{
-
using namespace ::com::sun::star;
-SchLegendDlg::SchLegendDlg(weld::Window* pWindow, const uno::Reference< uno::XComponentContext>& xCC)
+SchLegendDlg::SchLegendDlg(weld::Window* pWindow, const uno::Reference<uno::XComponentContext>& xCC)
: GenericDialogController(pWindow, "modules/schart/ui/dlg_InsertLegend.ui", "dlg_InsertLegend")
, m_xLegendPositionResources(new LegendPositionResources(*m_xBuilder, xCC))
{
}
-void SchLegendDlg::init( const uno::Reference< frame::XModel >& xChartModel )
+void SchLegendDlg::init(const rtl::Reference<::chart::ChartModel>& xChartModel)
{
- m_xLegendPositionResources->writeToResources( 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 );
+ m_xLegendPositionResources->writeToModel(xChartModel);
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/dlg_InsertTitle.cxx b/chart2/source/controller/dialogs/dlg_InsertTitle.cxx
index f228e037d32a..03f942945823 100644
--- a/chart2/source/controller/dialogs/dlg_InsertTitle.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertTitle.cxx
@@ -23,18 +23,17 @@
namespace chart
{
-
SchTitleDlg::SchTitleDlg(weld::Window* pWindow, const TitleDialogData& rInput)
: GenericDialogController(pWindow, "modules/schart/ui/inserttitledlg.ui", "InsertTitleDialog")
, m_xTitleResources(new TitleResources(*m_xBuilder, true))
{
m_xDialog->set_title(ObjectNameProvider::getName(OBJECTTYPE_TITLE, true));
- m_xTitleResources->writeToResources( rInput );
+ m_xTitleResources->writeToResources(rInput);
}
-void SchTitleDlg::getResult( TitleDialogData& rOutput )
+void SchTitleDlg::getResult(TitleDialogData& rOutput)
{
- m_xTitleResources->readFromResources( rOutput );
+ m_xTitleResources->readFromResources(rOutput);
}
} //namespace chart
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 f0c69702f14e..be02edeb6257 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
@@ -16,28 +16,30 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DLG_NUMBERFORMAT_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DLG_NUMBERFORMAT_HXX
+#pragma once
#include <sfx2/basedlgs.hxx>
-namespace weld { class Window; }
+namespace weld
+{
+class Window;
+class Container;
+}
class SfxItemSet;
class SfxItemPool;
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 );
+ static SfxItemSet CreateEmptyItemSetForNumberFormatDialog(SfxItemPool& rItemPool);
};
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index 1add0435b0bc..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,29 +35,35 @@
#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>
#include <svx/drawitem.hxx>
#include <svx/ofaitem.hxx>
-#include <svx/svxgrahicitem.hxx>
+#include <svx/svxgraphicitem.hxx>
#include <svx/dialogs.hrc>
#include <editeng/flstitem.hxx>
@@ -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 6b0a7eac2208..81d933b208bc 100644
--- a/chart2/source/controller/dialogs/res_BarGeometry.cxx
+++ b/chart2/source/controller/dialogs/res_BarGeometry.cxx
@@ -23,31 +23,30 @@
namespace chart
{
-
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)
+void BarGeometryResources::connect_changed(const Link<weld::TreeView&, void>& rLink)
{
m_xLB_Geometry->connect_changed(rLink);
}
-void BarGeometryResources::set_visible( bool bShow )
+void BarGeometryResources::set_visible(bool bShow)
{
- m_xFT_Geometry->set_visible( bShow );
- m_xLB_Geometry->set_visible( bShow );
+ m_xFT_Geometry->set_visible(bShow);
+ m_xLB_Geometry->set_visible(bShow);
}
-void BarGeometryResources::set_sensitive( bool bEnable )
+void BarGeometryResources::set_sensitive(bool bEnable)
{
- m_xFT_Geometry->set_sensitive( bEnable );
- m_xLB_Geometry->set_sensitive( bEnable );
+ m_xFT_Geometry->set_sensitive(bEnable);
+ m_xLB_Geometry->set_sensitive(bEnable);
}
sal_Int32 BarGeometryResources::get_selected_index() const
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index bd71bf51240e..c3d755cf92d6 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "res_DataLabel.hxx"
#include <TextDirectionListBox.hxx>
@@ -30,6 +34,7 @@
#include <svl/ilstitem.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/frmdiritem.hxx>
+#include <svx/sdangitm.hxx>
#include <svx/svxids.hrc>
#include <osl/diagnose.h>
@@ -39,43 +44,38 @@ namespace chart
namespace
{
-const OUStringLiteral our_aLBEntryMap[] = {" ", ", ", "; ", "\n", ". "};
+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
@@ -99,18 +99,18 @@ 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"))
{
m_xDC_Dial->SetText(m_xFT_Dial->get_label());
@@ -121,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 )
@@ -142,14 +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);
}
@@ -175,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;
@@ -203,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 );
@@ -214,43 +221,60 @@ 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.
{
- long nNumberOfCheckedLabelParts = 0;
+ tools::Long nNumberOfCheckedLabelParts = 0;
if (m_xCBNumber->get_state() != TRISTATE_FALSE)
++nNumberOfCheckedLabelParts;
if (m_xCBPercent->get_state() != TRISTATE_FALSE && m_xCBPercent->get_sensitive())
++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
@@ -278,11 +302,15 @@ 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 )
+ rOutAttrs->Put(SfxBoolItem( SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, m_xCBCustomLeaderLines->get_active()) );
auto const aSep = our_aLBEntryMap[m_xLB_Separator->get_active()];
- rOutAttrs->Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, aSep) );
+ rOutAttrs->Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, OUString(aSep)) );
std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_xLB_LabelPlacement->get_active()) );
if(aIt!=m_aListBoxToPlacementMap.end())
@@ -291,13 +319,13 @@ 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() )
{
- sal_Int32 nDegrees = m_xDC_Dial->GetRotation();
- rOutAttrs->Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+ Degree100 nDegrees = m_xDC_Dial->GetRotation();
+ rOutAttrs->Put(SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) );
}
}
@@ -306,28 +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_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())
{
@@ -340,16 +369,16 @@ 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 ) )
{
- sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ Degree100 nDegrees = pAngleItem->GetValue();
m_xDC_Dial->SetRotation( nDegrees );
}
else
- m_xDC_Dial->SetRotation( 0 );
+ m_xDC_Dial->SetRotation( 0_deg100 );
EnableControls();
}
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
index d21856cb4606..66a062d2ca24 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.hxx
@@ -16,16 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_DATALABEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_DATALABEL_HXX
+#pragma once
#include <svl/itemset.hxx>
#include <svx/dialcontrol.hxx>
+#include <TextDirectionListBox.hxx>
#include <map>
class SvNumberFormatter;
-namespace chart { class TextDirectionListBox; }
namespace chart
{
@@ -48,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;
@@ -59,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;
@@ -66,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;
@@ -80,17 +85,17 @@ 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();
};
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 e4cbe6d526e3..59b0f00b9b37 100644
--- a/chart2/source/controller/dialogs/res_Titles.cxx
+++ b/chart2/source/controller/dialogs/res_Titles.cxx
@@ -23,7 +23,6 @@
namespace chart
{
-
TitleResources::TitleResources(weld::Builder& rBuilder, bool bShowSecondaryAxesTitle)
: m_xFT_Main(rBuilder.weld_label("labelMainTitle"))
, m_xFT_Sub(rBuilder.weld_label("labelSubTitle"))
@@ -40,36 +39,33 @@ TitleResources::TitleResources(weld::Builder& rBuilder, bool bShowSecondaryAxesT
, m_xEd_SecondaryXAxis(rBuilder.weld_entry("secondaryXaxis"))
, m_xEd_SecondaryYAxis(rBuilder.weld_entry("secondaryYaxis"))
{
- m_xFT_SecondaryXAxis->set_visible( bShowSecondaryAxesTitle );
- m_xFT_SecondaryYAxis->set_visible( bShowSecondaryAxesTitle );
- m_xEd_SecondaryXAxis->set_visible( bShowSecondaryAxesTitle );
- m_xEd_SecondaryYAxis->set_visible( bShowSecondaryAxesTitle );
+ m_xFT_SecondaryXAxis->set_visible(bShowSecondaryAxesTitle);
+ m_xFT_SecondaryYAxis->set_visible(bShowSecondaryAxesTitle);
+ m_xEd_SecondaryXAxis->set_visible(bShowSecondaryAxesTitle);
+ m_xEd_SecondaryYAxis->set_visible(bShowSecondaryAxesTitle);
}
-TitleResources::~TitleResources()
-{
-}
+TitleResources::~TitleResources() {}
-void TitleResources::connect_changed( const Link<weld::Entry&,void>& rLink )
+void TitleResources::connect_changed(const Link<weld::Entry&, void>& rLink)
{
- m_xEd_Main->connect_changed( rLink );
- m_xEd_Sub->connect_changed( rLink );
- m_xEd_XAxis->connect_changed( rLink );
- m_xEd_YAxis->connect_changed( rLink );
- m_xEd_ZAxis->connect_changed( rLink );
- m_xEd_SecondaryXAxis->connect_changed( rLink );
- m_xEd_SecondaryYAxis->connect_changed( rLink );
+ m_xEd_Main->connect_changed(rLink);
+ m_xEd_Sub->connect_changed(rLink);
+ m_xEd_XAxis->connect_changed(rLink);
+ m_xEd_YAxis->connect_changed(rLink);
+ m_xEd_ZAxis->connect_changed(rLink);
+ m_xEd_SecondaryXAxis->connect_changed(rLink);
+ m_xEd_SecondaryYAxis->connect_changed(rLink);
}
bool TitleResources::get_value_changed_from_saved() const
{
- return m_xEd_Main->get_value_changed_from_saved()
- || m_xEd_Sub->get_value_changed_from_saved()
- || m_xEd_XAxis->get_value_changed_from_saved()
- || m_xEd_YAxis->get_value_changed_from_saved()
- || m_xEd_ZAxis->get_value_changed_from_saved()
- || m_xEd_SecondaryXAxis->get_value_changed_from_saved()
- || m_xEd_SecondaryYAxis->get_value_changed_from_saved();
+ return m_xEd_Main->get_value_changed_from_saved() || m_xEd_Sub->get_value_changed_from_saved()
+ || m_xEd_XAxis->get_value_changed_from_saved()
+ || m_xEd_YAxis->get_value_changed_from_saved()
+ || m_xEd_ZAxis->get_value_changed_from_saved()
+ || m_xEd_SecondaryXAxis->get_value_changed_from_saved()
+ || m_xEd_SecondaryYAxis->get_value_changed_from_saved();
}
void TitleResources::save_value()
@@ -83,23 +79,23 @@ void TitleResources::save_value()
m_xEd_SecondaryYAxis->save_value();
}
-void TitleResources::writeToResources( const TitleDialogData& rInput )
+void TitleResources::writeToResources(const TitleDialogData& rInput)
{
- m_xFT_Main->set_sensitive( rInput.aPossibilityList[0] );
- m_xFT_Sub->set_sensitive( rInput.aPossibilityList[1] );
- m_xFT_XAxis->set_sensitive( rInput.aPossibilityList[2] );
- m_xFT_YAxis->set_sensitive( rInput.aPossibilityList[3] );
- m_xFT_ZAxis->set_sensitive( rInput.aPossibilityList[4] );
- m_xFT_SecondaryXAxis->set_sensitive( rInput.aPossibilityList[5] );
- m_xFT_SecondaryYAxis->set_sensitive( rInput.aPossibilityList[6] );
+ m_xFT_Main->set_sensitive(rInput.aPossibilityList[0]);
+ m_xFT_Sub->set_sensitive(rInput.aPossibilityList[1]);
+ m_xFT_XAxis->set_sensitive(rInput.aPossibilityList[2]);
+ m_xFT_YAxis->set_sensitive(rInput.aPossibilityList[3]);
+ m_xFT_ZAxis->set_sensitive(rInput.aPossibilityList[4]);
+ m_xFT_SecondaryXAxis->set_sensitive(rInput.aPossibilityList[5]);
+ m_xFT_SecondaryYAxis->set_sensitive(rInput.aPossibilityList[6]);
- m_xEd_Main->set_sensitive( rInput.aPossibilityList[0] );
- m_xEd_Sub->set_sensitive( rInput.aPossibilityList[1] );
- m_xEd_XAxis->set_sensitive( rInput.aPossibilityList[2] );
- m_xEd_YAxis->set_sensitive( rInput.aPossibilityList[3] );
- m_xEd_ZAxis->set_sensitive( rInput.aPossibilityList[4] );
- m_xEd_SecondaryXAxis->set_sensitive( rInput.aPossibilityList[5] );
- m_xEd_SecondaryYAxis->set_sensitive( rInput.aPossibilityList[6] );
+ m_xEd_Main->set_sensitive(rInput.aPossibilityList[0]);
+ m_xEd_Sub->set_sensitive(rInput.aPossibilityList[1]);
+ m_xEd_XAxis->set_sensitive(rInput.aPossibilityList[2]);
+ m_xEd_YAxis->set_sensitive(rInput.aPossibilityList[3]);
+ m_xEd_ZAxis->set_sensitive(rInput.aPossibilityList[4]);
+ m_xEd_SecondaryXAxis->set_sensitive(rInput.aPossibilityList[5]);
+ m_xEd_SecondaryYAxis->set_sensitive(rInput.aPossibilityList[6]);
m_xEd_Main->set_text(rInput.aTextList[0]);
m_xEd_Sub->set_text(rInput.aTextList[1]);
@@ -110,23 +106,25 @@ void TitleResources::writeToResources( const TitleDialogData& rInput )
m_xEd_SecondaryYAxis->set_text(rInput.aTextList[6]);
}
-void TitleResources::readFromResources( TitleDialogData& rOutput )
+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 91f70f241bfc..e520d6da3bc8 100644
--- a/chart2/source/controller/dialogs/res_Trendline.hxx
+++ b/chart2/source/controller/dialogs/res_Trendline.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_TRENDLINE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_TRENDLINE_HXX
+#pragma once
#include <tools/link.hxx>
#include <svl/itemset.hxx>
@@ -25,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;
@@ -84,17 +84,15 @@ 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
-// INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_TRENDLINE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 00bc4e3f40bb..41366251729f 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEAPPEARANCE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEAPPEARANCE_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -26,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();
@@ -48,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;
@@ -66,6 +66,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 21597d382551..d0fc8a69d667 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
@@ -16,23 +16,24 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEGEOMETRY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEGEOMETRY_HXX
+#pragma once
#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();
@@ -48,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;
@@ -83,6 +84,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 27566a2a1251..2650e56fe8a4 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -18,9 +18,9 @@
*/
#include "tp_3D_SceneIllumination.hxx"
-#include <bitmaps.hlst>
#include <CommonConverters.hxx>
#include <ControllerLockGuard.hxx>
+#include <ChartModel.hxx>
#include <svx/colorbox.hxx>
#include <svx/float3d.hxx>
@@ -29,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>
@@ -68,7 +69,6 @@ struct LightSourceInfo
LightSourceInfo::LightSourceInfo()
: pButton(nullptr)
- , aLightSource()
{
aLightSource.nDiffuseColor = Color(0xffffff); // white
aLightSource.aDirection = drawing::Direction3D(1,1,1);
@@ -100,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(
@@ -139,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,
@@ -154,7 +154,7 @@ namespace
Color lcl_getAmbientColor(
const uno::Reference< beans::XPropertySet > & xSceneProperties )
{
- sal_Int32 nResult = 0x000000;
+ Color nResult;
try
{
xSceneProperties->getPropertyValue("D3DSceneAmbientColor") >>= nResult;
@@ -163,7 +163,7 @@ namespace
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
- return Color( nResult );
+ return nResult;
}
void lcl_setAmbientColor(
@@ -173,7 +173,7 @@ namespace
try
{
xSceneProperties->setPropertyValue("D3DSceneAmbientColor",
- uno::makeAny( rColor ));
+ uno::Any( rColor ));
}
catch( const uno::Exception & )
{
@@ -184,26 +184,27 @@ 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 ) )
, m_xChartModel( xChartModel )
, 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,11 +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)
@@ -432,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 27606079ec91..98a1f3273620 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
@@ -16,68 +16,71 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEILLUMINATION_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEILLUMINATION_HXX
+#pragma once
+#include <ModifyListenerCallBack.hxx>
#include <TimerTriggeredControllerLock.hxx>
#include <vcl/weld.hxx>
#include <svx/dlgctl3d.hxx>
+#include <svx/float3d.hxx>
-namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::beans
+{
+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:
- DECL_LINK( ClickLightSourceButtonHdl, weld::Button&, void );
- DECL_LINK( SelectColorHdl, ColorListBox&, void );
- DECL_LINK( ColorDialogHdl, weld::Button&, void );
- DECL_LINK( PreviewChangeHdl, SvxLightCtl3D*, void );
- DECL_LINK( PreviewSelectHdl, SvxLightCtl3D*, void );
+ DECL_LINK(ClickLightSourceButtonHdl, weld::Button&, void);
+ DECL_LINK(SelectColorHdl, ColorListBox&, void);
+ DECL_LINK(ColorDialogHdl, weld::Button&, void);
+ DECL_LINK(PreviewChangeHdl, SvxLightCtl3D*, void);
+ DECL_LINK(PreviewSelectHdl, SvxLightCtl3D*, void);
void updatePreview();
private:
- DECL_LINK(fillControlsFromModel, void *, void);
+ DECL_LINK(fillControlsFromModel, void*, void);
- void applyLightSourceToModel( sal_uInt32 nLightNumber );
+ void applyLightSourceToModel(sal_uInt32 nLightNumber);
void applyLightSourcesToModel();
std::unique_ptr<LightSourceInfo[]> m_pLightSourceInfoList;
- css::uno::Reference< css::beans::XPropertySet > m_xSceneProperties;
+ css::uno::Reference<css::beans::XPropertySet> m_xSceneProperties;
- TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
- bool m_bInCommitToModel;
+ bool m_bInCommitToModel;
- css::uno::Reference<css::frame::XModel> m_xChartModel;
+ ModifyListenerCallBack m_aModelChangeListener;
+ 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;
@@ -92,6 +95,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
index 1eaaa4063461..79976618341c 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -23,7 +23,7 @@
#include <TextDirectionListBox.hxx>
#include <svx/chrtitem.hxx>
-#include <svl/intitem.hxx>
+#include <svx/sdangitm.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/frmdiritem.hxx>
@@ -48,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))
{
@@ -72,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)
@@ -92,9 +90,9 @@ bool SchAxisLabelTabPage::FillItemSet( SfxItemSet* rOutAttrs )
if( m_xCtrlDial->HasRotation() )
{
- sal_Int32 nDegrees = bStacked ? 0 : m_xCtrlDial->GetRotation();
+ Degree100 nDegrees = bStacked ? 0_deg100 : m_xCtrlDial->GetRotation();
if( !m_bHasInitialDegrees || (nDegrees != m_nInitialDegrees) )
- rOutAttrs->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+ rOutAttrs->Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) );
}
if( m_bShowStaggeringControls )
@@ -124,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;
}
@@ -136,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 );
}
@@ -154,12 +152,12 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs )
// Rotation as orient item or in degrees ----------
// check new degree item
- m_nInitialDegrees = 0;
+ m_nInitialDegrees = 0_deg100;
aState = rInAttrs->GetItemState( SCHATTR_TEXT_DEGREES, false, &pPoolItem );
if( aState == SfxItemState::SET )
- m_nInitialDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ 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
@@ -171,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 );
}
@@ -200,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 );
}
@@ -222,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 )
{
@@ -269,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);
@@ -278,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 );
@@ -296,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 0e7b9a097178..75704ec4e4d5 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -16,13 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_AXISLABEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_AXISLABEL_HXX
+#pragma once
#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;
@@ -40,7 +40,7 @@ class SchAxisLabelTabPage : public SfxTabPage
private:
bool m_bShowStaggeringControls;
- sal_Int32 m_nInitialDegrees;
+ Degree100 m_nInitialDegrees;
bool m_bHasInitialDegrees; /// false = DialControl in tristate
bool m_bInitialStacking;
bool m_bHasInitialStacking; /// false = checkbox in tristate
@@ -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);
@@ -81,6 +80,4 @@ public:
};
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
index f94f09b98690..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
- long nTicks=0;
- 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 );
}
@@ -211,11 +209,11 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs)
PlaceLabelsSelectHdl( *m_xLB_PlaceLabels );
// Tick marks
- 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();
+ tools::Long nTicks = 0, nMinorTicks = 0;
+ 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 6be65c9dec48..86f749a26850 100644
--- a/chart2/source/controller/dialogs/tp_AxisPositions.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
@@ -16,51 +16,50 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_AXISPOSITIONS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_AXISPOSITIONS_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
namespace chart
{
-
class AxisPositionsTabPage : public SfxTabPage
{
public:
- AxisPositionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
+ AxisPositionsTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs);
virtual ~AxisPositionsTabPage() 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;
- virtual DeactivateRC DeactivatePage( SfxItemSet* pItemSet ) 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;
+ virtual DeactivateRC DeactivatePage(SfxItemSet* pItemSet) override;
- void SetNumFormatter( SvNumberFormatter* pFormatter );
+ void SetNumFormatter(SvNumberFormatter* pFormatter);
- void SetCrossingAxisIsCategoryAxis( bool bCrossingAxisIsCategoryAxis );
- void SetCategories( const css::uno::Sequence< OUString >& rCategories );
+ void SetCrossingAxisIsCategoryAxis(bool bCrossingAxisIsCategoryAxis);
+ void SetCategories(const css::uno::Sequence<OUString>& rCategories);
- void SupportAxisPositioning( bool bSupportAxisPositioning );
- void SupportCategoryPositioning( bool bSupportCategoryPositioning );
+ void SupportAxisPositioning(bool bSupportAxisPositioning);
+ void SupportCategoryPositioning(bool bSupportCategoryPositioning);
private: //methods:
DECL_LINK(CrossesAtSelectHdl, weld::ComboBox&, void);
DECL_LINK(PlaceLabelsSelectHdl, weld::ComboBox&, void);
private: //member:
- SvNumberFormatter* m_pNumFormatter;
+ SvNumberFormatter* m_pNumFormatter;
- bool m_bCrossingAxisIsCategoryAxis;
- css::uno::Sequence< OUString > m_aCategories;
+ bool m_bCrossingAxisIsCategoryAxis;
+ css::uno::Sequence<OUString> m_aCategories;
- bool m_bSupportAxisPositioning;
- bool m_bSupportCategoryPositioning;
+ bool m_bSupportAxisPositioning;
+ bool m_bSupportCategoryPositioning;
std::unique_ptr<weld::Frame> m_xFL_AxisLine;
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;
@@ -82,6 +80,4 @@ private: //member:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 271d4721cbe4..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,14 +47,14 @@ 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)
, m_aTimerTriggeredControllerLock( m_xChartModel )
, m_xFT_ChooseType(m_xBuilder->weld_label("FT_CAPTION_FOR_WIZARD"))
, m_xMainTypeList(m_xBuilder->weld_tree_view("charttype"))
- , m_xSubTypeList(new ValueSet(m_xBuilder->weld_scrolled_window("subtypewin")))
+ , m_xSubTypeList(new ValueSet(m_xBuilder->weld_scrolled_window("subtypewin", true)))
, m_xSubTypeListWin(new weld::CustomWeld(*m_xBuilder, "subtype", *m_xSubTypeList))
{
Size aSize(m_xSubTypeList->GetDrawingArea()->get_ref_device().LogicToPixel(Size(150, 50), MapMode(MapUnit::MapAppFont)));
@@ -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 405c3c9edf9d..c01b599f58d5 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.hxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_CHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_CHARTTYPE_HXX
+#pragma once
#include <vector>
@@ -46,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();
@@ -75,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;
@@ -91,6 +90,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.hxx b/chart2/source/controller/dialogs/tp_DataLabel.hxx
index e7d052728b4b..200063af9663 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_DataLabel.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATALABEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATALABEL_HXX
+#pragma once
#include "res_DataLabel.hxx"
#include <sfx2/tabdlg.hxx>
@@ -26,24 +25,24 @@ class SvNumberFormatter;
namespace chart
{
-
class DataLabelsTabPage : public SfxTabPage
{
public:
- DataLabelsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
+ DataLabelsTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs);
- static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs);
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs);
- void SetNumberFormatter( SvNumberFormatter* pFormatter );
+ void SetNumberFormatter(SvNumberFormatter* pFormatter);
virtual void Reset(const SfxItemSet* rInAttrs) override;
virtual bool FillItemSet(SfxItemSet* rOutAttrs) override;
private:
- DataLabelResources m_aDataLabelResources;
+ DataLabelResources m_aDataLabelResources;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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_DataPointOption.hxx b/chart2/source/controller/dialogs/tp_DataPointOption.hxx
index 5473d93c8996..b73a8a609eee 100644
--- a/chart2/source/controller/dialogs/tp_DataPointOption.hxx
+++ b/chart2/source/controller/dialogs/tp_DataPointOption.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATAPOINTOPTION_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATAPOINTOPTION_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
@@ -46,6 +45,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index b6ebe98d08d8..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
{
-const OUString lcl_aLabelRole( "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())
@@ -841,6 +834,9 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField)
aRange = xNewSeq->getSourceRangeRepresentation();
Reference< beans::XPropertySet > xProp( xNewSeq, uno::UNO_QUERY_THROW );
xProp->setPropertyValue( "Role" , uno::Any( lcl_aLabelRole ));
+
+ //Labels should always include hidden cells, regardless of the setting chosen
+ xProp->setPropertyValue( "IncludeHiddenCells", uno::Any(true));
xLabeledSeq->setLabel( xNewSeq );
}
}
@@ -876,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 );
@@ -905,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 3ba36a1cf97f..40219d917f9c 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -16,8 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATASOURCE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATASOURCE_HXX
+#pragma once
+
+#include <DataSeries.hxx>
+#include <ChartType.hxx>
#include <vcl/wizardmachine.hxx>
@@ -30,8 +32,9 @@ namespace chart { class TabPageNotifiable; }
namespace chart
{
-
+class ChartType;
class ChartTypeTemplateProvider;
+class DataSeries;
class DialogModel;
class SeriesEntry
@@ -40,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 :
@@ -143,7 +146,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATASOURCE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 2ce941a1d5b9..159de22b0d03 100644
--- a/chart2/source/controller/dialogs/tp_ErrorBars.hxx
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
@@ -16,15 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_ERRORBARS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_ERRORBARS_HXX
+#pragma once
#include <res_ErrorBar.hxx>
#include <sfx2/tabdlg.hxx>
+#include <rtl/ref.hxx>
namespace chart
{
+class ChartModel;
class ErrorBarsTabPage : public SfxTabPage
{
@@ -34,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;
@@ -46,6 +47,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 61e4c8929786..4534501b5209 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
@@ -16,14 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_LEGENDPOSITION_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_LEGENDPOSITION_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <res_LegendPosition.hxx>
-
-namespace chart { class TextDirectionListBox; }
+#include <TextDirectionListBox.hxx>
namespace chart
{
@@ -33,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:
@@ -47,6 +45,4 @@ public:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
index 6d2ac1b45332..7c2c4d942e66 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -49,7 +49,7 @@ bool SchLayoutTabPage::FillItemSet(SfxItemSet* rOutAttrs)
int nShape = m_pGeometryResources ? m_pGeometryResources->get_selected_index() : -1;
if (nShape != -1)
{
- long nSegs=32;
+ tools::Long nSegs=32;
if (nShape==CHART_SHAPE3D_PYRAMID)
nSegs=4;
@@ -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))
{
- 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_PointGeometry.hxx b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
index 2438ce898b8b..326cc902593e 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
@@ -16,22 +16,22 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_POINTGEOMETRY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_POINTGEOMETRY_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
namespace chart
{
-
class BarGeometryResources;
class SchLayoutTabPage : public SfxTabPage
{
public:
- SchLayoutTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
+ SchLayoutTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs);
virtual ~SchLayoutTabPage() override;
- static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs);
+ 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;
@@ -41,6 +41,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index 804c4221247a..ad7b2b6f0f3e 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -21,7 +21,8 @@
#include <chartview/ChartSfxItemIds.hxx>
#include <svl/eitem.hxx>
-#include <svl/intitem.hxx>
+#include <svx/sdangitm.hxx>
+#include <officecfg/Office/Compatibility.hxx>
namespace chart
{
@@ -54,8 +55,7 @@ bool PolarOptionsTabPage::FillItemSet( SfxItemSet* rOutAttrs )
{
if (m_xAngleDialWin->get_visible())
{
- rOutAttrs->Put(SfxInt32Item(SCHATTR_STARTING_ANGLE,
- static_cast< sal_Int32 >(m_xAngleDial->GetRotation()/100)));
+ rOutAttrs->Put(SdrAngleItem(SCHATTR_STARTING_ANGLE, m_xAngleDial->GetRotation()));
}
if( m_xCB_Clockwise->get_visible() )
@@ -69,29 +69,30 @@ 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))
{
- long nTmp = static_cast<long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
- m_xAngleDial->SetRotation( nTmp*100 );
+ Degree100 nTmp = pAngleItem->GetValue();
+ m_xAngleDial->SetRotation( nTmp );
}
else
{
m_xFL_StartingAngle->hide();
}
- if (rInAttrs->GetItemState(SCHATTR_CLOCKWISE, true, &pPoolItem) == SfxItemState::SET)
+ // tdf#108059 Hide clockwise orientation checkbox in OOXML-heavy environments it would be useless anyways
+ 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_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
index e5d4287cbe3e..eba4018052af 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.hxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_POLAROPTIONS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_POLAROPTIONS_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svx/dialcontrol.hxx>
@@ -55,6 +54,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
index c11c9eee8d8a..a88f6a826e0b 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -20,12 +20,13 @@
#include "tp_RangeChooser.hxx"
#include <DataSourceHelper.hxx>
#include <ChartTypeTemplateProvider.hxx>
+#include <ChartTypeTemplate.hxx>
#include "DialogModel.hxx"
#include <RangeSelectionHelper.hxx>
#include <TabPageNotifiable.hxx>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <svtools/miscopt.hxx>
+#include <officecfg/Office/Common.hxx>
#include <osl/diagnose.h>
namespace
@@ -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"))
@@ -109,8 +108,7 @@ RangeChooserTabPage::RangeChooserTabPage(weld::Container* pPage, weld::DialogCon
m_xEd_TimeStart->connect_changed( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
m_xEd_TimeEnd->connect_changed( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
- SvtMiscOptions aOpts;
- if ( !aOpts.IsExperimentalMode() )
+ if ( !officecfg::Office::Common::Misc::ExperimentalMode::get() )
{
m_xFL_TimeBased->hide();
m_xCB_TimeBased->hide();
@@ -193,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" );
@@ -217,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 );
}
@@ -228,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 );
@@ -317,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 b337910ccbd2..428e8a127dd9 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
@@ -17,19 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_RANGECHOOSER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_RANGECHOOSER_HXX
+#pragma once
#include <RangeSelectionListener.hxx>
#include <vcl/wizardmachine.hxx>
namespace chart { class TabPageNotifiable; }
-namespace com::sun::star::chart2 { class XChartTypeTemplate; }
namespace chart
{
-
+class ChartTypeTemplate;
class ChartTypeTemplateProvider;
class DialogModel;
@@ -65,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;
@@ -97,6 +94,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 b0e308845bc4..b90d3ef20211 100644
--- a/chart2/source/controller/dialogs/tp_Scale.hxx
+++ b/chart2/source/controller/dialogs/tp_Scale.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_SCALE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_SCALE_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
+#include <unotools/resmgr.hxx>
namespace chart
{
@@ -84,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.
@@ -99,13 +99,11 @@ 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();
};
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index 82bd80ab6542..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))
{
- long nVal=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ tools::Long nVal = pAxisItem->GetValue();
if(nVal==CHART_AXIS_SECONDARY_Y)
{
m_xRbtAxis2->set_active(true);
@@ -127,35 +125,35 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
}
}
- long nTmp;
- if (rInAttrs->GetItemState(SCHATTR_BAR_GAPWIDTH, true, &pPoolItem) == SfxItemState::SET)
+ tools::Long nTmp;
+ if (const SfxInt32Item* pGapWidthItem = rInAttrs->GetItemIfSet(SCHATTR_BAR_GAPWIDTH))
{
- nTmp = static_cast<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<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);
}
- 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 8580e5722996..6b163f3c8815 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_SERIESTOAXIS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_SERIESTOAXIS_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
@@ -48,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;
@@ -75,6 +74,4 @@ private: //member
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index d23e393d5f13..f3380042eb13 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -24,7 +24,7 @@
#include <editeng/eeitem.hxx>
#include <editeng/frmdiritem.hxx>
-#include <svl/intitem.hxx>
+#include <svx/sdangitm.hxx>
namespace chart
{
@@ -35,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))
{
@@ -59,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);
@@ -72,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,
@@ -93,10 +91,10 @@ bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs)
bool bStacked = m_xCbStacked->get_active();
rOutAttrs->Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
- sal_Int32 nDegrees = bStacked ? 0 : m_xCtrlDial->GetRotation();
- rOutAttrs->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+ 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;
@@ -106,7 +104,7 @@ void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs)
{
const SfxPoolItem* pItem = GetItem( *rInAttrs, SCHATTR_TEXT_DEGREES );
- sal_Int32 nDegrees = pItem ? static_cast<const SfxInt32Item*>(pItem)->GetValue() : 0;
+ Degree100 nDegrees = pItem ? static_cast<const SdrAngleItem*>(pItem)->GetValue() : 0_deg100;
m_xCtrlDial->SetRotation( nDegrees );
pItem = GetItem( *rInAttrs, SCHATTR_TEXT_STACKED );
@@ -114,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 b6b184eea775..9d59b693f9a8 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -16,13 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_TITLEROTATION_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_TITLEROTATION_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svx/dialcontrol.hxx>
+#include <TextDirectionListBox.hxx>
-namespace chart { class TextDirectionListBox; }
namespace weld {
class CheckButton;
class CustomWeld;
@@ -40,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);
@@ -60,6 +58,4 @@ public:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_Trendline.hxx b/chart2/source/controller/dialogs/tp_Trendline.hxx
index 596ff339b17a..3a240af38766 100644
--- a/chart2/source/controller/dialogs/tp_Trendline.hxx
+++ b/chart2/source/controller/dialogs/tp_Trendline.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_TRENDLINE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_TRENDLINE_HXX
+#pragma once
#include "res_Trendline.hxx"
@@ -44,6 +43,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
index b191f2a42468..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,11 +75,11 @@ 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 );
- AxisHelper::getAxisOrGridExcistence( aExistenceList, xDiagram, false );
+ AxisHelper::getAxisOrGridExistence( aExistenceList, xDiagram, false );
m_xCB_Grid_X->set_sensitive( aPossibilityList[0] );
m_xCB_Grid_Y->set_sensitive( aPossibilityList[1] );
m_xCB_Grid_Z->set_sensitive( aPossibilityList[2] );
@@ -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::getAxisOrGridExcistence( aOldExistenceList, xDiagram, false );
+ 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 f6c5bbc4b297..d2c30d8b4363 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
@@ -17,12 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_WIZARD_TITLESANDOBJECTS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_WIZARD_TITLESANDOBJECTS_HXX
+#pragma once
#include <TimerTriggeredControllerLock.hxx>
#include <vcl/wizardmachine.hxx>
+#include <rtl/ref.hxx>
#include <memory>
@@ -33,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;
@@ -50,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;
@@ -67,6 +68,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index d60b259dad62..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,16 +33,15 @@
#include <svx/svdetc.hxx>
#include <svx/svdoutl.hxx>
#include <svx/svxids.hrc>
-#include <svx/unoshape.hxx>
-#include <tools/globname.hxx>
#include <editeng/fhgtitem.hxx>
+#include <osl/diagnose.h>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/lang/XUnoTunnel.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;
@@ -58,38 +59,11 @@ namespace
return nHitTolerance;
}
-// this code is copied from sfx2/source/doc/objembed.cxx
-SfxObjectShell * lcl_GetParentObjectShell( const uno::Reference< frame::XModel > & xModel )
-{
- SfxObjectShell* pResult = nullptr;
-
- try
- {
- uno::Reference< container::XChild > xChildModel( xModel, uno::UNO_QUERY );
- if ( xChildModel.is() )
- {
- uno::Reference< lang::XUnoTunnel > xParentTunnel( xChildModel->getParent(), uno::UNO_QUERY );
- if ( xParentTunnel.is() )
- {
- SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID );
- pResult = reinterpret_cast< SfxObjectShell * >(
- xParentTunnel->getSomething( aSfxIdent.GetByteSequence() ) );
- }
- }
- }
- catch( const uno::Exception& )
- {
- // TODO: error handling
- }
-
- return pResult;
-}
-
// this code is copied from sfx2/source/doc/objembed.cxx. It is a workaround to
// get the reference device (e.g. printer) from the parent document
OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & xModel )
{
- SfxObjectShell * pParent = lcl_GetParentObjectShell( xModel );
+ SfxObjectShell* pParent = SfxObjectShell::GetParentShell(xModel);
if ( pParent )
return pParent->GetDocumentRefDev();
return nullptr;
@@ -107,7 +81,6 @@ DrawViewWrapper::DrawViewWrapper(
{
SetBufferedOutputAllowed(true);
SetBufferedOverlayAllowed(true);
- SetPagePaintingAllowed(true);
// #i12587# support for shapes in chart
SdrOutliner* pOutliner = getOutliner();
@@ -117,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
@@ -150,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()
@@ -196,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());
@@ -239,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
@@ -283,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;
}
@@ -313,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;
}
@@ -321,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 );
@@ -375,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 ef1eab3296fb..b7ccbac900da 100644
--- a/chart2/source/controller/inc/AccessibleBase.hxx
+++ b/chart2/source/controller/inc/AccessibleBase.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLEBASE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLEBASE_HXX
+#pragma once
#include <ObjectIdentifier.hxx>
@@ -28,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;
@@ -55,7 +52,9 @@ namespace chart
{
class AccessibleBase;
+class ChartView;
class ObjectHierarchy;
+class ChartController;
typedef ObjectIdentifier AccessibleUniqueId;
@@ -63,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;
@@ -90,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:
@@ -100,7 +99,7 @@ public:
LOST_SELECTION
};
- AccessibleBase( const AccessibleElementInfo & rAccInfo,
+ AccessibleBase( AccessibleElementInfo aAccInfo,
bool bMayHaveChildren,
bool bAlwaysTransparent );
virtual ~AccessibleBase() override;
@@ -136,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
@@ -186,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.
@@ -210,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 );
@@ -230,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
@@ -243,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()
@@ -306,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;
@@ -326,6 +318,4 @@ private:
} // namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/AccessibleChartView.hxx b/chart2/source/controller/inc/AccessibleChartView.hxx
index f6e174b53b14..793cdd69ab77 100644
--- a/chart2/source/controller/inc/AccessibleChartView.hxx
+++ b/chart2/source/controller/inc/AccessibleChartView.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLECHARTVIEW_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLECHARTVIEW_HXX
+#pragma once
#include "AccessibleBase.hxx"
#include <cppuhelper/implbase.hxx>
@@ -39,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;
@@ -61,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;
@@ -80,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;
@@ -102,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;
@@ -115,6 +118,5 @@ private: // members
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/AccessibleTextHelper.hxx b/chart2/source/controller/inc/AccessibleTextHelper.hxx
index 30b4123b9aac..85fcb83dc3e4 100644
--- a/chart2/source/controller/inc/AccessibleTextHelper.hxx
+++ b/chart2/source/controller/inc/AccessibleTextHelper.hxx
@@ -16,20 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLETEXTHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLETEXTHELPER_HXX
+#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
{
@@ -38,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
@@ -65,30 +55,28 @@ 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;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLETEXTHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx
index 5bd230bd67d7..c14ef82bd595 100644
--- a/chart2/source/controller/inc/AxisItemConverter.hxx
+++ b/chart2/source/controller/inc/AxisItemConverter.hxx
@@ -16,34 +16,37 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_AXISITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_AXISITEMCONVERTER_HXX
+#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;
@@ -51,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;
@@ -59,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;
@@ -71,6 +72,4 @@ private:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
index 0cf947d0e953..65ff58ea45ab 100644
--- a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
+++ b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARACTERPROPERTYITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARACTERPROPERTYITEMCONVERTER_HXX
+#pragma once
#include "ItemConverter.hxx"
#include <com/sun/star/awt/Size.hpp>
@@ -36,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;
@@ -57,6 +56,4 @@ private:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 1977e8e169fa..737d0cf3768f 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTCONTROLLER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTCONTROLLER_HXX
+#pragma once
#include <LifeTime.hxx>
+#include <ReferenceSizeProvider.hxx>
#include "CommandDispatchContainer.hxx"
#include "SelectionHelper.hxx"
@@ -35,12 +35,12 @@
#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>
namespace com::sun::star::accessibility { class XAccessible; }
namespace com::sun::star::accessibility { class XAccessibleContext; }
@@ -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();
@@ -427,9 +429,9 @@ private:
//executeDispatch methods
void executeDispatch_ObjectProperties();
- void executeDispatch_FormatObject( const OUString& rDispatchCommand );
+ 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 );
@@ -498,14 +506,18 @@ private:
void executeDispatch_LOKSetTextSelection(int nType, int nX, int nY);
void executeDispatch_LOKPieSegmentDragging(int nOffset);
+ void executeDispatch_FillColor(sal_uInt32 nColor);
+ 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();
@@ -513,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
@@ -527,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 );
@@ -554,6 +556,4 @@ private:
} // namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ChartDocumentWrapper.hxx b/chart2/source/controller/inc/ChartDocumentWrapper.hxx
index 9f36c42b3a2f..a5bded3c8fb7 100644
--- a/chart2/source/controller/inc/ChartDocumentWrapper.hxx
+++ b/chart2/source/controller/inc/ChartDocumentWrapper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARTDOCUMENTWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARTDOCUMENTWRAPPER_HXX
+#pragma once
#include <WrappedPropertySet.hxx>
#include <com/sun/star/chart/XChartDocument.hpp>
@@ -27,16 +26,15 @@
#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
-{
-
-namespace wrapper
+namespace chart::wrapper
{
class Chart2ModelContact;
@@ -52,7 +50,7 @@ class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper
{
};
-class ChartDocumentWrapper : public ChartDocumentWrapper_Base
+class ChartDocumentWrapper final : public ChartDocumentWrapper_Base
, public ::utl::OEventListenerAdapter
{
public:
@@ -76,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:
@@ -141,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();
@@ -160,17 +162,15 @@ 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;
bool m_bIsDisposed;
};
-} // namespace wrapper
-} // namespace chart
+} // namespace chart::wrapper
// CHART_CHARTDOCUMENT_HXX
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ChartToolbarController.hxx b/chart2/source/controller/inc/ChartToolbarController.hxx
index 140a62b60a5c..ce493bba674b 100644
--- a/chart2/source/controller/inc/ChartToolbarController.hxx
+++ b/chart2/source/controller/inc/ChartToolbarController.hxx
@@ -7,11 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARTTOOLBARCONTROLLER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARTTOOLBARCONTROLLER_HXX
+#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>
@@ -24,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);
@@ -70,7 +67,7 @@ public:
// XUpdatable
virtual void SAL_CALL update() override;
- using cppu::WeakComponentImplHelperBase::disposing;
+ using comphelper::WeakComponentImplHelperBase::disposing;
private:
@@ -79,6 +76,4 @@ private:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ChartWindow.hxx b/chart2/source/controller/inc/ChartWindow.hxx
index a05db545bfd2..918805cb3a8a 100644
--- a/chart2/source/controller/inc/ChartWindow.hxx
+++ b/chart2/source/controller/inc/ChartWindow.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTWINDOW_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTWINDOW_HXX
+#pragma once
#include <vcl/window.hxx>
@@ -30,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 );
@@ -54,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;
@@ -89,6 +81,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx
index 8e6aa4c49c49..ae95313c0f20 100644
--- a/chart2/source/controller/inc/CommandDispatchContainer.hxx
+++ b/chart2/source/controller/inc/CommandDispatchContainer.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCHCONTAINER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCHCONTAINER_HXX
+#pragma once
-#include <cppuhelper/weakref.hxx>
+#include <unotools/weakref.hxx>
#include <o3tl/sorted_vector.hxx>
#include <map>
@@ -34,7 +33,7 @@ namespace com::sun::star::util { struct URL; }
namespace chart
{
-
+class ChartModel;
class DrawCommandDispatch;
class ShapeController;
@@ -74,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
@@ -103,7 +102,7 @@ public:
const css::uno::Reference< css::frame::XController > & xChartController,
const css::util::URL & rURL );
- css::uno::Reference< css::frame::XDispatch > getChartDispatcher() { return m_xChartDispatcher; }
+ const css::uno::Reference< css::frame::XDispatch > & getChartDispatcher() const { return m_xChartDispatcher; }
void setDrawCommandDispatch( DrawCommandDispatch* pDispatch );
DrawCommandDispatch* getDrawCommandDispatch() { return m_pDrawCommandDispatch; }
@@ -123,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;
@@ -134,7 +133,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCHCONTAINER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ConfigurationAccess.hxx b/chart2/source/controller/inc/ConfigurationAccess.hxx
deleted file mode 100644
index 416ae72fe832..000000000000
--- a/chart2/source/controller/inc/ConfigurationAccess.hxx
+++ /dev/null
@@ -1,44 +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 INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CONFIGURATIONACCESS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CONFIGURATIONACCESS_HXX
-
-#include <tools/fldunit.hxx>
-
-namespace chart
-{
-
-namespace 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
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx
index 88c2b3a274e2..720cc0fef2e7 100644
--- a/chart2/source/controller/inc/DataPointItemConverter.hxx
+++ b/chart2/source/controller/inc/DataPointItemConverter.hxx
@@ -16,39 +16,40 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DATAPOINTITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DATAPOINTITEMCONVERTER_HXX
+#pragma once
#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,
@@ -63,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;
@@ -81,11 +82,9 @@ 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;
};
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 8bad644101cb..28c2a927ec19 100644
--- a/chart2/source/controller/inc/DrawViewWrapper.hxx
+++ b/chart2/source/controller/inc/DrawViewWrapper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DRAWVIEWWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DRAWVIEWWRAPPER_HXX
+#pragma once
#include <memory>
#include <svx/view3d.hxx>
@@ -44,7 +43,7 @@ protected:
~MarkHandleProvider() {}
};
-class DrawViewWrapper : public E3dView
+class DrawViewWrapper final : public E3dView
{
public:
DrawViewWrapper(
@@ -97,6 +96,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ErrorBarItemConverter.hxx b/chart2/source/controller/inc/ErrorBarItemConverter.hxx
index 691ca508a172..a53fbe18ef60 100644
--- a/chart2/source/controller/inc/ErrorBarItemConverter.hxx
+++ b/chart2/source/controller/inc/ErrorBarItemConverter.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ERRORBARITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ERRORBARITEMCONVERTER_HXX
+#pragma once
#include "ItemConverter.hxx"
@@ -27,16 +26,14 @@ namespace com::sun::star::lang { class XMultiServiceFactory; }
class SdrModel;
-namespace chart
-{
-namespace wrapper
+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,
@@ -47,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;
@@ -58,9 +55,6 @@ private:
css::uno::Reference< css::frame::XModel > m_xModel;
};
-} // namespace wrapper
-} // namespace chart
-
-#endif // INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ERRORBARITEMCONVERTER_HXX
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
index 1fcc4f2244ce..9d119d53ca3a 100644
--- a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
+++ b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_GRAPHICPROPERTYITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_GRAPHICPROPERTYITEMCONVERTER_HXX
+#pragma once
#include "ItemConverter.hxx"
@@ -25,9 +24,7 @@ namespace com::sun::star::lang { class XMultiServiceFactory; }
class SdrModel;
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
enum class GraphicObjectType
@@ -38,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;
@@ -62,10 +59,6 @@ private:
css::uno::Reference< css::lang::XMultiServiceFactory > m_xNamedPropertyTableFactory;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_GRAPHICPROPERTYITEMCONVERTER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ItemConverter.hxx b/chart2/source/controller/inc/ItemConverter.hxx
index 8d00d90426f4..031a633c22d8 100644
--- a/chart2/source/controller/inc/ItemConverter.hxx
+++ b/chart2/source/controller/inc/ItemConverter.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMCONVERTER_HXX
+#pragma once
#include <unotools/eventlisteneradapter.hxx>
#include <svl/itemset.hxx>
@@ -74,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;
@@ -117,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.
@@ -192,7 +182,4 @@ private:
}
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMCONVERTER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ItemPropertyMap.hxx b/chart2/source/controller/inc/ItemPropertyMap.hxx
index 26cd4e88c5a2..7bee6ae814b5 100644
--- a/chart2/source/controller/inc/ItemPropertyMap.hxx
+++ b/chart2/source/controller/inc/ItemPropertyMap.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMPROPERTYMAP_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMPROPERTYMAP_HXX
+#pragma once
#include <sal/config.h>
@@ -25,13 +24,11 @@
#include <map>
-namespace chart::wrapper {
-
-typedef std::map< ItemConverter::tWhichIdType, std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > >
+namespace chart::wrapper
+{
+typedef std::map<ItemConverter::tWhichIdType,
+ std::pair<ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType>>
ItemPropertyMapType;
-
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/LegendItemConverter.hxx b/chart2/source/controller/inc/LegendItemConverter.hxx
index 74de6cd62cc5..cbb657edf0d3 100644
--- a/chart2/source/controller/inc/LegendItemConverter.hxx
+++ b/chart2/source/controller/inc/LegendItemConverter.hxx
@@ -16,24 +16,21 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_LEGENDITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_LEGENDITEMCONVERTER_HXX
+#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;
-namespace chart
-{
-namespace wrapper
+namespace chart::wrapper
{
-class LegendItemConverter : public ItemConverter
+class LegendItemConverter final : public ItemConverter
{
public:
LegendItemConverter(
@@ -41,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;
@@ -49,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;
@@ -59,10 +56,6 @@ private:
std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_LEGENDITEMCONVERTER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/MultipleChartConverters.hxx b/chart2/source/controller/inc/MultipleChartConverters.hxx
index 9f5fd399d196..8fc9f33b4367 100644
--- a/chart2/source/controller/inc/MultipleChartConverters.hxx
+++ b/chart2/source/controller/inc/MultipleChartConverters.hxx
@@ -16,53 +16,54 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_MULTIPLECHARTCONVERTERS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_MULTIPLECHARTCONVERTERS_HXX
+#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 );
@@ -70,37 +71,34 @@ 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
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_MULTIPLECHARTCONVERTERS_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx
index a765275c4ef5..1531866aaf2b 100644
--- a/chart2/source/controller/inc/ObjectHierarchy.hxx
+++ b/chart2/source/controller/inc/ObjectHierarchy.hxx
@@ -16,27 +16,21 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX
+#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:
@@ -48,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 );
@@ -58,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;
@@ -70,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 );
@@ -96,13 +116,10 @@ private:
bool veryLast();
ObjectIdentifier m_aCurrentOID;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument;
+ rtl::Reference<::chart::ChartModel> m_xChartDocument;
ExplicitValueProvider * m_pExplicitValueProvider;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/ObjectNameProvider.hxx b/chart2/source/controller/inc/ObjectNameProvider.hxx
index ea0f7c4a7349..c613dd5ce855 100644
--- a/chart2/source/controller/inc/ObjectNameProvider.hxx
+++ b/chart2/source/controller/inc/ObjectNameProvider.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTNAMEPROVIDER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTNAMEPROVIDER_HXX
+#pragma once
#include <ObjectIdentifier.hxx>
#include <TitleHelper.hxx>
@@ -36,37 +35,35 @@ 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
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/PositionAndSizeHelper.hxx b/chart2/source/controller/inc/PositionAndSizeHelper.hxx
index efe94648a1c9..0f79373d52f9 100644
--- a/chart2/source/controller/inc/PositionAndSizeHelper.hxx
+++ b/chart2/source/controller/inc/PositionAndSizeHelper.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_POSITIONANDSIZEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_POSITIONANDSIZEHELPER_HXX
+#pragma once
#include <ObjectIdentifier.hxx>
@@ -37,14 +36,13 @@ 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 );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/RangeSelectionHelper.hxx b/chart2/source/controller/inc/RangeSelectionHelper.hxx
index e4669a044858..36fe0db99cce 100644
--- a/chart2/source/controller/inc/RangeSelectionHelper.hxx
+++ b/chart2/source/controller/inc/RangeSelectionHelper.hxx
@@ -16,12 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONHELPER_HXX
+#pragma once
#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; }
@@ -35,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();
@@ -60,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;
@@ -69,7 +68,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/RangeSelectionListener.hxx b/chart2/source/controller/inc/RangeSelectionListener.hxx
index 6f6239a0e95d..9117b4d9b2fc 100644
--- a/chart2/source/controller/inc/RangeSelectionListener.hxx
+++ b/chart2/source/controller/inc/RangeSelectionListener.hxx
@@ -16,56 +16,55 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONLISTENER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONLISTENER_HXX
+#pragma once
#include <ControllerLockGuard.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/sheet/XRangeSelectionListener.hpp>
+#include <rtl/ref.hxx>
-namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::frame
+{
+class XModel;
+}
namespace chart
{
+class ChartModel;
class RangeSelectionListenerParent
{
public:
- virtual void listeningFinished( const OUString & rNewRange ) = 0;
+ virtual void listeningFinished(const OUString& rNewRange) = 0;
virtual void disposingRangeSelection() = 0;
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:
// ____ XRangeSelectionListener ____
- virtual void SAL_CALL done( const css::sheet::RangeSelectionEvent& aEvent ) override;
- virtual void SAL_CALL aborted( const css::sheet::RangeSelectionEvent& aEvent ) override;
+ virtual void SAL_CALL done(const css::sheet::RangeSelectionEvent& aEvent) override;
+ virtual void SAL_CALL aborted(const css::sheet::RangeSelectionEvent& aEvent) override;
// ____ XEventListener ____
- virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
private:
- RangeSelectionListenerParent & m_rParent;
+ RangeSelectionListenerParent& m_rParent;
OUString m_aRange;
ControllerLockGuardUNO m_aControllerLockGuard;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONLISTENER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
index 73e67900ec8d..8c4262b55ec5 100644
--- a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
+++ b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
@@ -16,27 +16,25 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONCURVEITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONCURVEITEMCONVERTER_HXX
+#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
-{
-namespace wrapper
+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 );
@@ -46,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;
@@ -54,13 +52,9 @@ protected:
private:
std::shared_ptr< ItemConverter > m_spGraphicConverter;
- css::uno::Reference< css::chart2::XRegressionCurveContainer > m_xCurveContainer;
+ rtl::Reference< ::chart::DataSeries > m_xCurveContainer;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONCURVEITEMCONVERTER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
index 237452f6f898..83394b1ea45d 100644
--- a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
+++ b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
@@ -16,14 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONEQUATIONITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONEQUATIONITEMCONVERTER_HXX
+#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; }
@@ -31,7 +30,7 @@ class SdrModel;
namespace chart::wrapper {
-class RegressionEquationItemConverter : public ItemConverter
+class RegressionEquationItemConverter final : public ItemConverter
{
public:
RegressionEquationItemConverter(
@@ -39,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;
@@ -47,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;
@@ -59,6 +58,4 @@ private:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/SelectionHelper.hxx b/chart2/source/controller/inc/SelectionHelper.hxx
index 570fc60a58be..119640bd4300 100644
--- a/chart2/source/controller/inc/SelectionHelper.hxx
+++ b/chart2/source/controller/inc/SelectionHelper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SELECTIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SELECTIONHELPER_HXX
+#pragma once
#include "DrawViewWrapper.hxx"
#include <ObjectIdentifier.hxx>
@@ -39,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;
@@ -73,7 +73,7 @@ private: //member
ObjectIdentifier m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing;
};
-class SelectionHelper : public MarkHandleProvider
+class SelectionHelper final : public MarkHandleProvider
{
public:
static bool findNamedParent( SdrObject*& pInOutObject
@@ -93,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();
@@ -112,6 +112,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
index 2be1490ee997..b55457ac5b30 100644
--- a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
+++ b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
@@ -16,40 +16,41 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_SERIESOPTIONSITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_SERIESOPTIONSITEMCONVERTER_HXX
+#pragma once
#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
-{
-namespace wrapper
+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;
@@ -67,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;
@@ -78,10 +79,6 @@ private:
bool m_bHideLegendEntry;
};
-} // namespace wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_SERIESOPTIONSITEMCONVERTER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 00760488fa25..a6c56a2691e7 100644
--- a/chart2/source/controller/inc/StatisticsItemConverter.hxx
+++ b/chart2/source/controller/inc/StatisticsItemConverter.hxx
@@ -16,42 +16,37 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_STATISTICSITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_STATISTICSITEMCONVERTER_HXX
+#pragma once
#include "ItemConverter.hxx"
+#include <rtl/ref.hxx>
namespace com::sun::star::frame { class XModel; }
+namespace chart { class ChartModel; }
-namespace chart
-{
-namespace wrapper
+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 wrapper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_STATISTICSITEMCONVERTER_HXX
-#endif
+} // namespace chart::wrapper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/TabPageNotifiable.hxx b/chart2/source/controller/inc/TabPageNotifiable.hxx
index d9ba555887fd..c0b53972e546 100644
--- a/chart2/source/controller/inc/TabPageNotifiable.hxx
+++ b/chart2/source/controller/inc/TabPageNotifiable.hxx
@@ -16,8 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TABPAGENOTIFIABLE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TABPAGENOTIFIABLE_HXX
+#pragma once
+
+#include <sal/types.h>
// color to use as foreground for an invalid range
#define RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR COL_WHITE
@@ -28,12 +29,11 @@ class BuilderPage;
namespace chart
{
-
-class TabPageNotifiable
+class SAL_LOPLUGIN_ANNOTATE("crosscast") TabPageNotifiable
{
public:
- virtual void setInvalidPage( BuilderPage * pTabPage ) = 0;
- virtual void setValidPage( BuilderPage * pTabPage ) = 0;
+ virtual void setInvalidPage(BuilderPage* pTabPage) = 0;
+ virtual void setValidPage(BuilderPage* pTabPage) = 0;
protected:
~TabPageNotifiable() {}
@@ -41,7 +41,4 @@ protected:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TABPAGENOTIFIABLE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/TextDirectionListBox.hxx b/chart2/source/controller/inc/TextDirectionListBox.hxx
index 7db7d674e0bb..d346a23cb45d 100644
--- a/chart2/source/controller/inc/TextDirectionListBox.hxx
+++ b/chart2/source/controller/inc/TextDirectionListBox.hxx
@@ -17,23 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TEXTDIRECTIONLISTBOX_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TEXTDIRECTIONLISTBOX_HXX
+#pragma once
#include <svx/frmdirlbox.hxx>
namespace chart
{
-
-class TextDirectionListBox : public svx::FrameDirectionListBox
+class TextDirectionListBox final : public svx::FrameDirectionListBox
{
public:
explicit TextDirectionListBox(std::unique_ptr<weld::ComboBox> pControl);
};
-
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/TextLabelItemConverter.hxx b/chart2/source/controller/inc/TextLabelItemConverter.hxx
index 9647793a8df1..cb5406cf6a01 100644
--- a/chart2/source/controller/inc/TextLabelItemConverter.hxx
+++ b/chart2/source/controller/inc/TextLabelItemConverter.hxx
@@ -16,30 +16,32 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TEXTLABELITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TEXTLABELITEMCONVERTER_HXX
+#pragma once
#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 );
@@ -50,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,10 +66,10 @@ private:
bool mbDataSeries:1;
bool mbForbidPercentValue:1;
+
+ rtl::Reference<::chart::DataSeries> m_xSeries;
};
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
index e8018ae4370a..49541b1552d4 100644
--- a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
+++ b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
@@ -19,31 +19,38 @@
#pragma once
-#include <com/sun/star/uno/Reference.h>
#include <vcl/timer.hxx>
+#include <rtl/ref.hxx>
#include <memory>
-namespace com::sun::star::frame { class XModel; }
-namespace chart { class ControllerLockGuardUNO; }
+namespace com::sun::star::frame
+{
+class XModel;
+}
+namespace chart
+{
+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;
- std::unique_ptr< ControllerLockGuardUNO > m_apControllerLockGuard;
- AutoTimer m_aTimer;
+ rtl::Reference<::chart::ChartModel> m_xModel;
+ std::unique_ptr<ControllerLockGuardUNO> m_apControllerLockGuard;
+ AutoTimer m_aTimer;
- DECL_LINK( TimerTimeout, Timer*, void );
+ DECL_LINK(TimerTimeout, Timer*, void);
};
} //namespace chart
diff --git a/chart2/source/controller/inc/TitleDialogData.hxx b/chart2/source/controller/inc/TitleDialogData.hxx
index d589dc65df03..123ae9d6d65f 100644
--- a/chart2/source/controller/inc/TitleDialogData.hxx
+++ b/chart2/source/controller/inc/TitleDialogData.hxx
@@ -16,38 +16,37 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TITLEDIALOGDATA_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TITLEDIALOGDATA_HXX
+#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
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/TitleItemConverter.hxx b/chart2/source/controller/inc/TitleItemConverter.hxx
index 59078b5e949e..4a306b690363 100644
--- a/chart2/source/controller/inc/TitleItemConverter.hxx
+++ b/chart2/source/controller/inc/TitleItemConverter.hxx
@@ -16,28 +16,28 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TITLEITEMCONVERTER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TITLEITEMCONVERTER_HXX
+#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;
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;
@@ -45,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;
@@ -57,6 +57,4 @@ private:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_ChartType.hxx b/chart2/source/controller/inc/dlg_ChartType.hxx
index 64cab54b8ced..02e6ac998bbc 100644
--- a/chart2/source/controller/inc/dlg_ChartType.hxx
+++ b/chart2/source/controller/inc/dlg_ChartType.hxx
@@ -16,32 +16,33 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CHARTTYPE_HXX
+#pragma once
#include <vcl/weld.hxx>
+#include <rtl/ref.hxx>
-namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::frame
+{
+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;
};
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
index bfa1ce433a42..4566ec75142d 100644
--- a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
+++ b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CHARTTYPE_UNO_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CHARTTYPE_UNO_HXX
+#pragma once
#include <comphelper/proparrhlp.hxx>
#include <svtools/genericunodialog.hxx>
@@ -28,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:
@@ -58,10 +59,9 @@ 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
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index b44050eefd01..1b782632f4d3 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -17,44 +17,48 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_HXX
+#pragma once
#include "TimerTriggeredControllerLock.hxx"
#include "TabPageNotifiable.hxx"
+#include <rtl/ref.hxx>
#include <vcl/roadmapwizard.hxx>
#include <memory>
-namespace com::sun::star::chart2 { class XChartDocument; }
-namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::chart2
+{
+class XChartDocument;
+}
+namespace com::sun::star::uno
+{
+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;
// TabPageNotifiable
- virtual void setInvalidPage(BuilderPage * pTabPage) override;
- virtual void setValidPage(BuilderPage * pTabPage) override;
+ virtual void setInvalidPage(BuilderPage* pTabPage) override;
+ virtual void setValidPage(BuilderPage* pTabPage) override;
protected:
- virtual bool leaveState( WizardState _nState ) override;
+ virtual bool leaveState(WizardState _nState) override;
virtual WizardState determineNextState(WizardState nCurrentState) const override;
virtual void enterState(WizardState nState) override;
@@ -63,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;
@@ -75,6 +79,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
index 2e27418de27d..89b8cb5a08f2 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
@@ -17,10 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_UNO_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_UNO_HXX
+#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>
@@ -28,11 +27,10 @@
#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>
-#include <vcl/vclptr.hxx>
-#include <vcl/vclevent.hxx>
namespace com::sun::star::awt { class XWindow; }
namespace com::sun::star::frame { class XModel; }
@@ -42,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
@@ -54,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;
@@ -104,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;
@@ -113,6 +112,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx
index 878dc9d9cd69..205e822a12a5 100644
--- a/chart2/source/controller/inc/dlg_DataEditor.hxx
+++ b/chart2/source/controller/inc/dlg_DataEditor.hxx
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATAEDITOR_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATAEDITOR_HXX
+#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; }
@@ -33,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;
@@ -51,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;
@@ -63,13 +63,11 @@ 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);
};
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATAEDITOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx
index 272fe1a81813..166131e30ec9 100644
--- a/chart2/source/controller/inc/dlg_DataSource.hxx
+++ b/chart2/source/controller/inc/dlg_DataSource.hxx
@@ -16,27 +16,23 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATASOURCE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATASOURCE_HXX
-
-#include <vcl/weld.hxx>
+#pragma once
#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,
@@ -45,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
@@ -57,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;
@@ -77,7 +72,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATASOURCE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
index 14e3c6669d51..2b265c7d6541 100644
--- a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
+++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
@@ -16,19 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTAXIS_GRID_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTAXIS_GRID_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <com/sun/star/uno/Sequence.hxx>
namespace chart
{
-
struct InsertAxisOrGridDialogData
{
- css::uno::Sequence< sal_Bool > aPossibilityList;
- css::uno::Sequence< sal_Bool > aExistenceList;
+ css::uno::Sequence<sal_Bool> aPossibilityList;
+ css::uno::Sequence<sal_Bool> aExistenceList;
InsertAxisOrGridDialogData();
};
@@ -40,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;
@@ -49,8 +46,9 @@ protected:
std::unique_ptr<weld::CheckButton> m_xCbSecondaryZ;
public:
- SchAxisDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput, bool bAxisDlg = true);
- void getResult( InsertAxisOrGridDialogData& rOutput );
+ SchAxisDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput,
+ bool bAxisDlg = true);
+ void getResult(InsertAxisOrGridDialogData& rOutput);
};
/*************************************************************************
@@ -58,7 +56,7 @@ public:
|* Grid dialog
|*
\************************************************************************/
-class SchGridDlg : public SchAxisDlg
+class SchGridDlg final : public SchAxisDlg
{
public:
SchGridDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput);
@@ -66,6 +64,4 @@ public:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
index c39d608d1e8a..7777db3c9696 100644
--- a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
+++ b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTDATALABEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTDATALABEL_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <svl/itemset.hxx>
@@ -29,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;
@@ -44,6 +43,4 @@ public:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 60cbaac65856..4f8e8d094a34 100644
--- a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
+++ b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTERRORBARS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTERRORBARS_HXX
+#pragma once
#include <memory>
#include <vcl/weld.hxx>
@@ -25,33 +24,35 @@
#include "res_ErrorBar.hxx"
-namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::frame
+{
+class XModel;
+}
namespace chart
{
+class ChartView;
-class InsertErrorBarsDialog : public weld::GenericDialogController
+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 );
+ 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 );
+ void FillItemSet(SfxItemSet& rOutAttrs);
private:
- std::unique_ptr< ErrorBarResources > m_apErrorBarResources;
+ std::unique_ptr<ErrorBarResources> m_apErrorBarResources;
};
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_InsertLegend.hxx b/chart2/source/controller/inc/dlg_InsertLegend.hxx
index 41605db736f7..0e2cccc3809a 100644
--- a/chart2/source/controller/inc/dlg_InsertLegend.hxx
+++ b/chart2/source/controller/inc/dlg_InsertLegend.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTLEGEND_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTLEGEND_HXX
+#pragma once
#include <vcl/weld.hxx>
+#include <rtl/ref.hxx>
#include <memory>
@@ -30,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;
@@ -39,12 +40,10 @@ 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
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_InsertTitle.hxx b/chart2/source/controller/inc/dlg_InsertTitle.hxx
index 7eea6f2bbc86..096628529e9f 100644
--- a/chart2/source/controller/inc/dlg_InsertTitle.hxx
+++ b/chart2/source/controller/inc/dlg_InsertTitle.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTTITLE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTTITLE_HXX
+#pragma once
#include "res_Titles.hxx"
#include <vcl/weld.hxx>
@@ -25,7 +24,7 @@
namespace chart
{
-class SchTitleDlg : public weld::GenericDialogController
+class SchTitleDlg final : public weld::GenericDialogController
{
private:
std::unique_ptr<TitleResources> m_xTitleResources;
@@ -38,6 +37,4 @@ public:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
index 78a13838b9c6..621f096753e4 100644
--- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx
+++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
@@ -16,14 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_OBJECTPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_OBJECTPROPERTIES_HXX
+#pragma once
#include <ObjectIdentifier.hxx>
#include <sfx2/tabdlg.hxx>
+#include <vcl/graph.hxx>
namespace com::sun::star::util { class XNumberFormatsSupplier; }
-class Graphic;
namespace chart
{
@@ -31,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;}
@@ -58,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;}
@@ -93,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;
@@ -108,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,
@@ -134,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 );
@@ -143,6 +142,4 @@ public:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_ShapeFont.hxx b/chart2/source/controller/inc/dlg_ShapeFont.hxx
index 5429b8449dd7..cfeb002fb92d 100644
--- a/chart2/source/controller/inc/dlg_ShapeFont.hxx
+++ b/chart2/source/controller/inc/dlg_ShapeFont.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEFONT_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEFONT_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
@@ -27,21 +26,18 @@ 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;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEFONT_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
index 6e214dfbc91a..15d0c014d848 100644
--- a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
+++ b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEPARAGRAPH_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEPARAGRAPH_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
@@ -25,18 +24,15 @@ 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
-// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEPARAGRAPH_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx
index ad5466e49a37..66c4a8eaf41a 100644
--- a/chart2/source/controller/inc/dlg_View3D.hxx
+++ b/chart2/source/controller/inc/dlg_View3D.hxx
@@ -16,13 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_VIEW3D_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_VIEW3D_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <ControllerLockGuard.hxx>
-namespace com::sun::star::frame { class XModel; }
+namespace com::sun::star::frame
+{
+class XModel;
+}
namespace chart
{
@@ -30,18 +32,18 @@ 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;
+ ControllerLockHelper m_aControllerLocker;
static sal_uInt16 m_nLastPageId;
@@ -53,6 +55,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 0514855a2d60..c3521d5ba087 100644
--- a/chart2/source/controller/inc/res_ErrorBar.hxx
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -16,14 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX
+#pragma once
#include <memory>
#include <tools/link.hxx>
#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; }
@@ -37,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
@@ -61,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;
@@ -125,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 );
@@ -139,6 +139,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/res_LegendPosition.hxx b/chart2/source/controller/inc/res_LegendPosition.hxx
index 3701225b66d3..80ccaa85da6e 100644
--- a/chart2/source/controller/inc/res_LegendPosition.hxx
+++ b/chart2/source/controller/inc/res_LegendPosition.hxx
@@ -16,21 +16,22 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_LEGENDPOSITION_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_LEGENDPOSITION_HXX
+#pragma once
#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
{
@@ -39,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;
@@ -70,6 +72,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/res_Titles.hxx b/chart2/source/controller/inc/res_Titles.hxx
index f18c99b5b460..a7a2eba57277 100644
--- a/chart2/source/controller/inc/res_Titles.hxx
+++ b/chart2/source/controller/inc/res_Titles.hxx
@@ -16,29 +16,36 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_TITLES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_TITLES_HXX
+#pragma once
#include "TitleDialogData.hxx"
template <typename Arg, typename Ret> class Link;
-namespace weld { class Builder; }
-namespace weld { class Entry; }
-namespace weld { class Label; }
+namespace weld
+{
+class Builder;
+}
+namespace weld
+{
+class Entry;
+}
+namespace weld
+{
+class Label;
+}
namespace chart
{
-
class TitleResources final
{
public:
TitleResources(weld::Builder& rParent, bool bShowSecondaryAxesTitle);
~TitleResources();
- void writeToResources( const TitleDialogData& rInput );
- void readFromResources( TitleDialogData& rOutput );
+ void writeToResources(const TitleDialogData& rInput);
+ void readFromResources(TitleDialogData& rOutput);
- void connect_changed( const Link<weld::Entry&,void>& rLink );
+ void connect_changed(const Link<weld::Entry&, void>& rLink);
bool get_value_changed_from_saved() const;
void save_value();
@@ -63,6 +70,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 62078d4a877a..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,15 +41,14 @@
#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>
#include <svl/eitem.hxx>
#include <svx/chrtitem.hxx>
+#include <svx/sdangitm.hxx>
#include <svl/intitem.hxx>
#include <rtl/math.hxx>
@@ -78,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 )
@@ -94,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()
@@ -127,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;
@@ -178,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;
@@ -196,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;
@@ -236,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;
@@ -305,7 +306,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
break;
case SCHATTR_AXIS_TIME_RESOLUTION:
{
- long nTimeResolution=0;
+ sal_Int32 nTimeResolution=0;
if( rTimeIncrement.TimeResolution >>= nTimeResolution )
rOutItemSet.Put( SfxInt32Item( nWhichId, nTimeResolution ) );
else if( m_pExplicitScale )
@@ -327,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;
@@ -343,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;
@@ -352,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);
@@ -391,8 +392,8 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal )
{
- rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
- ::rtl::math::round( fVal * 100.0 ) ) ));
+ rOutItemSet.Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, Degree100(static_cast< sal_Int32 >(
+ ::rtl::math::round( fVal * 100.0 )) ) ));
}
}
break;
@@ -401,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);
@@ -431,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 );
@@ -615,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() )
@@ -660,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;
}
}
@@ -713,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;
@@ -755,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;
@@ -790,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;
@@ -838,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;
@@ -877,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 SfxInt32Item & >(
- rItemSet.Get( nWhichId )).GetValue()) / 100.0;
+ double fVal = toDegrees(rItemSet.Get(SCHATTR_TEXT_DEGREES).GetValue());
double fOldVal = 0.0;
bool bPropExisted =
( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal );
@@ -898,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 )
{
@@ -941,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 4920d2b727e0..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>
@@ -45,9 +49,9 @@
#include <svl/stritem.hxx>
#include <editeng/brushitem.hxx>
#include <svl/ilstitem.hxx>
-#include <tools/diagnose_ex.h>
+#include <svx/sdangitm.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/graph.hxx>
-#include <oox/helper/containerhelper.hxx>
#include <rtl/math.hxx>
#include <svx/tabline.hxx>
@@ -56,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 {
@@ -101,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 )
@@ -127,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 ) )
{
@@ -148,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 )
@@ -175,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 ) )
{
@@ -195,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,
@@ -215,10 +220,9 @@ DataPointItemConverter::DataPointItemConverter(
m_bDataSeries( bDataSeries ),
m_bOverwriteLabelsForAttributedDataPointsAlso(m_bDataSeries && bOverwriteLabelsForAttributedDataPointsAlso),
m_bUseSpecialFillColor(bUseSpecialFillColor),
- m_nSpecialFillColor(nSpecialFillColor),
+ m_nSpecialFillColor(ColorTransparency, nSpecialFillColor),
m_nNumberFormat(nNumberFormat),
m_nPercentNumberFormat(nPercentNumberFormat),
- m_aAvailableLabelPlacements(),
m_bForbidPercentValue(true),
m_bHideLegendEntry(false),
m_nPointIndex(nPointIndex),
@@ -229,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;
@@ -245,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)
{
@@ -288,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 )
@@ -318,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 ));
@@ -328,16 +335,18 @@ 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 ) )
{
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_LABEL , uno::Any( aLabel ) );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any() );
bChanged = true;
}
}
@@ -367,13 +376,13 @@ bool DataPointItemConverter::ApplySpecialItem(
case SCHATTR_DATADESCR_SEPARATOR:
{
OUString aNewValue = static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue();
- OUString aOldValue;
try
{
+ OUString aOldValue;
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 ) ) )
{
@@ -404,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 ) ) )
{
@@ -436,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 ) ) )
{
@@ -448,6 +457,7 @@ bool DataPointItemConverter::ApplySpecialItem(
{
GetPropertySet()->setPropertyValue("LabelPlacement", uno::Any(nNew));
GetPropertySet()->setPropertyValue("CustomLabelPosition", uno::Any());
+ GetPropertySet()->setPropertyValue("CustomLabelSize", uno::Any());
bChanged = true;
}
}
@@ -546,9 +556,7 @@ bool DataPointItemConverter::ApplySpecialItem(
case SCHATTR_TEXT_DEGREES:
{
- double fValue = static_cast< double >(
- static_cast< const SfxInt32Item & >(
- rItemSet.Get( nWhichId )).GetValue()) / 100.0;
+ double fValue = toDegrees(rItemSet.Get(SCHATTR_TEXT_DEGREES).GetValue());
double fOldValue = 0.0;
bool bPropExisted =
( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldValue );
@@ -567,17 +575,37 @@ 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;
+
+ case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES:
+ {
+ try
+ {
+ bool bNew = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
+ bool bOld = true;
+ if( (m_xSeries->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES) >>= bOld) && bOld != bNew )
+ {
+ m_xSeries->setFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, uno::Any(bNew));
+ bChanged = true;
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
}
}
break;
@@ -594,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;
@@ -601,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);
}
@@ -668,9 +698,9 @@ void DataPointItemConverter::FillSpecialItem(
case SCHATTR_DATADESCR_SEPARATOR:
{
- OUString aValue;
try
{
+ OUString aValue;
GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aValue;
rOutItemSet.Put( SfxStringItem( nWhichId, aValue ));
}
@@ -728,6 +758,21 @@ void DataPointItemConverter::FillSpecialItem(
}
break;
+ case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES:
+ {
+ try
+ {
+ bool bValue = true;
+ if( m_xSeries->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES ) >>= bValue )
+ rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ break;
+
case SCHATTR_STYLE_SYMBOL:
{
chart2::Symbol aSymbol;
@@ -762,8 +807,8 @@ void DataPointItemConverter::FillSpecialItem(
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fValue )
{
- rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
- ::rtl::math::round( fValue * 100.0 ) ) ));
+ rOutItemSet.Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, Degree100(static_cast< sal_Int32 >(
+ ::rtl::math::round( fValue * 100.0 ) ) )));
}
}
break;
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 ffa8c29a5b77..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;
@@ -71,7 +72,8 @@ ItemPropertyMapType & lcl_GetDataPointLinePropertyMap()
static ItemPropertyMapType aDataPointPropertyLineMap{
{XATTR_LINECOLOR, {"Color", 0}},
{XATTR_LINESTYLE, {"LineStyle", 0}},
- {XATTR_LINEWIDTH, {"LineWidth", 0}}};
+ {XATTR_LINEWIDTH, {"LineWidth", 0}},
+ {XATTR_LINECAP, {"LineCap", 0}}};
return aDataPointPropertyLineMap;
}
ItemPropertyMapType & lcl_GetLinePropertyMap()
@@ -80,7 +82,8 @@ ItemPropertyMapType & lcl_GetLinePropertyMap()
{XATTR_LINESTYLE, {"LineStyle", 0}},
{XATTR_LINEWIDTH, {"LineWidth", 0}},
{XATTR_LINECOLOR, {"LineColor", 0}},
- {XATTR_LINEJOINT, {"LineJoint", 0}}};
+ {XATTR_LINEJOINT, {"LineJoint", 0}},
+ {XATTR_LINECAP, {"LineCap", 0}}};
return aLinePropertyMap;
}
ItemPropertyMapType & lcl_GetFillPropertyMap()
@@ -135,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
@@ -424,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);
@@ -446,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 49ad338711b6..676527f3fef3 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_ITEMSETWRAPPER_SCHWHICHPAIRS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_ITEMSETWRAPPER_SCHWHICHPAIRS_HXX
+#pragma once
+#include <svl/whichranges.hxx>
#include <svx/svxids.hrc>
#include <svx/xdef.hxx>
#include <svx/svddef.hxx>
@@ -26,219 +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[] =
-{
- XATTR_LINESTYLE, XATTR_LINECOLOR,
- XATTR_LINETRANSPARENCE, XATTR_LINETRANSPARENCE,
- EE_ITEMS_START, EE_ITEMS_END,
- SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING,
+ 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,
- SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
- SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE,
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 nAreaWhichPairs[] =
-{
- 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
-};
+ XATTR_LINESTYLE, XATTR_LINECOLOR,
+ XATTR_LINETRANSPARENCE, XATTR_LINETRANSPARENCE,
+ EE_ITEMS_START, EE_ITEMS_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 sal_uInt16 nTextWhichPairs[] =
-{
- CHARACTER_WHICHPAIRS,
- SCHATTR_TEXT_START, SCHATTR_TEXT_END,
- 0
-};
+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
+>);
-const sal_uInt16 nTextOrientWhichPairs[] =
-{
- CHARACTER_WHICHPAIRS,
- SCHATTR_TEXT_START, SCHATTR_TEXT_END,
- 0
-};
+// 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_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 sal_uInt16 nStatWhichPairs[]=
-{
+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 nFillPropertyWhichPairs[] =
-{
- XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
- SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
- 0
-};
-
-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
-};
-
-const sal_uInt16 nChartStyleWhichPairs[] =
-{
- SCHATTR_STYLE_SHAPE, SCHATTR_STYLE_SHAPE,
- SCHATTR_NUM_OF_LINES_FOR_BAR, SCHATTR_NUM_OF_LINES_FOR_BAR,
- SCHATTR_SPLINE_ORDER, SCHATTR_SPLINE_ORDER,
- SCHATTR_SPLINE_RESOLUTION, SCHATTR_SPLINE_RESOLUTION,
- 0
-};
-
-const sal_uInt16 nRegressionCurveWhichPairs[] =
-{
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST // 1067 - 1078 svx/svddef.hxx
+>);
+
+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
+>);
-// INCLUDED_CHART2_SOURCE_CONTROLLER_ITEMSETWRAPPER_SCHWHICHPAIRS_HXX
-#endif
+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 d50f39abc3bb..653e7bf20e5a 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -21,18 +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 <tools/diagnose_ex.h>
+#include <svx/sdangitm.hxx>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -41,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)
@@ -59,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)
@@ -67,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 )
@@ -92,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];
@@ -109,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
@@ -140,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 & )
{
@@ -159,7 +156,7 @@ SeriesOptionsItemConverter::~SeriesOptionsItemConverter()
{
}
-const sal_uInt16 * SeriesOptionsItemConverter::GetWhichPairs() const
+const WhichRangesContainer& SeriesOptionsItemConverter::GetWhichPairs() const
{
// must span all used items!
return nSeriesOptionsWhichPairs;
@@ -183,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;
@@ -204,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;
}
}
}
@@ -241,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 )
@@ -260,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 )
@@ -276,8 +271,8 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
{
if( m_bSupportingStartingAngle )
{
- m_nStartingAngle = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
- uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
+ m_nStartingAngle = static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue().get() / 100;
+ rtl::Reference< Diagram > xDiagramProperties( m_xChartModel->getFirstChartDiagram() );
if( xDiagramProperties.is() )
{
xDiagramProperties->setPropertyValue( "StartingAngle" , uno::Any(m_nStartingAngle) );
@@ -293,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() );
@@ -314,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 ));
@@ -336,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 );
}
}
}
@@ -348,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;
@@ -398,7 +392,7 @@ void SeriesOptionsItemConverter::FillSpecialItem(
case SCHATTR_STARTING_ANGLE:
{
if( m_bSupportingStartingAngle )
- rOutItemSet.Put( SfxInt32Item(nWhichId,m_nStartingAngle));
+ 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 b4c4405ff88b..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,11 +108,9 @@ uno::Reference< beans::XPropertySet > lcl_getEquationProperties(
// ensure that a trendline is on
if( pItemSet )
{
- SvxChartRegress eRegress = SvxChartRegress::NONE;
- const SfxPoolItem *pPoolItem = nullptr;
- if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SvxChartRegressItem* pRegressionItem = pItemSet->GetItemIfSet( SCHATTR_REGRESSION_TYPE ) )
{
- eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
+ SvxChartRegress eRegress = pRegressionItem->GetValue();
bEquationExists = ( eRegress != SvxChartRegress::NONE );
}
}
@@ -119,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();
@@ -138,11 +137,9 @@ uno::Reference< beans::XPropertySet > lcl_getCurveProperties(
// ensure that a trendline is on
if( pItemSet )
{
- SvxChartRegress eRegress = SvxChartRegress::NONE;
- const SfxPoolItem *pPoolItem = nullptr;
- if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, true, &pPoolItem ) == SfxItemState::SET )
+ if( const SvxChartRegressItem* pRegressionItem = pItemSet->GetItemIfSet( SCHATTR_REGRESSION_TYPE ) )
{
- eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
+ SvxChartRegress eRegress = pRegressionItem->GetValue();
bExists = ( eRegress != SvxChartRegress::NONE );
}
}
@@ -194,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 ));
@@ -213,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 ))
{
}
@@ -225,7 +222,7 @@ StatisticsItemConverter::~StatisticsItemConverter()
{
}
-const sal_uInt16 * StatisticsItemConverter::GetWhichPairs() const
+const WhichRangesContainer& StatisticsItemConverter::GetWhichPairs() const
{
// must span all used items!
return nStatWhichPairs;
@@ -311,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 ));
}
@@ -449,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 ));
@@ -548,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())
{
@@ -659,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;
@@ -673,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;
@@ -687,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;
@@ -701,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;
@@ -731,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;
@@ -755,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 496b25e2692f..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>
@@ -34,7 +37,8 @@
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
#include <svx/tabline.hxx>
-#include <tools/diagnose_ex.h>
+#include <svx/sdangitm.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/graph.hxx>
#include <rtl/math.hxx>
@@ -43,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 {
@@ -97,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)
@@ -122,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))
{
@@ -145,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)
@@ -172,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))
{
@@ -192,24 +196,25 @@ 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),
mnPercentNumberFormat(nPercentNumberFormat),
mbDataSeries(bDataSeries),
- mbForbidPercentValue(true)
+ mbForbidPercentValue(true),
+ m_xSeries(xSeries)
{
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;
@@ -239,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;
@@ -266,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));
@@ -276,16 +282,18 @@ 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))
{
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries, CHART_UNONAME_LABEL, uno::Any(aLabel));
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries, CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any());
bChanged = true;
}
}
@@ -312,13 +320,13 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
case SCHATTR_DATADESCR_SEPARATOR:
{
OUString aNewValue = static_cast<const SfxStringItem&>(rItemSet.Get(nWhichId)).GetValue();
- OUString aOldValue;
try
{
+ OUString aOldValue;
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)))
{
@@ -348,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 ) ) )
{
@@ -378,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)))
{
@@ -390,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;
}
}
@@ -485,8 +494,8 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
case SCHATTR_TEXT_DEGREES:
{
double fValue = static_cast<double>(
- static_cast<const SfxInt32Item&>(
- rItemSet.Get(nWhichId)).GetValue()) / 100.0;
+ static_cast<const SdrAngleItem&>(
+ rItemSet.Get(nWhichId)).GetValue().get()) / 100.0;
double fOldValue = 0.0;
bool bPropExisted =
(GetPropertySet()->getPropertyValue("TextRotation") >>= fOldValue);
@@ -498,6 +507,24 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
}
}
break;
+ case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES:
+ {
+ try
+ {
+ bool bNew = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
+ bool bOld = true;
+ if( (m_xSeries->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES) >>= bOld) && bOld != bNew )
+ {
+ m_xSeries->setFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, uno::Any(bNew));
+ bChanged = true;
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ break;
}
return bChanged;
@@ -510,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;
@@ -517,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);
}
@@ -580,9 +609,9 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
break;
case SCHATTR_DATADESCR_SEPARATOR:
{
- OUString aValue;
try
{
+ OUString aValue;
GetPropertySet()->getPropertyValue("LabelSeparator") >>= aValue;
rOutItemSet.Put(SfxStringItem(nWhichId, aValue));
}
@@ -635,6 +664,20 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
rOutItemSet.Put(SfxBoolItem(nWhichId, mbForbidPercentValue));
}
break;
+ case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES:
+ {
+ try
+ {
+ bool bValue = true;
+ if( m_xSeries->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES ) >>= bValue )
+ rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ break;
case SCHATTR_STYLE_SYMBOL:
{
chart2::Symbol aSymbol;
@@ -668,7 +711,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
if (GetPropertySet()->getPropertyValue("TextRotation") >>= fValue)
{
rOutItemSet.Put(
- SfxInt32Item(nWhichId, 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 dfc57623bf2d..1327a0a0d91b 100644
--- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
@@ -23,7 +23,7 @@
#include <GraphicPropertyItemConverter.hxx>
#include <CharacterPropertyItemConverter.hxx>
#include <MultipleItemConverter.hxx>
-#include <svl/intitem.hxx>
+#include <svx/sdangitm.hxx>
#include <rtl/math.hxx>
#include <com/sun/star/chart2/XTitle.hpp>
@@ -50,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
@@ -62,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 )
{
@@ -82,7 +82,7 @@ FormattedStringsConverter::FormattedStringsConverter(
}
}
-const sal_uInt16 * FormattedStringsConverter::GetWhichPairs() const
+const WhichRangesContainer& FormattedStringsConverter::GetWhichPairs() const
{
return nCharacterPropertyWhichPairs;
}
@@ -92,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(
@@ -138,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;
@@ -167,8 +167,8 @@ bool TitleItemConverter::ApplySpecialItem(
{
// convert int to double (divided by 100)
double fVal = static_cast< double >(
- static_cast< const SfxInt32Item & >(
- rItemSet.Get( nWhichId )).GetValue()) / 100.0;
+ static_cast< const SdrAngleItem & >(
+ rItemSet.Get( nWhichId )).GetValue().get()) / 100.0;
double fOldVal = 0.0;
bool bPropExisted =
( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal );
@@ -197,8 +197,8 @@ void TitleItemConverter::FillSpecialItem(
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal )
{
- rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
- ::rtl::math::round( fVal * 100.0 ) ) ));
+ rOutItemSet.Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, Degree100(static_cast< sal_Int32 >(
+ ::rtl::math::round( fVal * 100.0 ) ) )));
}
}
break;
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index f81b261182fa..2bd0bf549e89 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -20,69 +20,68 @@
#include <memory>
#include <sal/config.h>
-#include <set>
-
+#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
@@ -97,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),
@@ -126,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()
@@ -140,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(
- static_cast<util::XCloseListener*>(pController) );
- }
- else if( m_xModel.is() )
- {
- //we need to add as dispose event listener
- m_xModel->addEventListener(
+ m_xModel->addCloseListener(
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) );
}
@@ -177,7 +160,7 @@ void ChartController::TheModel::tryTermination()
try
{
- if(m_xCloseable.is())
+ if(m_xModel.is())
{
try
{
@@ -185,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;
}
@@ -200,12 +183,6 @@ void ChartController::TheModel::tryTermination()
}
}
- else if( m_xModel.is() )
- {
- //@todo correct??
- m_xModel->dispose();
- return;
- }
}
catch(const uno::Exception&)
{
@@ -249,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];
}
}
@@ -293,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:
@@ -304,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;
@@ -334,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)
@@ -390,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?
@@ -413,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
@@ -427,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 );
}
{
@@ -444,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();
}
@@ -537,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();
@@ -565,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
}
@@ -591,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
@@ -636,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;
}
@@ -652,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
@@ -660,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()
@@ -716,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;
@@ -723,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() );
}
}
}
@@ -746,16 +727,17 @@ void SAL_CALL ChartController::dispose()
{
m_bDisposed = true;
+ mpSelectionChangeHandler->selectionChanged(css::lang::EventObject());
+ mpSelectionChangeHandler->Disconnect();
+
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);
}
}
- mpSelectionChangeHandler->selectionChanged(css::lang::EventObject());
- mpSelectionChangeHandler->Disconnect();
try
{
@@ -776,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() )
@@ -789,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;
@@ -810,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();
@@ -829,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 & )
{
@@ -857,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(
@@ -873,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
@@ -888,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;
@@ -932,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();
@@ -954,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();
}
}
@@ -979,55 +960,55 @@ void SAL_CALL ChartController::layoutEvent(
namespace
{
-bool lcl_isFormatObjectCommand( const OUString& aCommand )
-{
- return aCommand == "MainTitle"
- || aCommand == "SubTitle"
- || aCommand == "XTitle"
- || aCommand == "YTitle"
- || aCommand == "ZTitle"
- || aCommand == "SecondaryXTitle"
- || aCommand == "SecondaryYTitle"
- || aCommand == "AllTitles"
- || aCommand == "DiagramAxisX"
- || aCommand == "DiagramAxisY"
- || aCommand == "DiagramAxisZ"
- || aCommand == "DiagramAxisA"
- || aCommand == "DiagramAxisB"
- || aCommand == "DiagramAxisAll"
- || aCommand == "DiagramGridXMain"
- || aCommand == "DiagramGridYMain"
- || aCommand == "DiagramGridZMain"
- || aCommand == "DiagramGridXHelp"
- || aCommand == "DiagramGridYHelp"
- || aCommand == "DiagramGridZHelp"
- || aCommand == "DiagramGridAll"
-
- || aCommand == "DiagramWall"
- || aCommand == "DiagramFloor"
- || aCommand == "DiagramArea"
- || aCommand == "Legend"
-
- || aCommand == "FormatWall"
- || aCommand == "FormatFloor"
- || aCommand == "FormatChartArea"
- || aCommand == "FormatLegend"
-
- || aCommand == "FormatTitle"
- || aCommand == "FormatAxis"
- || aCommand == "FormatDataSeries"
- || aCommand == "FormatDataPoint"
- || aCommand == "FormatDataLabels"
- || aCommand == "FormatDataLabel"
- || aCommand == "FormatXErrorBars"
- || aCommand == "FormatYErrorBars"
- || aCommand == "FormatMeanValue"
- || aCommand == "FormatTrendline"
- || aCommand == "FormatTrendlineEquation"
- || aCommand == "FormatStockLoss"
- || aCommand == "FormatStockGain"
- || aCommand == "FormatMajorGrid"
- || aCommand == "FormatMinorGrid";
+bool lcl_isFormatObjectCommand( std::u16string_view aCommand )
+{
+ return aCommand == u"MainTitle"
+ || aCommand == u"SubTitle"
+ || aCommand == u"XTitle"
+ || aCommand == u"YTitle"
+ || aCommand == u"ZTitle"
+ || aCommand == u"SecondaryXTitle"
+ || aCommand == u"SecondaryYTitle"
+ || aCommand == u"AllTitles"
+ || aCommand == u"DiagramAxisX"
+ || aCommand == u"DiagramAxisY"
+ || aCommand == u"DiagramAxisZ"
+ || aCommand == u"DiagramAxisA"
+ || aCommand == u"DiagramAxisB"
+ || aCommand == u"DiagramAxisAll"
+ || aCommand == u"DiagramGridXMain"
+ || aCommand == u"DiagramGridYMain"
+ || aCommand == u"DiagramGridZMain"
+ || aCommand == u"DiagramGridXHelp"
+ || aCommand == u"DiagramGridYHelp"
+ || aCommand == u"DiagramGridZHelp"
+ || aCommand == u"DiagramGridAll"
+
+ || aCommand == u"DiagramWall"
+ || aCommand == u"DiagramFloor"
+ || aCommand == u"DiagramArea"
+ || aCommand == u"Legend"
+
+ || aCommand == u"FormatWall"
+ || aCommand == u"FormatFloor"
+ || aCommand == u"FormatChartArea"
+ || aCommand == u"FormatLegend"
+
+ || aCommand == u"FormatTitle"
+ || aCommand == u"FormatAxis"
+ || aCommand == u"FormatDataSeries"
+ || aCommand == u"FormatDataPoint"
+ || aCommand == u"FormatDataLabels"
+ || aCommand == u"FormatDataLabel"
+ || aCommand == u"FormatXErrorBars"
+ || aCommand == u"FormatYErrorBars"
+ || aCommand == u"FormatMeanValue"
+ || aCommand == u"FormatTrendline"
+ || aCommand == u"FormatTrendlineEquation"
+ || aCommand == u"FormatStockLoss"
+ || aCommand == u"FormatStockGain"
+ || aCommand == u"FormatMajorGrid"
+ || aCommand == u"FormatMinorGrid";
}
} // anonymous namespace
@@ -1104,6 +1085,37 @@ void SAL_CALL ChartController::dispatch(
this->executeDispatch_PositionAndSize(&rArgs);
}
}
+ else if(aCommand == "FillColor")
+ {
+ if (rArgs.getLength() > 0)
+ {
+ sal_uInt32 nColor;
+ if (rArgs[0].Value >>= nColor)
+ this->executeDispatch_FillColor(nColor);
+ }
+ }
+ else if(aCommand == "XLineColor")
+ {
+ if (rArgs.getLength() > 0)
+ {
+ sal_Int32 nColor = -1;
+ rArgs[0].Value >>= nColor;
+ this->executeDispatch_LineColor(nColor);
+ }
+ }
+ else if(aCommand == "LineWidth")
+ {
+ if (rArgs.getLength() > 0)
+ {
+ sal_Int32 nWidth = -1;
+ rArgs[0].Value >>= nWidth;
+ this->executeDispatch_LineWidth(nWidth);
+ }
+ }
+ else if(aCommand.startsWith("FillGradient"))
+ {
+ this->executeDispatch_FillGradient(aCommand.subView(aCommand.indexOf('=') + 1));
+ }
else if(aCommand == "Paste")
this->executeDispatch_Paste();
else if(aCommand == "Copy" )
@@ -1114,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 )
@@ -1147,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" )
@@ -1201,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();
@@ -1215,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" )
@@ -1279,6 +1299,8 @@ void SAL_CALL ChartController::dispatch(
}
}
}
+ else if( aCommand == "ChangeTheme" )
+ comphelper::dispatchCommand(".uno:ChangeTheme", getFrame(), rArgs);
}
void SAL_CALL ChartController::addStatusListener(
@@ -1313,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
@@ -1365,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(
@@ -1393,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 ) );
@@ -1401,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 */ )
@@ -1447,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 );
@@ -1462,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(
@@ -1484,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
@@ -1492,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()
@@ -1522,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;
@@ -1568,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()
{
@@ -1601,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",
@@ -1649,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 85f7ea5c345e..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::getAxisOrGridExcistence( 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,8 +135,8 @@ void ChartController::executeDispatch_InsertGrid()
try
{
InsertAxisOrGridDialogData aDialogInput;
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(getModel());
- AxisHelper::getAxisOrGridExcistence( aDialogInput.aExistenceList, xDiagram, false );
+ rtl::Reference< Diagram > xDiagram = getFirstDiagram();
+ AxisHelper::getAxisOrGridExistence( aDialogInput.aExistenceList, xDiagram, false );
AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, false );
SolarMutexGuard aGuard;
@@ -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 32c4bd78522e..df047d747afd 100644
--- a/chart2/source/controller/main/ChartController_Position.cxx
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -19,54 +19,50 @@
#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 )
{
- long nPosX(0);
- long nPosY(0);
- long nSizX(0);
- long nSizY(0);
+ tools::Long nPosX(0);
+ tools::Long nPosY(0);
+ tools::Long nSizX(0);
+ tools::Long nSizY(0);
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 )
{
@@ -114,11 +110,6 @@ void ChartController::executeDispatch_PositionAndSize(const ::css::uno::Sequence
if( aCID.isEmpty() )
return;
- awt::Size aSelectedSize;
- ExplicitValueProvider* pProvider( comphelper::getUnoTunnelImplementation<ExplicitValueProvider>( m_xChartView ) );
- if( pProvider )
- aSelectedSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
-
ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID );
UndoGuard aUndoGuard(
@@ -155,46 +146,44 @@ 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)));
}
}
}
if(pOutItemSet || pArgs)
{
- awt::Rectangle aObjectRect;
- lcl_getPositionAndSizeFromItemSet( aItemSet, aObjectRect, aSelectedSize );
- awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+ awt::Rectangle aOldObjectRect;
+ if( m_xChartView )
+ aOldObjectRect = m_xChartView->getRectangleOfObject(aCID);
+
+ awt::Rectangle aNewObjectRect;
+ lcl_getPositionAndSizeFromItemSet( aItemSet, aNewObjectRect, ToSize(aOldObjectRect) );
+ 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()
- , aObjectRect, awt::Rectangle(), aPageRect );
+ 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 587cbbfc00aa..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( const OString& 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( const OString& 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( const OString& 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( const OString& rDispatchCommand, const uno::R
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( const OString& 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( const OString& rDispatchCommand, const uno::R
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( const OString& 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( const OString& rDispatchCommand, const uno:
|| rDispatchCommand == "AllTitles"
)
{
- return lcl_getTitleCIDForCommand( rDispatchCommand, xChartModel );
+ return lcl_getTitleCIDForCommand( rDispatchCommand, xChartDocument );
}
//axis
else if( rDispatchCommand == "DiagramAxisX"
@@ -485,7 +493,7 @@ OUString lcl_getObjectCIDForCommand( const OString& rDispatchCommand, const uno:
|| rDispatchCommand == "DiagramAxisAll"
)
{
- return lcl_getAxisCIDForCommand( rDispatchCommand, xChartModel );
+ return lcl_getAxisCIDForCommand( rDispatchCommand, xChartDocument );
}
//grid
else if( rDispatchCommand == "DiagramGridYMain"
@@ -497,7 +505,7 @@ OUString lcl_getObjectCIDForCommand( const OString& rDispatchCommand, const uno:
|| 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( const OString& rDispatchCommand, const uno:
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( const OString& rDispatchCommand, const uno:
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( const OString& rDispatchCommand, const uno:
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( const OString& rDispatchCommand, const uno:
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( const OString& rDispatchCommand, const uno:
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( const OString& rDispatchCommand, const uno:
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( const OString& rDispatchCommand, const uno:
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( const OString& rDispatchCommand, const uno:
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( const OString& rDispatchCommand, const uno:
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,20 +647,20 @@ OUString lcl_getObjectCIDForCommand( const OString& rDispatchCommand, const uno:
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
}
}
// anonymous namespace
-void ChartController::executeDispatch_FormatObject(const OUString& rDispatchCommand)
+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 c6024350430d..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,30 +34,34 @@
#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>
#include <vcl/transfer.hxx>
#include <sot/storage.hxx>
#include <vcl/graph.hxx>
+#include <vcl/TypeSerializer.hxx>
#include <svx/unomodel.hxx>
#include <svx/svdmodel.hxx>
#include <unotools/streamwrap.hxx>
@@ -67,10 +72,14 @@
#include <svx/svdpage.hxx>
#include <svx/svdundo.hxx>
#include <svx/unoapi.hxx>
+#include <svx/unopage.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>
@@ -86,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(
@@ -104,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 );
@@ -119,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;
@@ -154,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()
@@ -176,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(
@@ -186,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
@@ -208,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 )
@@ -238,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();
}
@@ -257,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 ));
@@ -265,8 +266,7 @@ void ChartController::executeDispatch_Paste()
{
if ( aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) )
{
- tools::SvRef<SotStorageStream> 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 ) );
@@ -283,9 +283,11 @@ void ChartController::executeDispatch_Paste()
else if ( aDataHelper.HasFormat( SotClipboardFormatId::SVXB ) )
{
// graphic exchange format (graphic manager bitmap format?)
- tools::SvRef<SotStorageStream> xStm;
- if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ))
- ReadGraphic( *xStm, aGraphic );
+ if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB ))
+ {
+ TypeSerializer aSerializer(*xStm);
+ aSerializer.readGraphic(aGraphic);
+ }
}
else if( aDataHelper.HasFormat( SotClipboardFormatId::GDIMETAFILE ))
{
@@ -309,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 ) );
@@ -337,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 ) );
@@ -401,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 )
{
@@ -412,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 );
@@ -440,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 );
@@ -569,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()
@@ -593,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;
@@ -607,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();
}
@@ -633,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:
@@ -642,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 )
{
@@ -663,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(
@@ -679,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 )),
@@ -713,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;
@@ -725,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)),
@@ -746,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(
@@ -760,13 +775,19 @@ bool ChartController::executeDispatch_Delete()
aLabel.ShowNumberInPercent = false;
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() ));
- ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, CHART_UNONAME_LABEL, uno::Any(aLabel) );
+ 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() );
}
else
- xObjectProperties->setPropertyValue( CHART_UNONAME_LABEL, uno::Any(aLabel) );
+ {
+ xObjectProperties->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel));
+ xObjectProperties->setPropertyValue(CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any());
+ }
bReturn = true;
aUndoGuard.commit();
}
@@ -815,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())
{
@@ -839,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;
}
@@ -852,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;
@@ -885,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;
@@ -914,6 +934,122 @@ void ChartController::executeDispatch_ToggleGridVertical()
aUndoGuard.commit();
}
+void ChartController::executeDispatch_FillColor(sal_uInt32 nColor)
+{
+ try
+ {
+ OUString aCID( m_aSelection.getSelectedCID() );
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
+ if( xChartModel.is() )
+ {
+ Reference< beans::XPropertySet > xPointProperties(
+ ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) );
+ if( xPointProperties.is() )
+ xPointProperties->setPropertyValue( "FillColor", uno::Any( nColor ) );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION( "chart2" );
+ }
+}
+
+void ChartController::executeDispatch_FillGradient(std::u16string_view sJSONGradient)
+{
+ basegfx::BGradient aBGradient = basegfx::BGradient::fromJSON(sJSONGradient);
+ css::awt::Gradient aGradient = model::gradient::createUnoGradient2(aBGradient);
+
+ try
+ {
+ OUString aCID( m_aSelection.getSelectedCID() );
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
+
+ if( xChartModel.is() )
+ {
+ Reference< beans::XPropertySet > xPropSet(
+ ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) );
+
+ if( xPropSet.is() )
+ {
+ 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),
+ xChartModel,
+ aPrefferedName);
+
+ xPropSet->setPropertyValue("FillGradientName", css::uno::Any(aNewName));
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+}
+
+void ChartController::executeDispatch_LineColor(sal_uInt32 nColor)
+{
+ try
+ {
+ OUString aCID( m_aSelection.getSelectedCID() );
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
+ if( xChartModel.is() )
+ {
+ Reference< beans::XPropertySet > xPropSet(
+ ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) );
+
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType == OBJECTTYPE_DIAGRAM)
+ {
+ css::uno::Reference<css::chart2::XDiagram> xDiagram(
+ xPropSet, css::uno::UNO_QUERY);
+ if (xDiagram.is())
+ xPropSet.set(xDiagram->getWall());
+ }
+
+ if( xPropSet.is() )
+ xPropSet->setPropertyValue( "LineColor", css::uno::Any( Color(ColorTransparency, nColor) ) );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION( "chart2" );
+ }
+}
+
+void ChartController::executeDispatch_LineWidth(sal_uInt32 nWidth)
+{
+ try
+ {
+ OUString aCID( m_aSelection.getSelectedCID() );
+ rtl::Reference<::chart::ChartModel> xChartModel = getChartModel();
+ if( xChartModel.is() )
+ {
+ Reference< beans::XPropertySet > xPropSet(
+ ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) );
+
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType == OBJECTTYPE_DIAGRAM)
+ {
+ css::uno::Reference<css::chart2::XDiagram> xDiagram(
+ xPropSet, css::uno::UNO_QUERY);
+ if (xDiagram.is())
+ xPropSet.set(xDiagram->getWall());
+ }
+
+ if( xPropSet.is() )
+ xPropSet->setPropertyValue( "LineWidth", css::uno::Any( nWidth ) );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION( "chart2" );
+ }
+}
+
void ChartController::executeDispatch_LOKSetTextSelection(int nType, int nX, int nY)
{
if (!m_pDrawViewWrapper)
@@ -950,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(
@@ -980,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 2ac9f4b7bbd5..375c2824a8a1 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -17,14 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#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>
@@ -37,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>
@@ -48,27 +59,19 @@
#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 <sfx2/ipclient.hxx>
#include <svx/ActionDescriptionProvider.hxx>
#include <svx/obj3d.hxx>
#include <svx/scene3d.hxx>
@@ -80,10 +83,11 @@
#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 <sfx2/lokhelper.hxx>
#include <boost/property_tree/json_parser.hpp>
#include <sfx2/dispatch.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -92,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
@@ -145,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" );
@@ -248,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();
@@ -262,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 ) },
@@ -271,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();
@@ -458,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);
{
@@ -477,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;
@@ -533,7 +535,7 @@ IMPL_LINK_NOARG(ChartController, DoubleClickWaitingHdl, Timer *, void)
{
m_bWaitingForDoubleClick = false;
- if( !(!m_bWaitingForMouseUp && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured()) )
+ if( m_bWaitingForMouseUp || !m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() )
return;
impl_selectObjectAndNotiy();
@@ -598,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
@@ -635,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 );
@@ -664,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);
@@ -697,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);
}
@@ -723,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;
}
@@ -737,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;
@@ -769,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;
}
@@ -784,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();
}
@@ -837,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());
@@ -861,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 )
{
@@ -890,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 )
@@ -918,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() )
@@ -927,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() );
@@ -954,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;
}
@@ -1002,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() )
@@ -1015,263 +1015,259 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
OUString aMenuName;
if ( isShapeContext() )
// #i12587# support for shapes in chart
- aMenuName = m_pDrawViewWrapper->IsTextEdit() ? OUStringLiteral( "drawtext" ) : OUStringLiteral( "draw" );
+ 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(
@@ -1286,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
@@ -1325,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 );
}
}
@@ -1378,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 )
@@ -1390,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;
}
@@ -1422,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 );
@@ -1512,8 +1506,29 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
if( !m_aSelection.getSelectedCID().isEmpty() )
{
//move chart objects
- bReturn = impl_moveOrResizeObject(
- m_aSelection.getSelectedCID(), MOVE_OBJECT, fShiftAmountX, fShiftAmountY );
+ if (eObjectType == OBJECTTYPE_DATA_LABEL)
+ {
+ SdrObject* pObj = pDrawViewWrapper->getSelectedObject();
+ if (pObj)
+ {
+ tools::Rectangle aRect = pObj->GetSnapRect();
+ 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(), 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));
+ }
+ }
+ else
+ bReturn = impl_moveOrResizeObject(
+ m_aSelection.getSelectedCID(), MOVE_OBJECT, fShiftAmountX, fShiftAmountY );
}
else
{
@@ -1523,9 +1538,9 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
{
awt::Point aPos( xShape->getPosition() );
awt::Size aSize( xShape->getSize() );
- awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
- aPos.X = static_cast< long >( static_cast< double >( aPos.X ) + fShiftAmountX );
- aPos.Y = static_cast< long >( static_cast< double >( aPos.Y ) + fShiftAmountY );
+ 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 )
aPos.X = aPageSize.Width - aSize.Width;
if( aPos.X < 0 )
@@ -1546,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);
}
}
@@ -1587,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) {});
}
}
@@ -1603,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;
@@ -1624,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;
@@ -1712,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 )
@@ -1722,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);
}
}
@@ -1766,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())
@@ -1781,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 ));
@@ -1839,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
@@ -1901,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;
}
}
@@ -1917,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() );
@@ -1962,36 +1969,36 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
( !m_pDrawViewWrapper->IsMarkedHit( aMousePos ) || !m_aSelection.isDragableObjectSelected() ) )
{
PointerStyle ePointerStyle = PointerStyle::DrawRect;
- SdrObjKind eKind = static_cast< SdrObjKind >( m_pDrawViewWrapper->GetCurrentObjIdentifier() );
+ 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;
}
@@ -2028,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
{
@@ -2049,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;
@@ -2067,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()),
@@ -2087,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 04c390a0070e..ab573f1cd694 100644
--- a/chart2/source/controller/main/ChartDropTargetHelper.hxx
+++ b/chart2/source/controller/main/ChartDropTargetHelper.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTDROPTARGETHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTDROPTARGETHELPER_HXX
+#pragma once
#include <vcl/transfer.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star {
namespace chart2 {
@@ -29,6 +29,7 @@ namespace com::sun::star {
namespace chart
{
+class ChartModel;
class ChartDropTargetHelper : public DropTargetHelper
{
@@ -36,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:
@@ -47,12 +48,9 @@ protected:
private:
bool satisfiesPrerequisites() const;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument;
+ rtl::Reference<::chart::ChartModel> m_xChartDocument;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTDROPTARGETHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/ChartFrameloader.hxx b/chart2/source/controller/main/ChartFrameloader.hxx
index d1564b46e5fa..99f0ffd06903 100644
--- a/chart2/source/controller/main/ChartFrameloader.hxx
+++ b/chart2/source/controller/main/ChartFrameloader.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTFRAMELOADER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTFRAMELOADER_HXX
+#pragma once
#include <osl/conditn.hxx>
#include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
@@ -65,6 +64,4 @@ public:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 eb5a9b0279de..41cf7fc10924 100644
--- a/chart2/source/controller/main/ChartModelClone.hxx
+++ b/chart2/source/controller/main/ChartModelClone.hxx
@@ -17,17 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTMODELCLONE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTMODELCLONE_HXX
+#pragma once
#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
{
@@ -40,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
);
@@ -51,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();
@@ -64,13 +65,11 @@ 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;
};
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTMODELCLONE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
index 67db8d3e4503..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<SotStorageStream>& 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<SotStorageStream>& rxOStm, voi
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,13 +140,10 @@ bool ChartTransferable::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, voi
}
}
- Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) );
- if ( SvxDrawingLayerExport( pMarkedObjModel, xDocOut ) )
- {
- rxOStm->Commit();
- }
+ 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 ebe6df966874..486fdb48c5a9 100644
--- a/chart2/source/controller/main/ChartTransferable.hxx
+++ b/chart2/source/controller/main/ChartTransferable.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTTRANSFERABLE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTTRANSFERABLE_HXX
+#pragma once
#include <vcl/transfer.hxx>
@@ -47,18 +46,15 @@ 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<SotStorageStream>& 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;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTTRANSFERABLE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 0971fd079ca1..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::EnableB2dDraw | 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 00638a6c0e24..feb1c2183af5 100644
--- a/chart2/source/controller/main/CommandDispatch.hxx
+++ b/chart2/source/controller/main/CommandDispatch.hxx
@@ -16,12 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCH_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCH_HXX
+#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>
@@ -35,7 +33,7 @@ namespace chart
namespace impl
{
-typedef ::cppu::WeakComponentImplHelper<
+typedef ::comphelper::WeakComponentImplHelper<
css::frame::XDispatch,
css::util::XModifyListener >
CommandDispatch_Base;
@@ -43,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 );
@@ -107,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(
@@ -121,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;
@@ -130,7 +126,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCH_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 67a07514ee45..6a5e441e8e3c 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.hxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CONTROLLERCOMMANDDISPATCH_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CONTROLLERCOMMANDDISPATCH_HXX
+#pragma once
#include "CommandDispatch.hxx"
#include <com/sun/star/view/XSelectionChangeListener.hpp>
@@ -75,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(
@@ -117,7 +116,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CONTROLLERCOMMANDDISPATCH_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 9ae8090fc963..1a6593889066 100644
--- a/chart2/source/controller/main/DragMethod_Base.hxx
+++ b/chart2/source/controller/main/DragMethod_Base.hxx
@@ -16,24 +16,24 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_BASE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_BASE_HXX
+#pragma once
#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;
@@ -43,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;
@@ -51,12 +51,9 @@ protected:
ActionDescriptionProvider::ActionType m_eActionType;
private:
- css::uno::WeakReference< css::frame::XModel > m_xChartModel;
+ unotools::WeakReference<::chart::ChartModel> m_xChartModel;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_BASE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx
index 9814a5db6595..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);
@@ -98,7 +97,7 @@ void DragMethod_PieSegment::MoveSdrDrag(const Point& rPnt)
m_fAdditionalOffset = 1.0 - m_fInitialOffset;
B2DVector aNewPosVector = m_aStartVector + (m_aDragDirection * m_fAdditionalOffset);
- Point aNewPos( static_cast<long>(aNewPosVector.getX()), static_cast<long>(aNewPosVector.getY()) );
+ Point aNewPos( static_cast<tools::Long>(aNewPosVector.getX()), static_cast<tools::Long>(aNewPosVector.getY()) );
if( aNewPos != DragStat().GetNow() )
{
Hide();
@@ -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 4a1264a017f1..8cb498373f33 100644
--- a/chart2/source/controller/main/DragMethod_PieSegment.hxx
+++ b/chart2/source/controller/main/DragMethod_PieSegment.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_PIESEGMENT_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_PIESEGMENT_HXX
+#pragma once
#include "DragMethod_Base.hxx"
#include <basegfx/vector/b2dvector.hxx>
@@ -29,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;
@@ -37,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;
@@ -52,7 +51,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_PIESEGMENT_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 a9401c923a1c..69e9050eeb4e 100644
--- a/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_ROTATEDIAGRAM_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_ROTATEDIAGRAM_HXX
+#pragma once
#include "DragMethod_Base.hxx"
@@ -42,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;
@@ -84,7 +83,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_ROTATEDIAGRAM_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 24ed7095707f..516c2d2ec5f3 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -18,16 +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/adjustitem.hxx>
#include <editeng/eeitem.hxx>
#include <svx/strings.hrc>
#include <svx/dialmgr.hxx>
@@ -68,21 +66,21 @@ 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();
if ( pLineEndList.is() )
{
OUString aName(SvxResId(pResId));
- long nCount = pLineEndList->Count();
- for ( long nIndex = 0; nIndex < nCount; ++nIndex )
+ tools::Long nCount = pLineEndList->Count();
+ for ( tools::Long nIndex = 0; nIndex < nCount; ++nIndex )
{
const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex);
if ( pEntry->GetName() == aName )
@@ -102,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;
@@ -116,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 ) )
{
@@ -125,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,
@@ -140,15 +134,13 @@ 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 );
- sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ Degree100 nAngle = pSourceObj->GetRotateAngle();
if ( nAngle )
- {
- double a = nAngle * F_PI18000;
- pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
- }
+ pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle );
bAttributesAppliedFromGallery = true;
}
}
@@ -169,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();
@@ -188,13 +180,13 @@ void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr )
aArrow.append( aNewArrow );
}
- SfxItemSet aSet( pDrawViewWrapper->GetModel()->GetItemPool() );
+ SfxItemSet aSet(pDrawViewWrapper->GetModel().GetItemPool());
pDrawViewWrapper->GetAttributes( aSet );
- long nWidth = 300; // (1/100th mm)
- if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
+ tools::Long nWidth = 300; // (1/100th mm)
+ if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::INVALID )
{
- long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue();
+ tools::Long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue();
if ( nValue > 0 )
{
nWidth = nValue * 3;
@@ -206,7 +198,7 @@ void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr )
}
// WeakComponentImplHelperBase
-void DrawCommandDispatch::disposing()
+void DrawCommandDispatch::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
}
@@ -221,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;
@@ -262,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 ) )
@@ -276,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;
}
@@ -348,32 +340,29 @@ void DrawCommandDispatch::execute( const OUString& rCommand, const Sequence< bea
SolarMutexGuard aGuard;
m_pChartController->setDrawMode( eDrawMode );
- setInsertObj( sal::static_int_cast< sal_uInt16 >( eKind ) );
+ setInsertObj(eKind);
if ( bCreate )
{
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();
}
@@ -382,23 +371,23 @@ 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( sal_uInt16 eObj )
+void DrawCommandDispatch::setInsertObj(SdrObjKind eObj)
{
DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : nullptr );
if ( pDrawViewWrapper )
@@ -407,9 +396,9 @@ void DrawCommandDispatch::setInsertObj( sal_uInt16 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 );
@@ -437,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();
@@ -455,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() ) );
@@ -475,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 )
{
@@ -495,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 )
{
@@ -519,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;
@@ -531,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 );
@@ -551,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 7df47171a79e..65200cca6323 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.hxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.hxx
@@ -16,10 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAWCOMMANDDISPATCH_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAWCOMMANDDISPATCH_HXX
+#pragma once
+#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;
@@ -59,10 +60,10 @@ protected:
virtual void describeSupportedFeatures() override;
private:
- void setInsertObj( sal_uInt16 eObj );
- SdrObject* createDefaultObject( const sal_uInt16 nID );
+ void setInsertObj(SdrObjKind eObj);
+ 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;
@@ -70,7 +71,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAWCOMMANDDISPATCH_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index e1ef40a660be..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
@@ -48,7 +46,8 @@ using ::com::sun::star::uno::Sequence;
namespace
{
-const char lcl_aServiceName[] = "com.sun.star.comp.chart.ElementSelectorToolbarController";
+constexpr OUStringLiteral lcl_aServiceName
+ = u"com.sun.star.comp.chart.ElementSelectorToolbarController";
}
SelectorListBox::SelectorListBox(vcl::Window* pParent)
@@ -56,6 +55,8 @@ SelectorListBox::SelectorListBox(vcl::Window* pParent)
, m_xWidget(m_xBuilder->weld_combo_box("combobox"))
, m_bReleaseFocus(true)
{
+ InitControlBase(m_xWidget.get());
+
m_xWidget->connect_key_press(LINK(this, SelectorListBox, KeyInputHdl));
m_xWidget->connect_changed(LINK(this, SelectorListBox, SelectHdl));
m_xWidget->connect_focus_out(LINK(this, SelectorListBox, FocusOutHdl));
@@ -72,20 +73,13 @@ void SelectorListBox::dispose()
InterimItemWindow::dispose();
}
-void SelectorListBox::GetFocus()
-{
- if (m_xWidget)
- m_xWidget->grab_focus();
- InterimItemWindow::GetFocus();
-}
-
SelectorListBox::~SelectorListBox()
{
disposeOnce();
}
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)
@@ -99,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()
@@ -109,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
@@ -170,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;
@@ -194,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();
@@ -208,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();
}
@@ -278,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();
}
@@ -295,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 01cfd273c3ba..fb1e4e0527ff 100644
--- a/chart2/source/controller/main/ElementSelector.hxx
+++ b/chart2/source/controller/main/ElementSelector.hxx
@@ -16,20 +16,19 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_ELEMENTSELECTOR_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_ELEMENTSELECTOR_HXX
+#pragma once
#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
{
@@ -49,15 +48,13 @@ public:
virtual void dispose() override;
virtual ~SelectorListBox() override;
- virtual void GetFocus() override;
-
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;
@@ -85,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;
@@ -99,6 +96,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 e1125cd8e76a..3ceb35ad1268 100644
--- a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
+++ b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
@@ -16,19 +16,56 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
+#pragma once
#include "CommandDispatch.hxx"
#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,
@@ -85,17 +122,14 @@ 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
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 84e4325e3ef2..8cad36404fdc 100644
--- a/chart2/source/controller/main/PositionAndSizeHelper.cxx
+++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx
@@ -19,15 +19,13 @@
#include <PositionAndSizeHelper.hxx>
#include <ControllerLockGuard.hxx>
-#include <com/sun/star/chart2/LegendPosition.hpp>
#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
{
@@ -47,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 )
@@ -57,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 )
{
@@ -83,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 )
@@ -94,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)
@@ -107,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;
@@ -136,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
@@ -153,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
@@ -168,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 5475be204c00..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());
}
}
}
@@ -584,18 +587,18 @@ bool SelectionHelper::getMarkHandles( SdrHdlList& rHdlList )
if( m_pMarkObj && m_pMarkObj != m_pSelectedObj)
{
rHdlList.Clear();
- if( dynamic_cast<const SdrPathObj*>( m_pMarkObj) != nullptr )
+ if( auto pPathObj = dynamic_cast<const SdrPathObj*>( m_pMarkObj) )
{
//if th object is a polygon
//from each point a handle is generated
- const ::basegfx::B2DPolyPolygon& rPolyPolygon = static_cast<SdrPathObj*>(m_pMarkObj)->GetPathPoly();
+ const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPathObj->GetPathPoly();
for( sal_uInt32 nN = 0; nN < rPolyPolygon.count(); nN++)
{
const ::basegfx::B2DPolygon& aPolygon(rPolyPolygon.getB2DPolygon(nN));
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 70fcdecf9297..cdd8002ce2d8 100644
--- a/chart2/source/controller/main/ShapeController.hxx
+++ b/chart2/source/controller/main/ShapeController.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SHAPECONTROLLER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SHAPECONTROLLER_HXX
+#pragma once
#include "FeatureCommandDispatchBase.hxx"
#include <tools/link.hxx>
@@ -42,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;
@@ -65,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();
@@ -79,7 +78,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SHAPECONTROLLER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 8ad9e62aad59..ae9dcaf4f67a 100644
--- a/chart2/source/controller/main/StatusBarCommandDispatch.hxx
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
@@ -16,13 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_STATUSBARCOMMANDDISPATCH_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_STATUSBARCOMMANDDISPATCH_HXX
+#pragma once
#include "CommandDispatch.hxx"
#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; }
@@ -49,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;
@@ -64,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(
@@ -83,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;
@@ -91,7 +91,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_STATUSBARCOMMANDDISPATCH_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 770cb06cf008..a86479e167ce 100644
--- a/chart2/source/controller/main/UndoActions.hxx
+++ b/chart2/source/controller/main/UndoActions.hxx
@@ -16,14 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
+#pragma once
#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>
@@ -33,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
@@ -55,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;
@@ -68,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;
};
@@ -109,7 +98,4 @@ private:
} // namespace impl
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 aa5f5b2e3999..f872387c761b 100644
--- a/chart2/source/controller/main/UndoCommandDispatch.hxx
+++ b/chart2/source/controller/main/UndoCommandDispatch.hxx
@@ -16,16 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOCOMMANDDISPATCH_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOCOMMANDDISPATCH_HXX
+#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.
*/
@@ -34,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
@@ -48,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(
@@ -59,13 +60,10 @@ 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;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOCOMMANDDISPATCH_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 0d9fa75386e4..90443a247af4 100644
--- a/chart2/source/controller/main/UndoGuard.hxx
+++ b/chart2/source/controller/main/UndoGuard.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOGUARD_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOGUARD_HXX
+#pragma once
#include "ChartModelClone.hxx"
@@ -38,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
);
@@ -54,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;
@@ -112,7 +111,5 @@ private:
};
}
-// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOGUARD_HXX
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 c91c144422ef..87619f647d70 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
@@ -16,24 +16,21 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_SC_INC_SCPANELFACTORY_HXX
-#define INCLUDED_SC_INC_SCPANELFACTORY_HXX
+#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();
@@ -56,6 +53,4 @@ public:
} // end of namespace chart::sidebar
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 1f6230709efb..cb660661c140 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -7,14 +7,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#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>
@@ -30,14 +34,14 @@ namespace chart::sidebar {
namespace {
-SvxColorToolBoxControl* getColorToolBoxControl(ToolbarUnoDispatcher& rColorDispatch)
+SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rColorDispatch)
{
css::uno::Reference<css::frame::XToolbarController> xController = rColorDispatch.GetControllerForCommand(".uno:FillColor");
SvxColorToolBoxControl* pToolBoxColorControl = dynamic_cast<SvxColorToolBoxControl*>(xController.get());
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);
@@ -46,7 +50,20 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
css::uno::Any aAny = xSelectionSupplier->getSelection();
if (!aAny.hasValue())
- return OUString();
+ {
+ // if no selection, default to diagram wall so sidebar can show some editable properties
+ ChartController* pController = dynamic_cast<ChartController*>(xController.get());
+ if (pController)
+ {
+ 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();
+ }
+
+ if (!aAny.hasValue())
+ return OUString();
+ }
OUString aCID;
aAny >>= aCID;
@@ -55,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 =
@@ -176,7 +193,7 @@ XHatch getXHatchFromName(const css::uno::Reference<css::frame::XModel>& xModel,
}
GraphicObject getXBitmapFromName(const css::uno::Reference<css::frame::XModel>& xModel,
- const OUString& rName)
+ std::u16string_view rName)
{
try
{
@@ -239,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)
{
@@ -249,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),
@@ -267,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);
@@ -330,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));
}
@@ -370,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));
}
@@ -401,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)
@@ -459,10 +468,9 @@ void ChartAreaPanel::updateData()
GraphicObject aBitmap = getXBitmapFromName(mxModel, aBitmapName);
XFillBitmapItem aBitmapItem(aBitmapName, aBitmap);
std::unique_ptr<XFillBitmapItem> pBitmapItem;
- DrawModelWrapper* pModelWrapper = nullptr;
try
{
- pModelWrapper = getDrawModelWrapper(mxModel);
+ DrawModelWrapper* pModelWrapper = getDrawModelWrapper(mxModel);
if (pModelWrapper)
{
pBitmapItem = aBitmapItem.checkForUniqueItem(&pModelWrapper->getSdrModel());
@@ -488,7 +496,7 @@ void ChartAreaPanel::updateData()
{
sal_uInt32 nFillColor = 0;
xPropSet->getPropertyValue("FillColor") >>= nFillColor;
- XFillColorItem aFillColorItem("", Color(nFillColor));
+ XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor));
updateFillColor(true, &aFillColorItem);
}
}
@@ -504,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 5c0e0b23bbc4..e1edd3d832e8 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAREAPANEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAREAPANEL_HXX
+#pragma once
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <svx/xfillit0.hxx>
@@ -38,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);
@@ -58,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;
@@ -84,6 +83,4 @@ private:
} } // end of namespace svx::sidebar
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 77fdaf45f119..48a4620684b3 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -17,16 +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;
@@ -35,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;
@@ -53,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;
@@ -78,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;
@@ -102,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;
@@ -121,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())
@@ -135,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())
@@ -166,17 +162,18 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
aAny >>= aCID;
#if defined DBG_UTIL && !defined NDEBUG
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
- assert(eType == OBJECTTYPE_AXIS);
+ if(eType != OBJECTTYPE_AXIS)
+ SAL_WARN("chart2","Selected item is not an axis");
#endif
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;
@@ -184,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;
@@ -202,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)
@@ -221,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();
@@ -240,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())
@@ -255,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);
@@ -271,6 +254,10 @@ void ChartAxisPanel::updateData()
return;
OUString aCID = getCID(mxModel);
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType!=OBJECTTYPE_AXIS)
+ return;
+
SolarMutexGuard aGuard;
mxCBShowLabel->set_active(isLabelShown(mxModel, aCID));
@@ -280,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();
}
@@ -318,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 b510ef8b564c..e5ed4b5ebcc6 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -8,24 +8,18 @@
*
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAXISPANEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAXISPANEL_HXX
+#pragma once
#include <sfx2/sidebar/ControllerItem.hxx>
#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;
@@ -40,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(
@@ -62,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;
@@ -83,21 +74,20 @@ 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);
};
} } // end of namespace ::chart::sidebar
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
index d9903b12c275..f5c79133434c 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
@@ -7,7 +7,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "ChartColorWrapper.hxx"
+#include <ChartModel.hxx>
#include <ObjectIdentifier.hxx>
#include <PropertyHelper.hxx>
@@ -22,12 +27,21 @@
#include <svx/xlndsit.hxx>
#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 {
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())
@@ -44,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 =
@@ -67,16 +81,16 @@ 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))
{
}
-void ChartColorWrapper::operator()(const OUString& , const NamedColor& rColor)
+void ChartColorWrapper::operator()([[maybe_unused]] const OUString& , const NamedColor& rColor)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
@@ -86,18 +100,18 @@ void ChartColorWrapper::operator()(const OUString& , const NamedColor& rColor)
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 const OUStringLiteral aLineColor = "LineColor";
- static const OUStringLiteral aCommands[2] = {".uno:XLineColor", ".uno:FillColor"};
+ 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);
if (!xPropSet.is())
@@ -111,17 +125,27 @@ void ChartColorWrapper::updateData()
aEvent.IsEnabled = true;
aEvent.State = xPropSet->getPropertyValue(maPropertyName);
mpControl->statusChanged(aEvent);
+
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ if (comphelper::LibreOfficeKit::isActive() && pViewShell && (maPropertyName == aLineColor))
+ {
+ OString sCommand = OUStringToOString(aUrl.Complete, RTL_TEXTENCODING_ASCII_US);
+ sal_Int32 nColor = -1;
+ aEvent.State >>= nColor;
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+ 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;
}
@@ -177,7 +201,7 @@ void ChartLineStyleWrapper::updateData()
mpControl->statusChanged(aEvent);
}
-bool ChartLineStyleWrapper::operator()(const OUString& rCommand, const css::uno::Any& rValue)
+bool ChartLineStyleWrapper::operator()(std::u16string_view rCommand, const css::uno::Any& rValue)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
@@ -187,19 +211,19 @@ bool ChartLineStyleWrapper::operator()(const OUString& rCommand, const css::uno:
return false;
}
- if (rCommand == ".uno:XLineStyle")
+ if (rCommand == u".uno:XLineStyle")
{
xPropSet->setPropertyValue("LineStyle", rValue);
return true;
}
- else if (rCommand == ".uno:LineDash")
+ else if (rCommand == u".uno:LineDash")
{
XLineDashItem aDashItem;
aDashItem.PutValue(rValue, 0);
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 425b074f96cb..70b3ce8fa47c 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx
@@ -7,14 +7,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTCOLORWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTCOLORWRAPPER_HXX
+#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;
@@ -23,19 +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,24 +47,22 @@ private:
class ChartLineStyleWrapper
{
public:
- ChartLineStyleWrapper(css::uno::Reference<css::frame::XModel> const & xModel,
+ ChartLineStyleWrapper(rtl::Reference<::chart::ChartModel> xModel,
SvxLineStyleToolBoxControl* pControl);
- bool operator()(const OUString& rCommand, const css::uno::Any& rValue);
+ 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;
};
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 346672c2bb2a..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 isTitleVisisble(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,11 +296,12 @@ 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"))
+ , mxEditSubtitle(m_xBuilder->weld_entry("edit_subtitle"))
, mxCBXAxis(m_xBuilder->weld_check_button("checkbutton_x_axis"))
, mxCBXAxisTitle(m_xBuilder->weld_check_button("checkbutton_x_axis_title"))
, mxCBYAxis(m_xBuilder->weld_check_button("checkbutton_y_axis"))
@@ -325,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)
{
@@ -338,15 +336,12 @@ 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();
+ mxEditSubtitle.reset();
mxCBXAxis.reset();
mxCBXAxisTitle.reset();
mxCBYAxis.reset();
@@ -372,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);
@@ -403,31 +395,29 @@ void ChartElementsPanel::Initialize()
mxCBGridHorizontalMinor->connect_toggled(aLink);
mxLBLegendPosition->connect_changed(LINK(this, ChartElementsPanel, LegendPosHdl));
+
+ Link<weld::Entry&, void> aEditLink = LINK(this, ChartElementsPanel, EditHdl);
+ mxEditTitle->connect_changed(aEditLink);
+ mxEditSubtitle->connect_changed(aEditLink);
}
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];
}
@@ -439,21 +429,42 @@ 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));
mxCBLegendNoOverlay->set_sensitive(isLegendVisible(mxModel));
mxCBLegendNoOverlay->set_active(!isLegendOverlay(mxModel));
mxBoxLegend->set_sensitive(isLegendVisible(mxModel));
- mxCBTitle->set_active(isTitleVisisble(mxModel, TitleHelper::MAIN_TITLE));
- mxCBSubtitle->set_active(isTitleVisisble(mxModel, TitleHelper::SUB_TITLE));
- mxCBXAxisTitle->set_active(isTitleVisisble(mxModel, TitleHelper::X_AXIS_TITLE));
- mxCBYAxisTitle->set_active(isTitleVisisble(mxModel, TitleHelper::Y_AXIS_TITLE));
- mxCBZAxisTitle->set_active(isTitleVisisble(mxModel, TitleHelper::Z_AXIS_TITLE));
- mxCB2ndXAxisTitle->set_active(isTitleVisisble(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE));
- mxCB2ndYAxisTitle->set_active(isTitleVisisble(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE));
+
+ bool hasTitle = isTitleVisible(mxModel, TitleHelper::MAIN_TITLE);
+ mxCBTitle->set_active(hasTitle);
+
+ OUString title = mxEditTitle->get_text();
+ OUString newTitle = TitleHelper::getCompleteString(TitleHelper::getTitle(TitleHelper::MAIN_TITLE, mxModel));
+ if (title != newTitle)
+ mxEditTitle->set_text(newTitle);
+ if (mxEditTitle->get_sensitive() != hasTitle)
+ mxEditTitle->set_sensitive(hasTitle);
+
+ bool hasSubtitle = isTitleVisible(mxModel, TitleHelper::SUB_TITLE);
+ mxCBSubtitle->set_active(hasSubtitle);
+
+ OUString subtitle = mxEditSubtitle->get_text();
+ OUString newSubtitle = TitleHelper::getCompleteString(TitleHelper::getTitle(TitleHelper::SUB_TITLE, mxModel));
+ if (subtitle != newSubtitle)
+ mxEditSubtitle->set_text(newSubtitle);
+ if (mxEditSubtitle->get_sensitive() != hasSubtitle)
+ mxEditSubtitle->set_sensitive(hasSubtitle);
+
+ mxCBXAxisTitle->set_active(isTitleVisible(mxModel, TitleHelper::X_AXIS_TITLE));
+ mxCBYAxisTitle->set_active(isTitleVisible(mxModel, TitleHelper::Y_AXIS_TITLE));
+ mxCBZAxisTitle->set_active(isTitleVisible(mxModel, TitleHelper::Z_AXIS_TITLE));
+ mxCB2ndXAxisTitle->set_active(isTitleVisible(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE));
+ mxCB2ndYAxisTitle->set_active(isTitleVisible(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE));
mxCBGridVerticalMajor->set_active(isGridVisible(mxModel, GridType::VERT_MAJOR));
mxCBGridHorizontalMajor->set_active(isGridVisible(mxModel, GridType::HOR_MAJOR));
mxCBGridVerticalMinor->set_active(isGridVisible(mxModel, GridType::VERT_MINOR));
@@ -464,7 +475,6 @@ void ChartElementsPanel::updateData()
mxCB2ndXAxis->set_active(isAxisVisible(mxModel, AxisType::X_SECOND));
mxCB2ndYAxis->set_active(isAxisVisible(mxModel, AxisType::Y_SECOND));
-
bool bSupportsMainAxis = ChartTypeHelper::isSupportingMainAxis(
getChartType(mxModel), 0, 0);
if (bSupportsMainAxis)
@@ -512,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();
}
@@ -549,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())
@@ -608,6 +621,21 @@ 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)
+{
+ // title or subtitle?
+ TitleHelper::eTitleType aTitleType = TitleHelper::MAIN_TITLE;
+ if (&rEdit == mxEditSubtitle.get())
+ aTitleType = TitleHelper::SUB_TITLE;
+
+ // set it
+ OUString aText(rEdit.get_text());
+ TitleHelper::setCompleteString(aText, TitleHelper::getTitle(aTitleType, mxModel),
+ comphelper::getProcessComponentContext(), nullptr, true);
}
IMPL_LINK_NOARG(ChartElementsPanel, LegendPosHdl, weld::ComboBox&, void)
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 9d3ea7f6d913..2e0dee28b68f 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTELEMENTSPANEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTELEMENTSPANEL_HXX
+#pragma once
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
@@ -40,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(
@@ -53,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;
@@ -69,7 +64,9 @@ public:
private:
//ui controls
std::unique_ptr<weld::CheckButton> mxCBTitle;
+ std::unique_ptr<weld::Entry> mxEditTitle;
std::unique_ptr<weld::CheckButton> mxCBSubtitle;
+ std::unique_ptr<weld::Entry> mxEditSubtitle;
std::unique_ptr<weld::CheckButton> mxCBXAxis;
std::unique_ptr<weld::CheckButton> mxCBXAxisTitle;
std::unique_ptr<weld::CheckButton> mxCBYAxis;
@@ -96,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;
@@ -105,15 +102,15 @@ 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);
};
} } // end of namespace ::chart::sidebar
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index c31990146953..c9430791b3c9 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -18,12 +18,14 @@
*/
#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>
+
using namespace css;
using namespace css::uno;
@@ -39,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);
@@ -63,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);
@@ -82,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);
@@ -94,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);
@@ -122,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);
@@ -148,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);
@@ -167,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);
@@ -191,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);
@@ -207,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);
@@ -220,9 +222,11 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
aAny >>= aCID;
#if defined DBG_UTIL && !defined NDEBUG
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
- assert(eType == OBJECTTYPE_DATA_ERRORS_X ||
- eType == OBJECTTYPE_DATA_ERRORS_Y ||
- eType == OBJECTTYPE_DATA_ERRORS_Z);
+ if (eType != OBJECTTYPE_DATA_ERRORS_X &&
+ eType != OBJECTTYPE_DATA_ERRORS_Y &&
+ eType != OBJECTTYPE_DATA_ERRORS_Z)
+ SAL_WARN("chart2","Selected item is not an error bar");
+
#endif
return aCID;
@@ -230,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)
{
@@ -249,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();
@@ -265,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);
@@ -297,6 +290,12 @@ void ChartErrorBarPanel::updateData()
return;
OUString aCID = getCID(mxModel);
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType != OBJECTTYPE_DATA_ERRORS_X &&
+ eType != OBJECTTYPE_DATA_ERRORS_Y &&
+ eType != OBJECTTYPE_DATA_ERRORS_Z)
+ return;
+
bool bPos = showPositiveError(mxModel, aCID);
bool bNeg = showNegativeError(mxModel, aCID);
@@ -337,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();
}
@@ -375,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();
+
+ if (!mbModelValid)
+ return;
+
+ mxModel->addModifyListener(mxListener);
+}
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->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 ee5a306ba938..92f7afb0ad53 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -8,14 +8,12 @@
*
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTERRORBARPANEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTERRORBARPANEL_HXX
+#pragma once
#include <sfx2/sidebar/ControllerItem.hxx>
#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; }
@@ -23,6 +21,7 @@ namespace com::sun::star::util { class XModifyListener; }
namespace chart {
class ChartController;
+class ChartModel;
namespace sidebar {
@@ -33,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(
@@ -55,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;
@@ -77,20 +73,19 @@ 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);
};
} } // end of namespace ::chart::sidebar
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index 449b3efa278f..46cec9695f4d 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -9,15 +9,11 @@
#include "ChartLinePanel.hxx"
-#include <PropertyHelper.hxx>
#include <ChartController.hxx>
+#include <ChartModel.hxx>
-#include <svx/xlineit0.hxx>
#include <svx/xlnwtit.hxx>
-#include <svx/xlinjoit.hxx>
-#include <svx/xlndsit.hxx>
#include <svx/xlntrit.hxx>
-#include <svx/unomid.hxx>
#include <svx/linectrl.hxx>
#include <svx/tbcontrl.hxx>
@@ -25,28 +21,31 @@
#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>
+#include <sfx2/viewsh.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
namespace chart::sidebar {
namespace {
-SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(ToolbarUnoDispatcher& rToolBoxColor)
+SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(const ToolbarUnoDispatcher& rToolBoxColor)
{
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle");
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast<SvxLineStyleToolBoxControl*>(xController.get());
return pToolBoxLineStyleControl;
}
-SvxColorToolBoxControl* getColorToolBoxControl(ToolbarUnoDispatcher& rToolBoxLineStyle)
+SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rToolBoxLineStyle)
{
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxLineStyle.GetControllerForCommand(".uno:XLineColor");
SvxColorToolBoxControl* pToolBoxColorControl = dynamic_cast<SvxColorToolBoxControl*>(xController.get());
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);
@@ -64,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 =
@@ -104,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)
{
@@ -114,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),
@@ -135,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);
@@ -190,6 +175,11 @@ void ChartLinePanel::updateData()
XLineTransparenceItem aLineTransparenceItem(nLineTransparence);
updateLineTransparence(false, true, &aLineTransparenceItem);
+ sal_uInt32 nWidth = 0;
+ xPropSet->getPropertyValue("LineWidth") >>= nWidth;
+ XLineWidthItem aWidthItem(nWidth);
+ updateLineWidth(false, true, &aWidthItem);
+
maLineStyleWrapper.updateData();
maLineColorWrapper.updateData();
}
@@ -205,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)
@@ -275,6 +255,18 @@ void ChartLinePanel::setLineWidth(const XLineWidthItem& rItem)
xPropSet->setPropertyValue("LineWidth", css::uno::Any(rItem.GetValue()));
}
+void ChartLinePanel::updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem)
+{
+ LinePropertyPanelBase::updateLineWidth(bDisabled, bSetOrDefault, pItem);
+
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+ {
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+ ".uno:LineWidth=" + OString::number(mnWidthCoreValue));
+ }
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx
index 2f1c520dd426..ca3d8be14244 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTLINEPANEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTLINEPANEL_HXX
+#pragma once
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <svx/sidebar/LinePropertyPanelBase.hxx>
@@ -17,10 +16,8 @@
#include "ChartSidebarSelectionListener.hxx"
#include "ChartColorWrapper.hxx"
-class XLineCapItem;
class XLineDashItem;
class XLineEndItem;
-class XLineJointItem;
class XLineStartItem;
class XLineStyleItem;
class XLineTransparenceItem;
@@ -38,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);
@@ -56,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;
@@ -65,16 +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;
@@ -84,6 +80,4 @@ private:
} } // end of namespace svx::sidebar
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 83a3251925f1..9e94ac005ecb 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -18,23 +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;
@@ -43,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())
@@ -54,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())
@@ -83,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;
@@ -108,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;
@@ -130,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;
@@ -163,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())
@@ -175,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())
@@ -196,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())
@@ -208,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)
@@ -264,8 +260,10 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
#if defined DBG_UTIL && !defined NDEBUG
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
- assert(eType == OBJECTTYPE_DATA_SERIES || eType == OBJECTTYPE_DATA_POINT
- || eType == OBJECTTYPE_DATA_CURVE);
+ if (eType != OBJECTTYPE_DATA_SERIES &&
+ eType != OBJECTTYPE_DATA_POINT &&
+ eType != OBJECTTYPE_DATA_CURVE)
+ SAL_WARN("chart2","Selected item is not a chart series");
#endif
return aCID;
@@ -274,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"))
@@ -288,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)
@@ -298,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();
@@ -322,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);
@@ -355,6 +340,12 @@ void ChartSeriesPanel::updateData()
return;
OUString aCID = getCID(mxModel);
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType!=OBJECTTYPE_DATA_SERIES &&
+ eType != OBJECTTYPE_DATA_POINT &&
+ eType != OBJECTTYPE_DATA_CURVE)
+ return;
+
SolarMutexGuard aGuard;
bool bLabelVisible = isDataLabelVisible(mxModel, aCID);
mxCBLabel->set_active(bLabelVisible);
@@ -374,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();
}
@@ -412,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);
@@ -458,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 3197237297f6..5b69cc3b959f 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSERIESPANEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSERIESPANEL_HXX
+#pragma once
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
@@ -44,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(
@@ -66,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;
@@ -95,21 +91,20 @@ 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);
};
} } // end of namespace ::chart::sidebar
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx
index 5cc6b5beac99..adee06ddd51a 100644
--- a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx
+++ b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx
@@ -9,20 +9,16 @@
#include "ChartSidebarModifyListener.hxx"
-namespace chart::sidebar {
-
-ChartSidebarModifyListenerParent::~ChartSidebarModifyListenerParent()
+namespace chart::sidebar
{
-}
+ChartSidebarModifyListenerParent::~ChartSidebarModifyListenerParent() {}
-ChartSidebarModifyListener::ChartSidebarModifyListener(ChartSidebarModifyListenerParent* pParent):
- mpParent(pParent)
+ChartSidebarModifyListener::ChartSidebarModifyListener(ChartSidebarModifyListenerParent* pParent)
+ : mpParent(pParent)
{
}
-ChartSidebarModifyListener::~ChartSidebarModifyListener()
-{
-}
+ChartSidebarModifyListener::~ChartSidebarModifyListener() {}
void ChartSidebarModifyListener::modified(const css::lang::EventObject& /*rEvent*/)
{
@@ -38,7 +34,6 @@ void ChartSidebarModifyListener::disposing(const css::lang::EventObject& /*rEven
mpParent->modelInvalid();
mpParent = nullptr;
}
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx b/chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx
index 9efe382e2761..afcbbdab510c 100644
--- a/chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx
+++ b/chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx
@@ -7,15 +7,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSIDEBAR_MODIFYLISTENER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSIDEBAR_MODIFYLISTENER_HXX
+#pragma once
#include <com/sun/star/util/XModifyListener.hpp>
#include <cppuhelper/implbase.hxx>
-namespace chart {
-namespace sidebar {
-
+namespace chart::sidebar
+{
class ChartSidebarModifyListenerParent
{
public:
@@ -29,7 +27,6 @@ public:
class ChartSidebarModifyListener : public cppu::WeakImplHelper<css::util::XModifyListener>
{
public:
-
explicit ChartSidebarModifyListener(ChartSidebarModifyListenerParent* pParent);
virtual ~ChartSidebarModifyListener() override;
@@ -40,9 +37,6 @@ public:
private:
ChartSidebarModifyListenerParent* mpParent;
};
-
-} }
-
-#endif
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 84efd0323fc5..e8cea5003fa0 100644
--- a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx
+++ b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSIDEBARSELECTIONLISTENER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSIDEBARSELECTIONLISTENER_HXX
+#pragma once
#include <com/sun/star/view/XSelectionChangeListener.hpp>
#include <cppuhelper/implbase.hxx>
@@ -17,9 +16,8 @@
#include <vector>
-namespace chart {
-namespace sidebar {
-
+namespace chart::sidebar
+{
class ChartSidebarSelectionListenerParent
{
public:
@@ -28,10 +26,10 @@ public:
virtual void selectionChanged(bool bSelected) = 0;
};
-class ChartSidebarSelectionListener : public cppu::WeakImplHelper<css::view::XSelectionChangeListener>
+class ChartSidebarSelectionListener
+ : public cppu::WeakImplHelper<css::view::XSelectionChangeListener>
{
public:
-
// listen to all chart selection changes
explicit ChartSidebarSelectionListener(ChartSidebarSelectionListenerParent* pParent);
// only listen to the changes of eType
@@ -42,16 +40,13 @@ 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;
std::vector<ObjectType> maTypes;
};
-
-} }
-
-#endif
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx
index ceea3b2186b6..40423aa62ea1 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx
@@ -21,31 +21,24 @@
#include <TimerTriggeredControllerLock.hxx>
#include <ChartController.hxx>
-#include <ChartModelHelper.hxx>
-#include <ChartResourceGroupDlgs.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()))
@@ -54,13 +47,13 @@ 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)
, m_aTimerTriggeredControllerLock(m_xChartModel)
, m_xMainTypeList(m_xBuilder->weld_combo_box("cmb_chartType"))
- , m_xSubTypeList(new ValueSet(m_xBuilder->weld_scrolled_window("subtypewin")))
+ , m_xSubTypeList(new ValueSet(m_xBuilder->weld_scrolled_window("subtypewin", true)))
, m_xSubTypeListWin(new weld::CustomWeld(*m_xBuilder, "subtype", *m_xSubTypeList))
{
Size aSize(m_xSubTypeList->GetDrawingArea()->get_ref_device().LogicToPixel(
@@ -76,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
@@ -122,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();
@@ -145,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(); }
@@ -166,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;
@@ -184,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&)
@@ -229,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))
@@ -246,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)
{
@@ -266,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;
}
@@ -368,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&)
{
@@ -413,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&)
{
@@ -430,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 0186cf6419b9..8df0020431db 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTTYPEPANEL_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTTYPEPANEL_HXX
+#pragma once
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
@@ -28,19 +27,10 @@
#include <ChartTypeTemplateProvider.hxx>
#include <TimerTriggeredControllerLock.hxx>
-namespace com
-{
-namespace sun
-{
-namespace star
-{
-namespace util
+namespace com::sun::star::util
{
class XModifyListener;
}
-}
-}
-}
namespace weld
{
@@ -72,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();
@@ -103,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;
@@ -116,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;
@@ -132,6 +118,4 @@ private:
}
} // end of namespace ::chart::sidebar
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/uitest/uiobject.cxx b/chart2/source/controller/uitest/uiobject.cxx
index e850573b97f2..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)
@@ -150,15 +158,15 @@ namespace {
void recursiveAdd(chart::ObjectIdentifier const & rID, std::set<OUString>& rChildren, const chart::ObjectHierarchy& rHierarchy)
{
- std::vector<chart::ObjectIdentifier> aChildIndentifiers = rHierarchy.getChildren(rID);
- std::transform(aChildIndentifiers.begin(), aChildIndentifiers.end(), std::inserter(rChildren, rChildren.begin()),
+ std::vector<chart::ObjectIdentifier> aChildIdentifiers = rHierarchy.getChildren(rID);
+ std::transform(aChildIdentifiers.begin(), aChildIdentifiers.end(), std::inserter(rChildren, rChildren.begin()),
[](const chart::ObjectIdentifier& rObject)
{
return rObject.getObjectCID();
}
);
- for (const chart::ObjectIdentifier& ID: aChildIndentifiers)
+ for (const chart::ObjectIdentifier& ID: aChildIdentifiers)
recursiveAdd(ID, rChildren, rHierarchy);
}
@@ -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());
diff --git a/chart2/source/model/main/Axis.hxx b/chart2/source/inc/Axis.hxx
index 49f4003bbb4f..e36acdbad7aa 100644
--- a/chart2/source/model/main/Axis.hxx
+++ b/chart2/source/inc/Axis.hxx
@@ -16,11 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_AXIS_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_AXIS_HXX
+#pragma once
-#include <MutexContainer.hxx>
-#include <OPropertySet.hxx>
+#include "OPropertySet.hxx"
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
@@ -28,11 +26,14 @@
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
+#include "ModifyListenerHelper.hxx"
+#include "charttoolsdllapi.hxx"
+#include "PropertyHelper.hxx"
namespace chart
{
+class GridProperties;
+class Title;
namespace impl
{
@@ -46,8 +47,7 @@ typedef ::cppu::WeakImplHelper<
Axis_Base;
}
-class Axis final :
- public MutexContainer,
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) Axis final :
public impl::Axis_Base,
public ::property::OPropertySet
{
@@ -72,11 +72,12 @@ private:
void Init();
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+public:
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
@@ -103,6 +104,13 @@ private:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+ rtl::Reference< ::chart::Title > getTitleObject2() const;
+ void setTitleObject( const rtl::Reference< ::chart::Title >& xNewTitle );
+
+ rtl::Reference< ::chart::GridProperties > getGridProperties2();
+ std::vector< rtl::Reference< ::chart::GridProperties > > getSubGridProperties2();
+
+private:
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -119,20 +127,19 @@ private:
void AllocateSubGrids();
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
css::chart2::ScaleData m_aScaleData;
- css::uno::Reference< css::beans::XPropertySet > m_xGrid;
+ rtl::Reference< ::chart::GridProperties > m_xGrid;
- css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > m_aSubGridProperties;
+ std::vector< rtl::Reference< ::chart::GridProperties > > m_aSubGridProperties;
- css::uno::Reference< css::chart2::XTitle > m_xTitle;
+ rtl::Reference< ::chart::Title > m_xTitle;
};
-} // namespace chart
+OOO_DLLPUBLIC_CHARTTOOLS const ::chart::tPropertyValueMap & StaticAxisDefaults();
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_AXIS_HXX
-#endif
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx
index 2097d216bc60..f39e54c1fc00 100644
--- a/chart2/source/inc/AxisHelper.hxx
+++ b/chart2/source/inc/AxisHelper.hxx
@@ -16,11 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_AXISHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_AXISHELPER_HXX
+#pragma once
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
#include <com/sun/star/chart2/ScaleData.hpp>
+#include <rtl/ref.hxx>
+#include "GridProperties.hxx"
#include <vector>
@@ -38,8 +40,12 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class Axis;
+class BaseCoordinateSystem;
+class ChartType;
+class Diagram;
-class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) AxisHelper
{
public:
static css::uno::Reference< css::chart2::XScaling > createLinearScaling();
@@ -52,157 +58,155 @@ public:
static bool isLogarithmic( const css::uno::Reference< css::chart2::XScaling >& xScaling );
static void checkDateAxis( css::chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis );
- static css::chart2::ScaleData getDateCheckedScale( const css::uno::Reference< css::chart2::XAxis >& xAxis, ChartModel& rModel );
+ static css::chart2::ScaleData getDateCheckedScale( const rtl::Reference< ::chart::Axis >& xAxis, ChartModel& rModel );
static sal_Int32 getExplicitNumberFormatKeyForAxis(
- const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCorrespondingCoordinateSystem
- , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc
+ const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCorrespondingCoordinateSystem
+ , const rtl::Reference< ::chart::ChartModel>& xChartDoc
, bool bSearchForParallelAxisIfNothingIsFound );
- static css::uno::Reference<
- css::chart2::XAxis >
+ static rtl::Reference< ::chart::Axis >
createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
+ , const rtl::Reference< ::chart::Diagram >& xDiagram
, const css::uno::Reference< css::uno::XComponentContext >& xContext
, ReferenceSizeProvider * pRefSizeProvider = nullptr );
- static css::uno::Reference< css::chart2::XAxis >
+ static rtl::Reference< ::chart::Axis >
createAxis(
sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex // 0==main or 1==secondary axis
- , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
+ , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
, const css::uno::Reference< css::uno::XComponentContext > & xContext
, ReferenceSizeProvider * pRefSizeProvider = nullptr );
static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
+ , const rtl::Reference< ::chart::Diagram >& xDiagram
, const css::uno::Reference< css::uno::XComponentContext >& xContext
, ReferenceSizeProvider * pRefSizeProvider = nullptr );
static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
static bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
static bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
- static void makeAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
- static void makeGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
+ static void makeAxisVisible( const rtl::Reference< ::chart::Axis >& xAxis );
+ static void makeGridVisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties );
- static void makeAxisInvisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
- static void makeGridInvisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
+ static void makeAxisInvisible( const rtl::Reference< ::chart::Axis >& xAxis );
+ static void makeGridInvisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties );
- static void hideAxisIfNoDataIsAttached( const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram);
+ static void hideAxisIfNoDataIsAttached( const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::Diagram >& xDiagram);
- SAL_DLLPRIVATE static bool areAxisLabelsVisible( const css::uno::Reference< css::beans::XPropertySet >& xAxisProperties );
- static bool isAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
- static bool isGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
+ SAL_DLLPRIVATE static bool areAxisLabelsVisible( const rtl::Reference< ::chart::Axis >& xAxisProperties );
+ static bool isAxisVisible( const rtl::Reference< ::chart::Axis >& xAxis );
+ static bool isGridVisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties );
- static css::uno::Reference< css::chart2::XCoordinateSystem >
+ static rtl::Reference< ::chart::BaseCoordinateSystem >
getCoordinateSystemByIndex(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram
+ const rtl::Reference< ::chart::Diagram >& xDiagram
, sal_Int32 nIndex );
- static css::uno::Reference< css::chart2::XCoordinateSystem >
+ static rtl::Reference< ::chart::BaseCoordinateSystem >
getCoordinateSystemOfAxis(
- const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
- static css::uno::Reference< css::chart2::XAxis >
+ static rtl::Reference< ::chart::Axis >
getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
- static css::uno::Reference< css::chart2::XAxis >
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
+ static rtl::Reference< ::chart::Axis >
getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
- , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
+ , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
- static css::uno::Reference< css::chart2::XAxis >
- getCrossingMainAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
+ static rtl::Reference< ::chart::Axis >
+ getCrossingMainAxis( const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
- static css::uno::Reference< css::chart2::XAxis >
- getParallelAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ static rtl::Reference< ::chart::Axis >
+ getParallelAxis( const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
- static css::uno::Reference< css::beans::XPropertySet >
- getGridProperties( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
+ static rtl::Reference< ::chart::GridProperties >
+ getGridProperties( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
, sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex //0: Primary axis, 1: secondary axis
, sal_Int32 nSubGridIndex //-1: Main Grid; 0: First SubGrid etc
);
static sal_Int32 getDimensionIndexOfAxis(
- const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::Diagram >& xDiagram );
static bool getIndicesForAxis(
- const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
+ const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
static bool getIndicesForAxis(
- const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
+ const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::Diagram >& xDiagram
, sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
/** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
</sal_True> are returned
*/
- static css::uno::Sequence< css::uno::Reference< css::chart2::XAxis > >
- getAllAxesOfDiagram( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
+ static std::vector< rtl::Reference< ::chart::Axis > >
+ getAllAxesOfDiagram( const rtl::Reference< ::chart::Diagram >& xDiagram
, bool bOnlyVisible = false );
/** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
</sal_True> are returned
*/
- SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XAxis > >
- getAllAxesOfCoordinateSystem( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
+ SAL_DLLPRIVATE static std::vector< rtl::Reference< ::chart::Axis > >
+ getAllAxesOfCoordinateSystem( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
, bool bOnlyVisible = false );
- static css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > >
- getAllGrids( const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ static std::vector< rtl::Reference< ::chart::GridProperties > >
+ getAllGrids( const rtl::Reference< ::chart::Diagram >& xDiagram );
static void getAxisOrGridPossibilities( css::uno::Sequence< sal_Bool >& rPossibilityList
- , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true );
+ , const rtl::Reference< ::chart::Diagram>& xDiagram, bool bAxis=true );
- static void getAxisOrGridExcistence( css::uno::Sequence< sal_Bool >& rExcistenceList
- , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true );
+ static void getAxisOrGridExistence( css::uno::Sequence< sal_Bool >& rExistenceList
+ , const rtl::Reference< ::chart::Diagram>& xDiagram, bool bAxis=true );
- static bool changeVisibilityOfGrids( const css::uno::Reference< css::chart2::XDiagram>& xDiagram
+ static bool changeVisibilityOfGrids( const rtl::Reference< ::chart::Diagram>& xDiagram
, const css::uno::Sequence< sal_Bool >& rOldExistenceList
, const css::uno::Sequence< sal_Bool >& rNewExistenceList );
- static bool changeVisibilityOfAxes( const css::uno::Reference< css::chart2::XDiagram>& xDiagram
+ static bool changeVisibilityOfAxes( const rtl::Reference< ::chart::Diagram>& xDiagram
, const css::uno::Sequence< sal_Bool >& rOldExistenceList
, const css::uno::Sequence< sal_Bool >& rNewExistenceList
, const css::uno::Reference< css::uno::XComponentContext >& xContext
, ReferenceSizeProvider * pRefSizeProvider );
- static bool shouldAxisBeDisplayed( const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
- static bool isSecondaryYAxisNeeded( const css::uno::Reference<
- css::chart2::XCoordinateSystem >& xCooSys );
+ static bool shouldAxisBeDisplayed( const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
+ static bool isSecondaryYAxisNeeded( const rtl::Reference<
+ ::chart::BaseCoordinateSystem >& xCooSys );
- static css::uno::Reference< css::chart2::XChartType >
- getChartTypeByIndex( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys,
+ static rtl::Reference< ::chart::ChartType >
+ getChartTypeByIndex( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys,
sal_Int32 nIndex );
- static void setRTLAxisLayout( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
+ static void setRTLAxisLayout( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
- static css::uno::Reference< css::chart2::XChartType >
- getFirstChartTypeWithSeriesAttachedToAxisIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex );
+ static rtl::Reference< ::chart::ChartType >
+ getFirstChartTypeWithSeriesAttachedToAxisIndex( const rtl::Reference< ::chart::Diagram >& xDiagram, const sal_Int32 nAttachedAxisIndex );
static bool isAxisPositioningEnabled();
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/AxisIndexDefines.hxx b/chart2/source/inc/AxisIndexDefines.hxx
index 779f8fc7ff96..5e6d32d691b5 100644
--- a/chart2/source/inc/AxisIndexDefines.hxx
+++ b/chart2/source/inc/AxisIndexDefines.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_AXISINDEXDEFINES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_AXISINDEXDEFINES_HXX
+#pragma once
#include <sal/types.h>
@@ -28,6 +27,4 @@ const sal_Int32 SECONDARY_AXIS_INDEX = 1;
} // namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/inc/BaseCoordinateSystem.hxx b/chart2/source/inc/BaseCoordinateSystem.hxx
index 1f20e83a02dc..71f226abcd51 100644
--- a/chart2/source/model/inc/BaseCoordinateSystem.hxx
+++ b/chart2/source/inc/BaseCoordinateSystem.hxx
@@ -16,24 +16,23 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_INC_BASECOORDINATESYSTEM_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_INC_BASECOORDINATESYSTEM_HXX
+#pragma once
-#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
+#include "OPropertySet.hxx"
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
+#include "ModifyListenerHelper.hxx"
#include <vector>
namespace chart
{
+class Axis;
+class ChartType;
namespace impl
{
@@ -47,9 +46,8 @@ typedef ::cppu::WeakImplHelper
BaseCoordinateSystem_Base;
}
-class BaseCoordinateSystem :
+class SAL_DLLPUBLIC_RTTI BaseCoordinateSystem :
public impl::BaseCoordinateSystem_Base,
- public MutexContainer,
public ::property::OPropertySet
{
public:
@@ -58,7 +56,7 @@ public:
virtual ~BaseCoordinateSystem() override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -71,7 +69,6 @@ public:
/// merge XTypeProvider implementations
DECLARE_XTYPEPROVIDER()
-protected:
// ____ XCoordinateSystem ____
virtual ::sal_Int32 SAL_CALL getDimension() override;
virtual void SAL_CALL setAxisByDimension(
@@ -89,7 +86,7 @@ protected:
const css::uno::Reference< css::chart2::XChartType >& aChartType ) override;
virtual css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > SAL_CALL getChartTypes() override;
virtual void SAL_CALL setChartTypes(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aChartTypes ) override;
+ const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aChartTypes ) final override;
// ____ XModifyBroadcaster ____
virtual void SAL_CALL addModifyListener(
@@ -97,6 +94,14 @@ protected:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+ void setAxisByDimension( sal_Int32 nDimension, const rtl::Reference< ::chart::Axis >& xAxis, sal_Int32 nIndex );
+ const rtl::Reference< ::chart::Axis > & getAxisByDimension2(sal_Int32 nDimension, sal_Int32 nIndex ) const;
+
+ void setChartTypes( const std::vector< rtl::Reference< ::chart::ChartType > >& aChartTypes );
+ const std::vector< rtl::Reference<::chart::ChartType > > & getChartTypes2() const { return m_aChartTypes; }
+
+protected:
+
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -111,19 +116,14 @@ protected:
void fireModifyEvent();
-protected:
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
-
private:
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
sal_Int32 m_nDimensionCount;
- typedef std::vector< std::vector< css::uno::Reference< css::chart2::XAxis > > > tAxisVecVecType;
+ typedef std::vector< std::vector< rtl::Reference< ::chart::Axis > > > tAxisVecVecType;
tAxisVecVecType m_aAllAxis; //outer sequence is the dimension; inner sequence is the axis index that indicates main or secondary axis
- std::vector< css::uno::Reference< css::chart2::XChartType > > m_aChartTypes;
+ std::vector< rtl::Reference<::chart::ChartType > > m_aChartTypes;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_INC_BASECOORDINATESYSTEM_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/BaseGFXHelper.hxx b/chart2/source/inc/BaseGFXHelper.hxx
index 014371bfa20e..4ba4a65c8250 100644
--- a/chart2/source/inc/BaseGFXHelper.hxx
+++ b/chart2/source/inc/BaseGFXHelper.hxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_BASEGFXHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_BASEGFXHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <basegfx/matrix/b3dhommatrix.hxx>
#include <basegfx/range/b2irectangle.hxx>
#include <basegfx/tuple/b3dtuple.hxx>
@@ -34,25 +34,27 @@
namespace com::sun::star::awt { struct Rectangle; }
namespace com::sun::star::drawing { struct PolyPolygonShape3D; }
-namespace chart
-{
-namespace BaseGFXHelper
+namespace chart::BaseGFXHelper
{
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DRange getBoundVolume( const css::drawing::PolyPolygonShape3D& rPolyPoly );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ::basegfx::B3DRange getBoundVolume( const css::drawing::PolyPolygonShape3D& rPolyPoly );
+
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ::basegfx::B3DRange getBoundVolume( const std::vector<std::vector<css::drawing::Position3D>>& rPolyPoly );
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ::basegfx::B2IRectangle makeRectangle(
const css::awt::Point& rPosition,
const css::awt::Size& rSize );
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle( const css::awt::Rectangle& rRect );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ::basegfx::B2IRectangle makeRectangle( const css::awt::Rectangle& rRect );
-OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point B2IRectangleToAWTPoint(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::awt::Point B2IRectangleToAWTPoint(
const ::basegfx::B2IRectangle& rB2IRectangle );
-OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size B2IRectangleToAWTSize(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::awt::Size B2IRectangleToAWTSize(
const ::basegfx::B2IRectangle& rB2IRectangle );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::awt::Rectangle toAwtRectangle(const basegfx::B2IRectangle& rB2IRectangle);
+
::basegfx::B3DVector Direction3DToB3DVector(
const css::drawing::Direction3D& rDirection );
@@ -65,25 +67,21 @@ css::drawing::Direction3D B3DVectorToDirection3D(
css::drawing::Position3D B3DVectorToPosition3D(
const ::basegfx::B3DVector& rB3DVector );
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix(
const css::drawing::HomogenMatrix & rHomogenMatrix );
-OOO_DLLPUBLIC_CHARTTOOLS
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
css::drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix(
const ::basegfx::B3DHomMatrix & rB3DMatrix );
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetRotationFromMatrix(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ::basegfx::B3DTuple GetRotationFromMatrix(
const ::basegfx::B3DHomMatrix & rB3DMatrix );
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetScaleFromMatrix(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ::basegfx::B3DTuple GetScaleFromMatrix(
const ::basegfx::B3DHomMatrix & rB3DMatrix );
void ReduceToRotationMatrix( ::basegfx::B3DHomMatrix & rB3DMatrix );
-} // namespace BaseGFXHelper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_INC_BASEGFXHELPER_HXX
-#endif
+} // namespace chart::BaseGFXHelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/CachedDataSequence.hxx b/chart2/source/inc/CachedDataSequence.hxx
index 90acd6dbfa63..513907c2429d 100644
--- a/chart2/source/inc/CachedDataSequence.hxx
+++ b/chart2/source/inc/CachedDataSequence.hxx
@@ -16,14 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX
+#pragma once
// helper classes
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
#include <comphelper/uno3.hxx>
-#include <comphelper/broadcasthelper.hxx>
-#include <comphelper/propertycontainer.hxx>
+#include <comphelper/propertycontainer2.hxx>
#include <comphelper/proparrhlp.hxx>
// interfaces and types
@@ -33,7 +31,7 @@
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include "ModifyListenerHelper.hxx"
namespace com::sun::star::uno { class XComponentContext; }
@@ -42,7 +40,7 @@ namespace chart
namespace impl
{
-typedef ::cppu::WeakComponentImplHelper<
+typedef ::comphelper::WeakComponentImplHelper<
css::chart2::data::XDataSequence,
css::chart2::data::XNumericalDataSequence,
css::chart2::data::XTextualDataSequence,
@@ -57,8 +55,7 @@ typedef ::cppu::WeakComponentImplHelper<
* This sequence object does store actual values within, hence "cached".
*/
class CachedDataSequence final :
- public ::comphelper::OMutexAndBroadcastHelper,
- public ::comphelper::OPropertyContainer,
+ public ::comphelper::OPropertyContainer2,
public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >,
public impl::CachedDataSequence_Base
{
@@ -94,7 +91,7 @@ private:
/// @see css::beans::XPropertySet
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
/// @see ::comphelper::OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual ::cppu::IPropertyArrayHelper& getInfoHelper() override;
/// @see ::comphelper::OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
@@ -157,12 +154,9 @@ private:
css::uno::Sequence< double > m_aNumericalSequence;
css::uno::Sequence< OUString > m_aTextualSequence;
css::uno::Sequence< css::uno::Any > m_aMixedSequence;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ChangingResource.hxx b/chart2/source/inc/ChangingResource.hxx
index ca39d92b873d..bde5b0923400 100644
--- a/chart2/source/inc/ChangingResource.hxx
+++ b/chart2/source/inc/ChangingResource.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHANGINGRESOURCE_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHANGINGRESOURCE_HXX
+#pragma once
namespace chart
{
@@ -43,6 +42,5 @@ protected:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/CharacterProperties.hxx b/chart2/source/inc/CharacterProperties.hxx
index 7385bfe12020..40367f9b943d 100644
--- a/chart2/source/inc/CharacterProperties.hxx
+++ b/chart2/source/inc/CharacterProperties.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARACTERPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARACTERPROPERTIES_HXX
+#pragma once
#include "PropertyHelper.hxx"
#include "FastPropertyIdRanges.hxx"
@@ -121,20 +120,17 @@ namespace CharacterProperties
FAST_PROPERTY_ID_END_CHAR_PROP
};
- OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddPropertiesToVector(
std::vector< css::beans::Property > & rOutProperties );
- OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
- OOO_DLLPUBLIC_CHARTTOOLS bool IsCharacterPropertyHandle( sal_Int32 nHandle );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool IsCharacterPropertyHandle( sal_Int32 nHandle );
- OOO_DLLPUBLIC_CHARTTOOLS css::awt::FontDescriptor createFontDescriptorFromPropertySet(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::awt::FontDescriptor createFontDescriptorFromPropertySet(
const css::uno::Reference< css::beans::XMultiPropertySet > & xMultiPropSet );
}
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_CHARACTERPROPERTIES_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
index 0a8192706ef0..ec904ce8a7be 100644
--- a/chart2/source/inc/ChartModelHelper.hxx
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -16,11 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTMODELHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTMODELHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/awt/Size.hpp>
#include "charttoolsdllapi.hxx"
+#include <rtl/ref.hxx>
#include <vector>
@@ -37,53 +38,41 @@ namespace com::sun::star::view { class XSelectionSupplier; }
namespace chart
{
+class BaseCoordinateSystem;
+class ChartType;
+class DataSeries;
+class Diagram;
+class InternalDataProvider;
-class OOO_DLLPUBLIC_CHARTTOOLS ChartModelHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ChartModelHelper
{
public:
- static css::uno::Reference< css::chart2::data::XRangeHighlighter > createRangeHighlighter(
- const css::uno::Reference< css::view::XSelectionSupplier >& xSelectionSupplier );
+ static rtl::Reference< InternalDataProvider > createInternalDataProvider(
+ const rtl::Reference<::chart::ChartModel>& xChartDoc, bool bConnectToModel );
- static css::uno::Reference< css::chart2::data::XDataProvider > createInternalDataProvider(
- const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc, bool bConnectToModel );
+ static rtl::Reference< ::chart::BaseCoordinateSystem >
+ getFirstCoordinateSystem( const rtl::Reference<::chart::ChartModel>& xModel );
- static css::uno::Reference< css::chart2::XDiagram >
- findDiagram( const css::uno::Reference< css::frame::XModel >& xModel );
+ static std::vector< rtl::Reference< ::chart::DataSeries > >
+ getDataSeries( const rtl::Reference< ::chart::ChartModel > & xModel );
- static css::uno::Reference< css::chart2::XDiagram >
- findDiagram( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc );
-
- static css::uno::Reference< css::chart2::XCoordinateSystem >
- getFirstCoordinateSystem( ChartModel& rModel );
-
- static css::uno::Reference< css::chart2::XCoordinateSystem >
- getFirstCoordinateSystem( const css::uno::Reference< css::frame::XModel >& xModel );
-
- SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XDataSeries > >
- getDataSeries( ChartModel& rModel );
-
- SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XDataSeries > >
- getDataSeries( const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
- static std::vector< css::uno::Reference< css::chart2::XDataSeries > >
- getDataSeries( const css::uno::Reference< css::frame::XModel > & xModel );
-
- static css::uno::Reference< css::chart2::XChartType >
+ static rtl::Reference< ChartType >
getChartTypeOfSeries(
- const css::uno::Reference< css::frame::XModel >& xModel
- , const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries );
+ const rtl::Reference<::chart::ChartModel>& xModel
+ , const rtl::Reference< ::chart::DataSeries >& xGivenDataSeries );
static css::awt::Size getDefaultPageSize();
- static css::awt::Size getPageSize( const css::uno::Reference< css::frame::XModel >& xModel );
+ static css::awt::Size getPageSize( const rtl::Reference<::chart::ChartModel>& xModel );
- static void triggerRangeHighlighting( const css::uno::Reference< css::frame::XModel >& xModel );
+ static void triggerRangeHighlighting( const rtl::Reference<::chart::ChartModel>& xModel );
- static bool isIncludeHiddenCells( const css::uno::Reference< css::frame::XModel >& xChartModel );
+ static bool isIncludeHiddenCells( const rtl::Reference<::chart::ChartModel>& xChartModel );
static bool setIncludeHiddenCells( bool bIncludeHiddenCells, ChartModel& rModel);
+
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ChartResourceGroupDlgs.hxx b/chart2/source/inc/ChartResourceGroupDlgs.hxx
index 755e7af15345..e54585488971 100644
--- a/chart2/source/inc/ChartResourceGroupDlgs.hxx
+++ b/chart2/source/inc/ChartResourceGroupDlgs.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPDLGS_HXX
-#define INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPDLGS_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -26,7 +25,7 @@ namespace chart
{
class ChartTypeParameter;
-class SplinePropertiesDialog : public weld::GenericDialogController
+class SplinePropertiesDialog final : public weld::GenericDialogController
{
public:
explicit SplinePropertiesDialog(weld::Window* pParent);
@@ -44,7 +43,7 @@ private:
std::unique_ptr<weld::SpinButton> m_xMF_SplineOrder;
};
-class SteppedPropertiesDialog : public weld::GenericDialogController
+class SteppedPropertiesDialog final : public weld::GenericDialogController
{
public:
explicit SteppedPropertiesDialog(weld::Window* pParent);
@@ -60,6 +59,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ChartResourceGroups.hxx b/chart2/source/inc/ChartResourceGroups.hxx
index f3b3e2f4b2c5..ecb886f194af 100644
--- a/chart2/source/inc/ChartResourceGroups.hxx
+++ b/chart2/source/inc/ChartResourceGroups.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPS_HXX
-#define INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPS_HXX
+#pragma once
#include "res_BarGeometry.hxx"
#include "ChangingResource.hxx"
@@ -28,7 +27,6 @@
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
class SplinePropertiesDialog;
class SteppedPropertiesDialog;
@@ -39,7 +37,7 @@ enum
POS_3DSCHEME_REALISTIC = 1
};
-class Dim3DLookResourceGroup : public ChangingResource
+class Dim3DLookResourceGroup final : public ChangingResource
{
public:
explicit Dim3DLookResourceGroup(weld::Builder* pBuilder);
@@ -50,7 +48,7 @@ public:
void fillParameter(ChartTypeParameter& rParameter);
private:
- DECL_LINK(Dim3DLookCheckHdl, weld::ToggleButton&, void);
+ DECL_LINK(Dim3DLookCheckHdl, weld::Toggleable&, void);
DECL_LINK(SelectSchemeHdl, weld::ComboBox&, void);
private:
@@ -58,7 +56,7 @@ private:
std::unique_ptr<weld::ComboBox> m_xLB_Scheme;
};
-class SortByXValuesResourceGroup : public ChangingResource
+class SortByXValuesResourceGroup final : public ChangingResource
{
public:
explicit SortByXValuesResourceGroup(weld::Builder* pBuilder);
@@ -69,13 +67,13 @@ public:
void fillParameter(ChartTypeParameter& rParameter);
private:
- DECL_LINK(SortByXValuesCheckHdl, weld::ToggleButton&, void);
+ DECL_LINK(SortByXValuesCheckHdl, weld::Toggleable&, void);
private:
std::unique_ptr<weld::CheckButton> m_xCB_XValueSorting;
};
-class StackingResourceGroup : public ChangingResource
+class StackingResourceGroup final : public ChangingResource
{
public:
explicit StackingResourceGroup(weld::Builder* pBuilder);
@@ -86,8 +84,8 @@ public:
void fillParameter(ChartTypeParameter& rParameter);
private:
- DECL_LINK(StackingChangeHdl, weld::ToggleButton&, void);
- DECL_LINK(StackingEnableHdl, weld::ToggleButton&, void);
+ DECL_LINK(StackingChangeHdl, weld::Toggleable&, void);
+ DECL_LINK(StackingEnableHdl, weld::Toggleable&, void);
private:
std::unique_ptr<weld::CheckButton> m_xCB_Stacked;
@@ -100,7 +98,7 @@ private:
#define POS_LINETYPE_SMOOTH 1
#define POS_LINETYPE_STEPPED 2
-class SplineResourceGroup : public ChangingResource
+class SplineResourceGroup final : public ChangingResource
{
public:
explicit SplineResourceGroup(weld::Builder* pBuilder, weld::Window* pParent);
@@ -114,19 +112,19 @@ private:
DECL_LINK(LineTypeChangeHdl, weld::ComboBox&, void);
DECL_LINK(SplineDetailsDialogHdl, weld::Button&, void);
DECL_LINK(SteppedDetailsDialogHdl, weld::Button&, void);
- SplinePropertiesDialog& getSplinePropertiesDialog();
- SteppedPropertiesDialog& getSteppedPropertiesDialog();
+ std::shared_ptr<SplinePropertiesDialog> getSplinePropertiesDialog();
+ std::shared_ptr<SteppedPropertiesDialog> getSteppedPropertiesDialog();
private:
weld::Window* m_pParent;
std::unique_ptr<weld::Label> m_xFT_LineType;
std::unique_ptr<weld::ComboBox> m_xLB_LineType;
std::unique_ptr<weld::Button> m_xPB_DetailsDialog;
- std::unique_ptr<SplinePropertiesDialog> m_xSplinePropertiesDialog;
- std::unique_ptr<SteppedPropertiesDialog> m_xSteppedPropertiesDialog;
+ std::shared_ptr<SplinePropertiesDialog> m_xSplinePropertiesDialog;
+ std::shared_ptr<SteppedPropertiesDialog> m_xSteppedPropertiesDialog;
};
-class GeometryResourceGroup : public ChangingResource
+class GeometryResourceGroup final : public ChangingResource
{
public:
explicit GeometryResourceGroup(weld::Builder* pBuilder);
@@ -144,6 +142,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/ChartType.hxx b/chart2/source/inc/ChartType.hxx
index 3274d5660c9b..fa55cf05694f 100644
--- a/chart2/source/model/template/ChartType.hxx
+++ b/chart2/source/inc/ChartType.hxx
@@ -16,11 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CHARTTYPE_HXX
+#pragma once
-#include <MutexContainer.hxx>
-#include <OPropertySet.hxx>
+#include "OPropertySet.hxx"
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -29,11 +27,25 @@
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
+#include <rtl/ref.hxx>
#include <vector>
+#include "charttoolsdllapi.hxx"
namespace chart
{
+class BaseCoordinateSystem;
+class DataSeries;
+class ModifyEventForwarder;
+
+enum
+{
+ PROP_PIECHARTTYPE_USE_RINGS,
+ PROP_PIECHARTTYPE_3DRELATIVEHEIGHT,
+ PROP_PIECHARTTYPE_SUBTYPE // none, of-bar, of-pie
+};
+
+
namespace impl
{
@@ -47,8 +59,7 @@ typedef ::cppu::WeakImplHelper<
ChartType_Base;
}
-class ChartType :
- public MutexContainer,
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ChartType :
public impl::ChartType_Base,
public ::property::OPropertySet
{
@@ -59,14 +70,13 @@ public:
/// merge XInterface implementations
DECLARE_XINTERFACE()
-protected:
explicit ChartType( const ChartType & rOther );
// ____ XChartType ____
// still abstract ! implement !
virtual OUString SAL_CALL getChartType() override = 0;
virtual css::uno::Reference< css::chart2::XCoordinateSystem > SAL_CALL
- createCoordinateSystem( ::sal_Int32 DimensionCount ) override;
+ createCoordinateSystem( ::sal_Int32 DimensionCount ) final override;
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedMandatoryRoles() override;
virtual css::uno::Sequence< OUString > SAL_CALL
@@ -89,6 +99,21 @@ protected:
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+
+ virtual rtl::Reference<ChartType> cloneChartType() const = 0;
+
+ void addDataSeries(
+ const rtl::Reference< ::chart::DataSeries >& aDataSeries );
+ void removeDataSeries(
+ const rtl::Reference< ::chart::DataSeries >& aDataSeries );
+ void setDataSeries(
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& aDataSeries );
+ const std::vector< rtl::Reference< ::chart::DataSeries > > & getDataSeries2() const { return m_aDataSeries; }
+
+ virtual rtl::Reference< ::chart::BaseCoordinateSystem >
+ createCoordinateSystem2( sal_Int32 DimensionCount );
+
+protected:
// ____ XModifyListener ____
virtual void SAL_CALL modified(
@@ -101,7 +126,7 @@ protected:
void fireModifyEvent();
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
virtual void firePropertyChangeEvent() override;
@@ -115,16 +140,15 @@ protected:
DECLARE_XTYPEPROVIDER()
protected:
- css::uno::Reference< css::util::XModifyListener >
- const m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
private:
void impl_addDataSeriesWithoutNotification(
- const css::uno::Reference< css::chart2::XDataSeries >& aDataSeries );
+ const rtl::Reference< ::chart::DataSeries >& aDataSeries );
private:
typedef
- std::vector< css::uno::Reference< css::chart2::XDataSeries > > tDataSeriesContainerType;
+ std::vector< rtl::Reference< ::chart::DataSeries > > tDataSeriesContainerType;
// --- mutable members: the following members need mutex guard ---
@@ -135,7 +159,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ChartTypeDialogController.hxx b/chart2/source/inc/ChartTypeDialogController.hxx
index f65ce90a5008..4c03ff269e1f 100644
--- a/chart2/source/inc/ChartTypeDialogController.hxx
+++ b/chart2/source/inc/ChartTypeDialogController.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX
+#pragma once
#include <sal/config.h>
@@ -30,63 +29,27 @@
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <vcl/weld.hxx>
-namespace com
-{
-namespace sun
-{
-namespace star
-{
-namespace beans
+namespace com::sun::star::beans
{
class XPropertySet;
}
-}
-}
-}
-namespace com
-{
-namespace sun
-{
-namespace star
-{
-namespace chart2
+namespace com::sun::star::chart2
{
class XChartDocument;
}
-}
-}
-}
-namespace com
-{
-namespace sun
-{
-namespace star
-{
-namespace chart2
-{
-class XChartTypeTemplate;
-}
-}
-}
-}
-namespace com
-{
-namespace sun
-{
-namespace star
-{
-namespace lang
+namespace com::sun::star::lang
{
class XMultiServiceFactory;
}
-}
-}
-}
class ValueSet;
namespace chart
{
+class ChartModel;
+class ChartTypeTemplate;
+class ChartTypeManager;
+
enum GlobalStackMode
{
GlobalStackMode_NONE,
@@ -151,7 +114,7 @@ public:
virtual void showExtraControls(weld::Builder* pBuilder);
virtual void hideExtraControls() const;
virtual void
- fillExtraControls(const css::uno::Reference<css::chart2::XChartDocument>& xChartModel,
+ fillExtraControls(const rtl::Reference<::chart::ChartModel>& xChartModel,
const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const;
/// @throws css::uno::RuntimeException
virtual void setTemplateProperties(
@@ -168,10 +131,10 @@ public:
virtual void adjustParameterToMainType(ChartTypeParameter& rParameter);
OUString getServiceNameForParameter(const ChartTypeParameter& rParameter) const;
void commitToModel(const ChartTypeParameter& rParameter,
- const css::uno::Reference<css::chart2::XChartDocument>& xChartModel);
- css::uno::Reference<css::chart2::XChartTypeTemplate> getCurrentTemplate(
- const ChartTypeParameter& rParameter,
- const css::uno::Reference<css::lang::XMultiServiceFactory>& xTemplateManager) const;
+ const rtl::Reference<::chart::ChartModel>& xChartModel);
+ rtl::Reference<::chart::ChartTypeTemplate>
+ getCurrentTemplate(const ChartTypeParameter& rParameter,
+ const rtl::Reference<::chart::ChartTypeManager>& xTemplateManager) const;
protected:
bool bSupportsXAxisWithValues;
@@ -190,7 +153,7 @@ public:
virtual void adjustSubTypeAndEnableControls(ChartTypeParameter& rParameter) override;
};
-class ColumnChartDialogController : public ColumnOrBarChartDialogController_Base
+class ColumnChartDialogController final : public ColumnOrBarChartDialogController_Base
{
public:
ColumnChartDialogController();
@@ -203,7 +166,7 @@ public:
const ChartTypeParameter& rParameter) override;
};
-class BarChartDialogController : public ColumnOrBarChartDialogController_Base
+class BarChartDialogController final : public ColumnOrBarChartDialogController_Base
{
public:
BarChartDialogController();
@@ -216,7 +179,7 @@ public:
const ChartTypeParameter& rParameter) override;
};
-class PieChartDialogController : public ChartTypeDialogController
+class PieChartDialogController final : public ChartTypeDialogController
{
public:
PieChartDialogController();
@@ -232,7 +195,7 @@ public:
virtual bool shouldShow_3DLookControl() const override;
};
-class LineChartDialogController : public ChartTypeDialogController
+class LineChartDialogController final : public ChartTypeDialogController
{
public:
LineChartDialogController();
@@ -250,7 +213,7 @@ public:
virtual bool shouldShow_SplineControl() const override;
};
-class XYChartDialogController : public ChartTypeDialogController
+class XYChartDialogController final : public ChartTypeDialogController
{
public:
XYChartDialogController();
@@ -267,7 +230,7 @@ public:
virtual bool shouldShow_SortByXValuesResourceGroup() const override;
};
-class AreaChartDialogController : public ChartTypeDialogController
+class AreaChartDialogController final : public ChartTypeDialogController
{
public:
AreaChartDialogController();
@@ -284,7 +247,7 @@ public:
virtual bool shouldShow_3DLookControl() const override;
};
-class NetChartDialogController : public ChartTypeDialogController
+class NetChartDialogController final : public ChartTypeDialogController
{
public:
NetChartDialogController();
@@ -300,7 +263,7 @@ public:
virtual bool shouldShow_StackingControl() const override;
};
-class StockChartDialogController : public ChartTypeDialogController
+class StockChartDialogController final : public ChartTypeDialogController
{
public:
StockChartDialogController();
@@ -314,7 +277,7 @@ public:
virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override;
};
-class CombiColumnLineChartDialogController : public ChartTypeDialogController
+class CombiColumnLineChartDialogController final : public ChartTypeDialogController
{
public:
CombiColumnLineChartDialogController();
@@ -329,7 +292,7 @@ public:
virtual void showExtraControls(weld::Builder* pBuilder) override;
virtual void hideExtraControls() const override;
virtual void fillExtraControls(
- const css::uno::Reference<css::chart2::XChartDocument>& xChartModel,
+ const rtl::Reference<::chart::ChartModel>& xChartModel,
const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override;
virtual void setTemplateProperties(
@@ -343,7 +306,7 @@ private:
std::unique_ptr<weld::SpinButton> m_xMF_NumberOfLines;
};
-class BubbleChartDialogController : public ChartTypeDialogController
+class BubbleChartDialogController final : public ChartTypeDialogController
{
public:
BubbleChartDialogController();
@@ -358,6 +321,5 @@ public:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
index e749dd5b4f75..7366e4689773 100644
--- a/chart2/source/inc/ChartTypeHelper.hxx
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -17,72 +17,76 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTTYPEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTTYPEHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/drawing/Direction3D.hpp>
#include "charttoolsdllapi.hxx"
+#include "ChartType.hxx"
+#include <rtl/ref.hxx>
namespace com::sun::star::chart2 { class XChartType; }
namespace com::sun::star::chart2 { class XDataSeries; }
namespace chart
{
+class ChartType;
+class DataSeries;
-class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ChartTypeHelper
{
public:
- static bool isSupportingGeometryProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingStatisticProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingRegressionProperties(const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingMainAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
- static bool isSupportingSecondaryAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingAreaProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingSymbolProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingOverlapAndGapWidthProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingBarConnectors( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingRightAngledAxes( const css::uno::Reference< css::chart2::XChartType >& xChartType );
- static bool isSupportingAxisSideBySide( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
- static bool isSupportingStartingAngle( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ static bool isSupportingGeometryProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingStatisticProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingRegressionProperties(const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingMainAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
+ static bool isSupportingSecondaryAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingAreaProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingSymbolProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingOverlapAndGapWidthProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingBarConnectors( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingRightAngledAxes( const rtl::Reference< ::chart::ChartType >& xChartType );
+ static bool isSupportingAxisSideBySide( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingStartingAngle( const rtl::Reference< ::chart::ChartType >& xChartType );
//starting value for bars or baseline for areas for example
- static bool isSupportingBaseValue( const css::uno::Reference< css::chart2::XChartType >& xChartType );
- static bool isSupportingAxisPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
- static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex );
- static bool isSupportingComplexCategory( const css::uno::Reference< css::chart2::XChartType >& xChartType );
- static bool isSupportingCategoryPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingBaseValue( const rtl::Reference< ::chart::ChartType >& xChartType );
+ static bool isSupportingAxisPositioning( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
+ static bool isSupportingDateAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionIndex );
+ static bool isSupportingComplexCategory( const rtl::Reference< ::chart::ChartType >& xChartType );
+ static bool isSupportingCategoryPositioning( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool shiftCategoryPosAtXAxisPerDefault( const rtl::Reference< ::chart::ChartType >& xChartType );
//returns sequence of css::chart::DataLabelPlacement
static css::uno::Sequence < sal_Int32 > getSupportedLabelPlacements(
- const css::uno::Reference< css::chart2::XChartType >& xChartType, bool bSwapXAndY
- , const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+ const rtl::Reference< ::chart::ChartType >& xChartType, bool bSwapXAndY
+ , const rtl::Reference< ::chart::DataSeries >& xSeries );
//returns sequence of css::chart::MissingValueTreatment
static css::uno::Sequence < sal_Int32 > getSupportedMissingValueTreatments(
- const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ const rtl::Reference< ::chart::ChartType >& xChartType );
- SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultSimpleLightDirection( const css::uno::Reference< css::chart2::XChartType >& xChartType );
- SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultRealisticLightDirection( const css::uno::Reference< css::chart2::XChartType >& xChartType );
- SAL_DLLPRIVATE static sal_Int32 getDefaultDirectLightColor( bool bSimple, const css::uno::Reference< css::chart2::XChartType >& xChartType );
- SAL_DLLPRIVATE static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const css::uno::Reference< css::chart2::XChartType >& xChartType );
- static sal_Int32 getNumberOfDisplayedSeries( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries );
- SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultSimpleLightDirection( const rtl::Reference< ::chart::ChartType >& xChartType );
+ SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultRealisticLightDirection( const rtl::Reference< ::chart::ChartType >& xChartType );
+ SAL_DLLPRIVATE static sal_Int32 getDefaultDirectLightColor( bool bSimple, const rtl::Reference< ::chart::ChartType >& xChartType );
+ SAL_DLLPRIVATE static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const rtl::Reference< ::chart::ChartType >& xChartType );
+ static sal_Int32 getNumberOfDisplayedSeries( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nNumberOfSeries );
+ SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const rtl::Reference< ::chart::ChartType >& xChartType );
- static bool isSeriesInFrontOfAxisLine( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ static bool isSeriesInFrontOfAxisLine( const rtl::Reference< ::chart::ChartType >& xChartType );
static sal_Int32 //one of css::chart2::AxisType
- getAxisType( const css::uno::Reference< css::chart2::XChartType >& xChartType
+ getAxisType( const rtl::Reference< ::chart::ChartType >& xChartType
, sal_Int32 nDimensionIndex );
- static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const css::uno::Reference<
- css::chart2::XChartType >& xChartType );
+ static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference<
+ ::chart::ChartType >& xChartType );
- static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const css::uno::Reference<
- css::chart2::XChartType >& xChartType );
+ static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::Reference<
+ ::chart::ChartType >& xChartType );
- static bool isSupportingOnlyDeepStackingFor3D( const css::uno::Reference< css::chart2::XChartType >& xChartType );
+ static bool isSupportingOnlyDeepStackingFor3D( const rtl::Reference< ::chart::ChartType >& xChartType );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/ChartTypeTemplate.hxx b/chart2/source/inc/ChartTypeTemplate.hxx
index 0fe236ce1eb8..ffd7cca26599 100644
--- a/chart2/source/model/template/ChartTypeTemplate.hxx
+++ b/chart2/source/inc/ChartTypeTemplate.hxx
@@ -16,21 +16,34 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CHARTTYPETEMPLATE_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
-#include <StackMode.hxx>
+#include "DataInterpreter.hxx"
+#include "StackMode.hxx"
#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
+#include "charttoolsdllapi.hxx"
+#include <rtl/ref.hxx>
+#include <vector>
+namespace com::sun::star::beans { struct PropertyValue; }
namespace com::sun::star::chart2 { class XChartType; }
+namespace com::sun::star::chart2 { class XCoordinateSystem; }
namespace com::sun::star::chart2 { class XCoordinateSystemContainer; }
namespace com::sun::star::chart2 { class XDataSeries; }
+namespace com::sun::star::chart2 { class XDiagram; }
+namespace com::sun::star::chart2::data { class XDataSource; }
+namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class BaseCoordinateSystem;
+class ChartType;
+class DataSeries;
+class Diagram;
+class LabeledDataSequence;
/** For creating diagrams and modifying existing diagrams. A base class that
implements XChartTypeTemplate and offers some tooling for classes that
@@ -66,46 +79,69 @@ namespace chart
* create an XLegend via the global service factory, set it at the diagram.
*/
-class ChartTypeTemplate : public ::cppu::WeakImplHelper<
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ChartTypeTemplate : public ::cppu::WeakImplHelper<
css::chart2::XChartTypeTemplate,
css::lang::XServiceName >
{
public:
explicit ChartTypeTemplate( css::uno::Reference< css::uno::XComponentContext > const & xContext,
- const OUString & rServiceName );
+ OUString aServiceName );
virtual ~ChartTypeTemplate() override;
-protected:
+ rtl::Reference< ::chart::Diagram > createDiagramByDataSource2(
+ const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
+ const css::uno::Sequence< css::beans::PropertyValue >& aArguments );
+
// ____ XChartTypeTemplate ____
virtual css::uno::Reference< css::chart2::XDiagram > SAL_CALL createDiagramByDataSource(
const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
- const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override;
+ const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override final;
/// denotes if the chart needs categories at the first scale
virtual sal_Bool SAL_CALL supportsCategories() override;
-
virtual void SAL_CALL changeDiagram(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override;
+ const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override final;
virtual void SAL_CALL changeDiagramData(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
- const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override;
+ const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override final;
virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference<
- css::chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties ) override;
- // still abstract: getChartTypeForNewSeries()
- virtual css::uno::Reference< css::chart2::XDataInterpreter > SAL_CALL getDataInterpreter() override;
+ const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties ) override final;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getDataInterpreter() override final;
+ virtual css::uno::Reference< ::css::chart2::XChartType > SAL_CALL getChartTypeForNewSeries(
+ const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override final;
virtual void SAL_CALL applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
- ::sal_Int32 nSeriesCount ) override;
+ ::sal_Int32 nSeriesCount ) override final;
virtual void SAL_CALL resetStyles(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override;
+ const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override final;
+
+ void changeDiagram(
+ const rtl::Reference< ::chart::Diagram >& xDiagram );
+ void changeDiagramData(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
+ const css::uno::Sequence< css::beans::PropertyValue >& aArguments );
+ virtual bool matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties );
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) = 0;
+ virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2();
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount );
+ virtual void resetStyles2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram );
/// @throws css::uno::RuntimeException
void applyStyles(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ const rtl::Reference< ::chart::Diagram >& xDiagram );
// ____ XServiceName ____
virtual OUString SAL_CALL getServiceName() override;
@@ -125,7 +161,7 @@ protected:
*/
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) = 0;
virtual bool isSwapXAndY() const;
@@ -138,7 +174,7 @@ protected:
changeDiagram
*/
virtual void adaptDiagram(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
/** Creates a 2d or 3d cartesian coordinate system with mathematically
oriented, linear scales with auto-min/max. If the given
@@ -148,7 +184,7 @@ protected:
<p>The dimension depends on the value returned by getDimension().</p>
*/
virtual void createCoordinateSystems(
- const css::uno::Reference< css::chart2::XCoordinateSystemContainer > & xOutCooSysCnt );
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
/** Sets categories at the scales of dimension 0 and the percent stacking at
the scales of dimension 1 of all given coordinate systems.
@@ -156,7 +192,7 @@ protected:
<p>Called by FillDiagram.</p>
*/
virtual void adaptScales(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & aCooSysSeq,
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & aCooSysSeq,
const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xCategories );
/** create a data series tree, that fits the requirements of the chart type.
@@ -185,16 +221,14 @@ protected:
empty.</p>
*/
virtual void createChartTypes(
- const css::uno::Sequence<
- css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XDataSeries > > > & aSeriesSeq,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XCoordinateSystem > > & rCoordSys,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XChartType > > & aOldChartTypesSeq
+ const std::vector<
+ std::vector<
+ rtl::Reference<
+ ::chart::DataSeries > > > & aSeriesSeq,
+ const std::vector<
+ rtl::Reference<
+ ::chart::BaseCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
);
/** create axes and add them to the given container. If there are already
@@ -206,7 +240,7 @@ protected:
requesting a secondary axes a secondary y axes is added</p>
*/
void createAxes(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & rCoordSys );
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys );
/** Give the number of requested axis per dimension here. Default is one
axis for each dimension
@@ -216,18 +250,18 @@ protected:
/** adapt properties of existing axes and remove superfluous axes
*/
virtual void adaptAxes(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & rCoordSys );
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys );
const css::uno::Reference< css::uno::XComponentContext >&
GetComponentContext() const { return m_xContext;}
static void copyPropertiesFromOldToNewCoordinateSystem(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > & rOldChartTypesSeq,
- const css::uno::Reference< css::chart2::XChartType > & xNewChartType );
+ const std::vector< rtl::Reference< ChartType > > & rOldChartTypesSeq,
+ const rtl::Reference< ChartType > & xNewChartType );
protected:
css::uno::Reference< css::uno::XComponentContext > m_xContext;
- mutable css::uno::Reference< css::chart2::XDataInterpreter > m_xDataInterpreter;
+ mutable rtl::Reference< ::chart::DataInterpreter > m_xDataInterpreter;
private:
const OUString m_aServiceName;
@@ -235,22 +269,15 @@ private:
private:
/** modifies the given diagram
*/
- void FillDiagram( const css::uno::Reference<
- css::chart2::XDiagram > & xDiagram,
- const css::uno::Sequence<
- css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XDataSeries > > > & aSeriesSeq,
- const css::uno::Reference<
- css::chart2::data::XLabeledDataSequence >& xCategories,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XChartType > > & aOldChartTypesSeq);
+ void FillDiagram( const rtl::Reference< ::chart::Diagram >& xDiagram,
+ const std::vector<
+ std::vector<
+ rtl::Reference<
+ ::chart::DataSeries > > > & aSeriesSeq,
+ const css::uno::Reference< css::chart2::data::XLabeledDataSequence >& xCategories,
+ const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq);
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ChartTypeTemplateProvider.hxx b/chart2/source/inc/ChartTypeTemplateProvider.hxx
index fc4517d1bc4e..400b1c8e2819 100644
--- a/chart2/source/inc/ChartTypeTemplateProvider.hxx
+++ b/chart2/source/inc/ChartTypeTemplateProvider.hxx
@@ -17,35 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPETEMPLATEPROVIDER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPETEMPLATEPROVIDER_HXX
+#pragma once
-#include <com/sun/star/uno/Reference.hxx>
-
-namespace com
-{
-namespace sun
-{
-namespace star
-{
-namespace chart2
-{
-class XChartTypeTemplate;
-}
-}
-}
-}
+#include <rtl/ref.hxx>
namespace chart
{
+class ChartTypeTemplate;
+
class ChartTypeTemplateProvider
{
public:
- virtual css::uno::Reference<css::chart2::XChartTypeTemplate> getCurrentTemplate() const = 0;
+ virtual rtl::Reference<::chart::ChartTypeTemplate> getCurrentTemplate() const = 0;
virtual ~ChartTypeTemplateProvider() {}
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ChartViewHelper.hxx b/chart2/source/inc/ChartViewHelper.hxx
index 48f7c27b6fac..0ffe60220f60 100644
--- a/chart2/source/inc/ChartViewHelper.hxx
+++ b/chart2/source/inc/ChartViewHelper.hxx
@@ -16,24 +16,32 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEWHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEWHELPER_HXX
+#pragma once
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
+#include <rtl/ref.hxx>
-namespace com::sun::star::uno { template <class interface_type> class Reference; }
-namespace com::sun::star::frame { class XModel; }
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::chart2
+{
+class XChartDocument;
+}
namespace chart
{
+class ChartModel;
-class OOO_DLLPUBLIC_CHARTTOOLS ChartViewHelper
+namespace ChartViewHelper
{
-public:
- static void setViewToDirtyState( const css::uno::Reference< css::frame::XModel >& xChartModel );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void setViewToDirtyState(const rtl::Reference<ChartModel>& xChartModel);
+
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void setViewToDirtyState_UNO(const css::uno::Reference<css::chart2::XChartDocument>& xChartModel);
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/CloneHelper.hxx b/chart2/source/inc/CloneHelper.hxx
index da697e05ece4..cabcdb58366f 100644
--- a/chart2/source/inc/CloneHelper.hxx
+++ b/chart2/source/inc/CloneHelper.hxx
@@ -16,18 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CLONEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CLONEHELPER_HXX
+#pragma once
#include <com/sun/star/util/XCloneable.hpp>
-
-#include <algorithm>
+#include <rtl/ref.hxx>
#include <iterator>
#include <vector>
-namespace chart
-{
-namespace CloneHelper
+namespace chart::CloneHelper
{
/// functor that clones a UNO-Reference
@@ -57,6 +53,15 @@ template< class Interface >
CreateRefClone< Interface >());
}
+template< class T >
+ void CloneRefVector(
+ const std::vector< rtl::Reference< T > > & rSource,
+ std::vector< rtl::Reference< T > > & rDestination )
+{
+ for (const auto & rSourceItem : rSource)
+ rDestination.push_back(static_cast<T*>(rSourceItem->createClone().get()));
+}
+
/// clones a UNO-sequence of UNO-References
template< class Interface >
void CloneRefSequence(
@@ -69,10 +74,6 @@ template< class Interface >
CreateRefClone< Interface >());
}
-} // namespace CloneHelper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_INC_CLONEHELPER_HXX
-#endif
+} // namespace chart::CloneHelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ColorPerPointHelper.hxx b/chart2/source/inc/ColorPerPointHelper.hxx
index 6c34693da111..575019e9bbb2 100644
--- a/chart2/source/inc/ColorPerPointHelper.hxx
+++ b/chart2/source/inc/ColorPerPointHelper.hxx
@@ -17,22 +17,24 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_COLORPERPOINTHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_COLORPERPOINTHELPER_HXX
+#pragma once
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
+#include <rtl/ref.hxx>
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::uno { template <class interface_type> class Reference; }
namespace chart
{
+class DataSeries;
-class OOO_DLLPUBLIC_CHARTTOOLS ColorPerPointHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ColorPerPointHelper
{
public:
static bool hasPointOwnColor(
- const css::uno::Reference< css::beans::XPropertySet >& xDataSeriesProperties
+ const rtl::Reference< ::chart::DataSeries >& xDataSeries
, sal_Int32 nPointIndex
, const css::uno::Reference< css::beans::XPropertySet >& xDataPointProperties //may be NULL this is just for performance
);
@@ -40,11 +42,10 @@ public:
// returns true if AttributedDataPoints contains nPointIndex and the
// property Color is DEFAULT
SAL_DLLPRIVATE static bool hasPointOwnProperties(
- const css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties
+ const rtl::Reference< ::chart::DataSeries >& xDataSeries
, sal_Int32 nPointIndex );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx
index 940b95d70502..c6dc7b2ecd1d 100644
--- a/chart2/source/inc/CommonConverters.hxx
+++ b/chart2/source/inc/CommonConverters.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_COMMONCONVERTERS_HXX
-#define INCLUDED_CHART2_SOURCE_INC_COMMONCONVERTERS_HXX
+#pragma once
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -30,6 +29,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/point/b3dpoint.hxx>
#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
#include "charttoolsdllapi.hxx"
namespace com::sun::star::awt { struct Rectangle; }
@@ -85,21 +85,28 @@ OOO_DLLPUBLIC_CHARTTOOLS
void AddPointToPoly( css::drawing::PolyPolygonShape3D& rPoly
, const css::drawing::Position3D& rPos
, sal_Int32 nSequenceIndex=0 );
+OOO_DLLPUBLIC_CHARTTOOLS
+void AddPointToPoly( std::vector<std::vector<css::drawing::Position3D>>& rPoly
+ , const css::drawing::Position3D& rPos
+ , sal_Int32 nSequenceIndex=0 );
/** get a single Point from a Polygon
*/
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D getPointFromPoly(
+ const std::vector<std::vector<css::drawing::Position3D>>& rPolygon
+ , sal_Int32 nPointIndex, sal_Int32 nPolyIndex );
+OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D getPointFromPoly(
const css::drawing::PolyPolygonShape3D& rPolygon
, sal_Int32 nPointIndex, sal_Int32 nPolyIndex );
OOO_DLLPUBLIC_CHARTTOOLS
-void addPolygon( css::drawing::PolyPolygonShape3D& rRet
- , const css::drawing::PolyPolygonShape3D& rAdd );
+void addPolygon( std::vector<std::vector<css::drawing::Position3D>>& rRet
+ , const std::vector<std::vector<css::drawing::Position3D>>& rAdd );
/** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D
*/
OOO_DLLPUBLIC_CHARTTOOLS
-void appendPoly( css::drawing::PolyPolygonShape3D& rRet
- , const css::drawing::PolyPolygonShape3D& rAdd );
+void appendPoly( std::vector<std::vector<css::drawing::Position3D>>& rRet
+ , const std::vector<std::vector<css::drawing::Position3D>>& rAdd );
/** PolyPolygonBezierCoords -> PolyPolygonShape3D
*/
@@ -112,12 +119,21 @@ css::drawing::PolyPolygonShape3D BezierToPoly(
OOO_DLLPUBLIC_CHARTTOOLS
css::drawing::PointSequenceSequence PolyToPointSequence(
const css::drawing::PolyPolygonShape3D& rPolyPolygon );
+OOO_DLLPUBLIC_CHARTTOOLS
+css::drawing::PointSequenceSequence PolyToPointSequence(
+ const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon );
+
+/** PolyPolygonShape3D -> basegfx::B2DPolyPolygon (2D)
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+basegfx::B2DPolyPolygon PolyToB2DPolyPolygon(
+ const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon );
/** drawing::PointSequenceSequence + drawing::PointSequenceSequence
*/
OOO_DLLPUBLIC_CHARTTOOLS
void appendPointSequence( css::drawing::PointSequenceSequence& rTarget
- , css::drawing::PointSequenceSequence& rAdd );
+ , const css::drawing::PointSequenceSequence& rAdd );
/** Position3D + Direction3D == Position3D
*/
@@ -147,21 +163,11 @@ OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point Position3DToAWTPoint( const css::drawin
*/
OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size Direction3DToAWTSize( const css::drawing::Direction3D& rDirection );
-/** B3DPoint -> Sequence<double>
-*/
-OOO_DLLPUBLIC_CHARTTOOLS css::uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint );
-
/** Sequence<double> -> drawing::Position3D
*/
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D
SequenceToPosition3D( const css::uno::Sequence< double >& rSeq );
-/** drawing::Position3D -> Sequence<double>
-*/
-
-OOO_DLLPUBLIC_CHARTTOOLS css::uno::Sequence< double >
- Position3DToSequence( const css::drawing::Position3D& rPosition );
-
/** chart2::XDataSequence -> uno::Sequence< double >
*/
@@ -173,22 +179,22 @@ OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Sequence< OUString > DataSequenceToStringSequence(
const css::uno::Reference< css::chart2::data::XDataSequence > & xDataSequence );
-/** uno::Sequence< uno::Sequence< T > > -> uno::Sequence< T >
+/** std::vector< std::vector< T > > -> std::vector< T >
*/
template< typename T >
-css::uno::Sequence< T >
- FlattenSequence( const css::uno::Sequence< css::uno::Sequence< T > > & aSeqSeq )
+std::vector< T >
+ FlattenSequence( const std::vector< std::vector< T > > & aSeqSeq )
{
sal_Int32 nOuter, nInner, nCount = 0,
nResultSize = 0;
- const sal_Int32 nOuterSize = aSeqSeq.getLength();
+ const sal_Int32 nOuterSize = aSeqSeq.size();
for( nOuter=0; nOuter<nOuterSize; ++nOuter )
- nResultSize += aSeqSeq[nOuter].getLength();
- css::uno::Sequence< T > aResult( nResultSize );
+ nResultSize += aSeqSeq[nOuter].size();
+ std::vector< T > aResult( nResultSize );
for( nOuter=0; nOuter<nOuterSize; ++nOuter )
{
- const sal_Int32 nInnerSize = aSeqSeq[nOuter].getLength();
+ const sal_Int32 nInnerSize = aSeqSeq[nOuter].size();
for( nInner=0; nInner<nInnerSize; ++nInner, ++nCount )
aResult[nCount] = aSeqSeq[nOuter][nInner];
}
@@ -205,10 +211,9 @@ sal_Int16 getShortForLongAlso( const css::uno::Any& rAny );
OOO_DLLPUBLIC_CHARTTOOLS
bool replaceParamterInString( OUString & rInOutResourceString,
- const OUString & rParamToReplace,
- const OUString & rReplaceWith );
+ std::u16string_view rParamToReplace,
+ std::u16string_view rReplaceWith );
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx
index 10d32f5bf0e1..2d01e7ad27ae 100644
--- a/chart2/source/inc/CommonFunctors.hxx
+++ b/chart2/source/inc/CommonFunctors.hxx
@@ -16,18 +16,19 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_COMMONFUNCTORS_HXX
-#define INCLUDED_CHART2_SOURCE_INC_COMMONFUNCTORS_HXX
+#pragma once
#include <o3tl/any.hxx>
#include <rtl/math.hxx>
#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/ustring.hxx>
#include "charttoolsdllapi.hxx"
-namespace chart
-{
-namespace CommonFunctors
+#include <algorithm>
+#include <limits>
+
+namespace chart::CommonFunctors
{
/** unary function to convert any type T into a css::uno::Any.
@@ -35,35 +36,46 @@ namespace CommonFunctors
<p>uno::makeAny is an inline function. Thus is cannot be taken directly
(via mem_fun_ptr)</p>
*/
-template< typename T >
- struct makeAny
+struct makeAny
{
+ template< typename T >
css::uno::Any operator() ( const T & aVal )
{
- return css::uno::makeAny( aVal );
+ return css::uno::Any( aVal );
}
};
-/** unary function to convert css::uno::Any into a double number.
+/** unary function to convert an OUString or css::uno::Any into a double number.
- <p>In case no number can be generated from the Any, NaN (see
- rtl::math::SetNAN()) is returned.</p>
-*/
-struct OOO_DLLPUBLIC_CHARTTOOLS AnyToDouble
+ <p>For conversion of OUString, rtl::math::StringToDouble is used.</p>
+ <p>In case no number can be generated from the Any, NaN is returned.</p>
+ */
+struct OOO_DLLPUBLIC_CHARTTOOLS ToDouble
{
double operator() ( const css::uno::Any & rAny )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
+ double fResult = std::numeric_limits<double>::quiet_NaN();
rAny >>= fResult;
return fResult;
}
+
+ double operator() ( std::u16string_view rStr )
+ {
+ rtl_math_ConversionStatus eConversionStatus;
+ double fResult = ::rtl::math::stringToDouble( rStr, '.', ',', & eConversionStatus );
+
+ if( eConversionStatus != rtl_math_ConversionStatus_Ok )
+ return std::numeric_limits<double>::quiet_NaN();
+
+ return fResult;
+ }
};
-/** unary function to convert css::uno::Any into an
- OUString.
-*/
-struct OOO_DLLPUBLIC_CHARTTOOLS AnyToString
+/** unary function to convert a double number or css::uno::Any into an OUString.
+
+ <p>For conversion of doubles, rtl::math::DoubleToOUString is used.</p>
+ */
+struct OOO_DLLPUBLIC_CHARTTOOLS ToString
{
OUString operator() ( const css::uno::Any & rAny )
{
@@ -86,32 +98,7 @@ struct OOO_DLLPUBLIC_CHARTTOOLS AnyToString
return OUString();
}
-};
-
-/** unary function to convert an OUString into a double number.
-
- <p>For conversion rtl::math::StringToDouble is used.</p>
- */
-struct OOO_DLLPUBLIC_CHARTTOOLS OUStringToDouble
-{
- double operator() ( const OUString & rStr )
- {
- rtl_math_ConversionStatus eConversionStatus;
- double fResult = ::rtl::math::stringToDouble( rStr, '.', ',', & eConversionStatus );
-
- if( eConversionStatus != rtl_math_ConversionStatus_Ok )
- ::rtl::math::setNan( & fResult );
-
- return fResult;
- }
-};
-/** unary function to convert a double number into an OUString.
-
- <p>For conversion rtl::math::DoubleToOUString is used.</p>
- */
-struct OOO_DLLPUBLIC_CHARTTOOLS DoubleToOUString
-{
OUString operator() ( double fNumber )
{
return ::rtl::math::doubleToUString(
@@ -124,10 +111,13 @@ struct OOO_DLLPUBLIC_CHARTTOOLS DoubleToOUString
}
};
-} // namespace CommonFunctors
-} // namespace chart
+template <class Container, class Func> auto convertToSequence(const Container& container, Func f)
+{
+ css::uno::Sequence<decltype(f(container[0]))> result(container.size());
+ std::transform(container.begin(), container.end(), result.getArray(), f);
+ return result;
+}
-// INCLUDED_CHART2_SOURCE_INC_COMMONFUNCTORS_HXX
-#endif
+} // namespace chart::CommonFunctors
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ConfigColorScheme.hxx b/chart2/source/inc/ConfigColorScheme.hxx
index 7d0bbf662ed4..fe73dc671bb6 100644
--- a/chart2/source/inc/ConfigColorScheme.hxx
+++ b/chart2/source/inc/ConfigColorScheme.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
+#pragma once
#include "charttoolsdllapi.hxx"
#include <cppuhelper/implbase.hxx>
@@ -39,7 +38,7 @@ namespace impl
class ChartConfigItem;
}
-class ConfigColorScheme :
+class ConfigColorScheme final :
public ::cppu::WeakImplHelper<
css::chart2::XColorScheme,
css::lang::XServiceInfo >
@@ -54,7 +53,7 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
// ____ ConfigItemListener ____
- void notify( const OUString & rPropertyName );
+ void notify();
protected:
// ____ XColorScheme ____
@@ -73,7 +72,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ControllerLockGuard.hxx b/chart2/source/inc/ControllerLockGuard.hxx
index 090becde9343..b9da29954a02 100644
--- a/chart2/source/inc/ControllerLockGuard.hxx
+++ b/chart2/source/inc/ControllerLockGuard.hxx
@@ -16,36 +16,41 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CONTROLLERLOCKGUARD_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CONTROLLERLOCKGUARD_HXX
+#pragma once
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
-#include <com/sun/star/uno/Reference.h>
-
-namespace chart { class ChartModel; }
-namespace com::sun::star::frame { class XModel; }
+#include <rtl/ref.hxx>
namespace chart
{
+class ChartModel;
+}
+namespace com::sun::star::frame
+{
+class XModel;
+}
+namespace chart
+{
/** This guard calls lockControllers at the given Model in the CTOR and
unlockControllers in the DTOR. Using this ensures that controllers do not
remain locked when leaving a function even in case an exception is thrown.
*/
-class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockGuardUNO
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ControllerLockGuardUNO
{
public:
- explicit ControllerLockGuardUNO( const css::uno::Reference< css::frame::XModel > & xModel );
+ explicit ControllerLockGuardUNO(rtl::Reference<::chart::ChartModel> xModel);
~ControllerLockGuardUNO();
private:
- css::uno::Reference< css::frame::XModel > mxModel;
+ rtl::Reference<::chart::ChartModel> mxModel;
};
class ControllerLockGuard
{
public:
- explicit ControllerLockGuard( ChartModel& rModel );
+ explicit ControllerLockGuard(ChartModel& rModel);
~ControllerLockGuard();
private:
@@ -58,18 +63,17 @@ private:
Use the ControllerLockHelperGuard to lock/unlock the model during a block of
instructions.
*/
-class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ControllerLockHelper
{
public:
- explicit ControllerLockHelper(
- const css::uno::Reference< css::frame::XModel > & xModel );
+ explicit ControllerLockHelper(rtl::Reference<::chart::ChartModel> xModel);
~ControllerLockHelper();
SAL_DLLPRIVATE void lockControllers();
SAL_DLLPRIVATE void unlockControllers();
private:
- css::uno::Reference< css::frame::XModel > m_xModel;
+ rtl::Reference<::chart::ChartModel> m_xModel;
};
/** This guard calls lockControllers at the given ControllerLockHelper in the
@@ -77,19 +81,16 @@ private:
do not remain locked when leaving a function even in case an exception is
thrown.
*/
-class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockHelperGuard
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ControllerLockHelperGuard
{
public:
- explicit ControllerLockHelperGuard( ControllerLockHelper & rHelper );
+ explicit ControllerLockHelperGuard(ControllerLockHelper& rHelper);
~ControllerLockHelperGuard();
private:
- ControllerLockHelper & m_rHelper;
+ ControllerLockHelper& m_rHelper;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_CONTROLLERLOCKGUARD_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/DataInterpreter.hxx b/chart2/source/inc/DataInterpreter.hxx
new file mode 100644
index 000000000000..7638e5ccee3e
--- /dev/null
+++ b/chart2/source/inc/DataInterpreter.hxx
@@ -0,0 +1,154 @@
+/* -*- 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 "DataSeries.hxx"
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <rtl/ref.hxx>
+#include <vector>
+
+namespace chart
+{
+class DataSeries;
+class DataSource;
+class LabeledDataSequence;
+
+/** offers tooling to interpret different data sources in a structural
+ and chart-type-dependent way.
+ */
+struct InterpretedData
+{
+ std::vector< std::vector< rtl::Reference<::chart::DataSeries> > > Series;
+ css::uno::Reference< css::chart2::data::XLabeledDataSequence > Categories;
+};
+
+/** offers tooling to interpret different data sources in a structural
+ and chart-type-dependent way.
+ */
+class SAL_DLLPUBLIC_RTTI DataInterpreter : public ::cppu::WeakImplHelper<
+ css::lang::XServiceInfo >
+{
+public:
+ explicit DataInterpreter();
+ virtual ~DataInterpreter() override;
+
+ /// XServiceInfo declarations
+ 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;
+
+ // convenience methods
+ static OUString GetRole( const css::uno::Reference< css::chart2::data::XDataSequence > & xSeq );
+
+ static void SetRole(
+ const css::uno::Reference< css::chart2::data::XDataSequence > & xSeq,
+ const OUString & rRole );
+
+ static css::uno::Any GetProperty(
+ const css::uno::Sequence<css::beans::PropertyValue > & aArguments,
+ std::u16string_view rName );
+
+ static bool HasCategories(
+ const css::uno::Sequence< css::beans::PropertyValue > & rArguments,
+ const std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rData );
+
+ static bool UseCategoriesAsX(
+ const css::uno::Sequence< css::beans::PropertyValue > & rArguments );
+
+ static std::vector<css::uno::Reference< css::chart2::data::XLabeledDataSequence >> getDataSequences(
+ const css::uno::Reference< css::chart2::data::XDataSource >& xSource);
+
+ // ____ DataInterpreter ____
+ /** Interprets the given data.
+
+ @param xSource
+ the data source.
+
+ @param aArguments
+ Arguments that tell the template how to slice the given
+ range. The properties should be defined in a separate
+ service.
+
+ <p>For standard parameters that may be used, see the
+ service StandardDiagramCreationParameters.
+ </p>
+
+ @param aSeriesToReUse
+ use all the data series given here for the result before
+ creating new ones.
+ */
+ virtual InterpretedData interpretDataSource(
+ const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
+ const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& aSeriesToReUse );
+
+ /** Re-interprets the data given in <code>aInterpretedData</code>
+ while keeping the number of data series and the categories.
+ */
+ virtual InterpretedData reinterpretDataSeries(
+ const InterpretedData& aInterpretedData );
+
+ /** parses the given data and states, if a
+ reinterpretDataSeries() call can be done
+ without data loss.
+
+ @return
+ `TRUE`, if the data given in
+ <code>aInterpretedData</code> has a similar structure than
+ the one required is used as output of the data interpreter.
+ */
+ virtual bool isDataCompatible(
+ const InterpretedData& aInterpretedData );
+
+ /** Try to reverse the operation done in
+ interpretDataSource().
+
+ <p>In case <code>aInterpretedData</code> is the result of
+ interpretDataSource()( <code>xSource</code> ),
+ the result of this method should be <code>xSource</code>.</p>
+ */
+ static rtl::Reference< ::chart::DataSource > mergeInterpretedData(
+ const InterpretedData& aInterpretedData );
+
+ /** Get chart information that is specific to a particular chart
+ type, by key.
+
+ @param sKey
+ name of the piece of data to retrieve.
+
+ <p>Supported key strings:</p>
+ <ul>
+ <li><tt>"stock variant"</tt>: stock chart variant,
+ with 0 = neither Open Values nor volume, 1 = Open Values,
+ 2 = volume, 3 = both. Valid for candlestick charts.</li>
+ </ul>
+
+ @return
+ The value requested, or nothing if not present.
+ */
+ virtual css::uno::Any getChartTypeSpecificData(
+ const OUString& sKey );
+};
+
+} // namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/inc/DataSeries.hxx b/chart2/source/inc/DataSeries.hxx
index 7a571f1eb423..3705ea3fdab4 100644
--- a/chart2/source/model/inc/DataSeries.hxx
+++ b/chart2/source/inc/DataSeries.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_INC_DATASERIES_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_INC_DATASERIES_HXX
+#pragma once
// UNO types
#include <com/sun/star/chart2/XDataSeries.hpp>
@@ -25,25 +24,27 @@
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
// helper classes
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
+#include "ModifyListenerHelper.hxx"
+#include "PropertyHelper.hxx"
// STL
#include <vector>
#include <map>
-#include <MutexContainer.hxx>
-#include <OPropertySet.hxx>
+#include "OPropertySet.hxx"
+#include "charttoolsdllapi.hxx"
namespace com::sun::star::beans { class XPropertySet; }
namespace chart
{
+class LabeledDataSequence;
+class RegressionCurveModel;
namespace impl
{
@@ -59,10 +60,10 @@ typedef ::cppu::WeakImplHelper<
DataSeries_Base;
}
-class DataSeries final :
- public MutexContainer,
- public impl::DataSeries_Base,
- public ::property::OPropertySet
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) DataSeries
+ final
+ : public impl::DataSeries_Base
+ , public ::property::OPropertySet
{
public:
explicit DataSeries();
@@ -78,12 +79,8 @@ public:
/// merge XTypeProvider implementations
DECLARE_XTYPEPROVIDER()
-private:
explicit DataSeries( const DataSeries & rOther );
- // late initialization to call after copy-constructing
- void Init( const DataSeries & rOther );
-
// ____ XDataSeries ____
/// @see css::chart2::XDataSeries
virtual css::uno::Reference< css::beans::XPropertySet >
@@ -100,7 +97,7 @@ private:
virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
virtual void SAL_CALL setFastPropertyValue_NoBroadcast
( sal_Int32 nHandle,
@@ -135,6 +132,32 @@ private:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+ typedef std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > tDataSequenceContainer;
+
+ void setData( const tDataSequenceContainer& aData );
+ const tDataSequenceContainer & getDataSequences2() const { return m_aDataSequences; }
+
+ typedef
+ std::vector< rtl::Reference< ::chart::RegressionCurveModel > >
+ tRegressionCurveContainerType;
+
+ const tRegressionCurveContainerType & getRegressionCurves2() const { return m_aRegressionCurves; }
+
+ /** Get the label of a series (e.g. for the legend)
+
+ @param rLabelSequenceRole
+ The data sequence contained in xSeries that has this role will be used
+ to take its label.
+ */
+ OUString getLabelForRole( const OUString & rLabelSequenceRole );
+
+ bool hasUnhiddenData();
+
+private:
+
+ // late initialization to call after copy-constructing
+ void Init( const DataSeries & rOther );
+
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -149,24 +172,19 @@ private:
void fireModifyEvent();
- typedef std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > tDataSequenceContainer;
tDataSequenceContainer m_aDataSequences;
typedef std::map< sal_Int32,
css::uno::Reference< css::beans::XPropertySet > > tDataPointAttributeContainer;
tDataPointAttributeContainer m_aAttributedDataPoints;
- typedef
- std::vector< css::uno::Reference< css::chart2::XRegressionCurve > >
- tRegressionCurveContainerType;
tRegressionCurveContainerType m_aRegressionCurves;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
-} // namespace chart
+OOO_DLLPUBLIC_CHARTTOOLS const tPropertyValueMap & StaticDataSeriesDefaults();
-// INCLUDED_CHART2_SOURCE_MODEL_INC_DATASERIES_HXX
-#endif
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx
index c6fba94de6c7..2015398a7681 100644
--- a/chart2/source/inc/DataSeriesHelper.hxx
+++ b/chart2/source/inc/DataSeriesHelper.hxx
@@ -16,13 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_DATASERIESHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_DATASERIESHELPER_HXX
+#pragma once
+#include <config_options.h>
#include "StackMode.hxx"
#include "charttoolsdllapi.hxx"
#include <com/sun/star/uno/Reference.h>
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
#include <vector>
@@ -36,15 +37,18 @@ namespace com::sun::star::chart2::data { class XDataSource; }
namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
namespace com::sun::star::uno { class Any; }
namespace com::sun::star::uno { template <class E> class Sequence; }
-
-namespace chart
-{
-
-namespace DataSeriesHelper
+namespace chart { class BaseCoordinateSystem; }
+namespace chart { class ChartType; }
+namespace chart { class DataSource; }
+namespace chart { class Diagram; }
+namespace chart { class DataSeries; }
+namespace chart { class LabeledDataSequence; }
+
+namespace chart::DataSeriesHelper
{
-OOO_DLLPUBLIC_CHARTTOOLS OUString
- getRole( const css::uno::Reference<css::chart2::data::XLabeledDataSequence>& xLabeledDataSequence );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+OUString getRole( const css::uno::Reference<css::chart2::data::XLabeledDataSequence>& xLabeledDataSequence );
/** Retrieves the data sequence in the given data source that matches the
given role. If more than one sequences match the role, the first match
@@ -56,7 +60,8 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString
@param aRole
The role that is to be filtered out.
*/
-OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSequence >
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+css::uno::Reference< css::chart2::data::XLabeledDataSequence >
getDataSequenceByRole( const css::uno::Reference< css::chart2::data::XDataSource > & xSource,
const OUString& aRole,
bool bMatchPrefix = false );
@@ -70,115 +75,116 @@ OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSeq
@param aRole
The role that is to be filtered out.
*/
-OOO_DLLPUBLIC_CHARTTOOLS std::vector<
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+std::vector<
css::uno::Reference< css::chart2::data::XLabeledDataSequence > >
getAllDataSequencesByRole( const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & aDataSequences,
const OUString& aRole );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+std::vector<
+ css::uno::Reference< css::chart2::data::XLabeledDataSequence > >
+ getAllDataSequencesByRole( const std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & aDataSequences,
+ const OUString& aRole );
-OOO_DLLPUBLIC_CHARTTOOLS
-std::vector<css::uno::Reference<css::chart2::data::XLabeledDataSequence> >
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >
getAllDataSequences(
- const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& aSeries );
+ const std::vector<rtl::Reference<::chart::DataSeries> >& aSeries );
/** Retrieves all data sequences found in the given data series and puts them
into a data source. The order of sequences will match the order of the data
series.
*/
-OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XDataSource >
- getDataSource( const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > & aSeries );
-
-/** Get the label of a series (e.g. for the legend)
-
- @param rLabelSequenceRole
- The data sequence contained in xSeries that has this role will be used
- to take its label.
- */
-OOO_DLLPUBLIC_CHARTTOOLS OUString getDataSeriesLabel(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
- const OUString & rLabelSequenceRole );
-
-/** Get the label of a labeled sequence including necessary automatic generation
- */
-OOO_DLLPUBLIC_CHARTTOOLS OUString getLabelForLabeledDataSequence(
- const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLabeledSeq );
-
-OOO_DLLPUBLIC_CHARTTOOLS void setStackModeAtSeries(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > & aSeries,
- const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem,
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+rtl::Reference< ::chart::DataSource >
+ getDataSource( const std::vector< rtl::Reference< ::chart::DataSeries > > & aSeries );
+
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void setStackModeAtSeries(
+ const std::vector< rtl::Reference< ::chart::DataSeries > > & aSeries,
+ const rtl::Reference< ::chart::BaseCoordinateSystem > & xCorrespondingCoordinateSystem,
StackMode eStackMode );
-OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getAttachedAxisIndex(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+sal_Int32 getAttachedAxisIndex(
+ const rtl::Reference< ::chart::DataSeries > & xSeries );
/// @param nAxisIndex, if -1 it is determined by the given data series via getAttachedAxisIndex
-OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getNumberFormatKeyFromAxis(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
- const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem,
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+sal_Int32 getNumberFormatKeyFromAxis(
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
+ const rtl::Reference< ::chart::BaseCoordinateSystem > & xCorrespondingCoordinateSystem,
sal_Int32 nDimensionIndex,
sal_Int32 nAxisIndex = -1 );
-OOO_DLLPUBLIC_CHARTTOOLS
-css::uno::Reference< css::chart2::XCoordinateSystem >
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+rtl::Reference< ::chart::BaseCoordinateSystem >
getCoordinateSystemOfSeries(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
-OOO_DLLPUBLIC_CHARTTOOLS
-css::uno::Reference< css::chart2::XChartType >
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+rtl::Reference< ::chart::ChartType >
getChartTypeOfSeries(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
-OOO_DLLPUBLIC_CHARTTOOLS void deleteSeries(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
- const css::uno::Reference< css::chart2::XChartType > & xChartType );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void deleteSeries(
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
+ const rtl::Reference< ::chart::ChartType > & xChartType );
-OOO_DLLPUBLIC_CHARTTOOLS void switchSymbolsOnOrOff(
- const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties,
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void switchSymbolsOnOrOff(
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
bool bSymbolsOn, sal_Int32 nSeriesIndex );
-OOO_DLLPUBLIC_CHARTTOOLS void switchLinesOnOrOff(
- const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties,
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void switchLinesOnOrOff(
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
bool bLinesOn );
-OOO_DLLPUBLIC_CHARTTOOLS
-void makeLinesThickOrThin( const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties, bool bThick );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void makeLinesThickOrThin( const rtl::Reference< ::chart::DataSeries > & xSeries, bool bThick );
-OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void setPropertyAlsoToAllAttributedDataPoints(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
const OUString& rPropertyName,
const css::uno::Any& rPropertyValue );
-OOO_DLLPUBLIC_CHARTTOOLS bool hasAttributedDataPointDifferentValue(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+bool hasAttributedDataPointDifferentValue(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
const OUString& rPropertyName,
const css::uno::Any& rPropertyValue );
-OOO_DLLPUBLIC_CHARTTOOLS bool hasUnhiddenData( const css::uno::Reference<
- css::chart2::XDataSeries >& xSeries );
-
-OOO_DLLPUBLIC_CHARTTOOLS
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const css::uno::Reference<
css::chart2::data::XDataSequence >& xDataSequence, bool bTranslate );
-OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
-
-OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+bool hasDataLabelsAtSeries( const rtl::Reference< ::chart::DataSeries >& xSeries );
-OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelAtPoint( const css::uno::Reference< css::chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+bool hasDataLabelsAtPoints( const rtl::Reference< ::chart::DataSeries >& xSeries );
-OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+bool hasDataLabelAtPoint( const rtl::Reference< ::chart::DataSeries >& xSeries, sal_Int32 nPointIndex );
-OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelToPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void insertDataLabelsToSeriesAndAllPoints( const rtl::Reference< ::chart::DataSeries >& xSeries );
-OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void insertDataLabelToPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet );
-OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void deleteDataLabelsFromSeriesAndAllPoints( const rtl::Reference< ::chart::DataSeries >& xSeries );
-} // namespace DataSeriesHelper
-} // namespace chart
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
+void deleteDataLabelsFromPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet );
-// INCLUDED_CHART2_SOURCE_INC_DATASERIESHELPER_HXX
-#endif
+} // namespace chart::DataSeriesHelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/DataSeriesProperties.hxx b/chart2/source/inc/DataSeriesProperties.hxx
index 331396b49f60..7d36721ef066 100644
--- a/chart2/source/model/main/DataSeriesProperties.hxx
+++ b/chart2/source/inc/DataSeriesProperties.hxx
@@ -16,20 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATASERIESPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATASERIESPROPERTIES_HXX
+#pragma once
-#include <PropertyHelper.hxx>
-#include <FastPropertyIdRanges.hxx>
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
#include <vector>
namespace com::sun::star::beans { struct Property; }
-namespace chart
-{
-
-namespace DataSeriesProperties
+namespace chart::DataSeriesProperties
{
enum
{
@@ -38,18 +34,15 @@ namespace DataSeriesProperties
PROP_DATASERIES_VARY_COLORS_BY_POINT,
PROP_DATASERIES_ATTACHED_AXIS_INDEX,
PROP_DATASERIES_SHOW_LEGEND_ENTRY,
- PROP_DATASERIES_DELETED_LEGEND_ENTRIES
+ PROP_DATASERIES_DELETED_LEGEND_ENTRIES,
+ PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES
};
void AddPropertiesToVector(
std::vector< css::beans::Property > & rOutProperties );
void AddDefaultsToMap( tPropertyValueMap & rOutMap );
-}
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATASERIESPROPERTIES_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/DataSource.hxx b/chart2/source/inc/DataSource.hxx
index 6ad8bbffc409..9b976e439a66 100644
--- a/chart2/source/inc/DataSource.hxx
+++ b/chart2/source/inc/DataSource.hxx
@@ -16,18 +16,21 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_DATASOURCE_HXX
-#define INCLUDED_CHART2_SOURCE_INC_DATASOURCE_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart2/data/XDataSink.hpp>
#include <cppuhelper/implbase.hxx>
+#include <vector>
+#include "charttoolsdllapi.hxx"
namespace chart
{
+class LabeledDataSequence;
-class DataSource : public
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) DataSource final : public
::cppu::WeakImplHelper<
css::lang::XServiceInfo,
css::chart2::data::XDataSource,
@@ -37,6 +40,8 @@ public:
explicit DataSource();
explicit DataSource(
const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rSequences );
+ explicit DataSource(
+ const std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rSequences );
virtual ~DataSource() override;
@@ -45,7 +50,6 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-protected:
// ____ XDataSource ____
virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL
getDataSequences() override;
@@ -60,7 +64,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_DATASOURCE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx
index 5f159f6a5dac..7b08cafc22a7 100644
--- a/chart2/source/inc/DataSourceHelper.hxx
+++ b/chart2/source/inc/DataSourceHelper.hxx
@@ -17,12 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_DATASOURCEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_DATASOURCEHELPER_HXX
+#pragma once
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ref.hxx>
namespace chart { class ChartModel; }
namespace com::sun::star::beans { struct PropertyValue; }
@@ -35,30 +36,29 @@ namespace com::sun::star::frame { class XModel; }
namespace chart
{
+class DataSource;
+class Diagram;
+class LabeledDataSequence;
-class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) DataSourceHelper
{
public:
- static css::uno::Reference< css::chart2::data::XDataSource >
- createDataSource( const css::uno::Sequence<
- css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rSequences );
-
static css::uno::Reference< css::chart2::data::XDataSequence >
createCachedDataSequence();
static css::uno::Reference< css::chart2::data::XDataSequence >
createCachedDataSequence( const OUString & rSingleText );
- static css::uno::Reference< css::chart2::data::XLabeledDataSequence >
+ static rtl::Reference< LabeledDataSequence >
createLabeledDataSequence(
const css::uno::Reference< css::chart2::data::XDataSequence >& xValues ,
const css::uno::Reference< css::chart2::data::XDataSequence >& xLabels );
- static css::uno::Reference< css::chart2::data::XLabeledDataSequence >
+ static rtl::Reference< LabeledDataSequence >
createLabeledDataSequence(
const css::uno::Reference< css::chart2::data::XDataSequence >& xValues );
- static css::uno::Reference< css::chart2::data::XLabeledDataSequence >
+ static rtl::Reference< LabeledDataSequence >
createLabeledDataSequence();
static css::uno::Sequence< css::beans::PropertyValue >
@@ -75,26 +75,20 @@ public:
, OUString & rRangeRepresentation, css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories );
- static css::uno::Reference< css::chart2::data::XDataSource >
- pressUsedDataIntoRectangularFormat( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc );
+ static rtl::Reference< ::chart::DataSource >
+ pressUsedDataIntoRectangularFormat( const rtl::Reference< ::chart::ChartModel >& xChartDoc );
SAL_DLLPRIVATE static css::uno::Sequence< OUString > getUsedDataRanges(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+ const rtl::Reference< ::chart::Diagram > & xDiagram );
static css::uno::Sequence< OUString > getUsedDataRanges(
- const css::uno::Reference< css::frame::XModel > & xChartModel );
+ const rtl::Reference<::chart::ChartModel> & xChartModel );
- static css::uno::Reference< css::chart2::data::XDataSource > getUsedData(
+ static rtl::Reference< ::chart::DataSource > getUsedData(
ChartModel& rModel );
- static css::uno::Reference< css::chart2::data::XDataSource > getUsedData(
- const css::uno::Reference< css::frame::XModel >& xChartModel );
-
- static css::uno::Reference< css::chart2::data::XDataSource > getUsedData(
- const css::uno::Reference<css::chart2::XChartDocument >& xChartDoc );
-
static bool detectRangeSegmentation(
- const css::uno::Reference< css::frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, OUString& rOutRangeString
, css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& rOutUseColumns
@@ -102,7 +96,7 @@ public:
, bool& rOutHasCategories );
static void setRangeSegmentation(
- const css::uno::Reference< css::frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, const css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool bUseColumns
, bool bFirstCellAsLabel
@@ -116,7 +110,7 @@ public:
HasCategories and FirstCellAsLabel.
*/
static bool allArgumentsForRectRangeDetected(
- const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument );
+ const rtl::Reference<::chart::ChartModel>& xChartDocument );
SAL_DLLPRIVATE static css::uno::Sequence< OUString > getRangesFromLabeledDataSequence(
const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLSeq );
@@ -129,6 +123,5 @@ public:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/DataTable.hxx b/chart2/source/inc/DataTable.hxx
new file mode 100644
index 000000000000..fdebc6f1751a
--- /dev/null
+++ b/chart2/source/inc/DataTable.hxx
@@ -0,0 +1,87 @@
+/* -*- 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 "OPropertySet.hxx"
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/uno3.hxx>
+
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/chart2/XDataTable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include "ModifyListenerHelper.hxx"
+
+namespace chart
+{
+typedef cppu::WeakImplHelper<css::chart2::XDataTable, css::lang::XServiceInfo,
+ css::util::XCloneable, css::util::XModifyBroadcaster,
+ css::util::XModifyListener>
+ DataTable_Base;
+
+/** Data table implementation */
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) DataTable final : public DataTable_Base,
+ public ::property::OPropertySet
+{
+public:
+ explicit DataTable();
+ virtual ~DataTable() override;
+
+ /// XServiceInfo declarations
+ 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;
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+ explicit DataTable(DataTable const& rOther);
+
+private:
+ // ____ OPropertySet ____
+ virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any& rAny) const override;
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+public:
+ // ____ XPropertySet ____
+ virtual css::uno::Reference<css::beans::XPropertySetInfo>
+ SAL_CALL getPropertySetInfo() override;
+
+ // ____ XCloneable ____
+ virtual css::uno::Reference<css::util::XCloneable> SAL_CALL createClone() override;
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL
+ addModifyListener(const css::uno::Reference<css::util::XModifyListener>& aListener) override;
+ virtual void SAL_CALL
+ removeModifyListener(const css::uno::Reference<css::util::XModifyListener>& aListener) override;
+
+private:
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) override;
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent() override;
+ using OPropertySet::disposing;
+
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx
new file mode 100644
index 000000000000..62e9eeeac69a
--- /dev/null
+++ b/chart2/source/inc/Diagram.hxx
@@ -0,0 +1,381 @@
+/* -*- 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 "OPropertySet.hxx"
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart/X3DDefaultSetter.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "ModifyListenerHelper.hxx"
+#include "charttoolsdllapi.hxx"
+
+#include <vector>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::chart2 { class XDataSeries; }
+namespace com::sun::star::chart2::data { class XDataSource; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace chart
+{
+class Axis;
+class BaseCoordinateSystem;
+class ChartType;
+class ChartTypeManager;
+class ChartTypeTemplate;
+class DataSeries;
+class Legend;
+class DataTable;
+class RegressionCurveModel;
+enum class StackMode;
+class Wall;
+enum class ThreeDLookScheme;
+
+enum class DiagramPositioningMode
+{
+ Auto, Excluding, Including
+};
+
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper<
+ css::chart2::XDiagram,
+ css::lang::XServiceInfo,
+ css::chart2::XCoordinateSystemContainer,
+ css::chart2::XTitled,
+ css::chart::X3DDefaultSetter,
+ css::util::XModifyBroadcaster,
+ css::util::XModifyListener,
+ css::util::XCloneable >
+ Diagram_Base;
+}
+
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) Diagram
+ final
+ : public impl::Diagram_Base
+ , public ::property::OPropertySet
+{
+public:
+ Diagram( css::uno::Reference< css::uno::XComponentContext > xContext );
+ virtual ~Diagram() override;
+
+ /// XServiceInfo declarations
+ 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;
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+ explicit Diagram( const Diagram & rOther );
+
+ // ____ OPropertySet ____
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+
+ // ____ XPropertySet ____
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() override;
+
+ // ____ XFastPropertySet ____
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+
+ /// make original interface function visible again
+ using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
+
+ virtual void SAL_CALL getFastPropertyValue(
+ css::uno::Any& rValue, sal_Int32 nHandle ) const override;
+
+ // ____ XDiagram ____
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getWall() override;
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFloor() override;
+ virtual css::uno::Reference< css::chart2::XLegend > SAL_CALL getLegend() override;
+ virtual void SAL_CALL setLegend( const css::uno::Reference<
+ css::chart2::XLegend >& xLegend ) override;
+ virtual css::uno::Reference< css::chart2::XColorScheme > SAL_CALL getDefaultColorScheme() override;
+ virtual void SAL_CALL setDefaultColorScheme(
+ const css::uno::Reference< css::chart2::XColorScheme >& xColorScheme ) override;
+ virtual void SAL_CALL setDiagramData(
+ const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
+ const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override;
+
+ virtual css::uno::Reference<css::chart2::XDataTable> SAL_CALL getDataTable() override;
+ virtual void SAL_CALL setDataTable(const css::uno::Reference<css::chart2::XDataTable>& xDataTable) override;
+
+ // ____ XCoordinateSystemContainer ____
+ virtual void SAL_CALL addCoordinateSystem(
+ const css::uno::Reference< css::chart2::XCoordinateSystem >& aCoordSys ) override;
+ virtual void SAL_CALL removeCoordinateSystem(
+ const css::uno::Reference< css::chart2::XCoordinateSystem >& aCoordSys ) override;
+ virtual css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > SAL_CALL getCoordinateSystems() override;
+ virtual void SAL_CALL setCoordinateSystems(
+ const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > >& aCoordinateSystems ) override;
+
+ // ____ XTitled ____
+ virtual css::uno::Reference<
+ css::chart2::XTitle > SAL_CALL getTitleObject() override;
+ virtual void SAL_CALL setTitleObject( const css::uno::Reference<
+ css::chart2::XTitle >& Title ) override;
+
+ // ____ X3DDefaultSetter ____
+ virtual void SAL_CALL set3DSettingsToDefault() override;
+ virtual void SAL_CALL setDefaultRotation() override;
+ virtual void SAL_CALL setDefaultIllumination() override;
+
+ // ____ XCloneable ____
+ virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+ virtual void SAL_CALL removeModifyListener(
+ const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+
+ typedef
+ std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > >
+ tCoordinateSystemContainerType;
+
+ tCoordinateSystemContainerType getBaseCoordinateSystems() const;
+ void setCoordinateSystems(
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > >& aCoordinateSystems );
+
+ rtl::Reference< ::chart::Legend > getLegend2() const;
+ void setLegend(const rtl::Reference< ::chart::Legend > &);
+
+ void setDataTable(const rtl::Reference<::chart::DataTable>& xNewDataTable);
+ rtl::Reference<::chart::DataTable> getDataTableRef() const;
+
+ DiagramPositioningMode getDiagramPositioningMode();
+
+ //returns integer from constant group css::chart::MissingValueTreatment
+ sal_Int32 getCorrectedMissingValueTreatment(
+ const rtl::Reference< ::chart::ChartType >& xChartType );
+
+ void setGeometry3D( sal_Int32 nNewGeometry );
+
+ sal_Int32 getGeometry3D( bool& rbFound, bool& rbAmbiguous );
+
+ bool isPieOrDonutChart();
+
+ bool isSupportingFloorAndWall();
+
+ /**
+ * Move a series forward or backward.
+ *
+ * @param xDiagram
+ * Reference to the diagram that contains the series.
+ *
+ * @param xGivenDataSeries
+ * Reference to the series that should be moved.
+ *
+ * @param bForward
+ * Direction in which the series should be moved.
+ *
+ * @returns </sal_True> if the series was moved successfully.
+ *
+ */
+ bool moveSeries(
+ const rtl::Reference< DataSeries >& xGivenDataSeries,
+ bool bForward );
+
+ /**
+ * Test if a series can be moved.
+ *
+ * @param xDiagram
+ * Reference to the diagram that contains the series.
+ *
+ * @param xGivenDataSeries
+ * Reference to the series that should be tested for moving.
+ *
+ * @param bForward
+ * Direction of the move to be checked.
+ *
+ * @returns </sal_True> if the series can be moved.
+ *
+ */
+ bool isSeriesMoveable(
+ const rtl::Reference< DataSeries >& xGivenDataSeries,
+ bool bForward );
+
+ std::vector< rtl::Reference< ChartType > > getChartTypes();
+
+ rtl::Reference< ChartType > getChartTypeByIndex( sal_Int32 nIndex );
+
+ bool isSupportingDateAxis();
+
+ css::uno::Reference< css::chart2::data::XLabeledDataSequence >
+ getCategories();
+
+ void setCategories(
+ const css::uno::Reference< css::chart2::data::XLabeledDataSequence >& xCategories,
+ bool bSetAxisType = false, // when this flag is true ...
+ bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER
+
+ bool isCategory();
+
+ /** return all data series in this diagram grouped by chart-types
+ */
+ std::vector<
+ std::vector<
+ rtl::Reference< ::chart::DataSeries > > >
+ getDataSeriesGroups();
+
+ std::vector< rtl::Reference< ::chart::DataSeries > >
+ getDataSeries();
+
+ rtl::Reference< ChartType >
+ getChartTypeOfSeries( const rtl::Reference< DataSeries >& xSeries );
+
+ rtl::Reference< ::chart::Axis > getAttachedAxis(
+ const rtl::Reference< ::chart::DataSeries >& xSeries );
+
+ bool attachSeriesToAxis( bool bMainAxis,
+ const rtl::Reference< DataSeries >& xSeries,
+ const css::uno::Reference< css::uno::XComponentContext > & xContext,
+ bool bAdaptAxes=true );
+
+ /** Replaces all occurrences of xCooSysToReplace in the tree with
+ xReplacement in the diagram's tree
+ */
+ SAL_DLLPRIVATE void replaceCoordinateSystem(
+ const rtl::Reference< ::chart::BaseCoordinateSystem > & xCooSysToReplace,
+ const rtl::Reference< ::chart::BaseCoordinateSystem > & xReplacement );
+
+
+ /** Returns the dimension found for all chart types in the tree. If the
+ dimension is not unique, 0 is returned.
+ */
+ sal_Int32 getDimension();
+
+ /** Sets the dimension of the diagram given.
+
+ 1. Sets the dimension of all used ChartTypes
+ 2. Adapts the DataSeriesTree to reflect the new dimension
+ 3. If new coordinate-systems have to be created, adapts the
+ XCoordinateSystemContainer of the diagram.
+ */
+ void setDimension( sal_Int32 nNewDimensionCount );
+
+
+ StackMode getStackMode(bool& rbFound, bool& rbAmbiguous);
+
+ /** The stacking mode is only set at the series found inside
+ the first chart type. This is the standard for all current
+ templates (the only template that has more than one chart-type and
+ allows stacking is bar/line combi, and for this the stacking only
+ applies to the first chart type/the bars)
+ */
+ void setStackMode(StackMode eStackMode);
+
+
+ /** Sets the "SwapXAndYAxis" property at all coordinate systems found in the
+ given diagram.
+
+ "vertical==true" for bar charts, "vertical==false" for column charts
+ */
+ void setVertical( bool bVertical );
+
+ /** Gets the "SwapXAndYAxis" property at all coordinate systems found in the
+ given diagram.
+
+ "vertical==true" for bar charts, "vertical==false" for column charts
+ */
+ bool getVertical( bool& rbOutFoundResult, bool& rbOutAmbiguousResult );
+
+ struct tTemplateWithServiceName {
+ rtl::Reference< ::chart::ChartTypeTemplate > xChartTypeTemplate;
+ OUString sServiceName;
+ };
+
+ /** tries to find a template in the chart-type manager that matches this
+ diagram.
+
+ @return
+ A pair containing a template with the correct properties set as
+ first entry and the service name of the templates second entry. If
+ no template was found both elements are empty.
+ */
+ tTemplateWithServiceName
+ getTemplate(const rtl::Reference< ::chart::ChartTypeManager > & xChartTypeManager);
+
+ std::vector<rtl::Reference<::chart::RegressionCurveModel> >
+ getAllRegressionCurvesNotMeanValueLine();
+
+ double getCameraDistance();
+ void setCameraDistance( double fCameraDistance );
+
+ void getRotation(
+ sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree );
+ void setRotation(
+ sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree );
+ void getRotationAngle(
+ double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
+ void setRotationAngle(
+ double fXAngleRad, double fYAngleRad, double fZAngleRad );
+
+ ThreeDLookScheme detectScheme();
+ void setScheme( ThreeDLookScheme aScheme );
+
+ void setDefaultRotation( bool bPieOrDonut );
+
+ void switchRightAngledAxes( bool bRightAngledAxes );
+
+private:
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const css::lang::EventObject& aEvent ) override;
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const css::lang::EventObject& Source ) override;
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent() override;
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ tCoordinateSystemContainerType m_aCoordSystems;
+
+ rtl::Reference<Wall> m_xWall;
+ rtl::Reference<Wall> m_xFloor;
+
+ css::uno::Reference<css::chart2::XTitle> m_xTitle;
+
+ rtl::Reference<::chart::Legend> m_xLegend;
+ rtl::Reference<::chart::DataTable> m_xDataTable;
+ css::uno::Reference<css::chart2::XColorScheme> m_xColorScheme;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
+
+};
+
+} // namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index 3fcd9a0af2d3..eb9e4fd00792 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -16,22 +16,22 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_DIAGRAMHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_DIAGRAMHELPER_HXX
+#pragma once
#include "StackMode.hxx"
#include "charttoolsdllapi.hxx"
+#include "ChartTypeTemplate.hxx"
#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
-
-#include <utility>
-#include <vector>
+#include <rtl/ref.hxx>
namespace chart { class ChartModel; }
namespace com::sun::star::chart2 { class XAxis; }
namespace com::sun::star::chart2 { class XChartDocument; }
+namespace com::sun::star::chart2 { class XChartType; }
namespace com::sun::star::chart2 { class XCoordinateSystem; }
namespace com::sun::star::chart2 { class XDiagram; }
+namespace com::sun::star::chart2 { class XDataSeries; }
+namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
namespace com::sun::star::frame { class XModel; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
namespace com::sun::star::uno { class XComponentContext; }
@@ -40,66 +40,18 @@ namespace com::sun::star::util { class XNumberFormatsSupplier; }
namespace chart
{
-
-enum DiagramPositioningMode
-{
- DiagramPositioningMode_AUTO,
- DiagramPositioningMode_EXCLUDING,
- DiagramPositioningMode_INCLUDING
-};
-
-class OOO_DLLPUBLIC_CHARTTOOLS DiagramHelper
+class Axis;
+class BaseCoordinateSystem;
+class ChartType;
+class ChartTypeManager;
+class ChartTypeTemplate;
+class DataSeries;
+class Diagram;
+class LabeledDataSequence;
+
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) DiagramHelper
{
public:
- typedef std::pair<
- css::uno::Reference< css::chart2::XChartTypeTemplate >,
- OUString >
- tTemplateWithServiceName;
-
- /** tries to find a template in the chart-type manager that matches the
- given diagram.
-
- @return
- A pair containing a template with the correct properties set as
- first entry and the service name of the templates second entry. If
- no template was found both elements are empty.
- */
- static tTemplateWithServiceName
- getTemplateForDiagram(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- const css::uno::Reference< css::lang::XMultiServiceFactory > & xChartTypeManager);
-
- /** Sets the "SwapXAndYAxis" property at all coordinate systems found in the
- given diagram.
-
- "vertical==true" for bar charts, "vertical==false" for column charts
- */
- static void setVertical( const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- bool bVertical );
-
- /** Gets the "SwapXAndYAxis" property at all coordinate systems found in the
- given diagram.
-
- "vertical==true" for bar charts, "vertical==false" for column charts
- */
- static bool getVertical( const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- bool& rbOutFoundResult, bool& rbOutAmbiguousResult );
-
- static StackMode getStackMode(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- bool& rbFound, bool& rbAmbiguous
- );
-
- /** The stacking mode is only set at the series found inside
- the first chart type. This is the standard for all current
- templates (the only template that has more than one chart-type and
- allows stacking is bar/line combi, and for this the stacking only
- applies to the first chart type/the bars)
- */
- static void setStackMode(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- StackMode eStackMode
- );
/** Retrieves the stackmode of the first DataSeries or none. If the series have differing stack
modes, rbAmbiguous is set to true. If no series is there rbFound is set to false.
@@ -111,93 +63,27 @@ public:
"ambiguous")
*/
static StackMode getStackModeFromChartType(
- const css::uno::Reference< css::chart2::XChartType > & xChartType,
+ const rtl::Reference< ::chart::ChartType > & xChartType,
bool& rbFound, bool& rbAmbiguous,
- const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
+ const rtl::Reference< ::chart::BaseCoordinateSystem > & xCorrespondingCoordinateSystem
);
- /** Returns the dimension found for all chart types in the tree. If the
- dimension is not unique, 0 is returned.
- */
- static sal_Int32 getDimension(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
-
- /** Sets the dimension of the diagram given.
-
- 1. Sets the dimension of all used ChartTypes
- 2. Adapts the DataSeriesTree to reflect the new dimension
- 3. If new coordinate-systems have to be created, adapts the
- XCoordinateSystemContainer of the diagram.
- */
- static void setDimension(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- sal_Int32 nNewDimensionCount );
-
- /** Replaces all occurrences of xCooSysToReplace in the tree with
- xReplacement in the diagram's tree
- */
- SAL_DLLPRIVATE static void replaceCoordinateSystem(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSysToReplace,
- const css::uno::Reference< css::chart2::XCoordinateSystem > & xReplacement );
-
static bool isSeriesAttachedToMainAxis(
- const css::uno::Reference< css::chart2::XDataSeries >& xDataSeries );
-
- static bool attachSeriesToAxis( bool bMainAxis,
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- const css::uno::Reference< css::uno::XComponentContext > & xContext,
- bool bAdaptAxes=true );
-
- static css::uno::Reference< css::chart2::XAxis > getAttachedAxis(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
-
- static css::uno::Reference< css::chart2::XChartType >
- getChartTypeOfSeries(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
-
- static std::vector< css::uno::Reference< css::chart2::XDataSeries > >
- getDataSeriesFromDiagram(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
-
- /** return all data series in this diagram grouped by chart-types
- */
- static css::uno::Sequence<
- css::uno::Sequence<
- css::uno::Reference< css::chart2::XDataSeries > > >
- getDataSeriesGroups(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
-
- static bool isCategoryDiagram(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
-
- static void setCategoriesToDiagram(
- const css::uno::Reference< css::chart2::data::XLabeledDataSequence >& xCategories,
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- bool bSetAxisType = false, // when this flag is true ...
- bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER
-
- static css::uno::Reference< css::chart2::data::XLabeledDataSequence >
- getCategoriesFromDiagram(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+ const rtl::Reference< ::chart::DataSeries >& xDataSeries );
static css::uno::Sequence< OUString >
getExplicitSimpleCategories( ChartModel& rModel );
SAL_DLLPRIVATE static css::uno::Sequence< OUString >
generateAutomaticCategoriesFromCooSys(
- const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSys );
+ const rtl::Reference< ::chart::BaseCoordinateSystem > & xCooSys );
static void switchToDateCategories(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
+ const rtl::Reference<::chart::ChartModel> & xChartDoc );
static void switchToTextCategories(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
+ const rtl::Reference<::chart::ChartModel> & xChartDoc );
- static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
static bool isDateNumberFormat( sal_Int32 nNumberFormat, const css::uno::Reference< css::util::XNumberFormats >& xNumberFormats );
static sal_Int32 getDateNumberFormat( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
static sal_Int32 getDateTimeInputNumberFormat( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier, double fNumber );
@@ -205,81 +91,14 @@ public:
static sal_Int32 getPercentNumberFormat( const css::uno::Reference<
css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
- static css::uno::Reference< css::chart2::XChartType >
- getChartTypeByIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, sal_Int32 nIndex );
+ SAL_DLLPRIVATE static bool areChartTypesCompatible(
+ const rtl::Reference< ::chart::ChartType >& xFirstType,
+ const rtl::Reference< ::chart::ChartType >& xSecondType );
- static css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >
- getChartTypesFromDiagram(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
-
- SAL_DLLPRIVATE static bool areChartTypesCompatible( const css::uno::Reference<
- css::chart2::XChartType >& xFirstType,
- const css::uno::Reference< css::chart2::XChartType >& xSecondType );
-
- /**
- * Test if a series can be moved.
- *
- * @param xDiagram
- * Reference to the diagram that contains the series.
- *
- * @param xGivenDataSeries
- * Reference to the series that should be tested for moving.
- *
- * @param bForward
- * Direction of the move to be checked.
- *
- * @returns </sal_True> if the series can be moved.
- *
- */
- static bool isSeriesMoveable(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries,
- bool bForward );
-
- /**
- * Move a series forward or backward.
- *
- * @param xDiagram
- * Reference to the diagram that contains the series.
- *
- * @param xGivenDataSeries
- * Reference to the series that should be moved.
- *
- * @param bForward
- * Direction in which the series should be moved.
- *
- * @returns </sal_True> if the series was moved successfully.
- *
- */
- static bool moveSeries(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries,
- bool bForward );
-
- static bool isSupportingFloorAndWall( const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
-
- static bool isPieOrDonutChart( const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
-
- static sal_Int32 getGeometry3D(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- bool& rbFound, bool& rbAmbiguous );
-
- static void setGeometry3D(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- sal_Int32 nNewGeometry );
-
- //returns integer from constant group css::chart::MissingValueTreatment
- static sal_Int32 getCorrectedMissingValueTreatment(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram,
- const css::uno::Reference< css::chart2::XChartType >& xChartType );
-
- static DiagramPositioningMode getDiagramPositioningMode( const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
-
- static bool setDiagramPositioning( const css::uno::Reference< css::frame::XModel >& xChartModel,
+ static bool setDiagramPositioning( const rtl::Reference<::chart::ChartModel>& xChartModel,
const css::awt::Rectangle& rPosRect /*100th mm*/ );
- static css::awt::Rectangle getDiagramRectangleFromModel( const css::uno::Reference< css::frame::XModel >& xChartModel );
+ static css::awt::Rectangle getDiagramRectangleFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel );
static bool switchDiagramPositioningToExcludingPositioning( ChartModel& rModel
, bool bResetModifiedState //set model back to unchanged if it was unchanged before
@@ -292,7 +111,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_DIAGRAMHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/DisposeHelper.hxx b/chart2/source/inc/DisposeHelper.hxx
index 9f02ca3f8ab4..58dc2d5c55ba 100644
--- a/chart2/source/inc/DisposeHelper.hxx
+++ b/chart2/source/inc/DisposeHelper.hxx
@@ -16,43 +16,34 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_DISPOSEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_DISPOSEHELPER_HXX
+#pragma once
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/lang/XComponent.hpp>
-namespace chart
+namespace chart::DisposeHelper
{
-namespace DisposeHelper
-{
-
-template<class T>
-void Dispose(const T & xInterface)
+template <class T> void Dispose(const T& xInterface)
{
css::uno::Reference<css::lang::XComponent> xComponent(xInterface, css::uno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
-template<class T>
-void DisposeAndClear(css::uno::Reference<T> & rInterface)
+template <class T> void DisposeAndClear(css::uno::Reference<T>& rInterface)
{
Dispose<css::uno::Reference<T>>(rInterface);
- rInterface.set(nullptr);
+ rInterface.clear();
}
-template<class Container>
-void DisposeAllElements(Container & rContainer)
+template <class Container> void DisposeAllElements(Container& rContainer)
{
- for (const auto & rElement : rContainer)
+ for (const auto& rElement : rContainer)
{
Dispose<typename Container::value_type>(rElement);
}
}
-}} // namespace chart::DisposeHelper
-
-#endif // INCLUDED_CHART2_SOURCE_INC_DISPOSEHELPER_HXX
+} // namespace chart::DisposeHelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ErrorBar.hxx b/chart2/source/inc/ErrorBar.hxx
index 6cd513ebc940..939b95c739e8 100644
--- a/chart2/source/inc/ErrorBar.hxx
+++ b/chart2/source/inc/ErrorBar.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_ERRORBAR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_ERRORBAR_HXX
+#pragma once
-#include "MutexContainer.hxx"
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
#include <cppuhelper/implbase.hxx>
@@ -36,7 +35,7 @@
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/util/Color.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include "ModifyListenerHelper.hxx"
#include <vector>
@@ -58,9 +57,7 @@ typedef ::cppu::WeakImplHelper<
ErrorBar_Base;
}
-class ErrorBar final :
- public MutexContainer,
- public impl::ErrorBar_Base
+class ErrorBar final : public impl::ErrorBar_Base
{
private:
OUString maDashName;
@@ -78,7 +75,7 @@ private:
sal_Int32 meStyle;
public:
- OOO_DLLPUBLIC_CHARTTOOLS explicit ErrorBar();
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) explicit ErrorBar();
virtual ~ErrorBar() override;
/// XServiceInfo declarations
@@ -133,12 +130,9 @@ private:
css::chart2::data::XLabeledDataSequence > > tDataSequenceContainer;
tDataSequenceContainer m_aDataSequences;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_ERRORBAR_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/EventListenerHelper.hxx b/chart2/source/inc/EventListenerHelper.hxx
index c40fdc49c1e2..dcf3256d46b5 100644
--- a/chart2/source/inc/EventListenerHelper.hxx
+++ b/chart2/source/inc/EventListenerHelper.hxx
@@ -16,12 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_EVENTLISTENERHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_EVENTLISTENERHELPER_HXX
+#pragma once
#include <com/sun/star/lang/XComponent.hpp>
-#include <algorithm>
+#include <utility>
namespace com::sun::star::lang { class XEventListener; }
@@ -36,8 +35,8 @@ namespace impl
template< class InterfaceRef >
struct addListenerFunctor
{
- explicit addListenerFunctor( const css::uno::Reference< css::lang::XEventListener > & xListener ) :
- m_xListener( xListener )
+ explicit addListenerFunctor( css::uno::Reference< css::lang::XEventListener > xListener ) :
+ m_xListener(std::move( xListener ))
{}
void operator() ( const InterfaceRef & xObject )
@@ -54,8 +53,8 @@ private:
template< class InterfaceRef >
struct removeListenerFunctor
{
- explicit removeListenerFunctor( const css::uno::Reference< css::lang::XEventListener > & xListener ) :
- m_xListener( xListener )
+ explicit removeListenerFunctor( css::uno::Reference< css::lang::XEventListener > xListener ) :
+ m_xListener(std::move( xListener ))
{}
void operator() ( const InterfaceRef & xObject )
@@ -118,7 +117,4 @@ void removeListenerFromAllElements(
} // namespace EventListenerHelper
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_EVENTLISTENERHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx
index 13c9a3605cc6..73bc258c9922 100644
--- a/chart2/source/inc/ExplicitCategoriesProvider.hxx
+++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx
@@ -16,14 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX
+#pragma once
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
-#include <cppuhelper/weakref.hxx>
+#include <unotools/weakref.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
+#include <utility>
#include <vector>
namespace chart { class ChartModel; }
@@ -34,13 +35,15 @@ namespace com::sun::star::uno { class Any; }
namespace chart
{
+class BaseCoordinateSystem;
+class LabeledDataSequence;
struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
{
OUString Text;
sal_Int32 Count;
- ComplexCategory( const OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount)
+ ComplexCategory( OUString aText, sal_Int32 nCount ) : Text(std::move( aText )), Count (nCount)
{}
};
@@ -53,10 +56,10 @@ public:
virtual css::uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0;
};
-class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider final
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ExplicitCategoriesProvider final
{
public:
- ExplicitCategoriesProvider( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel
+ ExplicitCategoriesProvider( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSysModel
, ChartModel& rChartModel
);
~ExplicitCategoriesProvider();
@@ -69,7 +72,7 @@ public:
const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel );
static OUString getCategoryByIndex(
- const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel
+ const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSysModel
, ChartModel& rModel
, sal_Int32 nIndex );
@@ -83,8 +86,8 @@ public:
bool hasComplexCategories() const;
sal_Int32 getCategoryLevelCount() const;
- const css::uno::Sequence< css::uno::Reference<
- css::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList() const { return m_aSplitCategoriesList;}
+ const std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence> >&
+ getSplitCategoriesList() const { return m_aSplitCategoriesList;}
bool isDateAxis();
const std::vector< double >& getDateCategories();
@@ -94,15 +97,14 @@ private:
ExplicitCategoriesProvider& operator =(ExplicitCategoriesProvider const &) = delete;
bool volatile m_bDirty;
- css::uno::WeakReference< css::chart2::XCoordinateSystem > m_xCooSysModel;
+ unotools::WeakReference< ::chart::BaseCoordinateSystem > m_xCooSysModel;
ChartModel& mrModel;
css::uno::Reference< css::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
bool m_bIsExplicitCategoriesInited;
css::uno::Sequence< OUString > m_aExplicitCategories;
std::vector< std::vector< ComplexCategory > > m_aComplexCats;
- css::uno::Sequence< css::uno::Reference<
- css::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
+ std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
bool m_bIsDateAxis;
bool m_bIsAutoDate;
@@ -111,7 +113,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
index ba08bb13dfd1..c929ac80cd73 100644
--- a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
@@ -16,15 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX
+#pragma once
#include "RegressionCurveCalculator.hxx"
namespace chart
{
-class ExponentialRegressionCurveCalculator : public RegressionCurveCalculator
+class ExponentialRegressionCurveCalculator final : public RegressionCurveCalculator
{
public:
ExponentialRegressionCurveCalculator();
@@ -60,7 +59,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/FastPropertyIdRanges.hxx b/chart2/source/inc/FastPropertyIdRanges.hxx
index a2572c5117fc..d06809e44c1f 100644
--- a/chart2/source/inc/FastPropertyIdRanges.hxx
+++ b/chart2/source/inc/FastPropertyIdRanges.hxx
@@ -16,24 +16,22 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_FASTPROPERTYIDRANGES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_FASTPROPERTYIDRANGES_HXX
+#pragma once
namespace chart
{
-
enum FastPropertyIdRanges
{
FAST_PROPERTY_ID_START = 10000,
FAST_PROPERTY_ID_START_DATA_SERIES = FAST_PROPERTY_ID_START + 1000,
- FAST_PROPERTY_ID_START_DATA_POINT = FAST_PROPERTY_ID_START + 2000,
- FAST_PROPERTY_ID_START_CHAR_PROP = FAST_PROPERTY_ID_START + 3000,
- FAST_PROPERTY_ID_START_LINE_PROP = FAST_PROPERTY_ID_START + 4000,
- FAST_PROPERTY_ID_START_FILL_PROP = FAST_PROPERTY_ID_START + 5000,
- FAST_PROPERTY_ID_START_USERDEF_PROP= FAST_PROPERTY_ID_START + 6000,
- FAST_PROPERTY_ID_START_SCENE_PROP = FAST_PROPERTY_ID_START + 7000,
-// FAST_PROPERTY_ID_START_NAMED_FILL_PROP = FAST_PROPERTY_ID_START + 8000,
-// FAST_PROPERTY_ID_START_NAMED_LINE_PROP = FAST_PROPERTY_ID_START + 9000,
+ FAST_PROPERTY_ID_START_DATA_POINT = FAST_PROPERTY_ID_START + 2000,
+ FAST_PROPERTY_ID_START_CHAR_PROP = FAST_PROPERTY_ID_START + 3000,
+ FAST_PROPERTY_ID_START_LINE_PROP = FAST_PROPERTY_ID_START + 4000,
+ FAST_PROPERTY_ID_START_FILL_PROP = FAST_PROPERTY_ID_START + 5000,
+ FAST_PROPERTY_ID_START_USERDEF_PROP = FAST_PROPERTY_ID_START + 6000,
+ FAST_PROPERTY_ID_START_SCENE_PROP = FAST_PROPERTY_ID_START + 7000,
+ // FAST_PROPERTY_ID_START_NAMED_FILL_PROP = FAST_PROPERTY_ID_START + 8000,
+ // FAST_PROPERTY_ID_START_NAMED_LINE_PROP = FAST_PROPERTY_ID_START + 9000,
FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP = FAST_PROPERTY_ID_START + 12000,
FAST_PROPERTY_ID_START_CHART_SYMBOL_PROP = FAST_PROPERTY_ID_START + 13000,
FAST_PROPERTY_ID_START_CHART_DATACAPTION_PROP = FAST_PROPERTY_ID_START + 14000,
@@ -45,7 +43,4 @@ enum FastPropertyIdRanges
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_FASTPROPERTYIDRANGES_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/FillProperties.hxx b/chart2/source/inc/FillProperties.hxx
index 65a7b221e517..ce1c6d83629c 100644
--- a/chart2/source/inc/FillProperties.hxx
+++ b/chart2/source/inc/FillProperties.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_FILLPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_FILLPROPERTIES_HXX
+#pragma once
#include "PropertyHelper.hxx"
#include "FastPropertyIdRanges.hxx"
@@ -64,15 +63,12 @@ namespace FillProperties
, PROP_FILL_BACKGROUND
};
- OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddPropertiesToVector(
std::vector< css::beans::Property > & rOutProperties );
- OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
}
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_FILLPROPERTIES_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/FormattedString.hxx b/chart2/source/inc/FormattedString.hxx
index 9d17d5f3885a..23c81454facf 100644
--- a/chart2/source/model/main/FormattedString.hxx
+++ b/chart2/source/inc/FormattedString.hxx
@@ -16,18 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_FORMATTEDSTRING_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_FORMATTEDSTRING_HXX
+#pragma once
-#include <MutexContainer.hxx>
-#include <OPropertySet.hxx>
+#include "OPropertySet.hxx"
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
+#include "ModifyListenerHelper.hxx"
+#include "PropertyHelper.hxx"
namespace chart
{
@@ -44,7 +42,6 @@ typedef ::cppu::WeakImplHelper<
}
class FormattedString final :
- public MutexContainer,
public impl::FormattedString_Base,
public ::property::OPropertySet
{
@@ -75,7 +72,6 @@ public:
virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) override
{ ::property::OPropertySet::removeVetoableChangeListener(p1, p2); }
-private:
explicit FormattedString( const FormattedString & rOther );
// ____ XFormattedString ____
@@ -88,9 +84,13 @@ private:
setFieldType( const css::chart2::DataPointCustomLabelFieldType FieldType ) override;
virtual OUString SAL_CALL getGuid() override;
void SAL_CALL setGuid( const OUString& guid ) override;
+ virtual sal_Bool SAL_CALL getDataLabelsRange() override;
+ virtual void SAL_CALL setDataLabelsRange( sal_Bool dataLabelsRange ) override;
+ virtual OUString SAL_CALL getCellRange() override;
+ virtual void SAL_CALL setCellRange( const OUString& cellRange ) override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -116,6 +116,7 @@ private:
virtual void SAL_CALL disposing(
const css::lang::EventObject& Source ) override;
+private:
// ____ OPropertySet ____
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
@@ -128,13 +129,14 @@ private:
// ____ XDataPointCustomLabelField ____
css::chart2::DataPointCustomLabelFieldType m_aType;
OUString m_aGuid;
+ OUString m_aCellRange;
+ bool m_bDataLabelsRange;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
-} // namespace chart
+OOO_DLLPUBLIC_CHARTTOOLS const ::chart::tPropertyValueMap & StaticFormattedStringDefaults();
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_FORMATTEDSTRING_HXX
-#endif
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/FormattedStringHelper.hxx b/chart2/source/inc/FormattedStringHelper.hxx
index 9953de31aff5..adc1f54802b8 100644
--- a/chart2/source/inc/FormattedStringHelper.hxx
+++ b/chart2/source/inc/FormattedStringHelper.hxx
@@ -16,31 +16,28 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_FORMATTEDSTRINGHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_FORMATTEDSTRINGHELPER_HXX
+#pragma once
-#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::chart2 { class XFormattedString2; }
-namespace com::sun::star::uno { class XComponentContext; }
namespace com::sun::star::uno { template <class interface_type> class Reference; }
namespace chart
{
+class FormattedString;
class FormattedStringHelper
{
public:
- static css::uno::Sequence<
- css::uno::Reference< css::chart2::XFormattedString2 > >
- createFormattedStringSequence(
- const css::uno::Reference< css::uno::XComponentContext > & xContext
- , const OUString & rString
- , const css::uno::Reference< css::beans::XPropertySet > & xTextProperties ) throw();
+ static rtl::Reference< ::chart::FormattedString >
+ createFormattedString(
+ const OUString & rString
+ , const css::uno::Reference< css::beans::XPropertySet > & xTextProperties ) noexcept;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/GridProperties.hxx b/chart2/source/inc/GridProperties.hxx
index 38d1f9a74ede..da19322675e3 100644
--- a/chart2/source/model/main/GridProperties.hxx
+++ b/chart2/source/inc/GridProperties.hxx
@@ -16,18 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_GRIDPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_GRIDPROPERTIES_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
+#include "ModifyListenerHelper.hxx"
-#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
+#include "OPropertySet.hxx"
namespace chart
{
@@ -42,13 +39,13 @@ typedef ::cppu::WeakImplHelper<
GridProperties_Base;
}
-class GridProperties final :
- public MutexContainer,
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) GridProperties final :
public impl::GridProperties_Base,
public ::property::OPropertySet
{
public:
explicit GridProperties();
+ explicit GridProperties( const GridProperties & rOther );
virtual ~GridProperties() override;
/// XServiceInfo declarations
@@ -61,11 +58,8 @@ public:
/// merge XTypeProvider implementations
DECLARE_XTYPEPROVIDER()
-private:
- explicit GridProperties( const GridProperties & rOther );
-
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -82,6 +76,8 @@ private:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+private:
+
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -94,12 +90,9 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_GRIDPROPERTIES_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/InternalData.hxx b/chart2/source/inc/InternalData.hxx
index 25ed60606d74..9d9abeb3a7c0 100644
--- a/chart2/source/inc/InternalData.hxx
+++ b/chart2/source/inc/InternalData.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_INTERNALDATA_HXX
-#define INCLUDED_CHART2_SOURCE_INC_INTERNALDATA_HXX
+#pragma once
#include <com/sun/star/uno/Sequence.hxx>
@@ -43,8 +42,8 @@ public:
void setColumnValues( sal_Int32 nColumnIndex, const std::vector< double > & rNewData );
void setRowValues( sal_Int32 nRowIndex, const std::vector< double > & rNewData );
- void setComplexColumnLabel( sal_Int32 nColumnIndex, const std::vector< css::uno::Any >& rComplexLabel );
- void setComplexRowLabel( sal_Int32 nRowIndex, const std::vector< css::uno::Any >& rComplexLabel );
+ void setComplexColumnLabel( sal_Int32 nColumnIndex, std::vector< css::uno::Any >&& rComplexLabel );
+ void setComplexRowLabel( sal_Int32 nRowIndex, std::vector< css::uno::Any >&& rComplexLabel );
std::vector< css::uno::Any > getComplexColumnLabel( sal_Int32 nColumnIndex ) const;
std::vector< css::uno::Any > getComplexRowLabel( sal_Int32 nRowIndex ) const;
@@ -67,9 +66,9 @@ public:
typedef std::vector< std::vector< css::uno::Any > > tVecVecAny; //inner index is hierarchical level
- void setComplexRowLabels( const tVecVecAny& rNewRowLabels );
+ void setComplexRowLabels( tVecVecAny&& rNewRowLabels );
const tVecVecAny& getComplexRowLabels() const;
- void setComplexColumnLabels( const tVecVecAny& rNewColumnLabels );
+ void setComplexColumnLabels( tVecVecAny&& rNewColumnLabels );
const tVecVecAny& getComplexColumnLabels() const;
void dump() const;
@@ -92,8 +91,6 @@ private:
tVecVecAny m_aColumnLabels;//outer index is column index
};
-#endif
-
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/InternalDataProvider.hxx b/chart2/source/inc/InternalDataProvider.hxx
index 7c3491ae17e6..a5032efcdab8 100644
--- a/chart2/source/inc/InternalDataProvider.hxx
+++ b/chart2/source/inc/InternalDataProvider.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX
+#pragma once
#include "InternalData.hxx"
@@ -30,6 +29,7 @@
#include <com/sun/star/util/XCloneable.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
+#include <rtl/ref.hxx>
#include <map>
@@ -37,6 +37,8 @@ namespace com::sun::star::chart2 { class XChartDocument; }
namespace chart
{
+class ChartModel;
+class UncachedDataSequence;
namespace impl
{
@@ -62,7 +64,7 @@ typedef ::cppu::WeakImplHelper<
<p>The format for a complete range is "all". (Do we need more than
that?)</p>
*/
-class InternalDataProvider :
+class InternalDataProvider final :
public impl::InternalDataProvider_Base
{
public:
@@ -71,7 +73,7 @@ public:
// #i120559# allow handing over a default for data orientation
// (DataInColumns) that will be used when no data is available
explicit InternalDataProvider(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc,
+ const rtl::Reference< ::chart::ChartModel > & xChartDoc,
bool bConnectToModel,
bool bDefaultDataInColumns );
explicit InternalDataProvider( const InternalDataProvider & rOther );
@@ -113,7 +115,8 @@ public:
const OUString& aRangeRepresentation ) override;
virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
- createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation ) override;
+ createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation,
+ const OUString& aRoleQualifier ) override;
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override;
@@ -180,11 +183,12 @@ private:
css::uno::Reference< css::chart2::data::XDataSequence >
createDataSequenceAndAddToMap( const OUString & rRangeRepresentation,
const OUString & rRole );
- css::uno::Reference< css::chart2::data::XDataSequence >
+ rtl::Reference< UncachedDataSequence >
createDataSequenceAndAddToMap( const OUString & rRangeRepresentation );
- css::uno::Reference<css::chart2::data::XDataSequence>
- createDataSequenceFromArray( const OUString& rArrayStr, const OUString& rRole );
+ rtl::Reference<UncachedDataSequence>
+ createDataSequenceFromArray( const OUString& rArrayStr, std::u16string_view rRole,
+ std::u16string_view rRoleQualifier);
void deleteMapReferences( const OUString & rRangeRepresentation );
@@ -213,7 +217,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/LabeledDataSequence.hxx b/chart2/source/inc/LabeledDataSequence.hxx
index dd99ac8479b5..aa37753695f9 100644
--- a/chart2/source/inc/LabeledDataSequence.hxx
+++ b/chart2/source/inc/LabeledDataSequence.hxx
@@ -16,14 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_LABELEDDATASEQUENCE_HXX
-#define INCLUDED_CHART2_SOURCE_INC_LABELEDDATASEQUENCE_HXX
+#pragma once
-#include "MutexContainer.hxx"
+#include <config_options.h>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/chart2/data/XLabeledDataSequence2.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "ModifyListenerHelper.hxx"
+#include "charttoolsdllapi.hxx"
namespace com::sun::star::chart2::data { class XDataSequence; }
namespace com::sun::star::util { class XCloneable; }
@@ -40,17 +41,17 @@ typedef cppu::WeakImplHelper<
LabeledDataSequence_Base;
}
-class LabeledDataSequence :
- public MutexContainer,
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) LabeledDataSequence final :
public impl::LabeledDataSequence_Base
{
public:
explicit LabeledDataSequence();
+ explicit LabeledDataSequence(const LabeledDataSequence &);
explicit LabeledDataSequence(
- const css::uno::Reference< css::chart2::data::XDataSequence > & rValues );
+ css::uno::Reference< css::chart2::data::XDataSequence > xValues );
explicit LabeledDataSequence(
- const css::uno::Reference< css::chart2::data::XDataSequence > & rValues,
- const css::uno::Reference< css::chart2::data::XDataSequence > & rLabels );
+ css::uno::Reference< css::chart2::data::XDataSequence > xValues,
+ css::uno::Reference< css::chart2::data::XDataSequence > xLabels );
virtual ~LabeledDataSequence() override;
@@ -59,7 +60,6 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-protected:
// ____ XLabeledDataSequence ____
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getValues() override;
virtual void SAL_CALL setValues(
@@ -81,12 +81,9 @@ private:
css::uno::Reference< css::chart2::data::XDataSequence > m_xData;
css::uno::Reference< css::chart2::data::XDataSequence > m_xLabel;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_LABELEDDATASEQUENCE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Legend.hxx b/chart2/source/inc/Legend.hxx
index 516324f2e107..dbc3db602400 100644
--- a/chart2/source/model/main/Legend.hxx
+++ b/chart2/source/inc/Legend.hxx
@@ -16,18 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX
+#pragma once
-#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
+#include "OPropertySet.hxx"
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/chart2/XLegend.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
+#include "ModifyListenerHelper.hxx"
+#include "charttoolsdllapi.hxx"
+#include "PropertyHelper.hxx"
namespace chart
{
@@ -43,8 +42,7 @@ typedef ::cppu::WeakImplHelper<
Legend_Base;
}
-class Legend final :
- public MutexContainer,
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) Legend final :
public impl::Legend_Base,
public ::property::OPropertySet
{
@@ -62,15 +60,16 @@ public:
/// merge XTypeProvider implementations
DECLARE_XTYPEPROVIDER()
-private:
explicit Legend( const Legend & rOther );
+private:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+public:
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
@@ -84,6 +83,7 @@ private:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+private:
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -96,12 +96,11 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
-} // namespace chart
+OOO_DLLPUBLIC_CHARTTOOLS const ::chart::tPropertyValueMap& StaticLegendDefaults();
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX
-#endif
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/LegendHelper.hxx b/chart2/source/inc/LegendHelper.hxx
index 75064f594eb6..c46131bd2bc4 100644
--- a/chart2/source/inc/LegendHelper.hxx
+++ b/chart2/source/inc/LegendHelper.hxx
@@ -16,10 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_LEGENDHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_LEGENDHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
#include "charttoolsdllapi.hxx"
namespace chart { class ChartModel; }
@@ -29,17 +30,19 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class Diagram;
+class Legend;
-class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) LegendHelper
{
public:
- static css::uno::Reference< css::chart2::XLegend >
+ static rtl::Reference< ::chart::Legend >
showLegend( ChartModel& rModel
, const css::uno::Reference< css::uno::XComponentContext >& xContext );
static void hideLegend( ChartModel& rModel );
- static css::uno::Reference< css::chart2::XLegend >
+ static rtl::Reference< ::chart::Legend >
getLegend( ChartModel& rModel
, const css::uno::Reference< css::uno::XComponentContext >& xContext = nullptr
, bool bCreate = false );
@@ -48,10 +51,9 @@ public:
is a legend which has a "Show" property of value <FALSE/>. Otherwise,
<TRUE/> is returned.
*/
- static bool hasLegend( const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+ static bool hasLegend( const rtl::Reference< ::chart::Diagram > & xDiagram );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/LifeTime.hxx b/chart2/source/inc/LifeTime.hxx
index ca1e583f9835..582d10086b78 100644
--- a/chart2/source/inc/LifeTime.hxx
+++ b/chart2/source/inc/LifeTime.hxx
@@ -16,27 +16,29 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_LIFETIME_HXX
-#define INCLUDED_CHART2_SOURCE_INC_LIFETIME_HXX
+#pragma once
-#include <osl/mutex.hxx>
+#include <config_options.h>
+#include <mutex>
#include <osl/conditn.hxx>
-#include <cppuhelper/interfacecontainer.h>
+#include <comphelper/interfacecontainer4.hxx>
#include "charttoolsdllapi.hxx"
+namespace com::sun::star::document { class XStorageChangeListener; }
namespace com::sun::star::lang { class XComponent; }
+namespace com::sun::star::lang { class XEventListener; }
namespace com::sun::star::util { class CloseVetoException; }
namespace com::sun::star::util { class XCloseListener; }
namespace com::sun::star::util { class XCloseable; }
+namespace com::sun::star::util { class XModifyListener; }
+namespace com::sun::star::view { class XSelectionChangeListener; }
namespace apphelper
{
-class OOO_DLLPUBLIC_CHARTTOOLS LifeTimeManager
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) LifeTimeManager
{
friend class LifeTimeGuard;
-protected:
- mutable ::osl::Mutex m_aAccessMutex;
public:
LifeTimeManager( css::lang::XComponent* pComponent );
virtual ~LifeTimeManager();
@@ -45,25 +47,25 @@ public:
/// @throws css::uno::RuntimeException
bool dispose();
-public:
- ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer;
+ mutable std::mutex m_aAccessMutex;
+ ::comphelper::OInterfaceContainerHelper4<css::util::XCloseListener> m_aCloseListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::util::XModifyListener> m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::document::XStorageChangeListener> m_aStorageChangeListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::view::XSelectionChangeListener> m_aSelectionChangeListeners;
protected:
- SAL_DLLPRIVATE virtual bool impl_canStartApiCall();
- SAL_DLLPRIVATE virtual void impl_apiCallCountReachedNull(){}
+ SAL_DLLPRIVATE virtual bool impl_canStartApiCall();
+ SAL_DLLPRIVATE virtual void impl_apiCallCountReachedNull(std::unique_lock<std::mutex>& /*rGuard*/){}
SAL_DLLPRIVATE void impl_registerApiCall(bool bLongLastingCall);
- SAL_DLLPRIVATE void impl_unregisterApiCall(bool bLongLastingCall);
+ SAL_DLLPRIVATE void impl_unregisterApiCall(std::unique_lock<std::mutex>& rGuard, bool bLongLastingCall);
-protected:
css::lang::XComponent* m_pComponent;
-
::osl::Condition m_aNoAccessCountCondition;
sal_Int32 m_nAccessCount;
-
bool volatile m_bDisposed;
bool volatile m_bInDispose;
-
::osl::Condition m_aNoLongLastingCallCountCondition;
sal_Int32 m_nLongLastingCallCount;
};
@@ -97,10 +99,10 @@ public:
private:
virtual bool impl_canStartApiCall() override;
- virtual void impl_apiCallCountReachedNull() override;
+ virtual void impl_apiCallCountReachedNull(std::unique_lock<std::mutex>& rGuard) override;
void impl_setOwnership( bool bDeliverOwnership, bool bMyVeto );
- void impl_doClose();
+ void impl_doClose(std::unique_lock<std::mutex>& rGuard);
};
/*
@@ -179,10 +181,10 @@ public:
}
bool startApiCall(bool bLongLastingCall=false);
~LifeTimeGuard();
- void clear() { m_guard.clear(); }
+ void clear() { m_guard.unlock(); }
private:
- osl::ClearableMutexGuard m_guard;
+ std::unique_lock<std::mutex> m_guard;
LifeTimeManager& m_rManager;
bool m_bCallRegistered;
bool m_bLongLastingCallRegistered;
@@ -192,24 +194,6 @@ private:
LifeTimeGuard& operator= ( const LifeTimeGuard& ) = delete;
};
-template<class T>
-class NegativeGuard final
-{
- T * m_pT;
-public:
-
- NegativeGuard(T & t) : m_pT(&t)
- {
- m_pT->release();
- }
-
- ~NegativeGuard()
- {
- m_pT->acquire();
- }
-};
-
}//end namespace apphelper
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/LinePropertiesHelper.hxx b/chart2/source/inc/LinePropertiesHelper.hxx
index 11c56b186eaf..efa5a6e6b847 100644
--- a/chart2/source/inc/LinePropertiesHelper.hxx
+++ b/chart2/source/inc/LinePropertiesHelper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_LINEPROPERTIESHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_LINEPROPERTIESHELPER_HXX
+#pragma once
#include "PropertyHelper.hxx"
#include "FastPropertyIdRanges.hxx"
@@ -45,13 +44,14 @@ namespace LinePropertiesHelper
PROP_LINE_COLOR,
PROP_LINE_TRANSPARENCE,
PROP_LINE_WIDTH,
- PROP_LINE_JOINT
+ PROP_LINE_JOINT,
+ PROP_LINE_CAP
};
- OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddPropertiesToVector(
std::vector< css::beans::Property > & rOutProperties );
- OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
bool IsLineVisible( const css::uno::Reference<
css::beans::XPropertySet >& xLineProperties );
@@ -65,7 +65,4 @@ namespace LinePropertiesHelper
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_LINEPROPERTIESHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/LinearRegressionCurveCalculator.hxx b/chart2/source/inc/LinearRegressionCurveCalculator.hxx
index 24d82d1ecf5d..05853b26a8f5 100644
--- a/chart2/source/inc/LinearRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/LinearRegressionCurveCalculator.hxx
@@ -16,15 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_LINEARREGRESSIONCURVECALCULATOR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_LINEARREGRESSIONCURVECALCULATOR_HXX
+#pragma once
#include "PolynomialRegressionCurveCalculator.hxx"
namespace chart
{
-class LinearRegressionCurveCalculator : public PolynomialRegressionCurveCalculator
+class LinearRegressionCurveCalculator final : public PolynomialRegressionCurveCalculator
{
public:
LinearRegressionCurveCalculator();
@@ -35,7 +34,8 @@ private:
sal_Int32 aDegree,
sal_Bool aForceIntercept,
double aInterceptValue,
- sal_Int32 aPeriod) override;
+ sal_Int32 aPeriod,
+ sal_Int32 nMovingType) override;
virtual css::uno::Sequence<css::geometry::RealPoint2D> SAL_CALL getCurveValues(
double min,
@@ -48,7 +48,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_LINEARREGRESSIONCURVECALCULATOR_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx
index 522756afe139..02fa1fc22bc0 100644
--- a/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx
@@ -16,15 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX
+#pragma once
#include "RegressionCurveCalculator.hxx"
namespace chart
{
-class LogarithmicRegressionCurveCalculator : public RegressionCurveCalculator
+class LogarithmicRegressionCurveCalculator final : public RegressionCurveCalculator
{
public:
LogarithmicRegressionCurveCalculator();
@@ -58,7 +57,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx
index 7c947bec4d8c..be46e973887d 100644
--- a/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx
@@ -16,15 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_MEANVALUEREGRESSIONCURVECALCULATOR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_MEANVALUEREGRESSIONCURVECALCULATOR_HXX
+#pragma once
#include "RegressionCurveCalculator.hxx"
namespace chart
{
-class MeanValueRegressionCurveCalculator : public RegressionCurveCalculator
+class MeanValueRegressionCurveCalculator final : public RegressionCurveCalculator
{
public:
MeanValueRegressionCurveCalculator();
@@ -57,7 +56,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_MEANVALUEREGRESSIONCURVECALCULATOR_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/MediaDescriptorHelper.hxx b/chart2/source/inc/MediaDescriptorHelper.hxx
index f44d5d1d038f..46edb2657598 100644
--- a/chart2/source/inc/MediaDescriptorHelper.hxx
+++ b/chart2/source/inc/MediaDescriptorHelper.hxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_MEDIADESCRIPTORHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_MEDIADESCRIPTORHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -44,7 +44,7 @@ namespace com::sun::star::io { class XStream; }
namespace apphelper
{
-class OOO_DLLPUBLIC_CHARTTOOLS MediaDescriptorHelper final
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) MediaDescriptorHelper final
{
public:
MediaDescriptorHelper( const css::uno::Sequence< css::beans::PropertyValue > & rMediaDescriptor );
@@ -88,6 +88,4 @@ private:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/TrueGuard.hxx b/chart2/source/inc/ModifyListenerCallBack.hxx
index 109c64a06c03..b1b704c86002 100644
--- a/chart2/source/inc/TrueGuard.hxx
+++ b/chart2/source/inc/ModifyListenerCallBack.hxx
@@ -16,24 +16,43 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_TRUEGUARD_HXX
-#define INCLUDED_CHART2_SOURCE_INC_TRUEGUARD_HXX
+
+#pragma once
+
+#include <config_options.h>
+#include <tools/link.hxx>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include "charttoolsdllapi.hxx"
namespace chart
{
-/** This guard sets the given boolean reference to true in the constructor and to false in the destructor
+/** Use this class as a member if you want to listen on a XModifyBroadcaster
+without becoming a XModifyListener yourself
*/
-class TrueGuard final
+
+class ModifyListenerCallBack_impl;
+
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ModifyListenerCallBack final
{
public:
- explicit TrueGuard(bool& rbTrueDuringGuardedTime);
- ~TrueGuard();
+ explicit ModifyListenerCallBack(const Link<void*, void>& rCallBack);
-private:
- bool& m_rbTrueDuringGuardedTime;
+ ~ModifyListenerCallBack();
+
+ void startListening(
+ const ::com::sun::star::uno::Reference<::com::sun::star::util::XModifyBroadcaster>&
+ xBroadcaster);
+ SAL_DLLPRIVATE void stopListening();
+
+private: //methods
+ ModifyListenerCallBack(const ModifyListenerCallBack&) = delete;
+
+private: //member
+ ModifyListenerCallBack_impl* pModifyListener_impl;
+ css::uno::Reference<css::util::XModifyListener> m_xModifyListener;
};
-}
-// INCLUDED_CHART2_SOURCE_INC_TRUEGUARD_HXX
-#endif
+
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ModifyListenerHelper.hxx b/chart2/source/inc/ModifyListenerHelper.hxx
index 29c4106f538f..ee90d407a66f 100644
--- a/chart2/source/inc/ModifyListenerHelper.hxx
+++ b/chart2/source/inc/ModifyListenerHelper.hxx
@@ -16,52 +16,33 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_MODIFYLISTENERHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_MODIFYLISTENERHELPER_HXX
+#pragma once
#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/interfacecontainer4.hxx>
+#include <comphelper/compbase.hxx>
+#include <rtl/ref.hxx>
-#include "MutexContainer.hxx"
-
-#include <vector>
+#include <mutex>
#include <algorithm>
#include <utility>
-namespace com::sun::star::uno { class XWeak; }
-namespace com::sun::star::uno { template <class interface_type> class WeakReference; }
-
namespace chart
{
-namespace ModifyListenerHelper
-{
-
-css::uno::Reference< css::util::XModifyListener > createModifyEventForwarder();
/** This helper class serves as forwarder of modify events. It can be used
whenever an object has to send modify events after it gets a modify event of
one of its children.
-
- <p>The listeners are held as WeakReferences if they support XWeak. Thus the
- life time of the listeners is independent of the broadcaster's lifetime in
- this case.</p>
*/
-class ModifyEventForwarder :
- public MutexContainer,
- public ::cppu::WeakComponentImplHelper<
+class ModifyEventForwarder final :
+ public ::comphelper::WeakComponentImplHelper<
css::util::XModifyBroadcaster,
css::util::XModifyListener >
{
public:
ModifyEventForwarder();
- void AddListener(
- const css::uno::Reference< css::util::XModifyListener >& aListener );
- void RemoveListener(
- const css::uno::Reference< css::util::XModifyListener >& aListener );
-
-protected:
// ____ XModifyBroadcaster ____
virtual void SAL_CALL addModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
@@ -72,29 +53,21 @@ protected:
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
+private:
// ____ XEventListener (base of XModifyListener) ____
virtual void SAL_CALL disposing(
const css::lang::EventObject& Source ) override;
// ____ WeakComponentImplHelperBase ____
- virtual void SAL_CALL disposing() override;
-
-private:
- /// call disposing() at all listeners and remove all listeners
- void DisposeAndClear( const css::uno::Reference<
- css::uno::XWeak > & xSource );
+ virtual void disposing(std::unique_lock<std::mutex>& ) override;
-// ::osl::Mutex & m_rMutex;
- ::cppu::OBroadcastHelper m_aModifyListeners;
+ comphelper::OInterfaceContainerHelper4<css::util::XModifyListener> m_aModifyListeners;
+};
- typedef std::vector<
- std::pair<
- css::uno::WeakReference< css::util::XModifyListener >,
- css::uno::Reference< css::util::XModifyListener > > >
- tListenerMap;
+}
- tListenerMap m_aListenerMap;
-};
+namespace chart::ModifyListenerHelper
+{
namespace impl
{
@@ -102,8 +75,8 @@ namespace impl
template< class InterfaceRef >
struct addListenerFunctor
{
- explicit addListenerFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) :
- m_xListener( xListener )
+ explicit addListenerFunctor( css::uno::Reference< css::util::XModifyListener > xListener ) :
+ m_xListener(std::move( xListener ))
{}
void operator() ( const InterfaceRef & xObject )
@@ -120,8 +93,8 @@ private:
template< class InterfaceRef >
struct removeListenerFunctor
{
- explicit removeListenerFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) :
- m_xListener( xListener )
+ explicit removeListenerFunctor( css::uno::Reference< css::util::XModifyListener > xListener ) :
+ m_xListener(std::move( xListener ))
{}
void operator() ( const InterfaceRef & xObject )
@@ -138,8 +111,8 @@ private:
template< class Pair >
struct addListenerToMappedElementFunctor
{
- explicit addListenerToMappedElementFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) :
- m_xListener( xListener )
+ explicit addListenerToMappedElementFunctor( css::uno::Reference< css::util::XModifyListener > xListener ) :
+ m_xListener(std::move( xListener ))
{}
void operator() ( const Pair & aPair )
@@ -156,8 +129,8 @@ private:
template< class Pair >
struct removeListenerFromMappedElementFunctor
{
- explicit removeListenerFromMappedElementFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) :
- m_xListener( xListener )
+ explicit removeListenerFromMappedElementFunctor( css::uno::Reference< css::util::XModifyListener > xListener ) :
+ m_xListener(std::move( xListener ))
{}
void operator() ( const Pair & aPair )
@@ -184,6 +157,14 @@ void addListener(
aFunctor( xObject );
}
}
+template< class T >
+void addListener(
+ const rtl::Reference<T> & xBroadcaster,
+ const css::uno::Reference< css::util::XModifyListener > & xListener )
+{
+ if( xBroadcaster && xListener )
+ xBroadcaster->addModifyListener( xListener );
+}
template< class Container >
void addListenerToAllElements(
@@ -195,6 +176,17 @@ void addListenerToAllElements(
impl::addListenerFunctor< typename Container::value_type >( xListener ));
}
+template< class T >
+void addListenerToAllElements(
+ const std::vector<rtl::Reference<T>> & rContainer,
+ const css::uno::Reference< css::util::XModifyListener > & xListener )
+{
+ if( !xListener )
+ return;
+ for (auto const & i : rContainer)
+ i->addModifyListener(xListener);
+}
+
template< class Container >
void addListenerToAllMapElements(
const Container & rContainer,
@@ -205,16 +197,6 @@ void addListenerToAllMapElements(
impl::addListenerToMappedElementFunctor< typename Container::value_type >( xListener ));
}
-template< typename T >
-void addListenerToAllSequenceElements(
- const css::uno::Sequence< T > & rSequence,
- const css::uno::Reference< css::util::XModifyListener > & xListener )
-{
- if( xListener.is())
- std::for_each( rSequence.begin(), rSequence.end(),
- impl::addListenerFunctor< T >( xListener ));
-}
-
template< class InterfaceRef >
void removeListener(
const InterfaceRef & xObject,
@@ -227,6 +209,15 @@ void removeListener(
}
}
+template< class T >
+void removeListener(
+ const rtl::Reference<T> & xBroadcaster,
+ const css::uno::Reference< css::util::XModifyListener > & xListener )
+{
+ if( xBroadcaster && xListener )
+ xBroadcaster->removeModifyListener( xListener );
+}
+
template< class Container >
void removeListenerFromAllElements(
const Container & rContainer,
@@ -237,6 +228,17 @@ void removeListenerFromAllElements(
impl::removeListenerFunctor< typename Container::value_type >( xListener ));
}
+template< class T >
+void removeListenerFromAllElements(
+ const std::vector<rtl::Reference<T>> & rContainer,
+ const css::uno::Reference< css::util::XModifyListener > & xListener )
+{
+ if( !xListener )
+ return;
+ for (auto const & i : rContainer)
+ i->removeModifyListener(xListener);
+}
+
template< class Container >
void removeListenerFromAllMapElements(
const Container & rContainer,
@@ -247,20 +249,6 @@ void removeListenerFromAllMapElements(
impl::removeListenerFromMappedElementFunctor< typename Container::value_type >( xListener ));
}
-template< typename T >
-void removeListenerFromAllSequenceElements(
- const css::uno::Sequence< T > & rSequence,
- const css::uno::Reference< css::util::XModifyListener > & xListener )
-{
- if( xListener.is())
- std::for_each( rSequence.begin(), rSequence.end(),
- impl::removeListenerFunctor< T >( xListener ));
-}
-
-} // namespace ModifyListenerHelper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_INC_MODIFYLISTENERHELPER_HXX
-#endif
+} // namespace chart::ModifyListenerHelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx b/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx
index fb6185098193..f7e25fe51348 100644
--- a/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx
@@ -16,16 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_MOVINGAVERAGEREGRESSIONCURVECALCULATOR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_MOVINGAVERAGEREGRESSIONCURVECALCULATOR_HXX
+#pragma once
#include "RegressionCurveCalculator.hxx"
+#include "RegressionCalculationHelper.hxx"
#include <vector>
namespace chart
{
-class MovingAverageRegressionCurveCalculator : public RegressionCurveCalculator
+class MovingAverageRegressionCurveCalculator final : public RegressionCurveCalculator
{
public:
MovingAverageRegressionCurveCalculator();
@@ -52,12 +52,12 @@ private:
const css::uno::Reference<css::chart2::XScaling>& xScalingY,
sal_Bool bMaySkipPointsInCalculation ) override;
+ void calculateValues(RegressionCalculationHelper::tDoubleVectorPair aValues, bool bUseXAvg);
+ void calculateValuesCentral(RegressionCalculationHelper::tDoubleVectorPair aValues);
std::vector<double> aYList;
std::vector<double> aXList;
};
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_INC_MOVINGAVERAGEREGRESSIONCURVECALCULATOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/MutexContainer.hxx b/chart2/source/inc/MutexContainer.hxx
deleted file mode 100644
index bab6b6c3fb1a..000000000000
--- a/chart2/source/inc/MutexContainer.hxx
+++ /dev/null
@@ -1,41 +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 INCLUDED_CHART2_SOURCE_INC_MUTEXCONTAINER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_MUTEXCONTAINER_HXX
-
-#include <osl/mutex.hxx>
-
-namespace chart
-{
-class MutexContainer
-{
-protected:
- MutexContainer() = default;
-
- ~MutexContainer() = default;
-
- mutable ::osl::Mutex m_aMutex;
-};
-
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_INC_MUTEXCONTAINER_HXX
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/NameContainer.hxx b/chart2/source/inc/NameContainer.hxx
index 8d13d8037eff..12fc76978b0d 100644
--- a/chart2/source/inc/NameContainer.hxx
+++ b/chart2/source/inc/NameContainer.hxx
@@ -17,23 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_NAMECONTAINER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_NAMECONTAINER_HXX
+#pragma once
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XCloneable.hpp>
#include <cppuhelper/implbase.hxx>
-#include "charttoolsdllapi.hxx"
#include <map>
namespace chart
{
-OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::container::XNameContainer > createNameContainer(
- const css::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName );
-
namespace impl
{
typedef ::cppu::WeakImplHelper<
@@ -43,11 +38,12 @@ typedef ::cppu::WeakImplHelper<
NameContainer_Base;
}
-class NameContainer : public impl::NameContainer_Base
+/// Contains the XML namespaces map
+///
+class NameContainer final : public impl::NameContainer_Base
{
public:
- NameContainer() = delete;
- NameContainer( const css::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName );
+ NameContainer();
explicit NameContainer( const NameContainer & rOther );
virtual ~NameContainer() override;
@@ -76,16 +72,11 @@ public:
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
private: //member
- const css::uno::Type m_aType;
- const OUString m_aServicename;
- const OUString m_aImplementationName;
typedef std::map< OUString, css::uno::Any > tContentMap;
-
tContentMap m_aMap;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/NumberFormatterWrapper.hxx b/chart2/source/inc/NumberFormatterWrapper.hxx
index 828ef6a3cc4d..aff249d84f33 100644
--- a/chart2/source/inc/NumberFormatterWrapper.hxx
+++ b/chart2/source/inc/NumberFormatterWrapper.hxx
@@ -16,12 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_NUMBERFORMATTERWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_NUMBERFORMATTERWRAPPER_HXX
+#pragma once
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <tools/solar.h>
#include <tools/date.hxx>
class SvNumberFormatter;
@@ -30,7 +29,7 @@ class Color;
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS NumberFormatterWrapper final
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) NumberFormatterWrapper final
{
public:
NumberFormatterWrapper( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier );
@@ -62,10 +61,9 @@ public:
private:
NumberFormatterWrapper m_aNumberFormatterWrapper;
- sal_uLong m_nNumberFormatKey;
+ sal_uInt32 m_nNumberFormatKey;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx
index 1fafa218a9bd..0dd19a236e8a 100644
--- a/chart2/source/inc/OPropertySet.hxx
+++ b/chart2/source/inc/OPropertySet.hxx
@@ -16,10 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX
-#define INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX
+#pragma once
+
+#include <config_options.h>
// helper classes
+#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/propshlp.hxx>
// interfaces and types
@@ -29,15 +31,13 @@
#include <com/sun/star/style/XStyleSupplier.hpp>
#include "charttoolsdllapi.hxx"
-#include <memory>
+#include <unordered_map>
namespace property
{
-namespace impl
-{ class ImplOPropertySet; }
-
-class OPropertySet :
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OPropertySet :
+ protected cppu::BaseMutex,
public ::cppu::OBroadcastHelper,
// includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet
public ::cppu::OPropertySetHelper,
@@ -49,22 +49,25 @@ class OPropertySet :
public css::style::XStyleSupplier
{
public:
- OPropertySet( ::osl::Mutex & rMutex );
+ OPropertySet();
virtual ~OPropertySet();
protected:
- explicit OPropertySet( const OPropertySet & rOther, ::osl::Mutex & rMutex );
+ explicit OPropertySet( const OPropertySet & rOther );
void SetNewValuesExplicitlyEvenIfTheyEqualDefault();
/** implement this method to provide default values for all properties
supporting defaults. If a property does not have a default value, you
may throw an UnknownPropertyException.
+ We pass the any by reference because this code is very hot and doing
+ it this way is cheaper than the two step process of constructing a new
+ any and then assigning to via a return value.
@throws css::beans::UnknownPropertyException
@throws css::uno::RuntimeException
*/
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const = 0;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const = 0;
/** The InfoHelper table contains all property names and types of
this object.
@@ -104,7 +107,7 @@ protected:
( css::uno::Any & rConvertedValue,
css::uno::Any & rOldValue,
sal_Int32 nHandle,
- const css::uno::Any& rValue ) override;
+ const css::uno::Any& rValue ) override final;
/** The same as setFastPropertyValue; nHandle is always valid.
The changes must not be broadcasted in this method.
@@ -137,14 +140,15 @@ protected:
( css::uno::Any& rValue,
sal_Int32 nHandle ) const override;
- /// make original interface function visible again
- using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
-
/** implement this method in derived classes to get called when properties
change.
*/
virtual void firePropertyChangeEvent();
+public:
+ /// make original interface function visible again
+ using ::cppu::OPropertySetHelper::getFastPropertyValue;
+
// Interfaces
// ____ XInterface ____
@@ -158,51 +162,74 @@ protected:
// ____ XPropertyState ____
virtual css::beans::PropertyState SAL_CALL
- getPropertyState( const OUString& PropertyName ) override;
+ getPropertyState( const OUString& PropertyName ) override final;
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL
- getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
+ getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override final;
virtual void SAL_CALL
- setPropertyToDefault( const OUString& PropertyName ) override;
+ setPropertyToDefault( const OUString& PropertyName ) override final;
virtual css::uno::Any SAL_CALL
- getPropertyDefault( const OUString& aPropertyName ) override;
+ getPropertyDefault( const OUString& aPropertyName ) override final;
// ____ XMultiPropertyStates ____
// Note: getPropertyStates() is already implemented in XPropertyState with the
// same signature
virtual void SAL_CALL
- setAllPropertiesToDefault() override;
+ setAllPropertiesToDefault() override final;
virtual void SAL_CALL
- setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+ setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override final;
virtual css::uno::Sequence< css::uno::Any > SAL_CALL
- getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override;
+ getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override final;
// ____ XStyleSupplier ____
- virtual css::uno::Reference< css::style::XStyle > SAL_CALL getStyle() override;
- virtual void SAL_CALL setStyle( const css::uno::Reference< css::style::XStyle >& xStyle ) override;
+ virtual css::uno::Reference< css::style::XStyle > SAL_CALL getStyle() override final;
+ virtual void SAL_CALL setStyle( const css::uno::Reference< css::style::XStyle >& xStyle ) override final;
// ____ XMultiPropertySet ____
virtual void SAL_CALL setPropertyValues(
const css::uno::Sequence< OUString >& PropertyNames,
- const css::uno::Sequence< css::uno::Any >& Values ) override;
+ const css::uno::Sequence< css::uno::Any >& Values ) override final;
// ____ XFastPropertySet ____
- virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
+ virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) override final;
// Note: it is assumed that the base class implements setPropertyValue by
// using setFastPropertyValue
private:
- /// reference to mutex of class deriving from here
- ::osl::Mutex & m_rMutex;
+ /** supports states DIRECT_VALUE and DEFAULT_VALUE
+ */
+ css::beans::PropertyState
+ GetPropertyStateByHandle( sal_Int32 nHandle ) const;
+
+ css::uno::Sequence< css::beans::PropertyState >
+ GetPropertyStatesByHandle( const std::vector< sal_Int32 > & aHandles ) const;
+
+ void SetPropertyToDefault( sal_Int32 nHandle );
+ void SetPropertiesToDefault( const std::vector< sal_Int32 > & aHandles );
+ void SetAllPropertiesToDefault();
+
+ /** @param rValue is set to the value for the property given in nHandle. If
+ the property is not set, the style chain is searched for any
+ instance set there. If there was no value found either in the
+ property set itself or any of its styles, rValue remains
+ unchanged and false is returned.
+
+ @return false if the property is default, true otherwise.
+ */
+ bool GetPropertyValueByHandle(
+ css::uno::Any & rValue,
+ sal_Int32 nHandle ) const;
+
+ void SetPropertyValueByHandle( sal_Int32 nHandle,
+ const css::uno::Any & rValue );
+
+ bool SetStyle( const css::uno::Reference< css::style::XStyle > & xStyle );
- /// pImpl idiom implementation
- std::unique_ptr< impl::ImplOPropertySet > m_pImplProperties;
bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault;
+ std::unordered_map< sal_Int32, css::uno::Any > m_aProperties;
+ css::uno::Reference< css::style::XStyle > m_xStyle;
};
} // namespace property
-// INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx
index 59248857b91c..5cfd6a1671b1 100644
--- a/chart2/source/inc/ObjectIdentifier.hxx
+++ b/chart2/source/inc/ObjectIdentifier.hxx
@@ -16,13 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_OBJECTIDENTIFIER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_OBJECTIDENTIFIER_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
#include "TitleHelper.hxx"
#include "charttoolsdllapi.hxx"
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
namespace chart { class ChartModel; }
namespace com::sun::star::awt { struct Point; }
@@ -38,6 +42,11 @@ namespace com::sun::star::uno { class XInterface; }
namespace chart
{
+class Axis;
+class BaseCoordinateSystem;
+class DataSeries;
+class Diagram;
+class Legend;
enum ObjectType
{
@@ -65,11 +74,12 @@ enum ObjectType
OBJECTTYPE_DATA_STOCK_RANGE,
OBJECTTYPE_DATA_STOCK_LOSS,
OBJECTTYPE_DATA_STOCK_GAIN,
+ OBJECTTYPE_DATA_TABLE,
OBJECTTYPE_SHAPE,
OBJECTTYPE_UNKNOWN
};
-class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ObjectIdentifier
{
//CID == ClassifiedIdentifier <--> name of shape
//semicolon, colon, equal sign and slash have special meanings in a CID
@@ -90,45 +100,45 @@ class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier
public:
ObjectIdentifier();
- ObjectIdentifier( const OUString& rObjectCID );
+ ObjectIdentifier( OUString aObjectCID );
ObjectIdentifier( const css::uno::Reference< css::drawing::XShape >& rxShape );
ObjectIdentifier( const css::uno::Any& rAny );
bool operator==( const ObjectIdentifier& rOID ) const;
- bool operator!=( const ObjectIdentifier& rOID ) const;
bool operator<( const ObjectIdentifier& rOID ) const;
static OUString createClassifiedIdentifierForObject(
const css::uno::Reference< css::uno::XInterface >& xObject
- , ChartModel& rModel);
-
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static OUString createClassifiedIdentifierForObject(
- const css::uno::Reference< css::uno::XInterface >& xObject
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ const rtl::Reference< ::chart::Title >& xObject
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
+ static OUString createClassifiedIdentifierForObject(
+ const rtl::Reference< ::chart::Legend >& xObject
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
+ static OUString createClassifiedIdentifierForObject(
+ const rtl::Reference< ::chart::Axis >& xObject
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static OUString createClassifiedIdentifierForParticle(
- const OUString& rParticle );
+ std::u16string_view rParticle );
static OUString createClassifiedIdentifierForParticles(
- const OUString& rParentParticle
- , const OUString& rChildParticle
- , const OUString& rDragMethodServiceName = OUString()
- , const OUString& rDragParameterString = OUString() );
+ std::u16string_view rParentParticle
+ , std::u16string_view rChildParticle
+ , std::u16string_view rDragMethodServiceName = std::u16string_view()
+ , std::u16string_view rDragParameterString = std::u16string_view() );
static OUString createClassifiedIdentifierForGrid(
const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::frame::XModel >& xChartModel
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc
SAL_DLLPRIVATE static OUString createParticleForDiagram();
static OUString createParticleForCoordinateSystem(
- const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
- , ChartModel& rModel );
-
- static OUString createParticleForCoordinateSystem(
- const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static OUString createParticleForAxis(
sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
@@ -139,97 +149,95 @@ public:
static OUString createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
, sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex );
- static OUString createParticleForLegend( ChartModel& rModel );
-
static OUString createParticleForLegend(
- const css::uno::Reference< css::frame::XModel >& xChartModel );
+ const rtl::Reference<::chart::ChartModel>& xChartModel );
- static OUString addChildParticle( const OUString& rParticle, const OUString& rChildParticle );
+ /** Creates an identifier for the data table */
+ static OUString createParticleForDataTable(
+ const rtl::Reference<::chart::ChartModel>& xChartModel );
+
+ static OUString addChildParticle( std::u16string_view rParticle, std::u16string_view rChildParticle );
static OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex );
- static sal_Int32 getIndexFromParticleOrCID( const OUString& rParticleOrCID );
+ static sal_Int32 getIndexFromParticleOrCID( std::u16string_view rParticleOrCID );
static OUString createClassifiedIdentifier(
enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
- , const OUString& rParticleID );//e.g. SeriesID
+ , std::u16string_view rParticleID );//e.g. SeriesID
static OUString createClassifiedIdentifierWithParent(
enum ObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
- , const OUString& rParticleID //for points or subgrids this is an Index or otherwise an identifier from the model object
- , const OUString& rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
- , const OUString& rDragMethodServiceName = OUString()
- , const OUString& rDragParameterString = OUString()
+ , std::u16string_view rParticleID //for points or subgrids this is an Index or otherwise an identifier from the model object
+ , std::u16string_view rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
+ , std::u16string_view rDragMethodServiceName = std::u16string_view()
+ , std::u16string_view rDragParameterString = std::u16string_view()
);
- static bool isCID( const OUString& rName );
- static OUString getDragMethodServiceName( const OUString& rClassifiedIdentifier );
- static OUString getDragParameterString( const OUString& rCID );
- static bool isDragableObject( const OUString& rClassifiedIdentifier );
+ static bool isCID( std::u16string_view rName );
+ static std::u16string_view getDragMethodServiceName( std::u16string_view rClassifiedIdentifier );
+ static std::u16string_view getDragParameterString( std::u16string_view rCID );
+ static bool isDragableObject( std::u16string_view rClassifiedIdentifier );
bool isDragableObject() const;
- static bool isRotateableObject( const OUString& rClassifiedIdentifier );
- static bool isMultiClickObject( const OUString& rClassifiedIdentifier );
- static bool areSiblings( const OUString& rCID1, const OUString& rCID2 );//identical object is no sibling
- static bool areIdenticalObjects( const OUString& rCID1, const OUString& rCID2 );
+ static bool isRotateableObject( std::u16string_view rClassifiedIdentifier );
+ static bool isMultiClickObject( std::u16string_view rClassifiedIdentifier );
+ static bool areSiblings( std::u16string_view rCID1, std::u16string_view rCID2 );//identical object is no sibling
+ static bool areIdenticalObjects( std::u16string_view rCID1, std::u16string_view rCID2 );
static OUString getStringForType( ObjectType eObjectType );
- static ObjectType getObjectType( const OUString& rCID );
+ static ObjectType getObjectType( std::u16string_view rCID );
ObjectType getObjectType() const;
static OUString createSeriesSubObjectStub( ObjectType eSubObjectType
- , const OUString& rSeriesParticle
- , const OUString& rDragMethodServiceName = OUString()
- , const OUString& rDragParameterString = OUString() );
- static OUString createPointCID( const OUString& rPointCID_Stub, sal_Int32 nIndex );
+ , std::u16string_view rSeriesParticle
+ , std::u16string_view rDragMethodServiceName = std::u16string_view()
+ , std::u16string_view rDragParameterString = std::u16string_view() );
+ static OUString createPointCID( std::u16string_view rPointCID_Stub, sal_Int32 nIndex );
- static OUString createDataCurveCID( const OUString& rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine );
- static OUString createDataCurveEquationCID( const OUString& rSeriesParticle, sal_Int32 nCurveIndex );
+ static OUString createDataCurveCID( std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine );
+ static OUString createDataCurveEquationCID( std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex );
- SAL_DLLPRIVATE static OUString getObjectID( const OUString& rCID );
- static OUString getParticleID( const OUString& rCID );
- static OUString getFullParentParticle( const OUString& rCID );
+ SAL_DLLPRIVATE static OUString getObjectID( std::u16string_view rCID );
+ static std::u16string_view getParticleID( std::u16string_view rCID );
+ static std::u16string_view getFullParentParticle( std::u16string_view rCID );
//returns the series particle of a CID when the CID is a child of the series
- static OUString getSeriesParticleFromCID( const OUString& rCID );
+ static OUString getSeriesParticleFromCID( std::u16string_view rCID );
//return the model object that is indicated by rObjectCID
static css::uno::Reference< css::beans::XPropertySet >
getObjectPropertySet(
- const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
- static css::uno::Reference< css::beans::XPropertySet >
- getObjectPropertySet(
- const OUString& rObjectCID
- , const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument );
+ std::u16string_view rObjectCID
+ , const rtl::Reference< ::chart::ChartModel >& xChartDocument );
//return the axis object that belongs to rObjectCID if any
- static css::uno::Reference< css::chart2::XAxis >
+ static rtl::Reference< ::chart::Axis >
getAxisForCID(
- const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
//return the series object that belongs to rObjectCID if any
- static css::uno::Reference< css::chart2::XDataSeries >
+ static rtl::Reference< ::chart::DataSeries >
getDataSeriesForCID(
- const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
- static css::uno::Reference< css::chart2::XDiagram >
+ static rtl::Reference< ::chart::Diagram >
getDiagramForCID(
- const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static const OUString& getPieSegmentDragMethodServiceName();
static OUString createPieSegmentDragParameterString(
sal_Int32 nOffsetPercent
, const css::awt::Point& rMinimumPosition
, const css::awt::Point& rMaximumPosition );
- static bool parsePieSegmentDragParameterString( const OUString& rDragParameterString
+ static bool parsePieSegmentDragParameterString( std::u16string_view rDragParameterString
, sal_Int32& rOffsetPercent
, css::awt::Point& rMinimumPosition
, css::awt::Point& rMaximumPosition );
- static TitleHelper::eTitleType getTitleTypeForCID( const OUString& rCID );
+ static TitleHelper::eTitleType getTitleTypeForCID( std::u16string_view rCID );
- static OUString getMovedSeriesCID( const OUString& rObjectCID, bool bForward );
+ static OUString getMovedSeriesCID( std::u16string_view rObjectCID, bool bForward );
bool isValid() const;
bool isAutoGeneratedObject() const;
@@ -249,6 +257,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx b/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx
index e47d882d4903..73512497b190 100644
--- a/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_POLYNOMIALREGRESSIONCURVECALCULATOR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_POLYNOMIALREGRESSIONCURVECALCULATOR_HXX
+#pragma once
#include "RegressionCurveCalculator.hxx"
#include <vector>
@@ -59,6 +58,4 @@ private:
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_INC_POLYNOMIALREGRESSIONCURVECALCULATOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/PopupRequest.hxx b/chart2/source/inc/PopupRequest.hxx
index 0c9af2f50bad..90fe315d2471 100644
--- a/chart2/source/inc/PopupRequest.hxx
+++ b/chart2/source/inc/PopupRequest.hxx
@@ -7,51 +7,37 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX
-#define INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX
+#pragma once
-#include "MutexContainer.hxx"
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
#include <com/sun/star/awt/XRequestCallback.hpp>
namespace chart
{
-
namespace impl
{
-
-typedef cppu::WeakComponentImplHelper<css::awt::XRequestCallback> PopupRequest_Base;
-
+typedef comphelper::WeakComponentImplHelper<css::awt::XRequestCallback> PopupRequest_Base;
}
-class OOO_DLLPUBLIC_CHARTTOOLS PopupRequest : public MutexContainer, public impl::PopupRequest_Base
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) PopupRequest final : public impl::PopupRequest_Base
{
public:
explicit PopupRequest();
virtual ~PopupRequest() override;
- css::uno::Reference<css::awt::XCallback> const & getCallback() const
- {
- return m_xCallback;
- }
+ css::uno::Reference<css::awt::XCallback> const& getCallback() const { return m_xCallback; }
-protected:
// ____ XRequestCallback ____
- virtual void SAL_CALL addCallback(const css::uno::Reference< ::css::awt::XCallback >& xCallback,
+ virtual void SAL_CALL addCallback(const css::uno::Reference<::css::awt::XCallback>& xCallback,
const css::uno::Any& aData) override;
- // ____ WeakComponentImplHelperBase ____
- // is called when dispose() is called at this component
- virtual void SAL_CALL disposing() override;
-
private:
css::uno::Reference<css::awt::XCallback> m_xCallback;
};
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/PotentialRegressionCurveCalculator.hxx b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx
index c3306d3c6ee4..a0d05b4a2f53 100644
--- a/chart2/source/inc/PotentialRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx
@@ -16,15 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_POTENTIALREGRESSIONCURVECALCULATOR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_POTENTIALREGRESSIONCURVECALCULATOR_HXX
+#pragma once
#include "RegressionCurveCalculator.hxx"
namespace chart
{
-class PotentialRegressionCurveCalculator : public RegressionCurveCalculator
+class PotentialRegressionCurveCalculator final : public RegressionCurveCalculator
{
public:
PotentialRegressionCurveCalculator();
@@ -59,7 +58,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_POTENTIALREGRESSIONCURVECALCULATOR_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/PropertyHelper.hxx b/chart2/source/inc/PropertyHelper.hxx
index 19ce354c9735..3e1949057361 100644
--- a/chart2/source/inc/PropertyHelper.hxx
+++ b/chart2/source/inc/PropertyHelper.hxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_PROPERTYHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_PROPERTYHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/uno/Any.hxx>
#include "charttoolsdllapi.hxx"
@@ -42,7 +42,7 @@ namespace PropertyHelper
@return The name used for storing this element in the table
*/
-OOO_DLLPUBLIC_CHARTTOOLS OUString addLineDashUniqueNameToTable(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString addLineDashUniqueNameToTable(
const css::uno::Any & rValue,
const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
const OUString & rPreferredName );
@@ -52,7 +52,7 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString addLineDashUniqueNameToTable(
@return The name used for storing this element in the table
*/
-OOO_DLLPUBLIC_CHARTTOOLS OUString addGradientUniqueNameToTable(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString addGradientUniqueNameToTable(
const css::uno::Any & rValue,
const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
const OUString & rPreferredName );
@@ -62,7 +62,7 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString addGradientUniqueNameToTable(
@return The name used for storing this element in the table
*/
-OOO_DLLPUBLIC_CHARTTOOLS
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
OUString addTransparencyGradientUniqueNameToTable(
const css::uno::Any & rValue,
const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
@@ -73,7 +73,7 @@ OUString addTransparencyGradientUniqueNameToTable(
@return The name used for storing this element in the table
*/
-OOO_DLLPUBLIC_CHARTTOOLS OUString addHatchUniqueNameToTable(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString addHatchUniqueNameToTable(
const css::uno::Any & rValue,
const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
const OUString & rPreferredName );
@@ -83,7 +83,7 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString addHatchUniqueNameToTable(
@return The name used for storing this element in the table
*/
-OOO_DLLPUBLIC_CHARTTOOLS OUString addBitmapUniqueNameToTable(
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString addBitmapUniqueNameToTable(
const css::uno::Any & rValue,
const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
const OUString & rPreferredName );
@@ -93,7 +93,7 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString addBitmapUniqueNameToTable(
@param any is the value encapsulated in the variant type Any
*/
-OOO_DLLPUBLIC_CHARTTOOLS
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS)
void setPropertyValueAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key,
const css::uno::Any & rAny );
@@ -112,7 +112,7 @@ template< typename Value >
template<>
void setPropertyValue< css::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::uno::Any & rAny );
-OOO_DLLPUBLIC_CHARTTOOLS void setPropertyValueDefaultAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::uno::Any & rAny );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void setPropertyValueDefaultAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::uno::Any & rAny );
/** Calls setPropertyValue() but asserts that the given property hasn't been set
before.
@@ -131,7 +131,7 @@ template<>
/** Calls setPropertyValueDefault() with an empty Any as value
*/
-OOO_DLLPUBLIC_CHARTTOOLS void setEmptyPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key );
+UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void setEmptyPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key );
} // namespace PropertyHelper
@@ -146,7 +146,4 @@ struct OOO_DLLPUBLIC_CHARTTOOLS PropertyNameLess
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_PROPERTYHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/RangeHighlighter.hxx b/chart2/source/inc/RangeHighlighter.hxx
index c1fe2d721b5b..c7bcdd2c5c55 100644
--- a/chart2/source/inc/RangeHighlighter.hxx
+++ b/chart2/source/inc/RangeHighlighter.hxx
@@ -16,13 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_RANGEHIGHLIGHTER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_RANGEHIGHLIGHTER_HXX
+#pragma once
-#include "MutexContainer.hxx"
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <rtl/ref.hxx>
namespace com::sun::star {
namespace chart2 {
@@ -36,23 +36,25 @@ namespace com::sun::star::view { class XSelectionSupplier; }
namespace chart
{
+class ChartModel;
+class DataSeries;
+class Diagram;
namespace impl
{
-typedef ::cppu::WeakComponentImplHelper<
+typedef comphelper::WeakComponentImplHelper<
css::chart2::data::XRangeHighlighter,
css::view::XSelectionChangeListener
>
RangeHighlighter_Base;
}
-class RangeHighlighter :
- public MutexContainer,
+class RangeHighlighter final :
public impl::RangeHighlighter_Base
{
public:
explicit RangeHighlighter(
- const css::uno::Reference< css::view::XSelectionSupplier > & xSelectionSupplier );
+ const rtl::Reference< ::chart::ChartModel > & xSelectionSupplier );
virtual ~RangeHighlighter() override;
protected:
@@ -73,7 +75,7 @@ protected:
// ____ WeakComponentImplHelperBase ____
// is called when dispose() is called at this component
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
private:
void fireSelectionEvent();
@@ -81,26 +83,25 @@ private:
void stopListening();
void determineRanges();
- void fillRangesForDiagram( const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
+ void fillRangesForDiagram( const rtl::Reference< ::chart::Diagram > & xDiagram );
void fillRangesForDataSeries( const css::uno::Reference< css::chart2::XDataSeries > & xSeries );
void fillRangesForCategories( const css::uno::Reference< css::chart2::XAxis > & xAxis );
- void fillRangesForDataPoint( const css::uno::Reference< css::uno::XInterface > & xDataSeries, sal_Int32 nIndex );
+ void fillRangesForDataPoint( const rtl::Reference< ::chart::DataSeries > & xDataSeries, sal_Int32 nIndex );
void fillRangesForErrorBars( const css::uno::Reference< css::beans::XPropertySet > & xErrorBar,
const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries );
css::uno::Reference< css::view::XSelectionSupplier >
m_xSelectionSupplier;
+ rtl::Reference< ::chart::ChartModel > m_xChartModel;
css::uno::Reference< css::view::XSelectionChangeListener >
m_xListener;
css::uno::Sequence< css::chart2::data::HighlightedRange >
m_aSelectedRanges;
sal_Int32 m_nAddedListenerCount;
bool m_bIncludeHiddenCells;
+ comphelper::OInterfaceContainerHelper4<css::view::XSelectionChangeListener> maSelectionChangeListeners;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_RANGEHIGHLIGHTER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ReferenceSizeProvider.hxx b/chart2/source/inc/ReferenceSizeProvider.hxx
index 253ab79fb7b4..f3626b03d193 100644
--- a/chart2/source/inc/ReferenceSizeProvider.hxx
+++ b/chart2/source/inc/ReferenceSizeProvider.hxx
@@ -16,12 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
+#pragma once
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/awt/Size.hpp>
#include "charttoolsdllapi.hxx"
+#include <rtl/ref.hxx>
+#include <ChartModel.hxx>
namespace com::sun::star {
namespace chart2 {
@@ -37,7 +38,7 @@ namespace com::sun::star {
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ReferenceSizeProvider
{
public:
@@ -51,7 +52,7 @@ public:
ReferenceSizeProvider(
css::awt::Size aPageSize,
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
+ const rtl::Reference<::chart::ChartModel> & xChartDoc );
const css::awt::Size& getPageSize() const { return m_aPageSize;}
@@ -64,7 +65,7 @@ public:
with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
*/
static AutoResizeState getAutoResizeState(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
+ const rtl::Reference<::chart::ChartModel> & xChartDoc );
/** sets or resets the auto-resize at all objects that support this feature
for text to the opposite of the current setting. If the current state
@@ -120,13 +121,10 @@ private:
AutoResizeState & rInOutState );
css::awt::Size m_aPageSize;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartDoc;
+ rtl::Reference<::chart::ChartModel> m_xChartDoc;
bool m_bUseAutoScale;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/RegressionCalculationHelper.hxx b/chart2/source/inc/RegressionCalculationHelper.hxx
index a5b2b3b16975..0b9600e99dc5 100644
--- a/chart2/source/inc/RegressionCalculationHelper.hxx
+++ b/chart2/source/inc/RegressionCalculationHelper.hxx
@@ -16,19 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_REGRESSIONCALCULATIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_REGRESSIONCALCULATIONHELPER_HXX
+#pragma once
#include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/math.hxx>
-
+#include <cmath>
#include <utility>
#include <vector>
-namespace chart
-{
-namespace RegressionCalculationHelper
+namespace chart::RegressionCalculationHelper
{
typedef std::pair< std::vector< double >, std::vector< double > > tDoubleVectorPair;
@@ -133,10 +129,6 @@ public:
}
};
-} // namespace RegressionCalculationHelper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_INC_REGRESSIONCALCULATIONHELPER_HXX
-#endif
+} // namespace chart::RegressionCalculationHelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/RegressionCurveCalculator.hxx b/chart2/source/inc/RegressionCurveCalculator.hxx
index 183db2b65c06..ebb3ad40f616 100644
--- a/chart2/source/inc/RegressionCurveCalculator.hxx
+++ b/chart2/source/inc/RegressionCurveCalculator.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX
-#define INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <rtl/ustrbuf.hxx>
@@ -43,33 +42,13 @@ public:
static bool isLogarithmicScaling(
const css::uno::Reference< css::chart2::XScaling >& xScaling );
-protected:
- virtual OUString ImplGetRepresentation(
- const css::uno::Reference< css::util::XNumberFormatter >& xNumFormatter,
- sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength = nullptr ) const = 0;
-
- static OUString getFormattedString(
- const css::uno::Reference< css::util::XNumberFormatter >& xNumFormatter,
- sal_Int32 nNumberFormatKey,
- double fNumber,
- const sal_Int32* pStringLength );
-
- static void addStringToEquation( OUStringBuffer& aStrEquation, sal_Int32& nLineLength, OUStringBuffer const & aAddString, const sal_Int32* pMaxLength );
-
- double m_fCorrelationCoefficient;
-
- sal_Int32 mDegree;
- bool mForceIntercept;
- double mInterceptValue;
- sal_Int32 mPeriod;
- OUString mXName, mYName;
-
// ____ XRegressionCurveCalculator ____
virtual void SAL_CALL setRegressionProperties(
sal_Int32 aDegree,
sal_Bool aForceIntercept,
double aInterceptValue,
- sal_Int32 aPeriod) override;
+ sal_Int32 aPeriod,
+ sal_Int32 nMovingType) override;
virtual void SAL_CALL recalculateRegression(
const css::uno::Sequence< double >& aXValues,
@@ -95,11 +74,30 @@ protected:
virtual void SAL_CALL setXYNames(
const OUString& aXName, const OUString& aYName ) override;
+
+protected:
+ virtual OUString ImplGetRepresentation(
+ const css::uno::Reference< css::util::XNumberFormatter >& xNumFormatter,
+ sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength = nullptr ) const = 0;
+
+ static OUString getFormattedString(
+ const css::uno::Reference< css::util::XNumberFormatter >& xNumFormatter,
+ sal_Int32 nNumberFormatKey,
+ double fNumber,
+ const sal_Int32* pStringLength );
+
+ static void addStringToEquation( OUStringBuffer& aStrEquation, sal_Int32& nLineLength, OUStringBuffer const & aAddString, const sal_Int32* pMaxLength );
+
+ double m_fCorrelationCoefficient;
+
+ sal_Int32 mDegree;
+ bool mForceIntercept;
+ double mInterceptValue;
+ sal_Int32 mPeriod;
+ OUString mXName, mYName;
+ sal_Int32 mnMovingType;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx
index 8fa4071471d0..fc0c2abcd5b7 100644
--- a/chart2/source/inc/RegressionCurveHelper.hxx
+++ b/chart2/source/inc/RegressionCurveHelper.hxx
@@ -16,11 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <svx/chrtitem.hxx>
#include "charttoolsdllapi.hxx"
+#include <rtl/ref.hxx>
#include <vector>
@@ -32,62 +33,78 @@ namespace com::sun::star::chart2 { class XRegressionCurveCalculator; }
namespace com::sun::star::chart2 { class XRegressionCurveContainer; }
namespace com::sun::star::chart2::data { class XDataSource; }
namespace com::sun::star::frame { class XModel; }
+namespace chart { class ChartModel; }
+namespace chart { class DataSeries; }
+namespace chart { class RegressionCurveModel; }
+namespace chart { class RegressionCurveCalculator; }
-namespace chart
-{
-
-namespace RegressionCurveHelper
+namespace chart::RegressionCurveHelper
{
/// returns a model mean-value line
- css::uno::Reference<css::chart2::XRegressionCurve> createMeanValueLine();
+ rtl::Reference<::chart::RegressionCurveModel> createMeanValueLine();
/// returns a model regression curve
- css::uno::Reference<css::chart2::XRegressionCurve>
- createRegressionCurveByServiceName( const OUString& aServiceName );
+ rtl::Reference<::chart::RegressionCurveModel>
+ createRegressionCurveByServiceName( std::u16string_view aServiceName );
- OOO_DLLPUBLIC_CHARTTOOLS bool hasMeanValueLine(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool hasMeanValueLine(
const css::uno::Reference<css::chart2::XRegressionCurveContainer> & xRegCnt );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool hasMeanValueLine(
+ const rtl::Reference<::chart::DataSeries> & xRegCnt );
- OOO_DLLPUBLIC_CHARTTOOLS bool isMeanValueLine(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool isMeanValueLine(
const css::uno::Reference<css::chart2::XRegressionCurve> & xRegCurve );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool isMeanValueLine(
+ const rtl::Reference<::chart::RegressionCurveModel> & xRegCurve );
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve>
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
getMeanValueLine(
const css::uno::Reference<css::chart2::XRegressionCurveContainer> & xRegCnt );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
+ getMeanValueLine(
+ const rtl::Reference<::chart::DataSeries> & xRegCnt );
/** creates a mean-value line and adds it to the container.
@param xSeriesProp
If set, this property-set will be used to apply a line color
*/
- OOO_DLLPUBLIC_CHARTTOOLS void addMeanValueLine(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void addMeanValueLine(
css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegCnt,
const css::uno::Reference<css::beans::XPropertySet>& xSeriesProp );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void addMeanValueLine(
+ rtl::Reference<::chart::DataSeries> const & xRegCnt,
+ const css::uno::Reference<css::beans::XPropertySet>& xSeriesProp );
- OOO_DLLPUBLIC_CHARTTOOLS void removeMeanValueLine(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void removeMeanValueLine(
css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegCnt );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void removeMeanValueLine(
+ rtl::Reference<::chart::DataSeries> const & xRegCnt );
/** Returns the first regression curve found that is not of type
mean-value line
*/
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve>
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
getFirstCurveNotMeanValueLine(
const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
+ getFirstCurveNotMeanValueLine(
+ const rtl::Reference<::chart::DataSeries>& xCurveContainer );
/** Returns the regression curve found at the index provided.
*/
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve>
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
getRegressionCurveAtIndex(
- const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer,
+ const rtl::Reference<::chart::DataSeries>& xCurveContainer,
sal_Int32 aIndex);
/** Returns the type of the first regression curve found that is not of type
mean-value line
*/
- OOO_DLLPUBLIC_CHARTTOOLS SvxChartRegress getFirstRegressTypeNotMeanValueLine(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) SvxChartRegress getFirstRegressTypeNotMeanValueLine(
const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer );
- OOO_DLLPUBLIC_CHARTTOOLS SvxChartRegress getRegressionType(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) SvxChartRegress getRegressionType(
const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
/** @param xPropertySource is taken as source to copy all properties from if
@@ -95,7 +112,7 @@ namespace RegressionCurveHelper
@param xEquationProperties is set at the new regression curve as
equation properties if not null
*/
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve>
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
addRegressionCurve(
SvxChartRegress eType,
css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer,
@@ -103,22 +120,30 @@ namespace RegressionCurveHelper
css::uno::Reference<css::beans::XPropertySet>(),
const css::uno::Reference<css::beans::XPropertySet>& xEquationProperties =
css::uno::Reference<css::beans::XPropertySet>() );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
+ addRegressionCurve(
+ SvxChartRegress eType,
+ rtl::Reference<::chart::DataSeries> const & xCurveContainer,
+ const css::uno::Reference<css::beans::XPropertySet >& xPropertySource =
+ css::uno::Reference<css::beans::XPropertySet>(),
+ const css::uno::Reference<css::beans::XPropertySet>& xEquationProperties =
+ css::uno::Reference<css::beans::XPropertySet>() );
- OOO_DLLPUBLIC_CHARTTOOLS bool removeAllExceptMeanValueLine(
- css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool removeAllExceptMeanValueLine(
+ rtl::Reference<::chart::DataSeries> const & xCurveContainer );
- OOO_DLLPUBLIC_CHARTTOOLS void removeEquations(
- css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void removeEquations(
+ rtl::Reference<::chart::DataSeries> const & xCurveContainer );
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve>
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
changeRegressionCurveType(
SvxChartRegress eType,
css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegressionCurveContainer,
css::uno::Reference<css::chart2::XRegressionCurve> const & xRegressionCurve );
/// returns a calculator object for regression curves (used by the view)
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurveCalculator>
- createRegressionCurveCalculatorByServiceName( const OUString& aServiceName );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveCalculator>
+ createRegressionCurveCalculatorByServiceName( std::u16string_view aServiceName );
/** recalculates the regression parameters according to the data given in
the data source.
@@ -145,40 +170,34 @@ namespace RegressionCurveHelper
necessary that the data::XDataSource is an XDataSeries, thus this parameter
also changed.
*/
- OOO_DLLPUBLIC_CHARTTOOLS void initializeCurveCalculator(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void initializeCurveCalculator(
const css::uno::Reference<css::chart2::XRegressionCurveCalculator>& xOutCurveCalculator,
- const css::uno::Reference<css::chart2::XDataSeries>& xSeries,
- const css::uno::Reference<css::frame::XModel>& xModel );
+ const rtl::Reference<::chart::DataSeries>& xSeries,
+ const rtl::Reference<::chart::ChartModel>& xModel );
- OOO_DLLPUBLIC_CHARTTOOLS OUString getUINameForRegressionCurve(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString getUINameForRegressionCurve(
const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
- OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveName(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString getRegressionCurveName(
const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
- OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveGenericName(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString getRegressionCurveGenericName(
const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
- OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveSpecificName(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString getRegressionCurveSpecificName(
const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
- OOO_DLLPUBLIC_CHARTTOOLS std::vector<css::uno::Reference<css::chart2::XRegressionCurve> >
- getAllRegressionCurvesNotMeanValueLine(
- const css::uno::Reference<css::chart2::XDiagram>& xDiagram );
-
- OOO_DLLPUBLIC_CHARTTOOLS void resetEquationPosition(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void resetEquationPosition(
const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
/// @return the index of the given curve in the given container. -1 if not contained
- OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getRegressionCurveIndex(
- const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xContainer,
- const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) sal_Int32 getRegressionCurveIndex(
+ const rtl::Reference<::chart::DataSeries>& xContainer,
+ const rtl::Reference<::chart::RegressionCurveModel>& xCurve );
- OOO_DLLPUBLIC_CHARTTOOLS bool hasEquation(const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
-}
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool hasEquation(const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool MayHaveCorrelationCoefficient(const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/RegressionCurveModel.hxx b/chart2/source/inc/RegressionCurveModel.hxx
index 05257e2dc950..ddd75a8391a1 100644
--- a/chart2/source/tools/RegressionCurveModel.hxx
+++ b/chart2/source/inc/RegressionCurveModel.hxx
@@ -16,22 +16,20 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_TOOLS_REGRESSIONCURVEMODEL_HXX
-#define INCLUDED_CHART2_SOURCE_TOOLS_REGRESSIONCURVEMODEL_HXX
+#pragma once
-#include <MutexContainer.hxx>
-#include <OPropertySet.hxx>
+#include "OPropertySet.hxx"
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
+#include <sal/types.h>
#include <com/sun/star/chart2/XRegressionCurve.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
+#include "ModifyListenerHelper.hxx"
namespace chart
{
@@ -48,8 +46,7 @@ typedef ::cppu::WeakImplHelper<
RegressionCurveModel_Base;
}
-class RegressionCurveModel :
- public MutexContainer,
+class SAL_DLLPUBLIC_RTTI RegressionCurveModel :
public impl::RegressionCurveModel_Base,
public ::property::OPropertySet
{
@@ -76,7 +73,7 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -85,6 +82,7 @@ protected:
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
+public:
// ____ XRegressionCurve ____
virtual css::uno::Reference< css::chart2::XRegressionCurveCalculator > SAL_CALL getCalculator() override;
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getEquationProperties() override;
@@ -100,6 +98,7 @@ protected:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+protected:
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -118,8 +117,9 @@ protected:
private:
const tCurveType m_eRegressionCurveType;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
css::uno::Reference< css::beans::XPropertySet > m_xEquationProperties;
+ void setPropertyMayHaveR2();
};
// implementations for factory instantiation
@@ -239,7 +239,4 @@ public:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_TOOLS_REGRESSIONCURVEMODEL_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/RelativePositionHelper.hxx b/chart2/source/inc/RelativePositionHelper.hxx
index 961a55e99f6e..03ea72eebeed 100644
--- a/chart2/source/inc/RelativePositionHelper.hxx
+++ b/chart2/source/inc/RelativePositionHelper.hxx
@@ -17,9 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_RELATIVEPOSITIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_RELATIVEPOSITIONHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/drawing/Alignment.hpp>
#include <com/sun/star/awt/Point.hpp>
@@ -31,7 +31,7 @@ namespace com::sun::star::chart2 { struct RelativeSize; }
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS RelativePositionHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) RelativePositionHelper
{
public:
/** returns the upper left corner of an object that has size aObjectSize and
@@ -100,6 +100,5 @@ public:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/RelativeSizeHelper.hxx b/chart2/source/inc/RelativeSizeHelper.hxx
index 517804096100..6b3dbb7c2dee 100644
--- a/chart2/source/inc/RelativeSizeHelper.hxx
+++ b/chart2/source/inc/RelativeSizeHelper.hxx
@@ -16,19 +16,20 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_RELATIVESIZEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_RELATIVESIZEHELPER_HXX
+#pragma once
+#include <config_options.h>
#include "charttoolsdllapi.hxx"
namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::uno { template <class interface_type> class Reference; }
+class SvxShapeText;
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS RelativeSizeHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) RelativeSizeHelper
{
public:
static double calculate(
@@ -42,13 +43,15 @@ public:
const css::awt::Size & rOldReferenceSize,
const css::awt::Size & rNewReferenceSize );
+ static void adaptFontSizes(
+ SvxShapeText& xTargetProperties,
+ const css::awt::Size & rOldReferenceSize,
+ const css::awt::Size & rNewReferenceSize );
+
private:
RelativeSizeHelper() = delete;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_RELATIVESIZEHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ResId.hxx b/chart2/source/inc/ResId.hxx
index 31d96d155b91..48baf852ab04 100644
--- a/chart2/source/inc/ResId.hxx
+++ b/chart2/source/inc/ResId.hxx
@@ -16,20 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_RESID_HXX
-#define INCLUDED_CHART2_SOURCE_INC_RESID_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include "charttoolsdllapi.hxx"
+#include <unotools/resmgr.hxx>
namespace chart
{
-
-OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(const char *pId);
+OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(TranslateId aId);
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_RESID_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/Scaling.hxx b/chart2/source/inc/Scaling.hxx
index 7314ce84ebbc..6f6310933d1a 100644
--- a/chart2/source/inc/Scaling.hxx
+++ b/chart2/source/inc/Scaling.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_SCALING_HXX
-#define INCLUDED_CHART2_SOURCE_INC_SCALING_HXX
+#pragma once
#include <com/sun/star/chart2/XScaling.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -27,7 +26,7 @@
namespace chart
{
-class LogarithmicScaling :
+class LogarithmicScaling final :
public ::cppu::WeakImplHelper<
css::chart2::XScaling,
css::lang::XServiceName,
@@ -60,7 +59,7 @@ private:
const double m_fLogOfBase;
};
-class ExponentialScaling :
+class ExponentialScaling final :
public ::cppu::WeakImplHelper<
css::chart2::XScaling,
css::lang::XServiceName,
@@ -92,7 +91,7 @@ private:
const double m_fBase;
};
-class LinearScaling : public ::cppu::WeakImplHelper<
+class LinearScaling final : public ::cppu::WeakImplHelper<
css::chart2::XScaling,
css::lang::XServiceName,
css::lang::XServiceInfo
@@ -124,7 +123,7 @@ private:
const double m_fOffset;
};
-class PowerScaling : public ::cppu::WeakImplHelper<
+class PowerScaling final : public ::cppu::WeakImplHelper<
css::chart2::XScaling,
css::lang::XServiceName,
css::lang::XServiceInfo
@@ -156,6 +155,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/SceneProperties.hxx b/chart2/source/inc/SceneProperties.hxx
index 9fedd60a643f..1fdae1b6703f 100644
--- a/chart2/source/inc/SceneProperties.hxx
+++ b/chart2/source/inc/SceneProperties.hxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_SCENEPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_SCENEPROPERTIES_HXX
+#pragma once
+#include <config_options.h>
#include "PropertyHelper.hxx"
#include "FastPropertyIdRanges.hxx"
#include "charttoolsdllapi.hxx"
@@ -72,14 +72,12 @@ namespace SceneProperties
PROP_SCENE_LIGHT_ON_8
};
- OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddPropertiesToVector(
std::vector< css::beans::Property > & rOutProperties );
- OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
}
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_INC_SCENEPROPERTIES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/StackMode.hxx b/chart2/source/inc/StackMode.hxx
index 14e5fe6ee71e..718befc4e533 100644
--- a/chart2/source/inc/StackMode.hxx
+++ b/chart2/source/inc/StackMode.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_STACKMODE_HXX
-#define INCLUDED_CHART2_SOURCE_INC_STACKMODE_HXX
+#pragma once
namespace chart
{
@@ -33,7 +32,4 @@ enum class StackMode
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_STACKMODE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/StatisticsHelper.hxx b/chart2/source/inc/StatisticsHelper.hxx
index d9793456917f..f38a27ba500f 100644
--- a/chart2/source/inc/StatisticsHelper.hxx
+++ b/chart2/source/inc/StatisticsHelper.hxx
@@ -16,11 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/uno/Reference.h>
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
#include "charttoolsdllapi.hxx"
namespace com::sun::star::beans { class XPropertySet; }
@@ -30,43 +31,42 @@ namespace com::sun::star::chart2::data { class XDataSequence; }
namespace com::sun::star::chart2::data { class XDataSource; }
namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
namespace com::sun::star::uno { template <typename > class Sequence; }
+namespace chart { class LabeledDataSequence; }
+namespace chart { class DataSeries; }
-namespace chart
-{
-
-namespace StatisticsHelper
+namespace chart::StatisticsHelper
{
/** Calculates 1/n * sum (x_i - x_mean)^2.
@see http://mathworld.wolfram.com/Variance.html
*/
- OOO_DLLPUBLIC_CHARTTOOLS double getVariance( const css::uno::Sequence< double > & rData );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) double getVariance( const css::uno::Sequence< double > & rData );
// square root of the variance
- OOO_DLLPUBLIC_CHARTTOOLS double getStandardDeviation( const css::uno::Sequence< double > & rData );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) double getStandardDeviation( const css::uno::Sequence< double > & rData );
// also called "Standard deviation of the mean (SDOM)"
- OOO_DLLPUBLIC_CHARTTOOLS double getStandardError( const css::uno::Sequence< double > & rData );
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) double getStandardError( const css::uno::Sequence< double > & rData );
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSequence >
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::uno::Reference< css::chart2::data::XLabeledDataSequence >
getErrorLabeledDataSequenceFromDataSource(
const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource,
bool bPositiveValue,
bool bYError = true );
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XDataSequence >
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::uno::Reference< css::chart2::data::XDataSequence >
getErrorDataSequenceFromDataSource(
const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource,
bool bPositiveValue,
bool bYError = true );
- OOO_DLLPUBLIC_CHARTTOOLS double getErrorFromDataSource(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) double getErrorFromDataSource(
const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource,
sal_Int32 nIndex,
bool bPositiveValue,
bool bYError = true );
- OOO_DLLPUBLIC_CHARTTOOLS void setErrorDataSequence(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void setErrorDataSequence(
const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource,
const css::uno::Reference< css::chart2::data::XDataProvider > & xDataProvider,
const OUString & rNewRange,
@@ -75,33 +75,29 @@ namespace StatisticsHelper
OUString const * pXMLRange = nullptr );
/// @return the newly created or existing error bar object
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet >
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::uno::Reference< css::beans::XPropertySet >
addErrorBars(
- const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference< ::chart::DataSeries > & xDataSeries,
sal_Int32 nStyle,
bool bYError = true );
- OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet >
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::uno::Reference< css::beans::XPropertySet >
getErrorBars(
- const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference< ::chart::DataSeries > & xDataSeries,
bool bYError = true );
- OOO_DLLPUBLIC_CHARTTOOLS bool hasErrorBars(
- const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries,
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool hasErrorBars(
+ const rtl::Reference< ::chart::DataSeries > & xDataSeries,
bool bYError = true );
- OOO_DLLPUBLIC_CHARTTOOLS void removeErrorBars(
- const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries,
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void removeErrorBars(
+ const rtl::Reference< ::chart::DataSeries > & xDataSeries,
bool bYError = true );
- OOO_DLLPUBLIC_CHARTTOOLS bool usesErrorBarRanges(
- const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries,
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool usesErrorBarRanges(
+ const rtl::Reference< ::chart::DataSeries > & xDataSeries,
bool bYError = true );
-}
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/ThreeDHelper.hxx b/chart2/source/inc/ThreeDHelper.hxx
index 52c97392b5c9..2c43fff6c71a 100644
--- a/chart2/source/inc/ThreeDHelper.hxx
+++ b/chart2/source/inc/ThreeDHelper.hxx
@@ -17,10 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_THREEDHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_THREEDHELPER_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <rtl/ref.hxx>
#include "charttoolsdllapi.hxx"
namespace com::sun::star::beans { class XPropertySet; }
@@ -28,8 +29,9 @@ namespace com::sun::star::chart2 { class XDiagram; }
namespace chart
{
+class Diagram;
-enum ThreeDLookScheme
+enum class ThreeDLookScheme
{
ThreeDLookScheme_Simple,
ThreeDLookScheme_Realistic,
@@ -46,7 +48,7 @@ enum CuboidPlanePosition
CuboidPlanePosition_Back
};
-class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ThreeDHelper
{
public:
@@ -58,23 +60,6 @@ public:
*/
static css::drawing::CameraGeometry getDefaultCameraGeometry( bool bPie=false );
- static void getRotationAngleFromDiagram(
- const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
- , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
- static void setRotationAngleToDiagram(
- const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
- , double fXAngleRad, double fYAngleRad, double fZAngleRad );
-
- static void getRotationFromDiagram(
- const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
- , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree );
- static void setRotationToDiagram(
- const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
- , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree );
-
- static void switchRightAngledAxes( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
- , bool bRightAngledAxes );
-
static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad );
static double getXDegreeAngleLimitForRightAngledAxes() { return 90.0; }
static double getYDegreeAngleLimitForRightAngledAxes() { return 45.0; }
@@ -89,44 +74,28 @@ public:
sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg
, double fXRad, double fYRad, double fZRad );
- static double getCameraDistance(
- const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties );
- static void setCameraDistance(
- const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
- , double fCameraDistance );
SAL_DLLPRIVATE static void ensureCameraDistanceRange( double& rfCameraDistance );
SAL_DLLPRIVATE static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
static double CameraDistanceToPerspective( double fCameraDistance );
static double PerspectiveToCameraDistance( double fPerspective );
- static void set3DSettingsToDefault( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties );
- static void setDefaultRotation( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties );
- static void setDefaultIllumination( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties );
-
- static void setDefaultRotation( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties, bool bPieOrDonut );
-
- static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const css::uno::Reference<
- css::beans::XPropertySet >& xSceneProperties );
- static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const css::uno::Reference<
- css::beans::XPropertySet >& xSceneProperties );
- static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const css::uno::Reference<
- css::beans::XPropertySet >& xSceneProperties );
-
- static ThreeDLookScheme detectScheme( const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
- static void setScheme( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
- , ThreeDLookScheme aScheme );
+ static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const rtl::Reference<
+ ::chart::Diagram >& xDiagram );
+ static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const rtl::Reference<
+ ::chart::Diagram >& xDiagram );
+ static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const rtl::Reference<
+ ::chart::Diagram >& xDiagram );
//sal_Int32 nRoundedEdges: <0 or >100 -> mixed state
//sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state
- static void getRoundedEdgesAndObjectLines( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
+ static void getRoundedEdgesAndObjectLines( const rtl::Reference< ::chart::Diagram >& xDiagram
, sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines );
- static void setRoundedEdgesAndObjectLines( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
+ static void setRoundedEdgesAndObjectLines( const rtl::Reference< ::chart::Diagram >& xDiagram
, sal_Int32 nRoundedEdges, sal_Int32 nObjectLines );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Title.hxx b/chart2/source/inc/Title.hxx
index 9326b54b21ca..230267918de2 100644
--- a/chart2/source/model/main/Title.hxx
+++ b/chart2/source/inc/Title.hxx
@@ -16,18 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_TITLE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_TITLE_HXX
+#pragma once
-#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
+#include "OPropertySet.hxx"
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/chart2/XTitle.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
+#include "ModifyListenerHelper.hxx"
namespace chart
{
@@ -43,8 +40,7 @@ typedef ::cppu::WeakImplHelper<
Title_Base;
}
-class Title final :
- public MutexContainer,
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) Title final :
public impl::Title_Base,
public ::property::OPropertySet
{
@@ -62,11 +58,10 @@ public:
/// merge XTypeProvider implementations
DECLARE_XTYPEPROVIDER()
-private:
explicit Title( const Title & rOther );
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -88,6 +83,8 @@ private:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+private:
+
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -104,12 +101,9 @@ private:
css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > > m_aStrings;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_TITLE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/TitleHelper.hxx b/chart2/source/inc/TitleHelper.hxx
index e16beda39134..f4ea2204d7d5 100644
--- a/chart2/source/inc/TitleHelper.hxx
+++ b/chart2/source/inc/TitleHelper.hxx
@@ -16,12 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_TITLEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_TITLEHELPER_HXX
+#pragma once
#include <com/sun/star/uno/Reference.h>
+#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include "charttoolsdllapi.hxx"
+#include "Title.hxx"
namespace chart { class ChartModel; }
namespace chart { class ReferenceSizeProvider; }
@@ -32,7 +33,7 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS TitleHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) TitleHelper
{
public:
enum eTitleType
@@ -52,51 +53,46 @@ public:
TITLE_AT_STANDARD_Y_AXIS_POSITION //equals the X_AXIS_TITLE for barchart
};
- static css::uno::Reference< css::chart2::XTitle >
+ static rtl::Reference< ::chart::Title >
getTitle( eTitleType nTitleIndex
, ChartModel& rModel );
- static css::uno::Reference< css::chart2::XTitle >
+ static rtl::Reference< ::chart::Title >
getTitle( eTitleType nTitleIndex
- , const css::uno::Reference< css::frame::XModel >& xModel );
+ , const rtl::Reference< ::chart::ChartModel >& xModel );
- static css::uno::Reference<
- css::chart2::XTitle >
+ static rtl::Reference< ::chart::Title >
createTitle( eTitleType nTitleIndex
, const OUString& rTitleText
- , const css::uno::Reference< css::frame::XModel >& xModel
+ , const rtl::Reference< ::chart::ChartModel >& xModel
, const css::uno::Reference< css::uno::XComponentContext > & xContext
, ReferenceSizeProvider * pRefSizeProvider = nullptr );
- static css::uno::Reference<
- css::chart2::XTitle >
+ static rtl::Reference< ::chart::Title >
createOrShowTitle( eTitleType nTitleIndex
, const OUString& rTitleText
- , const css::uno::Reference< css::frame::XModel >& xModel
+ , const rtl::Reference< ::chart::ChartModel >& xModel
, const css::uno::Reference< css::uno::XComponentContext > & xContex );
static void removeTitle( eTitleType nTitleIndex
- , const css::uno::Reference< css::frame::XModel >& xModel );
+ , const rtl::Reference< ::chart::ChartModel >& xModel );
- static void hideTitle( eTitleType nTitleIndex
- , const css::uno::Reference< css::frame::XModel >& xModel );
-
-
- static OUString getCompleteString( const css::uno::Reference< css::chart2::XTitle >& xTitle );
+ static OUString getCompleteString( const rtl::Reference< ::chart::Title >& xTitle );
+ static OUString getUnstackedStr( const OUString& rNewText );
+ static void setFormattedString( const rtl::Reference< ::chart::Title >& xTitle,
+ const css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& aNewFormattedTitle );
static void setCompleteString( const OUString& rNewText
- , const css::uno::Reference< css::chart2::XTitle >& xTitle
+ , const rtl::Reference< ::chart::Title >& xTitle
, const css::uno::Reference< css::uno::XComponentContext > & xContext
- , const float * pDefaultCharHeight = nullptr );
-
- static bool getTitleType( eTitleType& rType
- , const css::uno::Reference< css::chart2::XTitle >& xTitle
- , ChartModel& rModel);
+ , const float * pDefaultCharHeight = nullptr
+ , bool bDialogTitle = false );
static bool getTitleType( eTitleType& rType
- , const css::uno::Reference< css::chart2::XTitle >& xTitle
- , const css::uno::Reference< css::frame::XModel >& xModel );
+ , const rtl::Reference< ::chart::Title >& xTitle
+ , const rtl::Reference< ::chart::ChartModel >& xModel );
+ static void hideTitle( eTitleType nTitleIndex,
+ const rtl::Reference< ::chart::ChartModel > & xModel);
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/UncachedDataSequence.hxx b/chart2/source/inc/UncachedDataSequence.hxx
index 0829ceffafa0..c134601944ff 100644
--- a/chart2/source/inc/UncachedDataSequence.hxx
+++ b/chart2/source/inc/UncachedDataSequence.hxx
@@ -16,15 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_UNCACHEDDATASEQUENCE_HXX
-#define INCLUDED_CHART2_SOURCE_INC_UNCACHEDDATASEQUENCE_HXX
+#pragma once
// helper classes
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
#include <comphelper/uno3.hxx>
#include <comphelper/broadcasthelper.hxx>
-#include <comphelper/propertycontainer.hxx>
+#include <comphelper/propertycontainer2.hxx>
#include <comphelper/proparrhlp.hxx>
+#include <rtl/ref.hxx>
// interfaces and types
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -41,10 +41,12 @@ namespace com::sun::star::chart2 { class XInternalDataProvider; }
namespace chart
{
+class InternalDataProvider;
+class ModifyEventForwarder;
namespace impl
{
-typedef ::cppu::WeakComponentImplHelper<
+typedef ::comphelper::WeakComponentImplHelper<
css::chart2::data::XDataSequence,
css::chart2::data::XNumericalDataSequence,
css::chart2::data::XTextualDataSequence,
@@ -67,8 +69,7 @@ typedef ::cppu::WeakComponentImplHelper<
* 'label 2', ...</p>
*/
class UncachedDataSequence final :
- public ::comphelper::OMutexAndBroadcastHelper,
- public ::comphelper::OPropertyContainer,
+ public ::comphelper::OPropertyContainer2,
public ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >,
public impl::UncachedDataSequence_Base
{
@@ -77,11 +78,11 @@ public:
lifetime is at least as long as the one of this object.
*/
UncachedDataSequence(
- const css::uno::Reference< css::chart2::XInternalDataProvider > & xIntDataProv,
- const OUString & rRangeRepresentation );
+ rtl::Reference< InternalDataProvider > xIntDataProv,
+ OUString aRangeRepresentation );
UncachedDataSequence(
- const css::uno::Reference< css::chart2::XInternalDataProvider > & xIntDataProv,
- const OUString & rRangeRepresentation,
+ rtl::Reference< InternalDataProvider > xIntDataProv,
+ OUString aRangeRepresentation,
const OUString & rRole );
UncachedDataSequence( const UncachedDataSequence & rSource );
virtual ~UncachedDataSequence() override;
@@ -101,7 +102,7 @@ private:
/// @see css::beans::XPropertySet
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
/// @see ::comphelper::OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual ::cppu::IPropertyArrayHelper& getInfoHelper() override;
/// @see ::comphelper::OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
@@ -161,15 +162,11 @@ private:
*/
void registerProperties();
- css::uno::Reference< css::chart2::XInternalDataProvider > m_xDataProvider;
- OUString m_aSourceRepresentation;
- css::uno::Reference< css::util::XModifyListener >
- m_xModifyEventForwarder;
+ rtl::Reference< InternalDataProvider > m_xDataProvider;
+ OUString m_aSourceRepresentation;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_UNCACHEDDATASEQUENCE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/UserDefinedProperties.hxx b/chart2/source/inc/UserDefinedProperties.hxx
index 93d7af9fda42..3d4e587db745 100644
--- a/chart2/source/inc/UserDefinedProperties.hxx
+++ b/chart2/source/inc/UserDefinedProperties.hxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_USERDEFINEDPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_USERDEFINEDPROPERTIES_HXX
+#pragma once
+#include <config_options.h>
#include "FastPropertyIdRanges.hxx"
#include "charttoolsdllapi.hxx"
@@ -46,13 +46,10 @@ namespace UserDefinedProperties
PROP_XML_USERDEF
};
- OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(
+ UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddPropertiesToVector(
std::vector< css::beans::Property > & rOutProperties );
}
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_USERDEFINEDPROPERTIES_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/WeakListenerAdapter.hxx b/chart2/source/inc/WeakListenerAdapter.hxx
index 08568f25316a..f300f1aa0391 100644
--- a/chart2/source/inc/WeakListenerAdapter.hxx
+++ b/chart2/source/inc/WeakListenerAdapter.hxx
@@ -16,11 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_WEAKLISTENERADAPTER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_WEAKLISTENERADAPTER_HXX
+#pragma once
#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/implbase.hxx>
@@ -48,9 +46,6 @@ public:
explicit WeakListenerAdapter( const css::uno::Reference< Listener > & xListener ) :
m_xListener( xListener )
{}
- explicit WeakListenerAdapter( const css::uno::WeakReference< Listener > & xListener ) :
- m_xListener( xListener )
- {}
protected:
// ____ XEventListener (base of all listeners) ____
@@ -72,20 +67,7 @@ private:
css::uno::WeakReference< Listener > m_xListener;
};
-class WeakModifyListenerAdapter :
- public WeakListenerAdapter< css::util::XModifyListener >
-{
-public:
- explicit WeakModifyListenerAdapter(
- const css::uno::WeakReference< css::util::XModifyListener > & xListener );
- virtual ~WeakModifyListenerAdapter() override;
-
-protected:
- // ____ XModifyListener ____
- virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
-};
-
-class WeakSelectionChangeListenerAdapter :
+class WeakSelectionChangeListenerAdapter final :
public WeakListenerAdapter< css::view::XSelectionChangeListener >
{
public:
@@ -101,7 +83,4 @@ protected:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_INC_WEAKLISTENERADAPTER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/WrappedDefaultProperty.hxx b/chart2/source/inc/WrappedDefaultProperty.hxx
index a3632118171d..f9fdbff2cbf9 100644
--- a/chart2/source/inc/WrappedDefaultProperty.hxx
+++ b/chart2/source/inc/WrappedDefaultProperty.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDDEFAULTPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDDEFAULTPROPERTY_HXX
+#pragma once
#include "WrappedProperty.hxx"
#include "charttoolsdllapi.hxx"
@@ -25,12 +24,12 @@
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS WrappedDefaultProperty : public WrappedProperty
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) WrappedDefaultProperty : public WrappedProperty
{
public:
explicit WrappedDefaultProperty(
const OUString& rOuterName, const OUString& rInnerName,
- const css::uno::Any& rNewOuterDefault );
+ css::uno::Any aNewOuterDefault );
virtual ~WrappedDefaultProperty() override;
virtual void setPropertyToDefault(
@@ -48,6 +47,5 @@ private:
} // namespace chart
// CHART2_WRAPPEDPROPERTYNEWDEFAULT_HXX
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/WrappedDirectStateProperty.hxx b/chart2/source/inc/WrappedDirectStateProperty.hxx
index ba2bc0aac459..082a70ed0a76 100644
--- a/chart2/source/inc/WrappedDirectStateProperty.hxx
+++ b/chart2/source/inc/WrappedDirectStateProperty.hxx
@@ -16,30 +16,25 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDDIRECTSTATEPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDDIRECTSTATEPROPERTY_HXX
+#pragma once
#include "WrappedProperty.hxx"
#include "charttoolsdllapi.hxx"
namespace chart
{
-
-class OOO_DLLPUBLIC_CHARTTOOLS WrappedDirectStateProperty :
- public WrappedProperty
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) WrappedDirectStateProperty : public WrappedProperty
{
public:
- explicit WrappedDirectStateProperty(
- const OUString& rOuterName, const OUString& rInnerName );
+ explicit WrappedDirectStateProperty(const OUString& rOuterName, const OUString& rInnerName);
virtual ~WrappedDirectStateProperty() override;
virtual css::beans::PropertyState getPropertyState(
- const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override;
+ const css::uno::Reference<css::beans::XPropertyState>& xInnerPropertyState) const override;
};
} // namespace chart
// CHART2_WRAPPEDPROPERTYNEWDEFAULT_HXX
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/WrappedIgnoreProperty.hxx b/chart2/source/inc/WrappedIgnoreProperty.hxx
index 185e06d663a5..22c1673cc956 100644
--- a/chart2/source/inc/WrappedIgnoreProperty.hxx
+++ b/chart2/source/inc/WrappedIgnoreProperty.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDIGNOREPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDIGNOREPROPERTY_HXX
+#pragma once
#include "WrappedProperty.hxx"
#include "charttoolsdllapi.hxx"
@@ -27,7 +26,7 @@
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperty final : public WrappedProperty
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) WrappedIgnoreProperty final : public WrappedProperty
{
public:
WrappedIgnoreProperty( const OUString& rOuterName, const css::uno::Any& rDefaultValue );
@@ -48,7 +47,7 @@ private:
mutable css::uno::Any m_aCurrentValue;
};
-class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperties
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) WrappedIgnoreProperties
{
public:
static void addIgnoreLineProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList );
@@ -60,7 +59,4 @@ public:
} //namespace chart
-// INCLUDED_CHART2_SOURCE_INC_WRAPPEDIGNOREPROPERTY_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/WrappedProperty.hxx b/chart2/source/inc/WrappedProperty.hxx
index 82b9f3b0cbd9..de6e0095e354 100644
--- a/chart2/source/inc/WrappedProperty.hxx
+++ b/chart2/source/inc/WrappedProperty.hxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTY_HXX
-#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTY_HXX
+#pragma once
+#include <config_options.h>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <rtl/ustring.hxx>
@@ -34,13 +34,13 @@ namespace com::sun::star::uno { template <class interface_type> class Reference;
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS WrappedProperty
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) WrappedProperty
{
/** The property visible to the outer PropertySet in the PropertySetWrapper may have a different name, type and value than
a corresponding property of the inner PropertySet. Use this class to do the conversion between the two.
*/
public:
- WrappedProperty( const OUString& rOuterName, const OUString& rInnerName );
+ WrappedProperty( OUString aOuterName, OUString aInnerName );
virtual ~WrappedProperty();
const OUString& getOuterName() const { return m_aOuterName;}
@@ -84,7 +84,4 @@ typedef std::map< sal_Int32, std::unique_ptr<const WrappedProperty> > tWrappedPr
} //namespace chart
-// INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTY_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/WrappedPropertySet.hxx b/chart2/source/inc/WrappedPropertySet.hxx
index 09c768fc75f0..dabc6e33c5c4 100644
--- a/chart2/source/inc/WrappedPropertySet.hxx
+++ b/chart2/source/inc/WrappedPropertySet.hxx
@@ -16,11 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTYSET_HXX
-#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTYSET_HXX
+#pragma once
+#include <config_options.h>
#include "WrappedProperty.hxx"
-#include "MutexContainer.hxx"
#include "charttoolsdllapi.hxx"
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/beans/XMultiPropertyStates.hpp>
@@ -29,6 +28,7 @@
#include <cppuhelper/implbase.hxx>
#include <memory>
+#include <mutex>
#include <vector>
namespace cppu { class IPropertyArrayHelper; }
@@ -37,9 +37,8 @@ namespace cppu { class OPropertyArrayHelper; }
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS WrappedPropertySet :
- public MutexContainer
- , public ::cppu::WeakImplHelper
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) WrappedPropertySet :
+ public ::cppu::WeakImplHelper
< css::beans::XPropertySet
, css::beans::XMultiPropertySet
, css::beans::XPropertyState
@@ -104,7 +103,9 @@ protected: //methods
const WrappedProperty* getWrappedProperty( const OUString& rOuterName );
const WrappedProperty* getWrappedProperty( sal_Int32 nHandle );
-protected: //member
+ std::mutex m_aMutex;
+
+private:
css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo
std::unique_ptr<::cppu::OPropertyArrayHelper> m_pPropertyArrayHelper;//holds all possible outer properties
@@ -120,7 +121,4 @@ protected: //member
} //namespace chart
-// INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTYSET_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/XMLRangeHelper.hxx b/chart2/source/inc/XMLRangeHelper.hxx
index 207770dbbed9..519c9b772271 100644
--- a/chart2/source/inc/XMLRangeHelper.hxx
+++ b/chart2/source/inc/XMLRangeHelper.hxx
@@ -16,16 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_XMLRANGEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_XMLRANGEHELPER_HXX
+#pragma once
#include <sal/types.h>
#include <rtl/ustring.hxx>
#include "charttoolsdllapi.hxx"
-namespace chart
-{
-namespace XMLRangeHelper
+namespace chart::XMLRangeHelper
{
struct OOO_DLLPUBLIC_CHARTTOOLS Cell
@@ -58,10 +55,6 @@ CellRange getCellRangeFromXMLString( const OUString & rXMLString );
OUString getXMLStringFromCellRange( const CellRange & rRange );
-} // namespace XMLRangeHelper
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_INC_XMLRANGEHELPER_HXX
-#endif
+} // namespace chart::XMLRangeHelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/charttoolsdllapi.hxx b/chart2/source/inc/charttoolsdllapi.hxx
index 3a5b8144b770..96336e1012ae 100644
--- a/chart2/source/inc/charttoolsdllapi.hxx
+++ b/chart2/source/inc/charttoolsdllapi.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTTOOLSDLLAPI_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTTOOLSDLLAPI_HXX
+#pragma once
#include <sal/config.h>
@@ -30,6 +29,4 @@
#define OOO_DLLPUBLIC_CHARTTOOLS SAL_DLLPUBLIC_IMPORT
#endif
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
index 2d02f2f8bd2b..a5099cc0c31a 100644
--- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx
+++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTSFXITEMIDS_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTSFXITEMIDS_HXX
+#pragma once
#include <svl/typedwhich.hxx>
@@ -33,6 +32,7 @@ class SvxBrushItem;
class SvxChartKindErrorItem;
class SvxChartTextOrderItem;
class SvxChartRegressItem;
+class SdrAngleItem;
// SCHATTR
@@ -49,9 +49,11 @@ constexpr TypedWhichId<SfxStringItem> SCHATTR_DATADESCR_SEPARATOR
constexpr TypedWhichId<SfxInt32Item> SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 6);
constexpr TypedWhichId<SfxIntegerListItem> SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 7);
constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 8); //percentage values should not be offered
-constexpr TypedWhichId<SfxUInt32Item> SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 9);
-constexpr TypedWhichId<SfxBoolItem> SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 10);
-constexpr sal_uInt16 SCHATTR_DATADESCR_END (SCHATTR_PERCENT_NUMBERFORMAT_SOURCE);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_CUSTOM_LEADER_LINES (SCHATTR_DATADESCR_START + 9);
+constexpr TypedWhichId<SfxUInt32Item> SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 10);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 11);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME (SCHATTR_DATADESCR_START + 12);
+constexpr sal_uInt16 SCHATTR_DATADESCR_END (SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME);
//legend
constexpr sal_uInt16 SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1);
@@ -62,7 +64,7 @@ constexpr sal_uInt16 SCHATTR_LEGEND_END (SCHATTR_LEGEND_N
//text
constexpr sal_uInt16 SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1);
-constexpr TypedWhichId<SfxInt32Item> SCHATTR_TEXT_DEGREES (SCHATTR_TEXT_START);
+constexpr TypedWhichId<SdrAngleItem> SCHATTR_TEXT_DEGREES (SCHATTR_TEXT_START);
constexpr TypedWhichId<SfxBoolItem> SCHATTR_TEXT_STACKED (SCHATTR_TEXT_START + 1);
constexpr sal_uInt16 SCHATTR_TEXT_END (SCHATTR_TEXT_STACKED);
@@ -161,7 +163,7 @@ constexpr TypedWhichId<SfxInt32Item> SCHATTR_NUM_OF_LINES_FOR_BAR
constexpr TypedWhichId<SfxInt32Item> SCHATTR_SPLINE_ORDER (SCHATTR_CHARTTYPE_START + 4);
constexpr TypedWhichId<SfxInt32Item> SCHATTR_SPLINE_RESOLUTION (SCHATTR_CHARTTYPE_START + 5);
constexpr TypedWhichId<SfxBoolItem> SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 6);
-constexpr TypedWhichId<SfxInt32Item> SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 7);
+constexpr TypedWhichId<SdrAngleItem> SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 7);
constexpr TypedWhichId<SfxBoolItem> SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 8);
constexpr TypedWhichId<SfxInt32Item> SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 9);
constexpr TypedWhichId<SfxIntegerListItem> SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 10);
@@ -189,9 +191,17 @@ constexpr TypedWhichId<SvxDoubleItem> SCHATTR_REGRESSION_INTERCEPT_VALUE
constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_CURVE_NAME (SCHATTR_REGRESSION_START + 9);
constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_XNAME (SCHATTR_REGRESSION_START + 10);
constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_YNAME (SCHATTR_REGRESSION_START + 11);
-constexpr sal_uInt16 SCHATTR_REGRESSION_END (SCHATTR_REGRESSION_YNAME);
+constexpr TypedWhichId<SfxInt32Item> SCHATTR_REGRESSION_MOVING_TYPE (SCHATTR_REGRESSION_START + 12);
+constexpr sal_uInt16 SCHATTR_REGRESSION_END (SCHATTR_REGRESSION_MOVING_TYPE);
-constexpr sal_uInt16 SCHATTR_END (SCHATTR_REGRESSION_END);
+constexpr sal_uInt16 SCHATTR_DATA_TABLE_START (SCHATTR_REGRESSION_END + 1);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_HORIZONTAL_BORDER (SCHATTR_DATA_TABLE_START + 0);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_VERTICAL_BORDER (SCHATTR_DATA_TABLE_START + 1);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_OUTLINE (SCHATTR_DATA_TABLE_START + 2);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_KEYS (SCHATTR_DATA_TABLE_START + 3);
+constexpr sal_uInt16 SCHATTR_DATA_TABLE_END (SCHATTR_DATA_TABLE_KEYS);
+
+constexpr sal_uInt16 SCHATTR_END (SCHATTR_DATA_TABLE_END);
// values for Items
@@ -223,6 +233,4 @@ constexpr sal_uInt16 SCHATTR_END (SCHATTR_REGRESSION_END);
#define CHART_AXIS_SECONDARY_Y 4
#define CHART_AXIS_SECONDARY_X 5
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx
index 203c3c390bd1..304b0f5a486f 100644
--- a/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx
+++ b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx
@@ -17,29 +17,26 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_DATAPOINTSYMBOLSUPPLIER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_DATAPOINTSYMBOLSUPPLIER_HXX
+#pragma once
#include <chartview/chartviewdllapi.hxx>
-#include <com/sun/star/uno/Reference.h>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::drawing { struct Direction3D; }
-namespace com::sun::star::lang { class XMultiServiceFactory; }
namespace chart
{
-class OOO_DLLPUBLIC_CHARTVIEW DataPointSymbolSupplier
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTVIEW) DataPointSymbolSupplier
{
public:
- static css::uno::Reference< css::drawing::XShapes >
- create2DSymbolList( const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory
- , const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference< SvxShapeGroup >
+ create2DSymbolList( const rtl::Reference<SvxDrawPage>& xTarget
, const css::drawing::Direction3D& rSize );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx
index bd9189dbff88..e555fb7ab021 100644
--- a/chart2/source/inc/chartview/DrawModelWrapper.hxx
+++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx
@@ -16,11 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_DRAWMODELWRAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_DRAWMODELWRAPPER_HXX
+#pragma once
#include <svx/svdmodel.hxx>
-
+#include <svx/unopage.hxx>
+#include <svx/unoshape.hxx>
#include <chartview/chartviewdllapi.hxx>
namespace com::sun::star::lang { class XMultiServiceFactory; }
@@ -35,14 +35,12 @@ class SdrObject;
namespace chart
{
-class OOO_DLLPUBLIC_CHARTVIEW DrawModelWrapper : private SdrModel
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTVIEW) DrawModelWrapper final : private SdrModel
{
private:
- SfxItemPool* m_pChartItemPool;
-
- css::uno::Reference< css::drawing::XDrawPage > m_xMainDrawPage;
- css::uno::Reference< css::drawing::XDrawPage > m_xHiddenDrawPage;
-
+ rtl::Reference<SvxDrawPage> m_xMainDrawPage;
+ rtl::Reference<SvxDrawPage> m_xHiddenDrawPage;
+ rtl::Reference<SfxItemPool> m_xChartItemPool;
VclPtr<OutputDevice> m_pRefDevice;
public:
@@ -52,14 +50,14 @@ public:
css::uno::Reference< css::lang::XMultiServiceFactory > getShapeFactory();
// the main page will contain the normal view objects
- css::uno::Reference< css::drawing::XDrawPage > const & getMainDrawPage();
+ const rtl::Reference<SvxDrawPage> & getMainDrawPage();
SAL_DLLPRIVATE void clearMainDrawPage();
// the extra page is not visible, but contains some extras like the symbols for data points
- css::uno::Reference< css::drawing::XDrawPage > const & getHiddenDrawPage();
+ const rtl::Reference<SvxDrawPage> & getHiddenDrawPage();
- static css::uno::Reference< css::drawing::XShapes >
- getChartRootShape( const css::uno::Reference< css::drawing::XDrawPage>& xPage );
+ static rtl::Reference<SvxShapeGroupAnyD>
+ getChartRootShape( const rtl::Reference<SvxDrawPage>& xPage );
SAL_DLLPRIVATE void lockControllers();
SAL_DLLPRIVATE void unlockControllers();
@@ -68,7 +66,7 @@ public:
SfxItemPool& GetItemPool();
- SAL_DLLPRIVATE virtual css::uno::Reference< css::uno::XInterface >
+ SAL_DLLPRIVATE virtual css::uno::Reference< css::frame::XModel >
createUnoModel() override;
SAL_DLLPRIVATE css::uno::Reference< css::frame::XModel >
getUnoModel();
@@ -85,11 +83,10 @@ public:
SdrObject* getNamedSdrObject( const OUString& rName );
static SdrObject* getNamedSdrObject( const OUString& rName, SdrObjList const * pObjList );
- static bool removeShape( const css::uno::Reference< css::drawing::XShape >& xShape );
+ static bool removeShape( const rtl::Reference<SvxShape>& xShape );
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/chartview/ExplicitScaleValues.hxx b/chart2/source/inc/chartview/ExplicitScaleValues.hxx
index 731d4c087a91..07b8290cb7db 100644
--- a/chart2/source/inc/chartview/ExplicitScaleValues.hxx
+++ b/chart2/source/inc/chartview/ExplicitScaleValues.hxx
@@ -16,9 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_EXPLICITSCALEVALUES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_EXPLICITSCALEVALUES_HXX
+#pragma once
+#include <config_options.h>
#include <chartview/chartviewdllapi.hxx>
#include <com/sun/star/chart/TimeInterval.hpp>
#include <com/sun/star/chart2/AxisOrientation.hpp>
@@ -26,15 +26,17 @@
#include <tools/date.hxx>
#include <vector>
-namespace com::sun::star::chart2 { class XScaling; }
+namespace com::sun::star::chart2
+{
+class XScaling;
+}
namespace chart
{
-
/** This structure contains the explicit values for a scale like Minimum and Maximum.
See also css::chart2::ScaleData.
*/
-struct OOO_DLLPUBLIC_CHARTVIEW ExplicitScaleData
+struct UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTVIEW) ExplicitScaleData
{
ExplicitScaleData();
@@ -42,14 +44,14 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitScaleData
double Maximum;
double Origin;
- css::chart2::AxisOrientation Orientation;
+ css::chart2::AxisOrientation Orientation;
- css::uno::Reference< css::chart2::XScaling > Scaling;
+ css::uno::Reference<css::chart2::XScaling> Scaling;
- sal_Int32 AxisType;//see css::chart2::AxisType
- bool ShiftedCategoryPosition;
- sal_Int32 TimeResolution; //constant of type <type>css::chart::TimeUnit</type>
- Date NullDate;
+ sal_Int32 AxisType; //see css::chart2::AxisType
+ bool m_bShiftedCategoryPosition;
+ sal_Int32 TimeResolution; //constant of type <type>css::chart::TimeUnit</type>
+ Date NullDate;
};
struct ExplicitSubIncrement
@@ -72,14 +74,14 @@ struct ExplicitSubIncrement
/** describes how tickmarks are positioned on the scale of an axis.
*/
-struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData
+struct UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTVIEW) ExplicitIncrementData
{
ExplicitIncrementData();
/** the following two members are only for date-time axis
*/
- css::chart::TimeInterval MajorTimeInterval;
- css::chart::TimeInterval MinorTimeInterval;
+ css::chart::TimeInterval MajorTimeInterval;
+ css::chart::TimeInterval MinorTimeInterval;
/** the other members are for *not* date-time axis
*/
@@ -104,7 +106,7 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData
<p><member>PostEquidistant</member> rules whether the <member>Distance</member>
is meant to be a value before or after scaling.</p>
*/
- double Distance;
+ double Distance;
/**
<member>PostEquidistant</member> rules whether the member <member>Distance</member>
@@ -116,7 +118,7 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData
If <member>PostEquidistant</member> equals <FALSE/> <member>Distance</member>
is given in values before <type>XScaling</type> is applied.</p>
*/
- bool PostEquidistant;
+ bool PostEquidistant;
/** The <member>BaseValue</member> gives a starting point on the scale
to which all further main tickmarks are relatively positioned.
@@ -134,7 +136,7 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData
And setting BaseValue to 2, -2, 4, -4 etc. in this example
leads to the same result as BaseValue=0.</p>
*/
- double BaseValue;
+ double BaseValue;
/** <member>SubIncrements</member> describes the positioning of further
sub tickmarks on the scale of an axis.
@@ -145,10 +147,9 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData
positions of subsequent tickmarks in relation to their parent tickmarks
given by the preceding SubIncrement.</p>
*/
- std::vector< ExplicitSubIncrement > SubIncrements;
+ std::vector<ExplicitSubIncrement> SubIncrements;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
index e2ff1e01a334..f4bc4aac874b 100644
--- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx
+++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
@@ -16,17 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_EXPLICITVALUEPROVIDER_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_EXPLICITVALUEPROVIDER_HXX
+#pragma once
-#include <com/sun/star/awt/Rectangle.hpp>
+#include <config_options.h>
+#include <sal/types.h>
#include <chartview/chartviewdllapi.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
#include <memory>
-namespace chart { class ChartModel; }
-namespace chart { struct ExplicitIncrementData; }
-namespace chart { struct ExplicitScaleData; }
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::chart2 { class XAxis; }
namespace com::sun::star::chart2 { class XChartDocument; }
@@ -38,12 +37,19 @@ namespace com::sun::star::uno { class XInterface; }
namespace com::sun::star::uno { template <typename > class Reference; }
namespace com::sun::star::uno { template <typename > class Sequence; }
namespace com::sun::star::util { class XNumberFormatsSupplier; }
+namespace com::sun::star::awt { struct Rectangle; }
+class SvxShape;
namespace chart
{
-
+class Axis;
+class BaseCoordinateSystem;
class DrawModelWrapper;
-class OOO_DLLPUBLIC_CHARTVIEW ExplicitValueProvider
+class ChartModel;
+struct ExplicitIncrementData;
+struct ExplicitScaleData;
+
+class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTVIEW) SAL_LOPLUGIN_ANNOTATE("crosscast") ExplicitValueProvider
{
public:
/** Gives calculated scale and increment values for a given xAxis in the current view.
@@ -51,7 +57,7 @@ public:
If the given Axis could not be found or for another reason no correct output can be given false is returned.
*/
virtual bool getExplicitValuesForAxis(
- css::uno::Reference< css::chart2::XAxis > xAxis
+ rtl::Reference< ::chart::Axis > xAxis
, ExplicitScaleData& rExplicitScale
, ExplicitIncrementData& rExplicitIncrement )=0;
@@ -63,23 +69,21 @@ public:
virtual css::awt::Rectangle getDiagramRectangleExcludingAxes()=0;
- virtual css::uno::Reference< css::drawing::XShape >
+ virtual rtl::Reference< SvxShape >
getShapeForCID( const OUString& rObjectCID )=0;
virtual std::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0;
- static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-
static css::awt::Rectangle
AddSubtractAxisTitleSizes(
ChartModel& rModel
- , const css::uno::Reference< css::uno::XInterface >& xChartView
+ , ExplicitValueProvider* pChartView
, const css::awt::Rectangle& rPositionAndSize, bool bSubtract );
static sal_Int32 getExplicitNumberFormatKeyForAxis(
- const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
- , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc);
+ const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference< ::chart::BaseCoordinateSystem > & xCorrespondingCoordinateSystem
+ , const rtl::Reference<::chart::ChartModel>& xChartDoc);
static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
const css::uno::Reference< css::beans::XPropertySet >& xSeriesOrPointProp );
@@ -89,10 +93,9 @@ public:
, const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
protected:
- ~ExplicitValueProvider() {}
+ ~ExplicitValueProvider() = default;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/chartview/chartviewdllapi.hxx b/chart2/source/inc/chartview/chartviewdllapi.hxx
index 2762104384f2..533a5cb8338e 100644
--- a/chart2/source/inc/chartview/chartviewdllapi.hxx
+++ b/chart2/source/inc/chartview/chartviewdllapi.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTVIEWDLLAPI_HXX
-#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTVIEWDLLAPI_HXX
+#pragma once
#include <sal/config.h>
@@ -30,6 +29,4 @@
#define OOO_DLLPUBLIC_CHARTVIEW SAL_DLLPUBLIC_IMPORT
#endif
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/defines.hxx b/chart2/source/inc/defines.hxx
index 135afe44bbef..1eb464bc203a 100644
--- a/chart2/source/inc/defines.hxx
+++ b/chart2/source/inc/defines.hxx
@@ -17,11 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_DEFINES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_DEFINES_HXX
+#pragma once
-#define FIXED_SIZE_FOR_3D_CHART_VOLUME 10000.0
-
-#endif
+constexpr double FIXED_SIZE_FOR_3D_CHART_VOLUME = 10000.0;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/res_BarGeometry.hxx b/chart2/source/inc/res_BarGeometry.hxx
index 235c5f4fe5ca..9e0c01870f29 100644
--- a/chart2/source/inc/res_BarGeometry.hxx
+++ b/chart2/source/inc/res_BarGeometry.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_BARGEOMETRY_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_BARGEOMETRY_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -43,6 +42,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/servicenames.hxx b/chart2/source/inc/servicenames.hxx
index a63c0939321a..0f5cbe2b40f9 100644
--- a/chart2/source/inc/servicenames.hxx
+++ b/chart2/source/inc/servicenames.hxx
@@ -16,40 +16,38 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_HXX
+#pragma once
-namespace chart
-{
-#define CHART_MODEL_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartModel"
-#define CHART_MODEL_SERVICE_NAME "com.sun.star.chart2.ChartDocument"
-//@todo create your own service containing the service com.sun.star.document.OfficeDocument
+#include <rtl/ustring.hxx>
-#define CHART_CONTROLLER_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartController"
-#define CHART_CONTROLLER_SERVICE_NAME "com.sun.star.chart2.ChartController"
-//@todo create your own service containing the service com.sun.star.frame.Controller
+inline constexpr OUString CHART_MODEL_SERVICE_IMPLEMENTATION_NAME
+ = u"com.sun.star.comp.chart2.ChartModel"_ustr;
+inline constexpr OUString CHART_MODEL_SERVICE_NAME = u"com.sun.star.chart2.ChartDocument"_ustr;
+//@todo create your own service containing the service com.sun.star.document.OfficeDocument
-#define CHART_VIEW_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartView"
-#define CHART_VIEW_SERVICE_NAME "com.sun.star.chart2.ChartView"
+inline constexpr OUString CHART_VIEW_SERVICE_IMPLEMENTATION_NAME
+ = u"com.sun.star.comp.chart2.ChartView"_ustr;
+inline constexpr OUString CHART_VIEW_SERVICE_NAME = u"com.sun.star.chart2.ChartView"_ustr;
-#define CHART_FRAMELOADER_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartFrameLoader"
-#define CHART_FRAMELOADER_SERVICE_NAME "com.sun.star.frame.SynchronousFrameLoader"
+inline constexpr OUString CHART_FRAMELOADER_SERVICE_IMPLEMENTATION_NAME
+ = u"com.sun.star.comp.chart2.ChartFrameLoader"_ustr;
+inline constexpr OUString CHART_FRAMELOADER_SERVICE_NAME
+ = u"com.sun.star.frame.SynchronousFrameLoader"_ustr;
-#define CHART_WIZARD_DIALOG_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.WizardDialog"
-#define CHART_WIZARD_DIALOG_SERVICE_NAME "com.sun.star.chart2.WizardDialog"
+inline constexpr OUString CHART_WIZARD_DIALOG_SERVICE_IMPLEMENTATION_NAME
+ = u"com.sun.star.comp.chart2.WizardDialog"_ustr;
+inline constexpr OUString CHART_WIZARD_DIALOG_SERVICE_NAME
+ = u"com.sun.star.chart2.WizardDialog"_ustr;
-#define CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartTypeDialog"
-#define CHART_TYPE_DIALOG_SERVICE_NAME "com.sun.star.chart2.ChartTypeDialog"
+inline constexpr OUString CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME
+ = u"com.sun.star.comp.chart2.ChartTypeDialog"_ustr;
+inline constexpr OUString CHART_TYPE_DIALOG_SERVICE_NAME
+ = u"com.sun.star.chart2.ChartTypeDialog"_ustr;
// wrapper for old UNO API (com.sun.star.chart)
-#define CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartDocumentWrapper"
-#define CHART_CHARTAPIWRAPPER_SERVICE_NAME "com.sun.star.chart2.ChartDocumentWrapper"
-
-// accessibility
-#define CHART_ACCESSIBLE_TEXT_SERVICE_NAME "com.sun.star.accessibility.AccessibleTextComponent"
-
-} //namespace chart
-
-#endif
+inline constexpr OUString CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME
+ = u"com.sun.star.comp.chart2.ChartDocumentWrapper"_ustr;
+inline constexpr OUString CHART_CHARTAPIWRAPPER_SERVICE_NAME
+ = u"com.sun.star.chart2.ChartDocumentWrapper"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx
index 9a1ee83db019..5ab2dcbf4929 100644
--- a/chart2/source/inc/servicenames_charttypes.hxx
+++ b/chart2/source/inc/servicenames_charttypes.hxx
@@ -16,24 +16,29 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_CHARTTYPES_HXX
-#define INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_CHARTTYPES_HXX
+#pragma once
-namespace chart {
+#include <rtl/ustring.hxx>
-#define CHART2_SERVICE_NAME_CHARTTYPE_AREA "com.sun.star.chart2.AreaChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_BAR "com.sun.star.chart2.BarChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_COLUMN "com.sun.star.chart2.ColumnChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_LINE "com.sun.star.chart2.LineChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_SCATTER "com.sun.star.chart2.ScatterChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_PIE "com.sun.star.chart2.PieChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_NET "com.sun.star.chart2.NetChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET "com.sun.star.chart2.FilledNetChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK "com.sun.star.chart2.CandleStickChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE "com.sun.star.chart2.BubbleChartType"
-
-} //namespace chart
-
-#endif
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_AREA
+ = u"com.sun.star.chart2.AreaChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_BAR
+ = u"com.sun.star.chart2.BarChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
+ = u"com.sun.star.chart2.ColumnChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_LINE
+ = u"com.sun.star.chart2.LineChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
+ = u"com.sun.star.chart2.ScatterChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_PIE
+ = u"com.sun.star.chart2.PieChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_NET
+ = u"com.sun.star.chart2.NetChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
+ = u"com.sun.star.chart2.FilledNetChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
+ = u"com.sun.star.chart2.CandleStickChartType"_ustr;
+inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
+ = u"com.sun.star.chart2.BubbleChartType"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/servicenames_coosystems.hxx b/chart2/source/inc/servicenames_coosystems.hxx
index 17648619948b..065155a8bb37 100644
--- a/chart2/source/inc/servicenames_coosystems.hxx
+++ b/chart2/source/inc/servicenames_coosystems.hxx
@@ -16,16 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_COOSYSTEMS_HXX
-#define INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_COOSYSTEMS_HXX
+#pragma once
-namespace chart
-{
+#include <rtl/ustring.hxx>
-#define CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME "com.sun.star.chart2.CoordinateSystems.CartesianView"
-#define CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME "com.sun.star.chart2.CoordinateSystems.PolarView"
-
-} //namespace chart
-#endif
+inline constexpr OUString CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME = u"com.sun.star.chart2.CoordinateSystems.CartesianView"_ustr;
+inline constexpr OUString CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME = u"com.sun.star.chart2.CoordinateSystems.PolarView"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index a8633cc2d3d3..b5a485dc4c86 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -20,11 +20,10 @@
#include <XMLFilter.hxx>
#include <MediaDescriptorHelper.hxx>
+#include <officecfg/Office/Common.hxx>
#include <svtools/sfxecode.hxx>
-#include <unotools/saveopt.hxx>
#include <comphelper/genericpropertyset.hxx>
#include <comphelper/propertysetinfo.hxx>
-#include <comphelper/propertysequence.hxx>
#include <comphelper/documentconstants.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx>
@@ -35,7 +34,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
-#include <com/sun/star/xml/sax/FastToken.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -49,9 +47,8 @@
#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/document/GraphicStorageHandler.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
-#include <xmloff/xmlnmspe.hxx>
using namespace ::com::sun::star;
@@ -61,9 +58,9 @@ using ::osl::MutexGuard;
namespace
{
-char const sXML_metaStreamName[] = "meta.xml";
-char const sXML_styleStreamName[] = "styles.xml";
-char const sXML_contentStreamName[] = "content.xml";
+constexpr OUString sXML_metaStreamName = u"meta.xml"_ustr;
+constexpr OUString sXML_styleStreamName = u"styles.xml"_ustr;
+constexpr OUString sXML_contentStreamName = u"content.xml"_ustr;
uno::Reference< embed::XStorage > lcl_getWriteStorage(
@@ -98,13 +95,12 @@ uno::Reference< embed::XStorage > lcl_getWriteStorage(
xStorage.set( aMDHelper.Storage );
else
{
- Sequence< uno::Any > aStorageArgs( 3 );
- if( aMDHelper.ISSET_OutputStream )
- aStorageArgs[0] <<= aMDHelper.OutputStream;
- else
- aStorageArgs[0] <<= aMDHelper.URL;
- aStorageArgs[1] <<= (embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE);
- aStorageArgs[2] <<= comphelper::containerToSequence( aPropertiesForStorage );
+ Sequence< uno::Any > aStorageArgs{
+ aMDHelper.ISSET_OutputStream ? uno::Any(aMDHelper.OutputStream)
+ : uno::Any(aMDHelper.URL),
+ uno::Any(embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE),
+ uno::Any(comphelper::containerToSequence( aPropertiesForStorage ))
+ };
xStorage.set(
xStorageFact->createInstanceWithArguments( aStorageArgs ),
@@ -165,10 +161,11 @@ uno::Reference< embed::XStorage > lcl_getReadStorage(
// convert XInputStream to XStorage via the storage factory
Reference< lang::XSingleServiceFactory > xStorageFact( embed::StorageFactory::create( xContext ) );
- Sequence< uno::Any > aStorageArgs( 3 );
- aStorageArgs[0] <<= xStream;
- aStorageArgs[1] <<= (embed::ElementModes::READ | embed::ElementModes::NOCREATE);
- aStorageArgs[2] <<= comphelper::containerToSequence( aPropertiesForStorage );
+ Sequence< uno::Any > aStorageArgs{
+ uno::Any(xStream),
+ uno::Any(embed::ElementModes::READ | embed::ElementModes::NOCREATE),
+ uno::Any(comphelper::containerToSequence( aPropertiesForStorage ))
+ };
xStorage.set(
xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW );
}
@@ -189,8 +186,7 @@ namespace chart
{
XMLFilter::XMLFilter( Reference< uno::XComponentContext > const & xContext ) :
- m_xContext( xContext ),
- m_bCancelOperation( false )
+ m_xContext( xContext )
{}
XMLFilter::~XMLFilter()
@@ -204,11 +200,6 @@ sal_Bool SAL_CALL XMLFilter::filter(
MutexGuard aGuard( m_aMutex );
- // ignore cancel flag at start of function
- // note: is currently ignored during import/export
- if( m_bCancelOperation )
- m_bCancelOperation = false;
-
if( m_xSourceDoc.is())
{
OSL_ENSURE( ! m_xTargetDoc.is(), "source doc is set -> target document should not be set" );
@@ -238,12 +229,6 @@ sal_Bool SAL_CALL XMLFilter::filter(
void SAL_CALL XMLFilter::cancel()
{
- // if mutex is locked set "cancel state"
- // note: is currently ignored in filter-method
- if( ! m_aMutex.tryToAcquire())
- {
- m_bCancelOperation = true;
- }
}
// ____ XImporter ____
@@ -303,8 +288,7 @@ ErrCode XMLFilter::impl_Import(
uno::Reference<lang::XMultiServiceFactory> xServiceFactory(xFactory, uno::UNO_QUERY);
if (xServiceFactory.is())
{
- uno::Sequence<uno::Any> aArgs(1);
- aArgs[0] <<= xStorage;
+ uno::Sequence<uno::Any> aArgs{ uno::Any(xStorage) };
xGraphicStorageHandler.set(
xServiceFactory->createInstanceWithArguments(
"com.sun.star.comp.Svx.GraphicImportHelper", aArgs), uno::UNO_QUERY);
@@ -312,7 +296,7 @@ ErrCode XMLFilter::impl_Import(
// create XPropertySet with extra information for the filter
/** property map for import info set */
- comphelper::PropertyMapEntry const aImportInfoMap[] =
+ static comphelper::PropertyMapEntry const aImportInfoMap[] =
{
// necessary properties for XML progress bar at load time
{ OUString("ProgressRange"), 0, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
@@ -323,7 +307,6 @@ ErrCode XMLFilter::impl_Import(
{ OUString("StreamRelPath"), 0, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString("StreamName"), 0, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString("BuildId"), 0, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
- { OUString(), 0, css::uno::Type(), 0, 0 }
};
uno::Reference< beans::XPropertySet > xImportInfo(
comphelper::GenericPropertySet_CreateInstance(
@@ -432,52 +415,49 @@ ErrCode XMLFilter::impl_ImportStream(
nArgs++;
uno::Sequence< uno::Any > aFilterCompArgs( nArgs );
+ auto aFilterCompArgsRange = asNonConstRange(aFilterCompArgs);
nArgs = 0;
if( xGraphicStorageHandler.is())
- aFilterCompArgs[nArgs++] <<= xGraphicStorageHandler;
+ aFilterCompArgsRange[nArgs++] <<= xGraphicStorageHandler;
if( xImportInfo.is())
- aFilterCompArgs[ nArgs++ ] <<= xImportInfo;
+ aFilterCompArgsRange[ nArgs++ ] <<= xImportInfo;
// the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
- Reference< xml::sax::XDocumentHandler > xDocHandler(
- xFactory->createInstanceWithArgumentsAndContext( rServiceName, aFilterCompArgs, m_xContext ),
- uno::UNO_QUERY_THROW );
-
- Reference< document::XImporter > xImporter( xDocHandler, uno::UNO_QUERY_THROW );
+ Reference< XInterface > xFilter =
+ xFactory->createInstanceWithArgumentsAndContext( rServiceName, aFilterCompArgs, m_xContext );
+ assert(xFilter);
+ Reference< document::XImporter > xImporter( xFilter, uno::UNO_QUERY );
+ assert(xImporter);
xImporter->setTargetDocument( Reference< lang::XComponent >( m_xTargetDoc, uno::UNO_SET_THROW ));
if ( !m_sDocumentHandler.isEmpty() )
{
try
{
- uno::Sequence< uno::Any > aArgs(2);
- beans::NamedValue aValue;
- aValue.Name = "DocumentHandler";
- aValue.Value <<= xDocHandler;
- aArgs[0] <<= aValue;
- aValue.Name = "Model";
- aValue.Value <<= m_xTargetDoc;
- aArgs[1] <<= aValue;
-
- xDocHandler.set(xFactory->createInstanceWithArgumentsAndContext(m_sDocumentHandler,aArgs,m_xContext), uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Any > aArgs{
+ uno::Any(beans::NamedValue("DocumentHandler", uno::Any(xFilter))),
+ uno::Any(beans::NamedValue("Model", uno::Any(m_xTargetDoc)))
+ };
+
+ xFilter = xFactory->createInstanceWithArgumentsAndContext(m_sDocumentHandler,aArgs,m_xContext);
}
catch (const uno::Exception&)
{
- TOOLS_WARN_EXCEPTION("chart2", "");
+ TOOLS_WARN_EXCEPTION("chart2", "failed to instantiate " << m_sDocumentHandler);
}
}
xml::sax::InputSource aParserInput;
aParserInput.aInputStream.set(xInputStream, uno::UNO_QUERY_THROW);
// the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
- Reference< xml::sax::XFastParser > xFastParser(xDocHandler, uno::UNO_QUERY);
+ Reference< xml::sax::XFastParser > xFastParser(xFilter, uno::UNO_QUERY);
if (xFastParser.is())
xFastParser->parseStream(aParserInput);
else
{
Reference<xml::sax::XParser> xParser = xml::sax::Parser::create(m_xContext);
- xParser->setDocumentHandler( xDocHandler );
+ xParser->setDocumentHandler( uno::Reference<xml::sax::XDocumentHandler>(xFilter, uno::UNO_QUERY_THROW) );
xParser->parseStream(aParserInput);
}
}
@@ -558,21 +538,17 @@ ErrCode XMLFilter::impl_Export(
{
try
{
- uno::Sequence< uno::Any > aArgs(2);
- beans::NamedValue aValue;
- aValue.Name = "DocumentHandler";
- aValue.Value <<= xDocHandler;
- aArgs[0] <<= aValue;
- aValue.Name = "Model";
- aValue.Value <<= xDocumentComp;
- aArgs[1] <<= aValue;
+ uno::Sequence< uno::Any > aArgs{
+ uno::Any(beans::NamedValue("DocumentHandler", uno::Any(xDocHandler))),
+ uno::Any(beans::NamedValue("Model", uno::Any(xDocumentComp)))
+ };
xDocHandler.set(xServiceFactory->createInstanceWithArguments(m_sDocumentHandler,aArgs), uno::UNO_QUERY );
xSaxWriter.set(xDocHandler,uno::UNO_QUERY);
}
catch (const uno::Exception&)
{
- OSL_FAIL("Exception caught!");
+ TOOLS_WARN_EXCEPTION( "chart2", "Exception caught!");
}
}
@@ -580,21 +556,19 @@ ErrCode XMLFilter::impl_Export(
xGraphicStorageHandler.set(document::GraphicStorageHandler::createWithStorage(m_xContext, xStorage));
// property map for export info set
- comphelper::PropertyMapEntry const aExportInfoMap[] =
+ static comphelper::PropertyMapEntry const aExportInfoMap[] =
{
{ OUString("UsePrettyPrinting"), 0, cppu::UnoType<bool>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
{ OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString("StreamRelPath"), 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString("ExportTableNumberList"), 0, cppu::UnoType<bool>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
- { OUString(), 0, css::uno::Type(), 0, 0 }
};
uno::Reference< beans::XPropertySet > xInfoSet =
comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) );
- SvtSaveOptions aSaveOpt;
- bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
+ bool bUsePrettyPrinting( officecfg::Office::Common::Save::Document::PrettyPrinting::get() );
xInfoSet->setPropertyValue( "UsePrettyPrinting", uno::Any( bUsePrettyPrinting ) );
if( ! bOasis )
xInfoSet->setPropertyValue( "ExportTableNumberList", uno::Any( true ));
@@ -605,11 +579,12 @@ ErrCode XMLFilter::impl_Export(
uno::Sequence< uno::Any > aFilterProperties( nArgs );
{
+ auto pFilterProperties = aFilterProperties.getArray();
nArgs = 0;
- aFilterProperties[ nArgs++ ] <<= xInfoSet;
- aFilterProperties[ nArgs++ ] <<= xDocHandler;
+ pFilterProperties[ nArgs++ ] <<= xInfoSet;
+ pFilterProperties[ nArgs++ ] <<= xDocHandler;
if( xGraphicStorageHandler.is())
- aFilterProperties[ nArgs++ ] <<= xGraphicStorageHandler;
+ pFilterProperties[ nArgs++ ] <<= xGraphicStorageHandler;
}
// export meta information
@@ -699,7 +674,7 @@ ErrCode XMLFilter::impl_ExportStream(
{
uno::Reference< beans::XPropertySet > xInfoSet;
if( rFilterProperties.hasElements() )
- rFilterProperties.getConstArray()[0] >>= xInfoSet;
+ rFilterProperties[0] >>= xInfoSet;
OSL_ENSURE( xInfoSet.is(), "missing infoset for export" );
if( xInfoSet.is() )
xInfoSet->setPropertyValue( "StreamName", uno::Any( rStreamName ) );
@@ -733,7 +708,7 @@ void XMLFilter::isOasisFormat(const Sequence< beans::PropertyValue >& _rMediaDes
}
OUString XMLFilter::getMediaType(bool _bOasis)
{
- return _bOasis ? OUString(MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII) : OUString(MIMETYPE_VND_SUN_XML_CHART_ASCII);
+ return _bOasis ? MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII : MIMETYPE_VND_SUN_XML_CHART_ASCII;
}
OUString SAL_CALL XMLFilter::getImplementationName()
diff --git a/chart2/source/model/inc/CartesianCoordinateSystem.hxx b/chart2/source/model/inc/CartesianCoordinateSystem.hxx
index 7b2847cd8b84..d84f53bf5719 100644
--- a/chart2/source/model/inc/CartesianCoordinateSystem.hxx
+++ b/chart2/source/model/inc/CartesianCoordinateSystem.hxx
@@ -16,19 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_INC_CARTESIANCOORDINATESYSTEM_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_INC_CARTESIANCOORDINATESYSTEM_HXX
+#pragma once
-#include "BaseCoordinateSystem.hxx"
+#include <BaseCoordinateSystem.hxx>
namespace chart
{
-
class CartesianCoordinateSystem : public BaseCoordinateSystem
{
public:
- explicit CartesianCoordinateSystem( sal_Int32 nDimensionCount );
- explicit CartesianCoordinateSystem( const CartesianCoordinateSystem & rSource );
+ explicit CartesianCoordinateSystem(sal_Int32 nDimensionCount);
+ explicit CartesianCoordinateSystem(const CartesianCoordinateSystem& rSource);
virtual ~CartesianCoordinateSystem() override;
// ____ XCoordinateSystem ____
@@ -36,15 +34,15 @@ public:
virtual OUString SAL_CALL getViewServiceName() override;
// ____ XCloneable ____
- virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+ virtual css::uno::Reference<css::util::XCloneable> SAL_CALL createClone() override;
// ____ 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;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
};
-class CartesianCoordinateSystem2d : public CartesianCoordinateSystem
+class CartesianCoordinateSystem2d final : public CartesianCoordinateSystem
{
public:
explicit CartesianCoordinateSystem2d();
@@ -52,11 +50,11 @@ public:
// ____ 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;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
};
-class CartesianCoordinateSystem3d : public CartesianCoordinateSystem
+class CartesianCoordinateSystem3d final : public CartesianCoordinateSystem
{
public:
explicit CartesianCoordinateSystem3d();
@@ -64,13 +62,10 @@ public:
// ____ 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;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
};
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_MODEL_INC_CARTESIANCOORDINATESYSTEM_HXX
-#endif
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/inc/ChartTypeManager.hxx b/chart2/source/model/inc/ChartTypeManager.hxx
deleted file mode 100644
index 176681564344..000000000000
--- a/chart2/source/model/inc/ChartTypeManager.hxx
+++ /dev/null
@@ -1,74 +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 INCLUDED_CHART2_SOURCE_MODEL_INC_CHARTTYPEMANAGER_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_INC_CHARTTYPEMANAGER_HXX
-
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/chart2/XChartTypeManager.hpp>
-
-namespace com::sun::star::uno { class XComponentContext; }
-
-namespace chart
-{
-
-class ChartTypeManager :
- public ::cppu::WeakImplHelper<
- css::lang::XServiceInfo,
- css::lang::XMultiServiceFactory,
- css::chart2::XChartTypeManager >
-{
-public:
- explicit ChartTypeManager(
- css::uno::Reference< css::uno::XComponentContext > const & xContext );
- virtual ~ChartTypeManager() override;
-
- 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;
-
-protected:
- // ____ 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;
-
- // ____ XChartTypeManager ____
- // currently empty
-
-private:
- css::uno::Reference< css::uno::XComponentContext >
- m_xContext;
-};
-
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_MODEL_INC_CHARTTYPEMANAGER_HXX
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/inc/Diagram.hxx b/chart2/source/model/inc/Diagram.hxx
deleted file mode 100644
index c909f183f174..000000000000
--- a/chart2/source/model/inc/Diagram.hxx
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_INC_DIAGRAM_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_INC_DIAGRAM_HXX
-
-#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
-#include <cppuhelper/implbase.hxx>
-#include <comphelper/uno3.hxx>
-#include <com/sun/star/chart2/XDiagram.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XTitled.hpp>
-#include <com/sun/star/chart/X3DDefaultSetter.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-
-#include <vector>
-
-namespace com::sun::star::beans { struct PropertyValue; }
-namespace com::sun::star::chart2::data { class XDataSource; }
-namespace com::sun::star::uno { class XComponentContext; }
-
-namespace chart
-{
-
-namespace impl
-{
-typedef ::cppu::WeakImplHelper<
- css::chart2::XDiagram,
- css::lang::XServiceInfo,
- css::chart2::XCoordinateSystemContainer,
- css::chart2::XTitled,
- css::chart::X3DDefaultSetter,
- css::util::XModifyBroadcaster,
- css::util::XModifyListener,
- css::util::XCloneable >
- Diagram_Base;
-}
-
-class Diagram final :
- public MutexContainer,
- public impl::Diagram_Base,
- public ::property::OPropertySet
-{
-public:
- Diagram( css::uno::Reference< css::uno::XComponentContext > const & xContext );
- virtual ~Diagram() override;
-
- /// XServiceInfo declarations
- 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;
-
- /// merge XInterface implementations
- DECLARE_XINTERFACE()
- /// merge XTypeProvider implementations
- DECLARE_XTYPEPROVIDER()
-
-private:
- explicit Diagram( const Diagram & rOther );
-
- // ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
-
- // ____ OPropertySet ____
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
-
- // ____ XPropertySet ____
- virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
- getPropertySetInfo() override;
-
- // ____ XFastPropertySet ____
- virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
-
- /// make original interface function visible again
- using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
-
- virtual void SAL_CALL getFastPropertyValue(
- css::uno::Any& rValue, sal_Int32 nHandle ) const override;
-
- // ____ XDiagram ____
- virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getWall() override;
- virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFloor() override;
- virtual css::uno::Reference< css::chart2::XLegend > SAL_CALL getLegend() override;
- virtual void SAL_CALL setLegend( const css::uno::Reference<
- css::chart2::XLegend >& xLegend ) override;
- virtual css::uno::Reference< css::chart2::XColorScheme > SAL_CALL getDefaultColorScheme() override;
- virtual void SAL_CALL setDefaultColorScheme(
- const css::uno::Reference< css::chart2::XColorScheme >& xColorScheme ) override;
- virtual void SAL_CALL setDiagramData(
- const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
- const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override;
-
- // ____ XCoordinateSystemContainer ____
- virtual void SAL_CALL addCoordinateSystem(
- const css::uno::Reference< css::chart2::XCoordinateSystem >& aCoordSys ) override;
- virtual void SAL_CALL removeCoordinateSystem(
- const css::uno::Reference< css::chart2::XCoordinateSystem >& aCoordSys ) override;
- virtual css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > SAL_CALL getCoordinateSystems() override;
- virtual void SAL_CALL setCoordinateSystems(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > >& aCoordinateSystems ) override;
-
- // ____ XTitled ____
- virtual css::uno::Reference<
- css::chart2::XTitle > SAL_CALL getTitleObject() override;
- virtual void SAL_CALL setTitleObject( const css::uno::Reference<
- css::chart2::XTitle >& Title ) override;
-
- // ____ X3DDefaultSetter ____
- virtual void SAL_CALL set3DSettingsToDefault() override;
- virtual void SAL_CALL setDefaultRotation() override;
- virtual void SAL_CALL setDefaultIllumination() override;
-
- // ____ XCloneable ____
- virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
-
- // ____ XModifyBroadcaster ____
- virtual void SAL_CALL addModifyListener(
- const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
- virtual void SAL_CALL removeModifyListener(
- const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
-
- // ____ XModifyListener ____
- virtual void SAL_CALL modified(
- const css::lang::EventObject& aEvent ) override;
-
- // ____ XEventListener (base of XModifyListener) ____
- virtual void SAL_CALL disposing(
- const css::lang::EventObject& Source ) override;
-
- // ____ OPropertySet ____
- virtual void firePropertyChangeEvent() override;
- using OPropertySet::disposing;
-
- void fireModifyEvent();
-
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
- typedef
- std::vector< css::uno::Reference< css::chart2::XCoordinateSystem > >
- tCoordinateSystemContainerType;
-
- tCoordinateSystemContainerType m_aCoordSystems;
-
- css::uno::Reference< css::beans::XPropertySet >
- m_xWall;
-
- css::uno::Reference< css::beans::XPropertySet >
- m_xFloor;
-
- css::uno::Reference< css::chart2::XTitle >
- m_xTitle;
-
- css::uno::Reference< css::chart2::XLegend >
- m_xLegend;
-
- css::uno::Reference< css::chart2::XColorScheme >
- m_xColorScheme;
-
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
-};
-
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_MODEL_INC_DIAGRAM_HXX
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/inc/PolarCoordinateSystem.hxx b/chart2/source/model/inc/PolarCoordinateSystem.hxx
index 4572201f5ce9..43eaefa5b0d6 100644
--- a/chart2/source/model/inc/PolarCoordinateSystem.hxx
+++ b/chart2/source/model/inc/PolarCoordinateSystem.hxx
@@ -16,19 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_INC_POLARCOORDINATESYSTEM_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_INC_POLARCOORDINATESYSTEM_HXX
+#pragma once
-#include "BaseCoordinateSystem.hxx"
+#include <BaseCoordinateSystem.hxx>
namespace chart
{
-
class PolarCoordinateSystem : public BaseCoordinateSystem
{
public:
- explicit PolarCoordinateSystem( sal_Int32 nDimensionCount );
- explicit PolarCoordinateSystem( const PolarCoordinateSystem & rSource );
+ explicit PolarCoordinateSystem(sal_Int32 nDimensionCount);
+ explicit PolarCoordinateSystem(const PolarCoordinateSystem& rSource);
virtual ~PolarCoordinateSystem() override;
// ____ XCoordinateSystem ____
@@ -36,15 +34,15 @@ public:
virtual OUString SAL_CALL getViewServiceName() override;
// ____ XCloneable ____
- virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+ virtual css::uno::Reference<css::util::XCloneable> SAL_CALL createClone() override;
// ____ 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;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
};
-class PolarCoordinateSystem2d : public PolarCoordinateSystem
+class PolarCoordinateSystem2d final : public PolarCoordinateSystem
{
public:
explicit PolarCoordinateSystem2d();
@@ -52,11 +50,11 @@ public:
// ____ 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;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
};
-class PolarCoordinateSystem3d : public PolarCoordinateSystem
+class PolarCoordinateSystem3d final : public PolarCoordinateSystem
{
public:
explicit PolarCoordinateSystem3d();
@@ -64,13 +62,10 @@ public:
// ____ 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;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
};
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_MODEL_INC_POLARCOORDINATESYSTEM_HXX
-#endif
+} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/inc/StockBar.hxx b/chart2/source/model/inc/StockBar.hxx
index b1247e584a63..38f5c2629b4a 100644
--- a/chart2/source/model/inc/StockBar.hxx
+++ b/chart2/source/model/inc/StockBar.hxx
@@ -16,17 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_INC_STOCKBAR_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_INC_STOCKBAR_HXX
+#pragma once
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <MutexContainer.hxx>
#include <OPropertySet.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
+#include <ModifyListenerHelper.hxx>
namespace chart
{
@@ -41,7 +38,6 @@ typedef ::cppu::WeakImplHelper<
}
class StockBar final :
- public MutexContainer,
public impl::StockBar_Base,
public ::property::OPropertySet
{
@@ -55,8 +51,11 @@ public:
private:
explicit StockBar( const StockBar & rOther );
+ // ____ XTypeProvider ____
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -85,12 +84,9 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_INC_STOCKBAR_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx
index 4f4ba101a24b..12c28ad40e79 100644
--- a/chart2/source/model/inc/XMLFilter.hxx
+++ b/chart2/source/model/inc/XMLFilter.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_INC_XMLFILTER_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_INC_XMLFILTER_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/document/XFilter.hpp>
@@ -25,9 +24,8 @@
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
#include <osl/mutex.hxx>
-#include <vcl/errcode.hxx>
+#include <comphelper/errcode.hxx>
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::uno { class XComponentContext; }
@@ -125,12 +123,10 @@ private:
css::uno::Sequence<css::beans::PropertyValue> m_aMediaDescriptor;
OUString m_sDocumentHandler; // when set it will be set as doc handler
-
- volatile bool m_bCancelOperation;
::osl::Mutex m_aMutex;
};
-class XMLReportFilterHelper : public XMLFilter
+class XMLReportFilterHelper final : public XMLFilter
{
virtual void isOasisFormat(const css::uno::Sequence< css::beans::PropertyValue >& _rMediaDescriptor,
bool & _rOutOASIS ) override;
@@ -165,7 +161,4 @@ protected:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_INC_XMLFILTER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
index ff42899d0c18..3d7cfc6267b8 100644
--- a/chart2/source/model/main/Axis.cxx
+++ b/chart2/source/model/main/Axis.cxx
@@ -17,16 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "Axis.hxx"
-#include "GridProperties.hxx"
+#include <Axis.hxx>
+#include <GridProperties.hxx>
#include <CharacterProperties.hxx>
#include <LinePropertiesHelper.hxx>
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
-#include <CloneHelper.hxx>
#include <AxisHelper.hxx>
#include <EventListenerHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <Title.hxx>
#include <unonames.hxx>
#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
@@ -36,7 +36,8 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <rtl/ref.hxx>
#include <vector>
#include <algorithm>
@@ -203,116 +204,75 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
+} // namespace
-struct StaticAxisDefaults_Initializer
+namespace chart
{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
- ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap );
-
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, css::chart::ChartAxisPosition_ZERO );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, css::chart::ChartAxisLabelPosition_NEAR_AXIS );
- ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_AXIS_TEXT_ROTATION, 0.0 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_BREAK, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_OVERLAP, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_STACKED, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_ARRANGE_ORDER, css::chart::ChartAxisArrangeOrderType_AUTO );
-
- float fDefaultCharHeight = 10.0;
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
-
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MAJOR_TICKMARKS, 2 /* CHAXIS_MARK_OUTER */ );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MINOR_TICKMARKS, 0 /* CHAXIS_MARK_NONE */ );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_MARK_POSITION, css::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_UNITS, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TRY_STAGGERING_FIRST, false );
- }
-};
-
-struct StaticAxisDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticAxisDefaults_Initializer >
+const ::chart::tPropertyValueMap & StaticAxisDefaults()
{
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aMap;
+ ::chart::CharacterProperties::AddDefaultsToMap( aMap );
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aMap );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_SHOW, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_CROSSOVER_POSITION, css::chart::ChartAxisPosition_ZERO );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_DISPLAY_LABELS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_LABEL_POSITION, css::chart::ChartAxisLabelPosition_NEAR_AXIS );
+ ::chart::PropertyHelper::setPropertyValueDefault< double >( aMap, PROP_AXIS_TEXT_ROTATION, 0.0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_TEXT_BREAK, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_TEXT_OVERLAP, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_TEXT_STACKED, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_TEXT_ARRANGE_ORDER, css::chart::ChartAxisArrangeOrderType_AUTO );
+
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue( aMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
+
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, PROP_AXIS_MAJOR_TICKMARKS, 2 /* CHAXIS_MARK_OUTER */ );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, PROP_AXIS_MINOR_TICKMARKS, 0 /* CHAXIS_MARK_NONE */ );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_MARK_POSITION, css::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_DISPLAY_UNITS, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_AXIS_TRY_STAGGERING_FIRST, false );
+ return aMap;
+ }();
+ return aStaticDefaults;
};
+} // namespace chart
-struct StaticAxisInfoHelper_Initializer
+namespace
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-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 );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticAxisInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticAxisInfoHelper_Initializer >
+::cppu::OPropertyArrayHelper& StaticAxisInfoHelper()
{
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
-struct StaticAxisInfo_Initializer
+std::vector< rtl::Reference< ::chart::GridProperties > > lcl_CloneSubGrids(
+ const std::vector< rtl::Reference< ::chart::GridProperties > > & rSource )
{
- uno::Reference< beans::XPropertySetInfo >* operator()()
+ std::vector< rtl::Reference< ::chart::GridProperties > > aDestination;
+ aDestination.reserve( rSource.size());
+ for( rtl::Reference< ::chart::GridProperties > const & i : rSource )
{
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticAxisInfoHelper::get() ) );
- return &xPropertySetInfo;
+ aDestination.push_back(new ::chart::GridProperties(*i));
}
-};
-
-struct StaticAxisInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticAxisInfo_Initializer >
-{
-};
-
-typedef uno::Reference< beans::XPropertySet > lcl_tSubGridType;
-
-void lcl_CloneSubGrids(
- const uno::Sequence< lcl_tSubGridType > & rSource, uno::Sequence< lcl_tSubGridType > & rDestination )
-{
- rDestination.realloc( rSource.getLength());
- lcl_tSubGridType * pDestBegin = rDestination.getArray();
- lcl_tSubGridType * pDestEnd = pDestBegin + rDestination.getLength();
- lcl_tSubGridType * pDestIt = pDestBegin;
-
- for( Reference< beans::XPropertySet > const & i : rSource )
- {
- Reference< beans::XPropertySet > xSubGrid( i );
- if( xSubGrid.is())
- {
- Reference< util::XCloneable > xCloneable( xSubGrid, uno::UNO_QUERY );
- if( xCloneable.is())
- xSubGrid.set( xCloneable->createClone(), uno::UNO_QUERY );
- }
-
- (*pDestIt) = xSubGrid;
- OSL_ASSERT( pDestIt != pDestEnd );
- ++pDestIt;
- }
- OSL_ASSERT( pDestIt == pDestEnd );
+ return aDestination;
}
} // anonymous namespace
@@ -321,12 +281,9 @@ namespace chart
{
Axis::Axis() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_aScaleData( AxisHelper::createDefaultScale() ),
- m_xGrid( new GridProperties() ),
- m_aSubGridProperties(),
- m_xTitle()
+ m_xGrid( new GridProperties() )
{
osl_atomic_increment(&m_refCount);
setFastPropertyValue_NoBroadcast(
@@ -343,22 +300,24 @@ Axis::Axis() :
Axis::Axis( const Axis & rOther ) :
impl::Axis_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_aScaleData( rOther.m_aScaleData )
{
- m_xGrid.set( CloneHelper::CreateRefClone< beans::XPropertySet >()( rOther.m_xGrid ));
+ if (rOther.m_xGrid)
+ m_xGrid = new ::chart::GridProperties(*rOther.m_xGrid);
if( m_xGrid.is())
ModifyListenerHelper::addListener( m_xGrid, m_xModifyEventForwarder );
if( m_aScaleData.Categories.is())
ModifyListenerHelper::addListener( m_aScaleData.Categories, m_xModifyEventForwarder );
- if( rOther.m_aSubGridProperties.hasElements() )
- lcl_CloneSubGrids( rOther.m_aSubGridProperties, m_aSubGridProperties );
- ModifyListenerHelper::addListenerToAllSequenceElements( m_aSubGridProperties, m_xModifyEventForwarder );
+ if( !rOther.m_aSubGridProperties.empty() )
+ m_aSubGridProperties = lcl_CloneSubGrids( rOther.m_aSubGridProperties );
+ ModifyListenerHelper::addListenerToAllElements( m_aSubGridProperties, m_xModifyEventForwarder );
- m_xTitle.set( CloneHelper::CreateRefClone< chart2::XTitle >()( rOther.m_xTitle ));
+ if ( rOther.m_xTitle )
+ m_xTitle = new Title( *rOther.m_xTitle );
if( m_xTitle.is())
ModifyListenerHelper::addListener( m_xTitle, m_xModifyEventForwarder );
}
@@ -375,12 +334,12 @@ Axis::~Axis()
try
{
ModifyListenerHelper::removeListener( m_xGrid, m_xModifyEventForwarder );
- ModifyListenerHelper::removeListenerFromAllSequenceElements( m_aSubGridProperties, m_xModifyEventForwarder );
+ ModifyListenerHelper::removeListenerFromAllElements( m_aSubGridProperties, m_xModifyEventForwarder );
ModifyListenerHelper::removeListener( m_xTitle, m_xModifyEventForwarder );
if( m_aScaleData.Categories.is())
{
ModifyListenerHelper::removeListener( m_aScaleData.Categories, m_xModifyEventForwarder );
- m_aScaleData.Categories.set(nullptr);
+ m_aScaleData.Categories.clear();
}
}
catch( const uno::Exception & )
@@ -388,7 +347,7 @@ Axis::~Axis()
DBG_UNHANDLED_EXCEPTION("chart2");
}
- m_aSubGridProperties.realloc(0);
+ m_aSubGridProperties.clear();
m_xGrid = nullptr;
m_xTitle = nullptr;
}
@@ -397,26 +356,26 @@ void Axis::AllocateSubGrids()
{
Reference< util::XModifyListener > xModifyEventForwarder;
Reference< lang::XEventListener > xEventListener;
- std::vector< Reference< beans::XPropertySet > > aOldBroadcasters;
- std::vector< Reference< beans::XPropertySet > > aNewBroadcasters;
+ std::vector< rtl::Reference< GridProperties > > aOldBroadcasters;
+ std::vector< rtl::Reference< GridProperties > > aNewBroadcasters;
{
MutexGuard aGuard( m_aMutex );
xModifyEventForwarder = m_xModifyEventForwarder;
xEventListener = this;
sal_Int32 nNewSubIncCount = m_aScaleData.IncrementData.SubIncrements.getLength();
- sal_Int32 nOldSubIncCount = m_aSubGridProperties.getLength();
+ sal_Int32 nOldSubIncCount = m_aSubGridProperties.size();
if( nOldSubIncCount > nNewSubIncCount )
{
// remove superfluous entries
for( sal_Int32 i = nNewSubIncCount; i < nOldSubIncCount; ++i )
aOldBroadcasters.push_back( m_aSubGridProperties[ i ] );
- m_aSubGridProperties.realloc( nNewSubIncCount );
+ m_aSubGridProperties.resize( nNewSubIncCount );
}
else if( nOldSubIncCount < nNewSubIncCount )
{
- m_aSubGridProperties.realloc( nNewSubIncCount );
+ m_aSubGridProperties.resize( nNewSubIncCount );
// allocate new entries
for( sal_Int32 i = nOldSubIncCount; i < nNewSubIncCount; ++i )
@@ -476,9 +435,20 @@ Reference< beans::XPropertySet > SAL_CALL Axis::getGridProperties()
MutexGuard aGuard( m_aMutex );
return m_xGrid;
}
+rtl::Reference< ::chart::GridProperties > Axis::getGridProperties2()
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_xGrid;
+}
Sequence< Reference< beans::XPropertySet > > SAL_CALL Axis::getSubGridProperties()
{
MutexGuard aGuard( m_aMutex );
+ return comphelper::containerToSequence<Reference< beans::XPropertySet >>(m_aSubGridProperties);
+}
+
+std::vector< rtl::Reference< GridProperties > > Axis::getSubGridProperties2()
+{
+ MutexGuard aGuard( m_aMutex );
return m_aSubGridProperties;
}
@@ -495,10 +465,23 @@ Reference< chart2::XTitle > SAL_CALL Axis::getTitleObject()
return m_xTitle;
}
+rtl::Reference< Title > Axis::getTitleObject2() const
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_xTitle;
+}
+
void SAL_CALL Axis::setTitleObject( const Reference< chart2::XTitle >& xNewTitle )
{
+ rtl::Reference<Title> xTitle = dynamic_cast<Title*>(xNewTitle.get());
+ assert(!xNewTitle || xTitle);
+ setTitleObject(xTitle);
+}
+
+void Axis::setTitleObject( const rtl::Reference< Title >& xNewTitle )
+{
Reference< util::XModifyListener > xModifyEventForwarder;
- Reference< chart2::XTitle > xOldTitle;
+ rtl::Reference< Title > xOldTitle;
{
MutexGuard aGuard( m_aMutex );
xOldTitle = m_xTitle;
@@ -517,39 +500,21 @@ void SAL_CALL Axis::setTitleObject( const Reference< chart2::XTitle >& xNewTitle
// ____ XCloneable ____
Reference< util::XCloneable > SAL_CALL Axis::createClone()
{
- Axis * pNewAxis( new Axis( *this ));
- // hold a reference to the clone
- Reference< util::XCloneable > xResult( pNewAxis );
+ rtl::Reference<Axis> pNewAxis( new Axis( *this ));
// do initialization that uses uno references to the clone
pNewAxis->Init();
- return xResult;
+ return pNewAxis;
}
// ____ XModifyBroadcaster ____
void SAL_CALL Axis::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception &)
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL Axis::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
@@ -577,24 +542,27 @@ void Axis::fireModifyEvent()
}
// ____ OPropertySet ____
-uno::Any Axis::GetDefaultValue( sal_Int32 nHandle ) const
+void Axis::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticAxisDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticAxisDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL Axis::getInfoHelper()
{
- return *StaticAxisInfoHelper::get();
+ return StaticAxisInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL Axis::getPropertySetInfo()
{
- return *StaticAxisInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticAxisInfoHelper() ) );
+ return xPropertySetInfo;
}
using impl::Axis_Base;
diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx
index 7075f2ed6f26..8af32fa09678 100644
--- a/chart2/source/model/main/BaseCoordinateSystem.cxx
+++ b/chart2/source/model/main/BaseCoordinateSystem.cxx
@@ -22,12 +22,13 @@
#include <UserDefinedProperties.hxx>
#include <CloneHelper.hxx>
#include <ModifyListenerHelper.hxx>
-#include "Axis.hxx"
+#include <Axis.hxx>
+#include <ChartType.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <o3tl/safeint.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
@@ -55,58 +56,31 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
-struct StaticCooSysDefaults_Initializer
+const ::chart::tPropertyValueMap & StaticCooSysDefaults()
{
- ::chart::tPropertyValueMap* operator()()
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
{
- static ::chart::tPropertyValueMap aStaticDefaults;
- ::chart::PropertyHelper::setPropertyValueDefault( aStaticDefaults, PROP_COORDINATESYSTEM_SWAPXANDYAXIS, false );
- return &aStaticDefaults;
- }
+ ::chart::tPropertyValueMap aMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_COORDINATESYSTEM_SWAPXANDYAXIS, false );
+ return aMap;
+ }();
+ return aStaticDefaults;
};
-struct StaticCooSysDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticCooSysDefaults_Initializer >
+::cppu::OPropertyArrayHelper& StaticCooSysInfoHelper()
{
-};
-
-struct StaticCooSysInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-struct StaticCooSysInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticCooSysInfoHelper_Initializer >
-{
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticCooSysInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticCooSysInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticCooSysInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticCooSysInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -116,15 +90,14 @@ namespace chart
BaseCoordinateSystem::BaseCoordinateSystem(
sal_Int32 nDimensionCount /* = 2 */ ) :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_nDimensionCount( nDimensionCount )
{
m_aAllAxis.resize( m_nDimensionCount );
for( sal_Int32 nN=0; nN<m_nDimensionCount; nN++ )
{
m_aAllAxis[nN].resize( 1 );
- Reference< chart2::XAxis > xAxis( new Axis );
+ rtl::Reference< Axis > xAxis( new Axis );
m_aAllAxis[nN][0] = xAxis;
ModifyListenerHelper::addListenerToAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
@@ -151,19 +124,21 @@ BaseCoordinateSystem::BaseCoordinateSystem(
BaseCoordinateSystem::BaseCoordinateSystem(
const BaseCoordinateSystem & rSource ) :
impl::BaseCoordinateSystem_Base(rSource),
- ::property::OPropertySet( rSource, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ ::property::OPropertySet( rSource ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_nDimensionCount( rSource.m_nDimensionCount )
{
m_aAllAxis.resize(rSource.m_aAllAxis.size());
tAxisVecVecType::size_type nN=0;
for( nN=0; nN<m_aAllAxis.size(); nN++ )
- CloneHelper::CloneRefVector<chart2::XAxis>( rSource.m_aAllAxis[nN], m_aAllAxis[nN] );
- CloneHelper::CloneRefVector<chart2::XChartType>( rSource.m_aChartTypes, m_aChartTypes );
+ CloneHelper::CloneRefVector( rSource.m_aAllAxis[nN], m_aAllAxis[nN] );
+ for (const auto & rxChartType : rSource.m_aChartTypes)
+ m_aChartTypes.push_back(rxChartType->cloneChartType());
for( nN=0; nN<m_aAllAxis.size(); nN++ )
ModifyListenerHelper::addListenerToAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
- ModifyListenerHelper::addListenerToAllElements( m_aChartTypes, m_xModifyEventForwarder );
+ for (const auto & rxChartType : m_aChartTypes)
+ rxChartType->addModifyListener( m_xModifyEventForwarder );
}
BaseCoordinateSystem::~BaseCoordinateSystem()
@@ -172,7 +147,8 @@ BaseCoordinateSystem::~BaseCoordinateSystem()
{
for(const tAxisVecVecType::value_type & i : m_aAllAxis)
ModifyListenerHelper::removeListenerFromAllElements( i, m_xModifyEventForwarder );
- ModifyListenerHelper::removeListenerFromAllElements( m_aChartTypes, m_xModifyEventForwarder );
+ for (const auto & rxChartType : m_aChartTypes)
+ rxChartType->removeModifyListener( m_xModifyEventForwarder );
}
catch( const uno::Exception & )
{
@@ -197,13 +173,41 @@ void SAL_CALL BaseCoordinateSystem::setAxisByDimension(
if( nIndex < 0 )
throw lang::IndexOutOfBoundsException();
+ assert(!xAxis || dynamic_cast<Axis*>(xAxis.get()));
+
+ if( m_aAllAxis[ nDimensionIndex ].size() < o3tl::make_unsigned( nIndex+1 ))
+ {
+ m_aAllAxis[ nDimensionIndex ].resize( nIndex+1 );
+ m_aAllAxis[ nDimensionIndex ][nIndex] = nullptr;
+ }
+
+ rtl::Reference< Axis > xOldAxis( m_aAllAxis[ nDimensionIndex ][nIndex] );
+ if( xOldAxis.is())
+ ModifyListenerHelper::removeListener( xOldAxis, m_xModifyEventForwarder );
+ m_aAllAxis[ nDimensionIndex ][nIndex] = dynamic_cast<Axis*>(xAxis.get());
+ if( xAxis.is())
+ ModifyListenerHelper::addListener( xAxis, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+void BaseCoordinateSystem::setAxisByDimension(
+ sal_Int32 nDimensionIndex,
+ const rtl::Reference< Axis >& xAxis,
+ sal_Int32 nIndex )
+{
+ if( nDimensionIndex < 0 || nDimensionIndex >= getDimension() )
+ throw lang::IndexOutOfBoundsException();
+
+ if( nIndex < 0 )
+ throw lang::IndexOutOfBoundsException();
+
if( m_aAllAxis[ nDimensionIndex ].size() < o3tl::make_unsigned( nIndex+1 ))
{
m_aAllAxis[ nDimensionIndex ].resize( nIndex+1 );
m_aAllAxis[ nDimensionIndex ][nIndex] = nullptr;
}
- Reference< chart2::XAxis > xOldAxis( m_aAllAxis[ nDimensionIndex ][nIndex] );
+ rtl::Reference< Axis > xOldAxis( m_aAllAxis[ nDimensionIndex ][nIndex] );
if( xOldAxis.is())
ModifyListenerHelper::removeListener( xOldAxis, m_xModifyEventForwarder );
m_aAllAxis[ nDimensionIndex ][nIndex] = xAxis;
@@ -226,6 +230,20 @@ Reference< chart2::XAxis > SAL_CALL BaseCoordinateSystem::getAxisByDimension(
return m_aAllAxis[ nDimensionIndex ][nAxisIndex];
}
+const rtl::Reference< Axis > & BaseCoordinateSystem::getAxisByDimension2(
+ sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+{
+ if( nDimensionIndex < 0 || nDimensionIndex >= m_nDimensionCount )
+ throw lang::IndexOutOfBoundsException();
+
+ OSL_ASSERT( m_aAllAxis.size() == static_cast< size_t >( m_nDimensionCount));
+
+ if( nAxisIndex < 0 || o3tl::make_unsigned(nAxisIndex) > m_aAllAxis[ nDimensionIndex ].size() )
+ throw lang::IndexOutOfBoundsException();
+
+ return m_aAllAxis[ nDimensionIndex ][nAxisIndex];
+}
+
sal_Int32 SAL_CALL BaseCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex )
{
if( nDimensionIndex < 0 || nDimensionIndex >= getDimension() )
@@ -243,19 +261,23 @@ sal_Int32 SAL_CALL BaseCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int
// ____ XChartTypeContainer ____
void SAL_CALL BaseCoordinateSystem::addChartType( const Reference< chart2::XChartType >& aChartType )
{
- if( std::find( m_aChartTypes.begin(), m_aChartTypes.end(), aChartType )
+ auto pChartType = dynamic_cast<ChartType*>(aChartType.get());
+ assert(pChartType);
+
+ if( std::find( m_aChartTypes.begin(), m_aChartTypes.end(), pChartType )
!= m_aChartTypes.end())
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException("type not found", static_cast<cppu::OWeakObject*>(this), 1);
- m_aChartTypes.push_back( aChartType );
+ m_aChartTypes.push_back( pChartType );
ModifyListenerHelper::addListener( aChartType, m_xModifyEventForwarder );
fireModifyEvent();
}
void SAL_CALL BaseCoordinateSystem::removeChartType( const Reference< chart2::XChartType >& aChartType )
{
- std::vector< uno::Reference< chart2::XChartType > >::iterator
- aIt( std::find( m_aChartTypes.begin(), m_aChartTypes.end(), aChartType ));
+ auto pChartType = dynamic_cast<ChartType*>(aChartType.get());
+ assert(pChartType);
+ auto aIt( std::find( m_aChartTypes.begin(), m_aChartTypes.end(), pChartType ));
if( aIt == m_aChartTypes.end())
throw container::NoSuchElementException(
"The given chart type is no element of the container",
@@ -268,42 +290,43 @@ void SAL_CALL BaseCoordinateSystem::removeChartType( const Reference< chart2::XC
Sequence< Reference< chart2::XChartType > > SAL_CALL BaseCoordinateSystem::getChartTypes()
{
- return comphelper::containerToSequence( m_aChartTypes );
+ return comphelper::containerToSequence< Reference< chart2::XChartType > >( m_aChartTypes );
}
void SAL_CALL BaseCoordinateSystem::setChartTypes( const Sequence< Reference< chart2::XChartType > >& aChartTypes )
{
- ModifyListenerHelper::removeListenerFromAllElements( m_aChartTypes, m_xModifyEventForwarder );
- m_aChartTypes = comphelper::sequenceToContainer<std::vector< css::uno::Reference< css::chart2::XChartType > >>( aChartTypes );
- ModifyListenerHelper::addListenerToAllElements( m_aChartTypes, m_xModifyEventForwarder );
+ for (auto const & aChartType : m_aChartTypes)
+ aChartType->removeModifyListener( m_xModifyEventForwarder );
+ m_aChartTypes.clear();
+ for (auto const & aChartType : aChartTypes)
+ {
+ auto pChartType = dynamic_cast<ChartType*>(aChartType.get());
+ assert(pChartType);
+ m_aChartTypes.push_back(pChartType);
+ pChartType->addModifyListener( m_xModifyEventForwarder );
+ }
+ fireModifyEvent();
+}
+
+void BaseCoordinateSystem::setChartTypes( const std::vector< rtl::Reference< ChartType > >& aChartTypes )
+{
+ for (auto const & aChartType : m_aChartTypes)
+ aChartType->removeModifyListener( m_xModifyEventForwarder );
+ m_aChartTypes = aChartTypes;
+ for (auto const & aChartType : m_aChartTypes)
+ aChartType->addModifyListener( m_xModifyEventForwarder );
fireModifyEvent();
}
// ____ XModifyBroadcaster ____
void SAL_CALL BaseCoordinateSystem::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2" );
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL BaseCoordinateSystem::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2" );
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
@@ -330,25 +353,28 @@ void BaseCoordinateSystem::fireModifyEvent()
}
// ____ OPropertySet ____
-uno::Any BaseCoordinateSystem::GetDefaultValue( sal_Int32 nHandle ) const
+void BaseCoordinateSystem::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticCooSysDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticCooSysDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL BaseCoordinateSystem::getInfoHelper()
{
- return *StaticCooSysInfoHelper::get();
+ return StaticCooSysInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL BaseCoordinateSystem::getPropertySetInfo()
{
- return *StaticCooSysInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticCooSysInfoHelper() ) );
+ return xPropertySetInfo;
}
using impl::BaseCoordinateSystem_Base;
diff --git a/chart2/source/model/main/CartesianCoordinateSystem.cxx b/chart2/source/model/main/CartesianCoordinateSystem.cxx
index dd0f77b40e58..1f1320d8ae69 100644
--- a/chart2/source/model/main/CartesianCoordinateSystem.cxx
+++ b/chart2/source/model/main/CartesianCoordinateSystem.cxx
@@ -31,7 +31,7 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace
{
-const char CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME[] = "com.sun.star.chart2.CoordinateSystems.Cartesian";
+constexpr OUString CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME = u"com.sun.star.chart2.CoordinateSystems.Cartesian"_ustr;
}
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 4f1d055f6a13..c0627abf7bbd 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -18,11 +18,15 @@
*/
#include <ChartModel.hxx>
+#include <ChartTypeManager.hxx>
+#include <ChartTypeTemplate.hxx>
#include <servicenames.hxx>
+#include <DataSource.hxx>
#include <DataSourceHelper.hxx>
#include <ChartModelHelper.hxx>
#include <DisposeHelper.hxx>
#include <ControllerLockGuard.hxx>
+#include <InternalDataProvider.hxx>
#include <ObjectIdentifier.hxx>
#include "PageBackground.hxx"
#include <CloneHelper.hxx>
@@ -31,6 +35,9 @@
#include <ChartView.hxx>
#include <PopupRequest.hxx>
#include <ModifyListenerHelper.hxx>
+#include <RangeHighlighter.hxx>
+#include <Diagram.hxx>
+#include <comphelper/dumpxmltostring.hxx>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart2/data/XPivotTableDataProvider.hpp>
@@ -39,9 +46,9 @@
#include <comphelper/propertysequence.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <svl/numformat.hxx>
#include <svl/numuno.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/embed/EmbedMapUnits.hpp>
#include <com/sun/star/embed/Aspects.hpp>
@@ -51,11 +58,10 @@
#include <com/sun/star/document/DocumentProperties.hpp>
#include <com/sun/star/util/CloseVetoException.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
#include <sal/log.hxx>
-#include <svl/zforlist.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
#include <libxml/xmlwriter.h>
using ::com::sun::star::uno::Sequence;
@@ -65,14 +71,13 @@ using ::osl::MutexGuard;
using namespace ::com::sun::star;
using namespace ::apphelper;
-using namespace ::chart::CloneHelper;
namespace
{
-const OUString lcl_aGDIMetaFileMIMEType(
- "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"");
-const OUString lcl_aGDIMetaFileMIMETypeHighContrast(
- "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"");
+constexpr OUString lcl_aGDIMetaFileMIMEType(
+ u"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\""_ustr);
+constexpr OUString lcl_aGDIMetaFileMIMETypeHighContrast(
+ u"application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\""_ustr);
} // anonymous namespace
@@ -81,7 +86,7 @@ const OUString lcl_aGDIMetaFileMIMETypeHighContrast(
namespace chart
{
-ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
+ChartModel::ChartModel(uno::Reference<uno::XComponentContext > xContext)
: m_aLifeTimeManager( this, this )
, m_bReadOnly( false )
, m_bModified( false )
@@ -90,11 +95,10 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
, mbTimeBased(false)
, m_aControllers( m_aModelMutex )
, m_nControllerLockCount(0)
- , m_xContext( xContext )
+ , m_xContext(std::move( xContext ))
, m_aVisualAreaSize( ChartModelHelper::getDefaultPageSize() )
, m_xPageBackground( new PageBackground )
- , m_xXMLNamespaceMap( createNameContainer( ::cppu::UnoType<OUString>::get(),
- "com.sun.star.xml.NamespaceMap", "com.sun.star.comp.chart.XMLNameSpaceMap" ) )
+ , m_xXMLNamespaceMap( new NameContainer() )
, mnStart(0)
, mnEnd(0)
{
@@ -108,9 +112,8 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
}
{
- ModifyListenerHelper::addListener( m_xPageBackground, this );
- m_xChartTypeManager.set( xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.ChartTypeManager", m_xContext ), uno::UNO_QUERY );
+ m_xPageBackground->addModifyListener( this );
+ m_xChartTypeManager = new ::chart::ChartTypeManager( m_xContext );
}
osl_atomic_decrement(&m_refCount);
}
@@ -148,25 +151,34 @@ ChartModel::ChartModel( const ChartModel & rOther )
m_xOldModelAgg->setDelegator( *this );
Reference< util::XModifyListener > xListener;
- Reference< chart2::XTitle > xNewTitle = CreateRefClone< chart2::XTitle >()( rOther.m_xTitle );
- Reference< chart2::XDiagram > xNewDiagram = CreateRefClone< chart2::XDiagram >()( rOther.m_xDiagram );
- Reference< beans::XPropertySet > xNewPageBackground = CreateRefClone< beans::XPropertySet >()( rOther.m_xPageBackground );
- Reference< chart2::XChartTypeManager > xChartTypeManager = CreateRefClone< chart2::XChartTypeManager >()( rOther.m_xChartTypeManager );
- Reference< container::XNameAccess > xXMLNamespaceMap = CreateRefClone< container::XNameAccess >()( rOther.m_xXMLNamespaceMap );
+ rtl::Reference< Title > xNewTitle;
+ if ( rOther.m_xTitle )
+ xNewTitle = new Title(*rOther.m_xTitle);
+ rtl::Reference< ::chart::Diagram > xNewDiagram;
+ if (rOther.m_xDiagram.is())
+ xNewDiagram = new ::chart::Diagram( *rOther.m_xDiagram );
+ rtl::Reference< ::chart::PageBackground > xNewPageBackground = new PageBackground( *rOther.m_xPageBackground );
{
- MutexGuard aGuard( m_aModelMutex );
- xListener = this;
- m_xTitle = xNewTitle;
- m_xDiagram = xNewDiagram;
- m_xPageBackground = xNewPageBackground;
- m_xChartTypeManager = xChartTypeManager;
- m_xXMLNamespaceMap = xXMLNamespaceMap;
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager; // does not implement XCloneable
+ rtl::Reference< ::chart::NameContainer > xXMLNamespaceMap = new NameContainer( *rOther.m_xXMLNamespaceMap );
+
+ {
+ MutexGuard aGuard( m_aModelMutex );
+ xListener = this;
+ m_xTitle = xNewTitle;
+ m_xDiagram = xNewDiagram;
+ m_xPageBackground = xNewPageBackground;
+ m_xChartTypeManager = std::move(xChartTypeManager);
+ m_xXMLNamespaceMap = std::move(xXMLNamespaceMap);
+ }
}
ModifyListenerHelper::addListener( xNewTitle, xListener );
- ModifyListenerHelper::addListener( xNewDiagram, xListener );
- ModifyListenerHelper::addListener( xNewPageBackground, xListener );
+ if( xNewDiagram && xListener)
+ xNewDiagram->addModifyListener( xListener );
+ if( xNewPageBackground && xListener)
+ xNewPageBackground->addModifyListener( xListener );
xListener.clear();
}
osl_atomic_decrement(&m_refCount);
@@ -188,9 +200,9 @@ void SAL_CALL ChartModel::initialize( const Sequence< Any >& /*rArguments*/ )
//support argument "DocumentRecoverySupport"?
}
-css::uno::Reference< css::uno::XInterface > ChartModel::getChartView() const
+ChartView* ChartModel::getChartView() const
{
- return static_cast< ::cppu::OWeakObject* >( mxChartView.get() );
+ return mxChartView.get();
}
// private methods
@@ -233,7 +245,7 @@ uno::Reference< frame::XController > ChartModel::impl_getCurrentController()
// get the first controller of this model
if( m_aControllers.getLength() )
{
- uno::Reference<uno::XInterface> xI = m_aControllers.getElements()[0];
+ uno::Reference<uno::XInterface> xI = m_aControllers.getInterface(0);
return uno::Reference<frame::XController>( xI, uno::UNO_QUERY );
}
@@ -243,18 +255,11 @@ uno::Reference< frame::XController > ChartModel::impl_getCurrentController()
void ChartModel::impl_notifyCloseListeners()
{
- ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
- .getContainer( cppu::UnoType<util::XCloseListener>::get());
- if( pIC )
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ if( m_aLifeTimeManager.m_aCloseListeners.getLength(aGuard) )
{
lang::EventObject aEvent( static_cast< lang::XComponent*>(this) );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- uno::Reference< util::XCloseListener > xListener( aIt.next(), uno::UNO_QUERY );
- if( xListener.is() )
- xListener->notifyClosing( aEvent );
- }
+ m_aLifeTimeManager.m_aCloseListeners.notifyEach(aGuard, &util::XCloseListener::notifyClosing, aEvent);
}
}
@@ -283,10 +288,10 @@ void ChartModel::impl_adjustAdditionalShapesPositionAndSize( const awt::Size& aV
double fWidth = static_cast< double >( aVisualAreaSize.Width ) / m_aVisualAreaSize.Width;
double fHeight = static_cast< double >( aVisualAreaSize.Height ) / m_aVisualAreaSize.Height;
- aPos.X = static_cast< long >( aPos.X * fWidth );
- aPos.Y = static_cast< long >( aPos.Y * fHeight );
- aSize.Width = static_cast< long >( aSize.Width * fWidth );
- aSize.Height = static_cast< long >( aSize.Height * fHeight );
+ aPos.X = static_cast< tools::Long >( aPos.X * fWidth );
+ aPos.Y = static_cast< tools::Long >( aPos.Y * fHeight );
+ aSize.Width = static_cast< tools::Long >( aSize.Width * fWidth );
+ aSize.Height = static_cast< tools::Long >( aSize.Height * fHeight );
xShape->setPosition( aPos );
xShape->setSize( aSize );
@@ -392,7 +397,11 @@ void SAL_CALL ChartModel::disconnectController( const uno::Reference< frame::XCo
if( m_xCurrentController == xController )
m_xCurrentController.clear();
- DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
+ if (m_xRangeHighlighter)
+ {
+ m_xRangeHighlighter->dispose();
+ m_xRangeHighlighter.clear();
+ }
DisposeHelper::DisposeAndClear(m_xPopupRequest);
}
@@ -477,7 +486,11 @@ void SAL_CALL ChartModel::setCurrentController( const uno::Reference< frame::XCo
m_xCurrentController = xController;
- DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
+ if (m_xRangeHighlighter)
+ {
+ m_xRangeHighlighter->dispose();
+ m_xRangeHighlighter.clear();
+ }
DisposeHelper::DisposeAndClear(m_xPopupRequest);
}
@@ -501,7 +514,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartModel::getCurrentSelection()
uno::Any aSel = xSelectionSupl->getSelection();
OUString aObjectCID;
if( aSel >>= aObjectCID )
- xReturn.set( ObjectIdentifier::getObjectPropertySet( aObjectCID, Reference< XChartDocument >(this)));
+ xReturn.set( ObjectIdentifier::getObjectPropertySet( aObjectCID, this));
}
}
return xReturn;
@@ -525,7 +538,7 @@ void SAL_CALL ChartModel::dispose()
//// @todo
if ( m_xDiagram.is() )
- ModifyListenerHelper::removeListener( m_xDiagram, this );
+ m_xDiagram->removeModifyListener( this );
if ( m_xDataProvider.is() )
{
@@ -537,12 +550,12 @@ void SAL_CALL ChartModel::dispose()
m_xDataProvider.clear();
m_xInternalDataProvider.clear();
m_xNumberFormatsSupplier.clear();
- DisposeHelper::DisposeAndClear( m_xOwnNumberFormatsSupplier );
- DisposeHelper::DisposeAndClear( m_xChartTypeManager );
- DisposeHelper::DisposeAndClear( m_xDiagram );
- DisposeHelper::DisposeAndClear( m_xTitle );
- DisposeHelper::DisposeAndClear( m_xPageBackground );
- DisposeHelper::DisposeAndClear( m_xXMLNamespaceMap );
+ m_xOwnNumberFormatsSupplier.clear();
+ m_xChartTypeManager.clear();
+ m_xDiagram.clear();
+ m_xTitle.clear();
+ m_xPageBackground.clear();
+ m_xXMLNamespaceMap.clear();
m_xStorage.clear();
// just clear, don't dispose - we're not the owner
@@ -558,7 +571,11 @@ void SAL_CALL ChartModel::dispose()
m_aControllers.disposeAndClear( lang::EventObject( static_cast< cppu::OWeakObject * >( this )));
m_xCurrentController.clear();
- DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
+ if (m_xRangeHighlighter)
+ {
+ m_xRangeHighlighter->dispose();
+ m_xRangeHighlighter.clear();
+ }
DisposeHelper::DisposeAndClear(m_xPopupRequest);
if( m_xOldModelAgg.is())
@@ -570,7 +587,8 @@ void SAL_CALL ChartModel::addEventListener( const uno::Reference< lang::XEventLi
if( m_aLifeTimeManager.impl_isDisposedOrClosed() )
return; //behave passive if already disposed or closed
- m_aLifeTimeManager.m_aListenerContainer.addInterface( cppu::UnoType<lang::XEventListener>::get(), xListener );
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aEventListeners.addInterface( aGuard, xListener );
}
void SAL_CALL ChartModel::removeEventListener( const uno::Reference< lang::XEventListener > & xListener )
@@ -578,7 +596,8 @@ void SAL_CALL ChartModel::removeEventListener( const uno::Reference< lang::XEven
if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
return; //behave passive if already disposed or closed
- m_aLifeTimeManager.m_aListenerContainer.removeInterface( cppu::UnoType<lang::XEventListener>::get(), xListener );
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aEventListeners.removeInterface( aGuard, xListener );
}
// util::XCloseBroadcaster (base of XCloseable)
@@ -592,7 +611,8 @@ void SAL_CALL ChartModel::removeCloseListener( const uno::Reference< util::XClos
if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
return; //behave passive if already disposed or closed
- m_aLifeTimeManager.m_aListenerContainer.removeInterface( cppu::UnoType<util::XCloseListener>::get(), xListener );
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aCloseListeners.removeInterface( aGuard, xListener );
}
// util::XCloseable
@@ -657,7 +677,7 @@ Reference< document::XUndoManager > SAL_CALL ChartModel::getUndoManager( )
::osl::MutexGuard aGuard( m_aModelMutex );
if ( !m_pUndoManager.is() )
m_pUndoManager.set( new UndoManager( *this, m_aModelMutex ) );
- return m_pUndoManager.get();
+ return m_pUndoManager;
}
// chart2::XChartDocument
@@ -670,18 +690,20 @@ uno::Reference< chart2::XDiagram > SAL_CALL ChartModel::getFirstDiagram()
void SAL_CALL ChartModel::setFirstDiagram( const uno::Reference< chart2::XDiagram >& xDiagram )
{
- Reference< chart2::XDiagram > xOldDiagram;
+ rtl::Reference< ::chart::Diagram > xOldDiagram;
Reference< util::XModifyListener > xListener;
{
MutexGuard aGuard( m_aModelMutex );
- if( xDiagram == m_xDiagram )
+ if( xDiagram.get() == m_xDiagram.get() )
return;
xOldDiagram = m_xDiagram;
- m_xDiagram = xDiagram;
+ assert(!xDiagram || dynamic_cast<::chart::Diagram*>(xDiagram.get()));
+ m_xDiagram = dynamic_cast<::chart::Diagram*>(xDiagram.get());
xListener = this;
}
//don't keep the mutex locked while calling out
- ModifyListenerHelper::removeListener( xOldDiagram, xListener );
+ if( xOldDiagram && xListener )
+ xOldDiagram->removeModifyListener( xListener );
ModifyListenerHelper::addListener( xDiagram, xListener );
setModified( true );
}
@@ -691,25 +713,20 @@ Reference< chart2::data::XDataSource > ChartModel::impl_createDefaultData()
Reference< chart2::data::XDataSource > xDataSource;
if( hasInternalDataProvider() )
{
- uno::Reference< lang::XInitialization > xIni(m_xInternalDataProvider,uno::UNO_QUERY);
- if( xIni.is() )
+ //init internal dataprovider
{
- //init internal dataprovider
- {
- uno::Sequence< uno::Any > aArgs(1);
- beans::NamedValue aParam( "CreateDefaultData" ,uno::Any(true) );
- aArgs[0] <<= aParam;
- xIni->initialize(aArgs);
- }
- //create data
- uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
- { "CellRangeRepresentation", uno::Any( OUString("all") ) },
- { "HasCategories", uno::Any( true ) },
- { "FirstCellAsLabel", uno::Any( true ) },
- { "DataRowSource", uno::Any( css::chart::ChartDataRowSource_COLUMNS ) }
- }));
- xDataSource = m_xInternalDataProvider->createDataSource( aArgs );
+ beans::NamedValue aParam( "CreateDefaultData" ,uno::Any(true) );
+ uno::Sequence< uno::Any > aArgs{ uno::Any(aParam) };
+ m_xInternalDataProvider->initialize(aArgs);
}
+ //create data
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "CellRangeRepresentation", uno::Any( OUString("all") ) },
+ { "HasCategories", uno::Any( true ) },
+ { "FirstCellAsLabel", uno::Any( true ) },
+ { "DataRowSource", uno::Any( css::chart::ChartDataRowSource_COLUMNS ) }
+ }));
+ xDataSource = m_xInternalDataProvider->createDataSource( aArgs );
}
return xDataSource;
}
@@ -725,7 +742,7 @@ void SAL_CALL ChartModel::createInternalDataProvider( sal_Bool bCloneExistingDat
if( bCloneExistingData )
m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( this, true );
else
- m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( Reference<XChartDocument>(), true );
+ m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( nullptr, true );
m_xDataProvider.set( m_xInternalDataProvider );
}
setModified( true );
@@ -741,15 +758,15 @@ void ChartModel::removeDataProviders()
void ChartModel::dumpAsXml(xmlTextWriterPtr pWriter) const
{
- xmlTextWriterStartElement(pWriter, BAD_CAST("ChartModel"));
- xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ChartModel"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
if (mxChartView.is())
{
mxChartView->dumpAsXml(pWriter);
}
- xmlTextWriterEndElement(pWriter);
+ (void)xmlTextWriterEndElement(pWriter);
}
sal_Bool SAL_CALL ChartModel::hasInternalDataProvider()
@@ -774,7 +791,7 @@ void SAL_CALL ChartModel::attachDataProvider( const uno::Reference< chart2::data
{
try
{
- bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( Reference< frame::XModel >(this) );
+ bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( this );
xProp->setPropertyValue("IncludeHiddenCells", uno::Any(bIncludeHiddenCells));
}
catch (const beans::UnknownPropertyException&)
@@ -800,9 +817,9 @@ void SAL_CALL ChartModel::attachNumberFormatsSupplier( const uno::Reference< uti
{
{
MutexGuard aGuard( m_aModelMutex );
- if( xNewSupplier==m_xNumberFormatsSupplier )
+ if( xNewSupplier == m_xNumberFormatsSupplier )
return;
- if( xNewSupplier==m_xOwnNumberFormatsSupplier )
+ if( xNewSupplier == uno::Reference<XNumberFormatsSupplier>(m_xOwnNumberFormatsSupplier) )
return;
if( m_xOwnNumberFormatsSupplier.is() && xNewSupplier.is() )
{
@@ -838,10 +855,10 @@ void SAL_CALL ChartModel::setArguments( const Sequence< beans::PropertyValue >&
Reference< chart2::data::XDataSource > xDataSource( m_xDataProvider->createDataSource( aArguments ) );
if( xDataSource.is() )
{
- Reference< chart2::XDiagram > xDia( getFirstDiagram() );
+ rtl::Reference< Diagram > xDia = getFirstChartDiagram();
if( !xDia.is() )
{
- Reference< chart2::XChartTypeTemplate > xTemplate( impl_createDefaultChartTypeTemplate() );
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate( impl_createDefaultChartTypeTemplate() );
if( xTemplate.is())
setFirstDiagram( xTemplate->createDiagramByDataSource( xDataSource, aArguments ) );
}
@@ -864,22 +881,18 @@ void SAL_CALL ChartModel::setArguments( const Sequence< beans::PropertyValue >&
Sequence< OUString > SAL_CALL ChartModel::getUsedRangeRepresentations()
{
- return DataSourceHelper::getUsedDataRanges( Reference< frame::XModel >(this));
+ return DataSourceHelper::getUsedDataRanges( this );
}
Reference< chart2::data::XDataSource > SAL_CALL ChartModel::getUsedData()
{
- return DataSourceHelper::getUsedData( Reference< chart2::XChartDocument >(this));
+ return DataSourceHelper::getUsedData( *this );
}
Reference< chart2::data::XRangeHighlighter > SAL_CALL ChartModel::getRangeHighlighter()
{
if( ! m_xRangeHighlighter.is())
- {
- uno::Reference< view::XSelectionSupplier > xSelSupp( getCurrentController(), uno::UNO_QUERY );
- if( xSelSupp.is() )
- m_xRangeHighlighter.set( ChartModelHelper::createRangeHighlighter( xSelSupp ));
- }
+ m_xRangeHighlighter = new RangeHighlighter( this );
return m_xRangeHighlighter;
}
@@ -890,12 +903,11 @@ Reference<awt::XRequestCallback> SAL_CALL ChartModel::getPopupRequest()
return m_xPopupRequest;
}
-Reference< chart2::XChartTypeTemplate > ChartModel::impl_createDefaultChartTypeTemplate()
+rtl::Reference< ::chart::ChartTypeTemplate > ChartModel::impl_createDefaultChartTypeTemplate()
{
- Reference< chart2::XChartTypeTemplate > xTemplate;
- Reference< lang::XMultiServiceFactory > xFact( m_xChartTypeManager, uno::UNO_QUERY );
- if( xFact.is() )
- xTemplate.set( xFact->createInstance( "com.sun.star.chart2.template.Column" ), uno::UNO_QUERY );
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate;
+ if( m_xChartTypeManager.is() )
+ xTemplate = m_xChartTypeManager->createTemplate( "com.sun.star.chart2.template.Column" );
return xTemplate;
}
@@ -903,7 +915,8 @@ void SAL_CALL ChartModel::setChartTypeManager( const uno::Reference< chart2::XCh
{
{
MutexGuard aGuard( m_aModelMutex );
- m_xChartTypeManager = xNewManager;
+ m_xChartTypeManager = dynamic_cast<::chart::ChartTypeManager*>(xNewManager.get());
+ assert(!xNewManager || m_xChartTypeManager);
}
setModified( true );
}
@@ -932,7 +945,20 @@ uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject()
return m_xTitle;
}
-void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >& xTitle )
+rtl::Reference< Title > ChartModel::getTitleObject2() const
+{
+ MutexGuard aGuard( m_aModelMutex );
+ return m_xTitle;
+}
+
+void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >& xNewTitle )
+{
+ rtl::Reference<Title> xTitle = dynamic_cast<Title*>(xNewTitle.get());
+ assert(!xNewTitle || xTitle);
+ setTitleObject(xTitle);
+}
+
+void ChartModel::setTitleObject( const rtl::Reference< Title >& xTitle )
{
{
MutexGuard aGuard( m_aModelMutex );
@@ -1080,13 +1106,9 @@ uno::Any SAL_CALL ChartModel::getTransferData( const datatransfer::DataFlavor& a
Sequence< datatransfer::DataFlavor > SAL_CALL ChartModel::getTransferDataFlavors()
{
- uno::Sequence< datatransfer::DataFlavor > aRet(1);
-
- aRet[0] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMETypeHighContrast,
+ return { datatransfer::DataFlavor( lcl_aGDIMetaFileMIMETypeHighContrast,
"GDIMetaFile",
- cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );
-
- return aRet;
+ cppu::UnoType<uno::Sequence< sal_Int8 >>::get() ) };
}
sal_Bool SAL_CALL ChartModel::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
@@ -1147,7 +1169,7 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString
}
break;
case SERVICE_NAMESPACE_MAP:
- return Reference< uno::XInterface >( m_xXMLNamespaceMap );
+ return static_cast<cppu::OWeakObject*>(m_xXMLNamespaceMap.get());
}
}
else if(rServiceSpecifier == CHART_VIEW_SERVICE_NAME)
@@ -1215,7 +1237,7 @@ Reference< util::XNumberFormatsSupplier > const & ChartModel::getNumberFormatsSu
// ____ XUnoTunnel ___
::sal_Int64 SAL_CALL ChartModel::getSomething( const Sequence< ::sal_Int8 >& aIdentifier )
{
- if( isUnoTunnelId<SvNumberFormatsSupplierObj>(aIdentifier) )
+ if( comphelper::isUnoTunnelId<SvNumberFormatsSupplierObj>(aIdentifier) )
{
Reference< lang::XUnoTunnel > xTunnel( getNumberFormatsSupplier(), uno::UNO_QUERY );
if( xTunnel.is() )
@@ -1256,8 +1278,7 @@ void SAL_CALL ChartModel::setParent( const Reference< uno::XInterface >& Parent
// ____ XDataSource ____
uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ChartModel::getDataSequences()
{
- Reference< chart2::data::XDataSource > xSource(
- DataSourceHelper::getUsedData( uno::Reference< frame::XModel >(this) ) );
+ rtl::Reference< DataSource > xSource = DataSourceHelper::getUsedData( *this );
if( xSource.is())
return xSource->getDataSequences();
@@ -1265,12 +1286,17 @@ uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ChartM
}
//XDumper
-OUString SAL_CALL ChartModel::dump()
+OUString SAL_CALL ChartModel::dump(OUString const & kind)
{
+ if (kind.isEmpty()) {
+ return comphelper::dumpXmlToString([this](auto writer) { return dumpAsXml(writer); });
+ }
+
+ // kind == "shapes":
uno::Reference< qa::XDumper > xDumper(
createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
if (xDumper.is())
- return xDumper->dump();
+ return xDumper->dump(kind);
return OUString();
}
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index b3dd7a7cfeeb..8d9e6076078a 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -22,10 +22,15 @@
#include <MediaDescriptorHelper.hxx>
#include <ChartViewHelper.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartTypeManager.hxx>
+#include <ChartTypeTemplate.hxx>
#include <DataSourceHelper.hxx>
#include <AxisHelper.hxx>
#include <ThreeDHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <Legend.hxx>
+#include <XMLFilter.hxx>
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -41,8 +46,6 @@
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/io/TempFile.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/ucb/CommandFailedException.hpp>
#include <com/sun/star/ucb/ContentCreationException.hpp>
@@ -50,13 +53,16 @@
#include <ucbhelper/content.hxx>
#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/tempfile.hxx>
+#include <utility>
#include <vcl/cvtgrf.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
+#include <sfx2/objsh.hxx>
#include <algorithm>
@@ -68,19 +74,6 @@ using ::osl::MutexGuard;
namespace
{
-struct lcl_PropNameEquals
-{
- explicit lcl_PropNameEquals( const OUString & rStrToCompareWith ) :
- m_aStr( rStrToCompareWith )
- {}
- bool operator() ( const beans::PropertyValue & rProp )
- {
- return rProp.Name == m_aStr;
- }
-private:
- OUString m_aStr;
-};
-
template< typename T >
T lcl_getProperty(
const Sequence< beans::PropertyValue > & rMediaDescriptor,
@@ -89,10 +82,9 @@ T lcl_getProperty(
T aResult;
if( rMediaDescriptor.hasElements())
{
- const beans::PropertyValue * pIt = rMediaDescriptor.getConstArray();
- const beans::PropertyValue * pEndIt = pIt + + rMediaDescriptor.getLength();
- pIt = std::find_if( pIt, pEndIt, lcl_PropNameEquals( rPropName ));
- if( pIt != pEndIt )
+ auto pIt = std::find_if(rMediaDescriptor.begin(), rMediaDescriptor.end(),
+ [&rPropName](auto& prop) { return prop.Name == rPropName; });
+ if (pIt != rMediaDescriptor.end())
(*pIt).Value >>= aResult;
}
return aResult;
@@ -103,7 +95,7 @@ void lcl_addStorageToMediaDescriptor(
const Reference< embed::XStorage > & xStorage )
{
rOutMD.realloc( rOutMD.getLength() + 1 );
- rOutMD[rOutMD.getLength() - 1] = beans::PropertyValue(
+ rOutMD.getArray()[rOutMD.getLength() - 1] = beans::PropertyValue(
"Storage", -1, uno::Any( xStorage ), beans::PropertyState_DIRECT_VALUE );
}
@@ -124,10 +116,9 @@ Reference< embed::XStorage > lcl_createStorage(
uno::UNO_QUERY );
Reference< lang::XSingleServiceFactory > xStorageFact( embed::StorageFactory::create( xContext ) );
- Sequence< uno::Any > aStorageArgs( 3 );
- aStorageArgs[0] <<= xStream;
- aStorageArgs[1] <<= embed::ElementModes::READWRITE;
- aStorageArgs[2] <<= rMediaDescriptor;
+ Sequence< uno::Any > aStorageArgs{ uno::Any(xStream),
+ uno::Any(embed::ElementModes::READWRITE),
+ uno::Any(rMediaDescriptor) };
xStorage.set(
xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW );
}
@@ -195,10 +186,7 @@ Reference< document::XFilter > ChartModel::impl_createFilter(
if( ! xFilter.is())
{
SAL_WARN("chart2", "No FilterName passed in MediaDescriptor" );
- xFilter.set(
- m_xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.comp.chart2.XMLFilter", m_xContext ),
- uno::UNO_QUERY_THROW );
+ xFilter = new XMLFilter(m_xContext);
}
return xFilter;
@@ -299,8 +287,7 @@ void SAL_CALL ChartModel::storeToURL(
{
if( m_xContext.is() && aMediaDescriptorHelper.ISSET_OutputStream )
{
- Reference< io::XStream > xStream(
- io::TempFile::create(m_xContext), uno::UNO_QUERY_THROW );
+ rtl::Reference< utl::TempFileFastService > xStream = new utl::TempFileFastService;
Reference< io::XInputStream > xInputStream( xStream->getInputStream());
Reference< embed::XStorage > xStorage(
@@ -309,8 +296,7 @@ void SAL_CALL ChartModel::storeToURL(
{
impl_store( aReducedMediaDescriptor, xStorage );
- Reference< io::XSeekable > xSeekable( xStream, uno::UNO_QUERY_THROW );
- xSeekable->seek( 0 );
+ xStream->seek( 0 );
::comphelper::OStorageHelper::CopyInputToOutput( xInputStream, aMediaDescriptorHelper.OutputStream );
}
}
@@ -362,7 +348,7 @@ void ChartModel::impl_store(
//notify parent data provider after saving thus the parent document can store
//the ranges for which a load and update of the chart will be necessary
Reference< beans::XPropertySet > xPropSet( m_xParent, uno::UNO_QUERY );
- if ( !(!hasInternalDataProvider() && xPropSet.is()) )
+ if ( hasInternalDataProvider() || !xPropSet.is() )
return;
apphelper::MediaDescriptorHelper aMDHelper(rMediaDescriptor);
@@ -384,7 +370,7 @@ void ChartModel::insertDefaultChart()
try
{
// create default chart
- Reference< chart2::XChartTypeTemplate > xTemplate( impl_createDefaultChartTypeTemplate() );
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate( impl_createDefaultChartTypeTemplate() );
if( xTemplate.is())
{
try
@@ -395,12 +381,11 @@ void ChartModel::insertDefaultChart()
bool bSupportsCategories = xTemplate->supportsCategories();
if( bSupportsCategories )
{
- aParam.realloc( 1 );
- aParam[0] = beans::PropertyValue( "HasCategories", -1, uno::Any( true ),
- beans::PropertyState_DIRECT_VALUE );
+ aParam = { beans::PropertyValue( "HasCategories", -1, uno::Any( true ),
+ beans::PropertyState_DIRECT_VALUE ) };
}
- Reference< chart2::XDiagram > xDiagram( xTemplate->createDiagramByDataSource( xDataSource, aParam ) );
+ rtl::Reference< Diagram > xDiagram( xTemplate->createDiagramByDataSource2( xDataSource, aParam ) );
setFirstDiagram( xDiagram );
@@ -410,30 +395,23 @@ void ChartModel::insertDefaultChart()
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
// create and attach legend
- Reference< chart2::XLegend > xLegend(
- m_xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.Legend", m_xContext ), uno::UNO_QUERY_THROW );
- Reference< beans::XPropertySet > xLegendProperties( xLegend, uno::UNO_QUERY );
- if( xLegendProperties.is() )
- {
- xLegendProperties->setPropertyValue( "FillStyle", uno::Any( drawing::FillStyle_NONE ));
- xLegendProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ));
- xLegendProperties->setPropertyValue( "LineColor", uno::Any( static_cast< sal_Int32 >( 0xb3b3b3 ) )); // gray30
- xLegendProperties->setPropertyValue( "FillColor", uno::Any( static_cast< sal_Int32 >( 0xe6e6e6 ) ) ); // gray10
+ rtl::Reference< Legend > xLegend = new Legend();
+ xLegend->setPropertyValue( "FillStyle", uno::Any( drawing::FillStyle_NONE ));
+ xLegend->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ));
+ xLegend->setPropertyValue( "LineColor", uno::Any( static_cast< sal_Int32 >( 0xb3b3b3 ) )); // gray30
+ xLegend->setPropertyValue( "FillColor", uno::Any( static_cast< sal_Int32 >( 0xe6e6e6 ) ) ); // gray10
- if( bIsRTL )
- xLegendProperties->setPropertyValue( "AnchorPosition", uno::Any( chart2::LegendPosition_LINE_START ));
- }
+ if( bIsRTL )
+ xLegend->setPropertyValue( "AnchorPosition", uno::Any( chart2::LegendPosition_LINE_START ));
if(xDiagram.is())
xDiagram->setLegend( xLegend );
// set simple 3D look
- Reference< beans::XPropertySet > xDiagramProperties( xDiagram, uno::UNO_QUERY );
- if( xDiagramProperties.is() )
+ if( xDiagram.is() )
{
- xDiagramProperties->setPropertyValue( "RightAngledAxes", uno::Any( true ));
- xDiagramProperties->setPropertyValue( "D3DScenePerspective", uno::Any( drawing::ProjectionMode_PARALLEL ));
- ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
+ xDiagram->setPropertyValue( "RightAngledAxes", uno::Any( true ));
+ xDiagram->setPropertyValue( "D3DScenePerspective", uno::Any( drawing::ProjectionMode_PARALLEL ));
+ xDiagram->setScheme( ThreeDLookScheme::ThreeDLookScheme_Realistic );
}
//set some new 'defaults' for wall and floor
@@ -509,10 +487,9 @@ void SAL_CALL ChartModel::load(
if( aMDHelper.ISSET_Stream )
{
// convert XStream to XStorage via the storage factory
- Sequence< uno::Any > aStorageArgs( 2 );
- aStorageArgs[0] <<= aMDHelper.Stream;
- // todo: check if stream is read-only
- aStorageArgs[1] <<= embed::ElementModes::READ; //WRITE | embed::ElementModes::NOCREATE);
+ Sequence< uno::Any > aStorageArgs{ uno::Any(aMDHelper.Stream),
+ // todo: check if stream is read-only
+ uno::Any(embed::ElementModes::READ) }; //WRITE | embed::ElementModes::NOCREATE);
xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ),
uno::UNO_QUERY_THROW );
@@ -521,9 +498,8 @@ void SAL_CALL ChartModel::load(
{
OSL_ASSERT( aMDHelper.ISSET_InputStream );
// convert XInputStream to XStorage via the storage factory
- Sequence< uno::Any > aStorageArgs( 2 );
- aStorageArgs[0] <<= aMDHelper.InputStream;
- aStorageArgs[1] <<= embed::ElementModes::READ;
+ Sequence< uno::Any > aStorageArgs{ uno::Any(aMDHelper.InputStream),
+ uno::Any(embed::ElementModes::READ) };
xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ),
uno::UNO_QUERY_THROW );
@@ -645,18 +621,11 @@ void ChartModel::impl_notifyModifiedListeners()
//always notify the view first!
ChartViewHelper::setViewToDirtyState( this );
- ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
- .getContainer( cppu::UnoType<util::XModifyListener>::get());
- if( pIC )
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ if( m_aLifeTimeManager.m_aModifyListeners.getLength(aGuard) )
{
lang::EventObject aEvent( static_cast< lang::XComponent*>(this) );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- uno::Reference< util::XModifyListener > xListener( aIt.next(), uno::UNO_QUERY );
- if( xListener.is() )
- xListener->modified( aEvent );
- }
+ m_aLifeTimeManager.m_aModifyListeners.notifyEach(aGuard, &util::XModifyListener::modified, aEvent);
}
}
@@ -668,6 +637,16 @@ sal_Bool SAL_CALL ChartModel::isModified()
void SAL_CALL ChartModel::setModified( sal_Bool bModified )
{
+ // tdf#141914: allow to set *unmodified* when parent does not allow to set modified
+ if (bModified)
+ {
+ // tdf#77007: honor parent's IsEnableSetModified
+ // Check it before LifeTimeGuard, to avoid deadlocking solar mutex and this guard
+ if (auto pParentShell = SfxObjectShell::GetShellFromComponent(getParent());
+ pParentShell && !pParentShell->IsEnableSetModified())
+ return;
+ }
+
apphelper::LifeTimeGuard aGuard(m_aLifeTimeManager);
if(!aGuard.startApiCall())//@todo ? is this a long lasting call??
return; //behave passive if already disposed or closed or throw exception @todo?
@@ -675,7 +654,8 @@ void SAL_CALL ChartModel::setModified( sal_Bool bModified )
if( m_nControllerLockCount > 0 )
{
- m_bUpdateNotificationsPending = true;
+ if (bModified)
+ m_bUpdateNotificationsPending = true; // Maybe !bModified should reset it?
return;//don't call listeners if controllers are locked
}
aGuard.clear();
@@ -691,8 +671,8 @@ void SAL_CALL ChartModel::addModifyListener(
if( m_aLifeTimeManager.impl_isDisposedOrClosed() )
return; //behave passive if already disposed or closed
- m_aLifeTimeManager.m_aListenerContainer.addInterface(
- cppu::UnoType<util::XModifyListener>::get(), xListener );
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aModifyListeners.addInterface( aGuard, xListener );
}
void SAL_CALL ChartModel::removeModifyListener(
@@ -701,8 +681,8 @@ void SAL_CALL ChartModel::removeModifyListener(
if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
return; //behave passive if already disposed or closed
- m_aLifeTimeManager.m_aListenerContainer.removeInterface(
- cppu::UnoType<util::XModifyListener>::get(), xListener );
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aModifyListeners.removeInterface( aGuard, xListener );
}
// util::XModifyListener
@@ -719,12 +699,11 @@ void SAL_CALL ChartModel::modified( const lang::EventObject& rEvenObject)
DataSourceHelper::createArguments("PivotChart", uno::Sequence<sal_Int32>(), true, true, true);
Reference<chart2::data::XDataSource> xDataSource(xDataProvider->createDataSource(aArguments));
- Reference<lang::XMultiServiceFactory> xFactory(getChartTypeManager(), uno::UNO_QUERY);
- Reference<chart2::XDiagram> xDiagram(getFirstDiagram());
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = getTypeManager();
+ rtl::Reference<Diagram> xDiagram(getFirstChartDiagram());
- DiagramHelper::tTemplateWithServiceName aTemplateAndService = DiagramHelper::getTemplateForDiagram(xDiagram, xFactory);
- css::uno::Reference<css::chart2::XChartTypeTemplate> xChartTypeTemplate(aTemplateAndService.first);
- xChartTypeTemplate->changeDiagramData(xDiagram, xDataSource, aArguments);
+ Diagram::tTemplateWithServiceName aTemplateAndService = xDiagram->getTemplate(xChartTypeManager);
+ aTemplateAndService.xChartTypeTemplate->changeDiagramData(xDiagram, xDataSource, aArguments);
}
catch (const uno::Exception &)
{
@@ -772,17 +751,14 @@ Reference< embed::XStorage > SAL_CALL ChartModel::getDocumentStorage()
void ChartModel::impl_notifyStorageChangeListeners()
{
- ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
- .getContainer( cppu::UnoType<document::XStorageChangeListener>::get());
- if( pIC )
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ if( m_aLifeTimeManager.m_aStorageChangeListeners.getLength(aGuard) )
{
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- uno::Reference< document::XStorageChangeListener > xListener( aIt.next(), uno::UNO_QUERY );
- if( xListener.is() )
- xListener->notifyStorageChange( static_cast< ::cppu::OWeakObject* >( this ), m_xStorage );
- }
+ m_aLifeTimeManager.m_aStorageChangeListeners.forEach(aGuard,
+ [this](const uno::Reference<document::XStorageChangeListener>& l)
+ {
+ l->notifyStorageChange( static_cast< ::cppu::OWeakObject* >( this ), m_xStorage );
+ });
}
}
@@ -791,8 +767,8 @@ void SAL_CALL ChartModel::addStorageChangeListener( const Reference< document::X
if( m_aLifeTimeManager.impl_isDisposedOrClosed() )
return; //behave passive if already disposed or closed
- m_aLifeTimeManager.m_aListenerContainer.addInterface(
- cppu::UnoType<document::XStorageChangeListener>::get(), xListener );
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aStorageChangeListeners.addInterface( aGuard, xListener );
}
void SAL_CALL ChartModel::removeStorageChangeListener( const Reference< document::XStorageChangeListener >& xListener )
@@ -800,8 +776,8 @@ void SAL_CALL ChartModel::removeStorageChangeListener( const Reference< document
if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
return; //behave passive if already disposed or closed
- m_aLifeTimeManager.m_aListenerContainer.removeInterface(
- cppu::UnoType<document::XStorageChangeListener>::get(), xListener );
+ std::unique_lock aGuard(m_aLifeTimeManager.m_aAccessMutex);
+ m_aLifeTimeManager.m_aStorageChangeListeners.removeInterface(aGuard, xListener );
}
} // namespace chart
diff --git a/chart2/source/model/main/DataPoint.cxx b/chart2/source/model/main/DataPoint.cxx
index 6e9f6d483ccc..d6c8a9e2ac3b 100644
--- a/chart2/source/model/main/DataPoint.cxx
+++ b/chart2/source/model/main/DataPoint.cxx
@@ -26,7 +26,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
@@ -39,45 +39,21 @@ using ::com::sun::star::beans::Property;
namespace
{
-struct StaticDataPointInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& StaticDataPointInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- ::chart::DataPointProperties::AddPropertiesToVector( aProperties );
- ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::DataPointProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-struct StaticDataPointInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticDataPointInfoHelper_Initializer >
-{
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticDataPointInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticDataPointInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticDataPointInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticDataPointInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -86,9 +62,8 @@ namespace chart
{
DataPoint::DataPoint( const uno::Reference< beans::XPropertySet > & rParentProperties ) :
- ::property::OPropertySet( m_aMutex ),
m_xParentProperties( rParentProperties ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_bNoParentPropAllowed( false )
{
SetNewValuesExplicitlyEvenIfTheyEqualDefault();
@@ -96,8 +71,8 @@ DataPoint::DataPoint( const uno::Reference< beans::XPropertySet > & rParentPrope
DataPoint::DataPoint( const DataPoint & rOther ) :
impl::DataPoint_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_bNoParentPropAllowed( true )
{
SetNewValuesExplicitlyEvenIfTheyEqualDefault();
@@ -165,17 +140,18 @@ void SAL_CALL DataPoint::setParent(
}
// ____ OPropertySet ____
-uno::Any DataPoint::GetDefaultValue( sal_Int32 nHandle ) const
+void DataPoint::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
// the value set at the data series is the default
uno::Reference< beans::XFastPropertySet > xFast( m_xParentProperties.get(), uno::UNO_QUERY );
if( !xFast.is())
{
OSL_ENSURE( m_bNoParentPropAllowed, "data point needs a parent property set to provide values correctly" );
- return uno::Any();
+ rAny.clear();
+ return;
}
- return xFast->getFastPropertyValue( nHandle );
+ rAny = xFast->getFastPropertyValue( nHandle );
}
void SAL_CALL DataPoint::setFastPropertyValue_NoBroadcast(
@@ -208,40 +184,26 @@ void SAL_CALL DataPoint::setFastPropertyValue_NoBroadcast(
::cppu::IPropertyArrayHelper & SAL_CALL DataPoint::getInfoHelper()
{
- return *StaticDataPointInfoHelper::get();
+ return StaticDataPointInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL DataPoint::getPropertySetInfo()
{
- return *StaticDataPointInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticDataPointInfoHelper() ) );
+ return xPropertySetInfo;
}
// ____ XModifyBroadcaster ____
void SAL_CALL DataPoint::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL DataPoint::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
diff --git a/chart2/source/model/main/DataPoint.hxx b/chart2/source/model/main/DataPoint.hxx
index de3e5020387c..ba94449fff94 100644
--- a/chart2/source/model/main/DataPoint.hxx
+++ b/chart2/source/model/main/DataPoint.hxx
@@ -16,20 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINT_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINT_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
+#include <ModifyListenerHelper.hxx>
namespace chart
{
@@ -46,7 +43,6 @@ typedef ::cppu::WeakImplHelper<
}
class DataPoint final :
- public MutexContainer,
public impl::DataPoint_Base,
public ::property::OPropertySet
{
@@ -65,7 +61,7 @@ private:
explicit DataPoint( const DataPoint & rOther );
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
virtual void SAL_CALL setFastPropertyValue_NoBroadcast
( sal_Int32 nHandle,
@@ -104,13 +100,10 @@ private:
css::uno::WeakReference< css::beans::XPropertySet > m_xParentProperties;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
bool m_bNoParentPropAllowed;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINT_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
index 7bc20bbc30e6..c27407c98fca 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -26,14 +26,18 @@
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
#include <com/sun/star/drawing/RectanglePoint.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/RelativeSize.hpp>
#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
+#include <tools/color.hxx>
+
using namespace ::com::sun::star;
using ::com::sun::star::beans::Property;
@@ -220,6 +224,12 @@ void DataPointProperties::AddPropertiesToVector(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID );
+ rOutProperties.emplace_back( "LineCap",
+ ::chart::LinePropertiesHelper::PROP_LINE_CAP,
+ cppu::UnoType<drawing::LineCap>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
+
// FillProperties
// bitmap properties
rOutProperties.emplace_back( "FillBitmapOffsetX",
@@ -438,13 +448,18 @@ void DataPointProperties::AddPropertiesToVector(
cppu::UnoType<chart2::RelativePosition>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID );
+
+ rOutProperties.emplace_back("CustomLabelSize", PROP_DATAPOINT_LABEL_CUSTOM_SIZE,
+ cppu::UnoType<chart2::RelativeSize>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID);
}
void DataPointProperties::AddDefaultsToMap(
::chart::tPropertyValueMap & rOutMap )
{
- PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATAPOINT_COLOR, 0x0099ccff ); // blue 8
- PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_TRANSPARENCY, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_COLOR, Color(0x99, 0xcc, 0xff) ); // blue 8
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_TRANSPARENCY, sal_Int16(0) );
//fill
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_FILL_STYLE, drawing::FillStyle_SOLID );
@@ -455,28 +470,29 @@ void DataPointProperties::AddDefaultsToMap(
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_FILL_BACKGROUND, false );
//border
- PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATAPOINT_BORDER_COLOR, 0x000000 ); // black
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_COLOR, COL_BLACK );
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_STYLE, drawing::LineStyle_SOLID ); // drawing::LineStyle_NONE
- PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATAPOINT_BORDER_WIDTH, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_WIDTH, sal_Int32(0) );
PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_DASH_NAME );
- PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_BORDER_TRANSPARENCY, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_TRANSPARENCY, sal_Int16(0) );
//line
PropertyHelper::setPropertyValueDefault( rOutMap, LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_SOLID );
- PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, LinePropertiesHelper::PROP_LINE_WIDTH, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, LinePropertiesHelper::PROP_LINE_WIDTH, sal_Int32(0) );
PropertyHelper::setPropertyValueDefault( rOutMap, LinePropertiesHelper::PROP_LINE_DASH, drawing::LineDash());
PropertyHelper::setEmptyPropertyValueDefault( rOutMap, LinePropertiesHelper::PROP_LINE_DASH_NAME );
+ PropertyHelper::setPropertyValueDefault( rOutMap, LinePropertiesHelper::PROP_LINE_CAP, drawing::LineCap_BUTT);
//fill bitmap
- PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 );
- PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, 0 );
- PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 0 );
- PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, sal_Int16(0) );
+ PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, sal_Int16(0) );
+ PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, sal_Int16(0) );
+ PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, sal_Int16(0) );
PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE );
PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, true );
- PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, 0 );
- PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, sal_Int32(0) );
+ PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, sal_Int32(0) );
PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_MODE, drawing::BitmapMode_REPEAT );
//others
@@ -484,19 +500,19 @@ void DataPointProperties::AddDefaultsToMap(
aSymbProp.Style = chart2::SymbolStyle_NONE;
aSymbProp.StandardSymbol = 0;
aSymbProp.Size = awt::Size( 250, 250 ); // ca. 7pt x 7pt (7pt=246.94)
- aSymbProp.BorderColor = 0x000000; // Black
+ aSymbProp.BorderColor = sal_Int32(COL_BLACK);
aSymbProp.FillColor = 0xee4000; // OrangeRed2
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_SYMBOL_PROP, aSymbProp );
- PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_DATAPOINT_OFFSET, 0.0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_OFFSET, 0.0 );
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_GEOMETRY3D, chart2::DataPointGeometry3D::CUBOID );
//@todo maybe choose a different one here -> should be dynamically that of the attached axis
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_ERROR_BAR_X, uno::Reference< beans::XPropertySet >());
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_ERROR_BAR_Y, uno::Reference< beans::XPropertySet >());
- PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_PERCENT_DIAGONAL, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_PERCENT_DIAGONAL, sal_Int16(0) );
- PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_DATAPOINT_TEXT_ROTATION, 0.0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_TEXT_ROTATION, 0.0 );
PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE, true);
@@ -507,21 +523,23 @@ void DataPointProperties::AddDefaultsToMap(
false, // ShowNumber
false, // ShowNumberInPercent
false, // ShowCategoryName
- false // ShowLegendSymbol
+ false, // ShowLegendSymbol
+ false, // ShowCustomLabel
+ false // ShowSeriesName
));
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_TEXT_WORD_WRAP, false );
- PropertyHelper::setPropertyValueDefault< OUString >( rOutMap, PROP_DATAPOINT_LABEL_SEPARATOR, " " );
- PropertyHelper::setPropertyValueDefault<sal_Int32>(rOutMap, PROP_DATAPOINT_LABEL_BORDER_STYLE, sal_Int32(drawing::LineStyle_NONE));
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_LABEL_SEPARATOR, OUString(" ") );
+ PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_STYLE, drawing::LineStyle_NONE);
PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_COLOR);
PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_FILL_STYLE);
PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_FILL_COLOR);
PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_FILL_BACKGROUND);
PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_FILL_HATCH_NAME);
- PropertyHelper::setPropertyValueDefault<sal_Int32>(rOutMap, PROP_DATAPOINT_LABEL_BORDER_WIDTH, 0);
+ PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_WIDTH, sal_Int32(0));
PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_DASH, drawing::LineDash());
PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_DASH_NAME);
- PropertyHelper::setPropertyValueDefault<sal_Int16>(rOutMap, PROP_DATAPOINT_LABEL_BORDER_TRANS, 0);
+ PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_TRANS, sal_Int16(0));
uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields(0);
PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_CUSTOM_LABEL_FIELDS, aFields);
diff --git a/chart2/source/model/main/DataPointProperties.hxx b/chart2/source/model/main/DataPointProperties.hxx
index 1998c4e20369..1689322148d8 100644
--- a/chart2/source/model/main/DataPointProperties.hxx
+++ b/chart2/source/model/main/DataPointProperties.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINTPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINTPROPERTIES_HXX
+#pragma once
#include <PropertyHelper.hxx>
#include <FastPropertyIdRanges.hxx>
@@ -88,7 +87,8 @@ namespace DataPointProperties
PROP_DATAPOINT_LABEL_BORDER_DASH_NAME,
PROP_DATAPOINT_LABEL_BORDER_TRANS,
PROP_DATAPOINT_CUSTOM_LABEL_FIELDS,
- PROP_DATAPOINT_LABEL_CUSTOM_POS
+ PROP_DATAPOINT_LABEL_CUSTOM_POS,
+ PROP_DATAPOINT_LABEL_CUSTOM_SIZE
// additionally some properties from ::chart::LineProperties
};
@@ -101,7 +101,4 @@ namespace DataPointProperties
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_DATAPOINTPROPERTIES_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 5c0ded40cda7..38f2c474b47a 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -18,19 +18,22 @@
*/
#include <DataSeries.hxx>
-#include "DataSeriesProperties.hxx"
+#include <DataSeriesProperties.hxx>
#include "DataPointProperties.hxx"
#include <CharacterProperties.hxx>
#include <UserDefinedProperties.hxx>
#include "DataPoint.hxx"
#include <DataSeriesHelper.hxx>
#include <CloneHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <ModifyListenerHelper.hxx>
-#include <EventListenerHelper.hxx>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/ustrbuf.hxx>
#include <algorithm>
@@ -43,46 +46,43 @@ using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Reference;
using ::osl::MutexGuard;
-namespace
+namespace chart
{
-
-struct StaticDataSeriesDefaults : public rtl::StaticWithInit< ::chart::tPropertyValueMap, StaticDataSeriesDefaults >
+const ::chart::tPropertyValueMap & StaticDataSeriesDefaults()
{
- ::chart::tPropertyValueMap operator()()
- {
- ::chart::tPropertyValueMap aStaticDefaults;
- ::chart::DataSeriesProperties::AddDefaultsToMap( aStaticDefaults );
- ::chart::CharacterProperties::AddDefaultsToMap( aStaticDefaults );
- float fDefaultCharHeight = 10.0;
- ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
- return aStaticDefaults;
- }
+ static const ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aMap;
+ ::chart::DataSeriesProperties::AddDefaultsToMap( aMap );
+ ::chart::CharacterProperties::AddDefaultsToMap( aMap );
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue( aMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
+ return aMap;
+ }();
+ return aStaticDefaults;
};
+} // namespace chart
-struct StaticDataSeriesInfoHelper : public rtl::StaticWithInit< ::cppu::OPropertyArrayHelper, StaticDataSeriesInfoHelper, StaticDataSeriesInfoHelper, uno::Sequence< Property > >
+namespace
{
- uno::Sequence< Property > operator()()
- {
- std::vector< css::beans::Property > aProperties;
- ::chart::DataSeriesProperties::AddPropertiesToVector( aProperties );
- ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
+::cppu::OPropertyArrayHelper& StaticDataSeriesInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper oHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::DataSeriesProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
- return comphelper::containerToSequence( aProperties );
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticDataSeriesInfo : public rtl::StaticWithInit< uno::Reference< beans::XPropertySetInfo >, StaticDataSeriesInfo >
-{
- uno::Reference< beans::XPropertySetInfo > operator()()
- {
- return ::cppu::OPropertySetHelper::createPropertySetInfo(StaticDataSeriesInfoHelper::get() );
- }
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return oHelper;
};
void lcl_SetParent(
@@ -126,24 +126,22 @@ namespace chart
{
DataSeries::DataSeries() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
}
DataSeries::DataSeries( const DataSeries & rOther ) :
impl::DataSeries_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
if( ! rOther.m_aDataSequences.empty())
{
- CloneHelper::CloneRefVector<css::chart2::data::XLabeledDataSequence>(
- rOther.m_aDataSequences, m_aDataSequences );
+ CloneHelper::CloneRefVector(rOther.m_aDataSequences, m_aDataSequences );
ModifyListenerHelper::addListenerToAllElements( m_aDataSequences, m_xModifyEventForwarder );
}
- CloneHelper::CloneRefVector< chart2::XRegressionCurve >( rOther.m_aRegressionCurves, m_aRegressionCurves );
+ CloneHelper::CloneRefVector( rOther.m_aRegressionCurves, m_aRegressionCurves );
ModifyListenerHelper::addListenerToAllElements( m_aRegressionCurves, m_xModifyEventForwarder );
// add as listener to XPropertySet properties
@@ -164,9 +162,6 @@ DataSeries::DataSeries( const DataSeries & rOther ) :
// late initialization to call after copy-constructing
void DataSeries::Init( const DataSeries & rOther )
{
- if( ! rOther.m_aDataSequences.empty())
- EventListenerHelper::addListenerToAllElements( m_aDataSequences, this );
-
Reference< uno::XInterface > xThisInterface( static_cast< ::cppu::OWeakObject * >( this ));
if( ! rOther.m_aAttributedDataPoints.empty())
{
@@ -221,35 +216,36 @@ DataSeries::~DataSeries()
// ____ XCloneable ____
uno::Reference< util::XCloneable > SAL_CALL DataSeries::createClone()
{
- DataSeries * pNewSeries( new DataSeries( *this ));
- // hold a reference to the clone
- uno::Reference< util::XCloneable > xResult( pNewSeries );
+ rtl::Reference<DataSeries> pNewSeries( new DataSeries( *this ));
// do initialization that uses uno references to the clone
pNewSeries->Init( *this );
- return xResult;
+ return pNewSeries;
}
// ____ OPropertySet ____
-uno::Any DataSeries::GetDefaultValue( sal_Int32 nHandle ) const
+void DataSeries::GetDefaultValue( sal_Int32 nHandle, uno::Any& rDest ) const
{
- const tPropertyValueMap& rStaticDefaults = StaticDataSeriesDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticDataSeriesDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rDest.clear();
+ else
+ rDest = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL DataSeries::getInfoHelper()
{
- return StaticDataSeriesInfoHelper::get();
+ return StaticDataSeriesInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL DataSeries::getPropertySetInfo()
{
- return StaticDataSeriesInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropSetInfo =
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticDataSeriesInfoHelper() );
+ return xPropSetInfo;
}
void SAL_CALL DataSeries::getFastPropertyValue
@@ -300,13 +296,13 @@ Reference< beans::XPropertySet >
{
Reference< beans::XPropertySet > xResult;
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences;
{
MutexGuard aGuard( m_aMutex );
- aSequences = comphelper::containerToSequence( m_aDataSequences );
+ aSequences = m_aDataSequences;
}
- std::vector< Reference< chart2::data::XLabeledDataSequence > > aValuesSeries(
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aValuesSeries(
DataSeriesHelper::getAllDataSequencesByRole( aSequences , "values" ) );
if (aValuesSeries.empty())
@@ -388,18 +384,34 @@ void SAL_CALL DataSeries::setData( const uno::Sequence< Reference< chart2::data:
tDataSequenceContainer aOldDataSequences;
tDataSequenceContainer aNewDataSequences;
Reference< util::XModifyListener > xModifyEventForwarder;
- Reference< lang::XEventListener > xListener;
{
MutexGuard aGuard( m_aMutex );
xModifyEventForwarder = m_xModifyEventForwarder;
- xListener = this;
std::swap( aOldDataSequences, m_aDataSequences );
- aNewDataSequences = comphelper::sequenceToContainer<tDataSequenceContainer>( aData );
+ for (const auto & i : aData)
+ {
+ aNewDataSequences.push_back(i);
+ }
+ m_aDataSequences = aNewDataSequences;
+ }
+ ModifyListenerHelper::removeListenerFromAllElements( aOldDataSequences, xModifyEventForwarder );
+ ModifyListenerHelper::addListenerToAllElements( aNewDataSequences, xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+void DataSeries::setData( const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > >& aData )
+{
+ tDataSequenceContainer aOldDataSequences;
+ tDataSequenceContainer aNewDataSequences;
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ {
+ MutexGuard aGuard( m_aMutex );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ std::swap( aOldDataSequences, m_aDataSequences );
+ aNewDataSequences = aData;
m_aDataSequences = aNewDataSequences;
}
ModifyListenerHelper::removeListenerFromAllElements( aOldDataSequences, xModifyEventForwarder );
- EventListenerHelper::removeListenerFromAllElements( aOldDataSequences, xListener );
- EventListenerHelper::addListenerToAllElements( aNewDataSequences, xListener );
ModifyListenerHelper::addListenerToAllElements( aNewDataSequences, xModifyEventForwarder );
fireModifyEvent();
}
@@ -408,23 +420,25 @@ void SAL_CALL DataSeries::setData( const uno::Sequence< Reference< chart2::data:
Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL DataSeries::getDataSequences()
{
MutexGuard aGuard( m_aMutex );
- return comphelper::containerToSequence( m_aDataSequences );
+ return comphelper::containerToSequence<Reference< chart2::data::XLabeledDataSequence >>( m_aDataSequences );
}
// ____ XRegressionCurveContainer ____
void SAL_CALL DataSeries::addRegressionCurve(
const uno::Reference< chart2::XRegressionCurve >& xRegressionCurve )
{
+ auto pRegressionCurve = dynamic_cast<RegressionCurveModel*>(xRegressionCurve.get());
+ assert(pRegressionCurve);
Reference< util::XModifyListener > xModifyEventForwarder;
{
MutexGuard aGuard( m_aMutex );
xModifyEventForwarder = m_xModifyEventForwarder;
- if( std::find( m_aRegressionCurves.begin(), m_aRegressionCurves.end(), xRegressionCurve )
+ if( std::find( m_aRegressionCurves.begin(), m_aRegressionCurves.end(), pRegressionCurve )
!= m_aRegressionCurves.end())
- throw lang::IllegalArgumentException();
- m_aRegressionCurves.push_back( xRegressionCurve );
+ throw lang::IllegalArgumentException("curve not found", static_cast<cppu::OWeakObject*>(this), 1);
+ m_aRegressionCurves.push_back( pRegressionCurve );
}
- ModifyListenerHelper::addListener( xRegressionCurve, xModifyEventForwarder );
+ ModifyListenerHelper::addListener( rtl::Reference<RegressionCurveModel>(pRegressionCurve), xModifyEventForwarder );
fireModifyEvent();
}
@@ -433,13 +447,15 @@ void SAL_CALL DataSeries::removeRegressionCurve(
{
if( !xRegressionCurve.is() )
throw container::NoSuchElementException();
+ auto pRegressionCurve = dynamic_cast<RegressionCurveModel*>(xRegressionCurve.get());
+ assert(pRegressionCurve);
Reference< util::XModifyListener > xModifyEventForwarder;
{
MutexGuard aGuard( m_aMutex );
xModifyEventForwarder = m_xModifyEventForwarder;
tRegressionCurveContainerType::iterator aIt(
- std::find( m_aRegressionCurves.begin(), m_aRegressionCurves.end(), xRegressionCurve ) );
+ std::find( m_aRegressionCurves.begin(), m_aRegressionCurves.end(), pRegressionCurve ) );
if( aIt == m_aRegressionCurves.end())
throw container::NoSuchElementException(
"The given regression curve is no element of this series",
@@ -447,21 +463,27 @@ void SAL_CALL DataSeries::removeRegressionCurve(
m_aRegressionCurves.erase( aIt );
}
- ModifyListenerHelper::removeListener( xRegressionCurve, xModifyEventForwarder );
+ ModifyListenerHelper::removeListener( rtl::Reference<RegressionCurveModel>(pRegressionCurve), xModifyEventForwarder );
fireModifyEvent();
}
uno::Sequence< uno::Reference< chart2::XRegressionCurve > > SAL_CALL DataSeries::getRegressionCurves()
{
MutexGuard aGuard( m_aMutex );
- return comphelper::containerToSequence( m_aRegressionCurves );
+ return comphelper::containerToSequence<uno::Reference< chart2::XRegressionCurve >>( m_aRegressionCurves );
}
void SAL_CALL DataSeries::setRegressionCurves(
const Sequence< Reference< chart2::XRegressionCurve > >& aRegressionCurves )
{
tRegressionCurveContainerType aOldCurves;
- auto aNewCurves( comphelper::sequenceToContainer<tRegressionCurveContainerType>( aRegressionCurves ) );
+ tRegressionCurveContainerType aNewCurves;
+ for (const auto & i : aRegressionCurves)
+ {
+ auto pRegressionCurve = dynamic_cast<RegressionCurveModel*>(i.get());
+ assert(pRegressionCurve);
+ aNewCurves.push_back(pRegressionCurve);
+ }
Reference< util::XModifyListener > xModifyEventForwarder;
{
MutexGuard aGuard( m_aMutex );
@@ -477,28 +499,12 @@ void SAL_CALL DataSeries::setRegressionCurves(
// ____ XModifyBroadcaster ____
void SAL_CALL DataSeries::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL DataSeries::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
@@ -508,13 +514,8 @@ void SAL_CALL DataSeries::modified( const lang::EventObject& aEvent )
}
// ____ XEventListener (base of XModifyListener) ____
-void SAL_CALL DataSeries::disposing( const lang::EventObject& rEventObject )
+void SAL_CALL DataSeries::disposing( const lang::EventObject& )
{
- // forget disposed data sequences
- tDataSequenceContainer::iterator aIt(
- std::find( m_aDataSequences.begin(), m_aDataSequences.end(), rEventObject.Source ));
- if( aIt != m_aDataSequences.end())
- m_aDataSequences.erase( aIt );
}
// ____ OPropertySet ____
@@ -553,6 +554,173 @@ css::uno::Sequence< OUString > SAL_CALL DataSeries::getSupportedServiceNames()
"com.sun.star.beans.PropertySet" };
}
+static Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > > & rDataSequences )
+{
+ Reference< chart2::data::XLabeledDataSequence > xResult;
+
+ for( auto const & labeledData : rDataSequences )
+ {
+ OSL_ENSURE( labeledData.is(), "empty LabeledDataSequence" );
+ // no values are set but a label exists
+ if( labeledData.is() &&
+ ( ! labeledData->getValues().is() &&
+ labeledData->getLabel().is()))
+ {
+ xResult.set( labeledData );
+ break;
+ }
+ }
+
+ return xResult;
+}
+
+static OUString lcl_getDataSequenceLabel( const Reference< chart2::data::XDataSequence > & xSequence )
+{
+ OUString aResult;
+
+ Reference< chart2::data::XTextualDataSequence > xTextSeq( xSequence, uno::UNO_QUERY );
+ if( xTextSeq.is())
+ {
+ Sequence< OUString > aSeq( xTextSeq->getTextualData());
+
+ const sal_Int32 nMax = aSeq.getLength() - 1;
+ OUStringBuffer aBuf;
+
+ for( sal_Int32 i = 0; i <= nMax; ++i )
+ {
+ aBuf.append( aSeq[i] );
+ if( i < nMax )
+ aBuf.append( ' ');
+ }
+ aResult = aBuf.makeStringAndClear();
+ }
+ else if( xSequence.is())
+ {
+ Sequence< uno::Any > aSeq( xSequence->getData());
+
+ const sal_Int32 nMax = aSeq.getLength() - 1;
+ OUString aVal;
+ OUStringBuffer aBuf;
+ double fNum = 0;
+
+ for( sal_Int32 i = 0; i <= nMax; ++i )
+ {
+ if( aSeq[i] >>= aVal )
+ {
+ aBuf.append( aVal );
+ if( i < nMax )
+ aBuf.append( ' ');
+ }
+ else if( aSeq[ i ] >>= fNum )
+ {
+ aBuf.append( fNum );
+ if( i < nMax )
+ aBuf.append( ' ');
+ }
+ }
+ aResult = aBuf.makeStringAndClear();
+ }
+
+ return aResult;
+}
+
+static OUString getLabelForLabeledDataSequence(
+ const Reference< chart2::data::XLabeledDataSequence > & xLabeledSeq )
+{
+ OUString aResult;
+ if( xLabeledSeq.is())
+ {
+ Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel());
+ if( xSeq.is() )
+ aResult = lcl_getDataSequenceLabel( xSeq );
+ if( !xSeq.is() || aResult.isEmpty() )
+ {
+ // no label set or label content is empty -> use auto-generated one
+ Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() );
+ if( xValueSeq.is() )
+ {
+ Sequence< OUString > aLabels( xValueSeq->generateLabel(
+ chart2::data::LabelOrigin_SHORT_SIDE ) );
+ // no labels returned is interpreted as: auto-generation not
+ // supported by sequence
+ if( aLabels.hasElements() )
+ aResult=aLabels[0];
+ else
+ {
+ //todo?: maybe use the index of the series as name
+ //but as the index may change it would be better to have such a name persistent
+ //what is not possible at the moment
+ //--> maybe use the identifier as part of the name ...
+ aResult = lcl_getDataSequenceLabel( xValueSeq );
+ }
+ }
+ }
+ }
+ return aResult;
+}
+
+OUString DataSeries::getLabelForRole( const OUString & rLabelSequenceRole )
+{
+ OUString aResult;
+
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
+ ::chart::DataSeriesHelper::getDataSequenceByRole( this, rLabelSequenceRole ));
+ if( xLabeledSeq.is())
+ aResult = getLabelForLabeledDataSequence( xLabeledSeq );
+ else
+ {
+ // special case: labeled data series with only a label and no values may
+ // serve as label
+ xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( getDataSequences() ));
+ if( xLabeledSeq.is())
+ {
+ Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel());
+ if( xSeq.is())
+ aResult = lcl_getDataSequenceLabel( xSeq );
+ }
+ }
+
+ return aResult;
+}
+
+static bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
+{
+ if (!xDataSequence.is())
+ return false;
+ uno::Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ uno::Sequence< sal_Int32 > aHiddenValues;
+ try
+ {
+ xProp->getPropertyValue( "HiddenValues" ) >>= aHiddenValues;
+ if( !aHiddenValues.hasElements() )
+ return true;
+ }
+ catch( const uno::Exception& )
+ {
+ return true;
+ }
+ }
+ return xDataSequence->getData().hasElements();
+}
+
+bool DataSeries::hasUnhiddenData()
+{
+ MutexGuard aGuard( m_aMutex );
+
+ for(uno::Reference< chart2::data::XLabeledDataSequence > const & rDataSequence : m_aDataSequences)
+ {
+ if( !rDataSequence.is() )
+ continue;
+ if( lcl_SequenceHasUnhiddenData( rDataSequence->getValues() ) )
+ return true;
+ }
+ return false;
+}
+
+
} // namespace chart
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/chart2/source/model/main/DataSeriesProperties.cxx b/chart2/source/model/main/DataSeriesProperties.cxx
index 5d0cb777e151..e6d40feb5ab6 100644
--- a/chart2/source/model/main/DataSeriesProperties.cxx
+++ b/chart2/source/model/main/DataSeriesProperties.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "DataSeriesProperties.hxx"
+#include <DataSeriesProperties.hxx>
#include "DataPointProperties.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
@@ -69,6 +69,12 @@ void DataSeriesProperties::AddPropertiesToVector(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID );
+ rOutProperties.emplace_back( "ShowCustomLeaderLines",
+ PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES,
+ cppu::UnoType<sal_Bool>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
+
// add properties of service DataPointProperties
DataPointProperties::AddPropertiesToVector( rOutProperties );
}
@@ -78,8 +84,9 @@ void DataSeriesProperties::AddDefaultsToMap(
{
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_STACKING_DIRECTION, chart2::StackingDirection_NO_STACKING );
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_VARY_COLORS_BY_POINT, false );
- PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATASERIES_ATTACHED_AXIS_INDEX, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_ATTACHED_AXIS_INDEX, sal_Int32(0) );
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_SHOW_LEGEND_ENTRY, true );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, true );
// PROP_DATASERIES_ATTRIBUTED_DATA_POINTS has no default
diff --git a/chart2/source/model/main/DataTable.cxx b/chart2/source/model/main/DataTable.cxx
new file mode 100644
index 000000000000..6cec190615bd
--- /dev/null
+++ b/chart2/source/model/main/DataTable.cxx
@@ -0,0 +1,209 @@
+/* -*- 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 <DataTable.hxx>
+
+#include <LinePropertiesHelper.hxx>
+#include <FillProperties.hxx>
+#include <CharacterProperties.hxx>
+#include <ModifyListenerHelper.hxx>
+#include <PropertyHelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include <algorithm>
+
+using namespace css;
+
+namespace
+{
+/** DataTable Properties */
+enum
+{
+ DataTableProperty_HorizontalBorder,
+ DataTableProperty_VerticalBorder,
+ DataTableProperty_Outilne,
+ DataTableProperty_Keys,
+};
+
+void lcl_AddPropertiesToVector(std::vector<beans::Property>& rProps)
+{
+ auto const nBound = beans::PropertyAttribute::BOUND;
+ auto const nMaybeDefault = beans::PropertyAttribute::MAYBEDEFAULT;
+
+ rProps.emplace_back("HBorder", DataTableProperty_HorizontalBorder, cppu::UnoType<bool>::get(),
+ nBound | nMaybeDefault);
+ rProps.emplace_back("VBorder", DataTableProperty_VerticalBorder, cppu::UnoType<bool>::get(),
+ nBound | nMaybeDefault);
+ rProps.emplace_back("Outline", DataTableProperty_Outilne, cppu::UnoType<bool>::get(),
+ nBound | nMaybeDefault);
+ rProps.emplace_back("Keys", DataTableProperty_Keys, cppu::UnoType<bool>::get(),
+ nBound | nMaybeDefault);
+}
+
+const ::chart::tPropertyValueMap& StaticDataTableDefaults()
+{
+ static ::chart::tPropertyValueMap aStaticDefaults = []() {
+ ::chart::tPropertyValueMap aMap;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap(aMap);
+ ::chart::FillProperties::AddDefaultsToMap(aMap);
+ ::chart::CharacterProperties::AddDefaultsToMap(aMap);
+
+ ::chart::PropertyHelper::setPropertyValueDefault(aMap, DataTableProperty_HorizontalBorder,
+ false);
+ ::chart::PropertyHelper::setPropertyValueDefault(aMap, DataTableProperty_VerticalBorder,
+ false);
+ ::chart::PropertyHelper::setPropertyValueDefault(aMap, DataTableProperty_Outilne, false);
+ ::chart::PropertyHelper::setPropertyValueDefault(aMap, DataTableProperty_Keys, false);
+
+ ::chart::PropertyHelper::setPropertyValue(
+ aMap, ::chart::LinePropertiesHelper::PROP_LINE_WIDTH, uno::Any(sal_Int32(1)));
+
+ ::chart::PropertyHelper::setPropertyValueDefault(
+ aMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE);
+
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue(
+ aMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight);
+ ::chart::PropertyHelper::setPropertyValue(
+ aMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight);
+ ::chart::PropertyHelper::setPropertyValue(
+ aMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight);
+ return aMap;
+ }();
+ return aStaticDefaults;
+};
+
+cppu::OPropertyArrayHelper& StaticDataTableInfoHelper()
+{
+ static cppu::OPropertyArrayHelper aPropHelper = []() {
+ std::vector<beans::Property> aProperties;
+ lcl_AddPropertiesToVector(aProperties);
+ ::chart::LinePropertiesHelper::AddPropertiesToVector(aProperties);
+ ::chart::FillProperties::AddPropertiesToVector(aProperties);
+ ::chart::CharacterProperties::AddPropertiesToVector(aProperties);
+ std::sort(aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess());
+
+ return comphelper::containerToSequence(aProperties);
+ }();
+ return aPropHelper;
+};
+
+} // anonymous namespace
+
+namespace chart
+{
+DataTable::DataTable()
+ : m_xModifyEventForwarder(new ModifyEventForwarder())
+{
+}
+
+DataTable::DataTable(const DataTable& rOther)
+ : DataTable_Base(rOther)
+ , ::property::OPropertySet(rOther)
+ , m_xModifyEventForwarder(new ModifyEventForwarder())
+{
+}
+
+DataTable::~DataTable() = default;
+
+// ____ XCloneable ____
+uno::Reference<util::XCloneable> SAL_CALL DataTable::createClone()
+{
+ return uno::Reference<util::XCloneable>(new DataTable(*this));
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL DataTable::addModifyListener(const uno::Reference<util::XModifyListener>& aListener)
+{
+ m_xModifyEventForwarder->addModifyListener(aListener);
+}
+
+void SAL_CALL
+DataTable::removeModifyListener(const uno::Reference<util::XModifyListener>& aListener)
+{
+ m_xModifyEventForwarder->removeModifyListener(aListener);
+}
+
+// ____ XModifyListener ____
+void SAL_CALL DataTable::modified(const lang::EventObject& aEvent)
+{
+ m_xModifyEventForwarder->modified(aEvent);
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL DataTable::disposing(const lang::EventObject& /* Source */)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void DataTable::firePropertyChangeEvent()
+{
+ m_xModifyEventForwarder->modified(lang::EventObject(static_cast<uno::XWeak*>(this)));
+}
+
+// ____ OPropertySet ____
+void DataTable::GetDefaultValue(sal_Int32 nHandle, uno::Any& rAny) const
+{
+ const tPropertyValueMap& rStaticDefaults = StaticDataTableDefaults();
+ auto aFound = rStaticDefaults.find(nHandle);
+ if (aFound == rStaticDefaults.end())
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
+}
+
+::cppu::IPropertyArrayHelper& SAL_CALL DataTable::getInfoHelper()
+{
+ return StaticDataTableInfoHelper();
+}
+
+// ____ XPropertySet ____
+uno::Reference<beans::XPropertySetInfo> SAL_CALL DataTable::getPropertySetInfo()
+{
+ static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticDataTableInfoHelper()));
+ return xPropertySetInfo;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+OUString SAL_CALL DataTable::getImplementationName()
+{
+ return "com.sun.star.comp.chart2.DataTable";
+}
+
+sal_Bool SAL_CALL DataTable::supportsService(const OUString& rServiceName)
+{
+ return cppu::supportsService(this, rServiceName);
+}
+
+uno::Sequence<OUString> SAL_CALL DataTable::getSupportedServiceNames()
+{
+ return { "com.sun.star.chart2.DataTable", "com.sun.star.beans.PropertySet",
+ "com.sun.star.drawing.FillProperties", "com.sun.star.drawing.LineProperties",
+ "com.sun.star.style.CharacterProperties" };
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(DataTable, DataTable_Base, ::property::OPropertySet)
+IMPLEMENT_FORWARD_XTYPEPROVIDER2(DataTable, DataTable_Base, ::property::OPropertySet)
+
+} // namespace chart
+
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_comp_chart2_DataTable_get_implementation(
+ css::uno::XComponentContext* /*pComponentContext*/, uno::Sequence<uno::Any> const& /*rAny*/)
+{
+ return cppu::acquire(new ::chart::DataTable);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 0b9efc80f794..a963e2a25c07 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -18,7 +18,16 @@
*/
#include <Diagram.hxx>
+#include <AxisHelper.hxx>
+#include <BaseGFXHelper.hxx>
+#include <ChartTypeHelper.hxx>
+#include <ChartTypeManager.hxx>
+#include <ChartTypeTemplate.hxx>
+#include <ChartType.hxx>
+#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
+#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include "Wall.hxx"
#include <ModifyListenerHelper.hxx>
#include <UserDefinedProperties.hxx>
@@ -28,23 +37,39 @@
#include <CloneHelper.hxx>
#include <SceneProperties.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <Legend.hxx>
+#include <Axis.hxx>
+#include <DataTable.hxx>
+#include <servicenames_charttypes.hxx>
+#include <defines.hxx>
#include <basegfx/numeric/ftools.hxx>
-#include <rtl/instance.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
+#include <com/sun/star/chart2/StackingDirection.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/CloseVetoException.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/safeint.hxx>
+#include <rtl/math.hxx>
+#include <tools/helpers.hxx>
#include <algorithm>
+#include <utility>
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans::PropertyAttribute;
+using namespace ::chart::SceneProperties;
using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Sequence;
@@ -72,6 +97,7 @@ enum
PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
PROP_DIAGRAM_3DRELATIVEHEIGHT,
PROP_DIAGRAM_DATATABLEHBORDER,
+ PROP_DIAGRAM_OF_PIE_TYPE,
PROP_DIAGRAM_DATATABLEVBORDER,
PROP_DIAGRAM_DATATABLEOUTLINE,
PROP_DIAGRAM_EXTERNALDATA
@@ -158,67 +184,40 @@ void lcl_AddPropertiesToVector(
PROP_DIAGRAM_3DRELATIVEHEIGHT,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::MAYBEVOID );
- 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( "SubPieType",
+ PROP_DIAGRAM_OF_PIE_TYPE,
+ cppu::UnoType<chart2::PieChartSubType>::get(),
+ beans::PropertyAttribute::MAYBEVOID );
rOutProperties.emplace_back( "ExternalData",
PROP_DIAGRAM_EXTERNALDATA,
cppu::UnoType<OUString>::get(),
beans::PropertyAttribute::MAYBEVOID );
}
-struct StaticDiagramDefaults_Initializer
+const ::chart::tPropertyValueMap& StaticDiagramDefaults()
{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_CONNECT_BARS, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEHBORDER, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEVBORDER, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEOUTLINE, false );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 );
- ::chart::SceneProperties::AddDefaultsToMap( rOutMap );
- }
-};
-
-struct StaticDiagramDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticDiagramDefaults_Initializer >
-{
+ ::chart::tPropertyValueMap aMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_CONNECT_BARS, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 );
+ ::chart::PropertyHelper::setPropertyValueDefault< chart2::PieChartSubType >( aMap, PROP_DIAGRAM_OF_PIE_TYPE,
+ chart2::PieChartSubType_NONE);
+ ::chart::SceneProperties::AddDefaultsToMap( aMap );
+ return aMap;
+ }();
+ return aStaticDefaults;
};
-struct StaticDiagramInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& StaticDiagramInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
@@ -228,49 +227,28 @@ private:
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticDiagramInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticDiagramInfoHelper_Initializer >
-{
-};
-
-struct StaticDiagramInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticDiagramInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
+ return ::cppu::OPropertyArrayHelper( aProperties.data(), aProperties.size() );
+ }();
+ return aPropHelper;
};
-struct StaticDiagramInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticDiagramInfo_Initializer >
+const uno::Reference< beans::XPropertySetInfo >& StaticDiagramInfo()
{
+ static const uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticDiagramInfoHelper() ) );
+ return xPropertySetInfo;
};
-/// clones a UNO-sequence of UNO-References
-typedef Reference< chart2::XCoordinateSystem > lcl_tCooSysRef;
-typedef std::vector< lcl_tCooSysRef > lcl_tCooSysVector;
-
void lcl_CloneCoordinateSystems(
- const lcl_tCooSysVector & rSource,
- lcl_tCooSysVector & rDestination )
+ const ::chart::Diagram::tCoordinateSystemContainerType & rSource,
+ ::chart::Diagram::tCoordinateSystemContainerType & rDestination )
{
- for( auto const & i : rSource )
+ for( rtl::Reference< ::chart::BaseCoordinateSystem > const & i : rSource )
{
- lcl_tCooSysRef xClone;
- css::uno::Reference< css::util::XCloneable > xCloneable( i, css::uno::UNO_QUERY );
- if( xCloneable.is())
- xClone.set( xCloneable->createClone(), css::uno::UNO_QUERY );
-
- if( xClone.is())
- {
- rDestination.push_back( xClone );
- }
- else
- rDestination.push_back( i );
+ auto xClone = i->createClone();
+ ::chart::BaseCoordinateSystem* pClone = dynamic_cast<::chart::BaseCoordinateSystem*>(xClone.get());
+ assert(pClone);
+ rDestination.push_back( pClone );
}
}
@@ -279,36 +257,43 @@ void lcl_CloneCoordinateSystems(
namespace chart
{
-Diagram::Diagram( uno::Reference< uno::XComponentContext > const & xContext ) :
- ::property::OPropertySet( m_aMutex ),
- m_xContext( xContext ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+Diagram::Diagram( uno::Reference< uno::XComponentContext > xContext ) :
+ m_xContext(std::move( xContext )),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
// Set camera position to a default position (that should be set hard, so
// that it will be exported. The property default is a camera looking
// straight ono the scene). These defaults have been acquired from the old
// chart implementation.
setFastPropertyValue_NoBroadcast(
- SceneProperties::PROP_SCENE_CAMERA_GEOMETRY, uno::Any(
+ PROP_SCENE_CAMERA_GEOMETRY, uno::Any(
ThreeDHelper::getDefaultCameraGeometry()));
}
Diagram::Diagram( const Diagram & rOther ) :
impl::Diagram_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
+ ::property::OPropertySet( rOther ),
m_xContext( rOther.m_xContext ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
lcl_CloneCoordinateSystems( rOther.m_aCoordSystems, m_aCoordSystems );
- ModifyListenerHelper::addListenerToAllElements( m_aCoordSystems, m_xModifyEventForwarder );
+ for (auto & xSystem : m_aCoordSystems)
+ xSystem->addModifyListener(m_xModifyEventForwarder);
- m_xWall.set( CloneHelper::CreateRefClone< beans::XPropertySet >()( rOther.m_xWall ));
- m_xFloor.set( CloneHelper::CreateRefClone< beans::XPropertySet >()( rOther.m_xFloor ));
+ if ( rOther.m_xWall )
+ m_xWall = new Wall( *rOther.m_xWall );
+ if ( rOther.m_xFloor )
+ m_xFloor = new Wall( *rOther.m_xFloor );
m_xTitle.set( CloneHelper::CreateRefClone< chart2::XTitle >()( rOther.m_xTitle ));
- m_xLegend.set( CloneHelper::CreateRefClone< chart2::XLegend >()( rOther.m_xLegend ));
-
- ModifyListenerHelper::addListener( m_xWall, m_xModifyEventForwarder );
- ModifyListenerHelper::addListener( m_xFloor, m_xModifyEventForwarder );
+ if (rOther.m_xLegend)
+ m_xLegend = new Legend(*rOther.m_xLegend);
+ if (rOther.m_xDataTable)
+ m_xDataTable = new DataTable(*rOther.m_xDataTable);
+
+ if ( m_xWall )
+ m_xWall->addModifyListener( m_xModifyEventForwarder );
+ if ( m_xFloor )
+ m_xFloor->addModifyListener( m_xModifyEventForwarder );
ModifyListenerHelper::addListener( m_xTitle, m_xModifyEventForwarder );
ModifyListenerHelper::addListener( m_xLegend, m_xModifyEventForwarder );
}
@@ -317,10 +302,13 @@ Diagram::~Diagram()
{
try
{
- ModifyListenerHelper::removeListenerFromAllElements( m_aCoordSystems, m_xModifyEventForwarder );
+ for (auto & xSystem : m_aCoordSystems)
+ xSystem->removeModifyListener(m_xModifyEventForwarder);
- ModifyListenerHelper::removeListener( m_xWall, m_xModifyEventForwarder );
- ModifyListenerHelper::removeListener( m_xFloor, m_xModifyEventForwarder );
+ if ( m_xWall )
+ m_xWall->removeModifyListener( m_xModifyEventForwarder );
+ if ( m_xFloor )
+ m_xFloor->removeModifyListener( m_xModifyEventForwarder );
ModifyListenerHelper::removeListener( m_xTitle, m_xModifyEventForwarder );
ModifyListenerHelper::removeListener( m_xLegend, m_xModifyEventForwarder );
}
@@ -333,7 +321,7 @@ Diagram::~Diagram()
// ____ XDiagram ____
uno::Reference< beans::XPropertySet > SAL_CALL Diagram::getWall()
{
- uno::Reference< beans::XPropertySet > xRet;
+ rtl::Reference< Wall > xRet;
bool bAddListener = false;
{
MutexGuard aGuard( m_aMutex );
@@ -345,13 +333,13 @@ uno::Reference< beans::XPropertySet > SAL_CALL Diagram::getWall()
xRet = m_xWall;
}
if(bAddListener)
- ModifyListenerHelper::addListener( xRet, m_xModifyEventForwarder );
+ xRet->addModifyListener( m_xModifyEventForwarder );
return xRet;
}
uno::Reference< beans::XPropertySet > SAL_CALL Diagram::getFloor()
{
- uno::Reference< beans::XPropertySet > xRet;
+ rtl::Reference< Wall > xRet;
bool bAddListener = false;
{
MutexGuard aGuard( m_aMutex );
@@ -363,7 +351,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL Diagram::getFloor()
xRet = m_xFloor;
}
if(bAddListener)
- ModifyListenerHelper::addListener( xRet, m_xModifyEventForwarder );
+ xRet->addModifyListener( m_xModifyEventForwarder );
return xRet;
}
@@ -373,9 +361,22 @@ uno::Reference< chart2::XLegend > SAL_CALL Diagram::getLegend()
return m_xLegend;
}
+rtl::Reference< ::chart::Legend > Diagram::getLegend2() const
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_xLegend;
+}
+
void SAL_CALL Diagram::setLegend( const uno::Reference< chart2::XLegend >& xNewLegend )
{
- Reference< chart2::XLegend > xOldLegend;
+ auto pLegend = dynamic_cast<Legend*>(xNewLegend.get());
+ assert(!xNewLegend || pLegend);
+ setLegend(rtl::Reference< Legend >(pLegend));
+}
+
+void Diagram::setLegend( const rtl::Reference< Legend >& xNewLegend )
+{
+ rtl::Reference< Legend > xOldLegend;
{
MutexGuard aGuard( m_aMutex );
if( m_xLegend == xNewLegend )
@@ -420,15 +421,14 @@ void SAL_CALL Diagram::setDiagramData(
const Reference< chart2::data::XDataSource >& xDataSource,
const Sequence< beans::PropertyValue >& aArguments )
{
- uno::Reference< lang::XMultiServiceFactory > xChartTypeManager( m_xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.ChartTypeManager", m_xContext ), uno::UNO_QUERY );
- DiagramHelper::tTemplateWithServiceName aTemplateAndService = DiagramHelper::getTemplateForDiagram( this, xChartTypeManager );
- uno::Reference< chart2::XChartTypeTemplate > xTemplate( aTemplateAndService.first );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = new ::chart::ChartTypeManager( m_xContext );
+ Diagram::tTemplateWithServiceName aTemplateAndService = getTemplate( xChartTypeManager );
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate( aTemplateAndService.xChartTypeTemplate );
if( !xTemplate.is() )
- xTemplate.set( xChartTypeManager->createInstance( "com.sun.star.chart2.template.Column" ), uno::UNO_QUERY );
+ xTemplate = xChartTypeManager->createTemplate( "com.sun.star.chart2.template.Column" );
if(!xTemplate.is())
return;
- xTemplate->changeDiagramData( this, xDataSource, aArguments );
+ xTemplate->changeDiagramData( rtl::Reference< ::chart::Diagram >(this), xDataSource, aArguments );
}
// ____ XTitled ____
@@ -458,35 +458,138 @@ void SAL_CALL Diagram::setTitleObject( const uno::Reference< chart2::XTitle >& x
// ____ X3DDefaultSetter ____
void SAL_CALL Diagram::set3DSettingsToDefault()
{
- ThreeDHelper::set3DSettingsToDefault( this );
+ setPropertyToDefault( "D3DSceneDistance");
+ setPropertyToDefault( "D3DSceneFocalLength");
+ setDefaultRotation();
+ setDefaultIllumination();
}
void SAL_CALL Diagram::setDefaultRotation()
{
- ThreeDHelper::setDefaultRotation( this );
+ bool bPieOrDonut( isPieOrDonutChart() );
+ setDefaultRotation( bPieOrDonut );
+}
+
+static ::basegfx::B3DHomMatrix lcl_getCompleteRotationMatrix( Diagram& rDiagram )
+{
+ ::basegfx::B3DHomMatrix aCompleteRotation;
+ double fXAngleRad=0.0;
+ double fYAngleRad=0.0;
+ double fZAngleRad=0.0;
+ rDiagram.getRotationAngle( fXAngleRad, fYAngleRad, fZAngleRad );
+ aCompleteRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
+ return aCompleteRotation;
+}
+static void lcl_RotateLightSource( Diagram& rDiagram
+ , int nLightSourceDirectionProp
+ , int nLightSourceOnProp
+ , const ::basegfx::B3DHomMatrix& rRotationMatrix )
+{
+ bool bLightOn = false;
+ if( !(rDiagram.getFastPropertyValue( nLightSourceOnProp ) >>= bLightOn) )
+ return;
+
+ if( bLightOn )
+ {
+ drawing::Direction3D aLight;
+ if( rDiagram.getFastPropertyValue( nLightSourceDirectionProp ) >>= aLight )
+ {
+ ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aLight ) );
+ aLightVector = rRotationMatrix*aLightVector;
+
+ rDiagram.setFastPropertyValue( nLightSourceDirectionProp
+ , uno::Any( BaseGFXHelper::B3DVectorToDirection3D( aLightVector ) ) );
+ }
+ }
+}
+
+static void lcl_setLightsForScheme( Diagram& rDiagram, const ThreeDLookScheme& rScheme )
+{
+ if( rScheme == ThreeDLookScheme::ThreeDLookScheme_Unknown)
+ return;
+
+ // "D3DSceneLightOn2" / UNO_NAME_3D_SCENE_LIGHTON_2
+ rDiagram.setFastPropertyValue( PROP_SCENE_LIGHT_ON_2, uno::Any( true ) );
+
+ rtl::Reference< ChartType > xChartType( rDiagram.getChartTypeByIndex( 0 ) );
+ uno::Any aADirection( rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple
+ ? ChartTypeHelper::getDefaultSimpleLightDirection(xChartType)
+ : ChartTypeHelper::getDefaultRealisticLightDirection(xChartType) );
+
+ // "D3DSceneLightDirection2" / UNO_NAME_3D_SCENE_LIGHTDIRECTION_2
+ rDiagram.setFastPropertyValue( PROP_SCENE_LIGHT_DIRECTION_2, aADirection );
+ //rotate light direction when right angled axes are off but supported
+ {
+ bool bRightAngledAxes = false;
+ rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes"
+ if(!bRightAngledAxes)
+ {
+ if( ChartTypeHelper::isSupportingRightAngledAxes( xChartType ) )
+ {
+ ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( rDiagram ) );
+ BaseGFXHelper::ReduceToRotationMatrix( aRotation );
+ // "D3DSceneLightDirection2", "D3DSceneLightOn2"
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_2, PROP_SCENE_LIGHT_ON_2, aRotation );
+ }
+ }
+ }
+
+ sal_Int32 nColor = ::chart::ChartTypeHelper::getDefaultDirectLightColor(
+ rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple, xChartType);
+ // "D3DSceneLightColor2" / UNO_NAME_3D_SCENE_LIGHTCOLOR_2
+ rDiagram.setFastPropertyValue( PROP_SCENE_LIGHT_COLOR_2, uno::Any( nColor ) );
+
+ sal_Int32 nAmbientColor = ::chart::ChartTypeHelper::getDefaultAmbientLightColor(
+ rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple, xChartType);
+ // "D3DSceneAmbientColor" / UNO_NAME_3D_SCENE_AMBIENTCOLOR
+ rDiagram.setFastPropertyValue( PROP_SCENE_AMBIENT_COLOR, uno::Any( nAmbientColor ) );
}
void SAL_CALL Diagram::setDefaultIllumination()
{
- ThreeDHelper::setDefaultIllumination( this );
+ drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH );
+ try
+ {
+ // "D3DSceneShadeMode"
+ getFastPropertyValue( PROP_SCENE_SHADE_MODE )>>= aShadeMode;
+ // "D3DSceneLightOn1" / UNO_NAME_3D_SCENE_LIGHTON_1
+ setFastPropertyValue( PROP_SCENE_LIGHT_ON_1, uno::Any( false ) );
+ setFastPropertyValue( PROP_SCENE_LIGHT_ON_3, uno::Any( false ) );
+ setFastPropertyValue( PROP_SCENE_LIGHT_ON_4, uno::Any( false ) );
+ setFastPropertyValue( PROP_SCENE_LIGHT_ON_5, uno::Any( false ) );
+ setFastPropertyValue( PROP_SCENE_LIGHT_ON_6, uno::Any( false ) );
+ setFastPropertyValue( PROP_SCENE_LIGHT_ON_7, uno::Any( false ) );
+ setFastPropertyValue( PROP_SCENE_LIGHT_ON_8, uno::Any( false ) );
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ ThreeDLookScheme aScheme = (aShadeMode == drawing::ShadeMode_FLAT)
+ ? ThreeDLookScheme::ThreeDLookScheme_Simple
+ : ThreeDLookScheme::ThreeDLookScheme_Realistic;
+ lcl_setLightsForScheme( *this, aScheme );
}
// ____ XCoordinateSystemContainer ____
void SAL_CALL Diagram::addCoordinateSystem(
const uno::Reference< chart2::XCoordinateSystem >& aCoordSys )
{
+ ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordSys.get());
+ assert(pCoordSys);
{
MutexGuard aGuard( m_aMutex );
- if( std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), aCoordSys )
+ if( std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), pCoordSys )
!= m_aCoordSystems.end())
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException("coordsys not found", static_cast<cppu::OWeakObject*>(this), 1);
if( !m_aCoordSystems.empty() )
{
OSL_FAIL( "more than one coordinatesystem is not supported yet by the fileformat" );
return;
}
- m_aCoordSystems.push_back( aCoordSys );
+ m_aCoordSystems.push_back( pCoordSys );
}
ModifyListenerHelper::addListener( aCoordSys, m_xModifyEventForwarder );
fireModifyEvent();
@@ -495,10 +598,11 @@ void SAL_CALL Diagram::addCoordinateSystem(
void SAL_CALL Diagram::removeCoordinateSystem(
const uno::Reference< chart2::XCoordinateSystem >& aCoordSys )
{
+ ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordSys.get());
+ assert(pCoordSys);
{
MutexGuard aGuard( m_aMutex );
- std::vector< uno::Reference< chart2::XCoordinateSystem > >::iterator
- aIt( std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), aCoordSys ));
+ auto aIt = std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), pCoordSys );
if( aIt == m_aCoordSystems.end())
throw container::NoSuchElementException(
"The given coordinate-system is no element of the container",
@@ -512,7 +616,13 @@ void SAL_CALL Diagram::removeCoordinateSystem(
uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > SAL_CALL Diagram::getCoordinateSystems()
{
MutexGuard aGuard( m_aMutex );
- return comphelper::containerToSequence( m_aCoordSystems );
+ return comphelper::containerToSequence<uno::Reference< chart2::XCoordinateSystem >>( m_aCoordSystems );
+}
+
+Diagram::tCoordinateSystemContainerType Diagram::getBaseCoordinateSystems() const
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_aCoordSystems;
}
void SAL_CALL Diagram::setCoordinateSystems(
@@ -523,6 +633,30 @@ void SAL_CALL Diagram::setCoordinateSystems(
if( aCoordinateSystems.hasElements() )
{
OSL_ENSURE( aCoordinateSystems.getLength()<=1, "more than one coordinatesystem is not supported yet by the fileformat" );
+ ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordinateSystems[0].get());
+ assert(pCoordSys);
+ aNew.push_back( pCoordSys );
+ }
+ {
+ MutexGuard aGuard( m_aMutex );
+ std::swap( aOld, m_aCoordSystems );
+ m_aCoordSystems = aNew;
+ }
+ for (auto & xSystem : aOld)
+ xSystem->removeModifyListener(m_xModifyEventForwarder);
+ for (auto & xSystem : aNew)
+ xSystem->addModifyListener(m_xModifyEventForwarder);
+ fireModifyEvent();
+}
+
+void Diagram::setCoordinateSystems(
+ const std::vector< rtl::Reference< BaseCoordinateSystem > >& aCoordinateSystems )
+{
+ tCoordinateSystemContainerType aNew;
+ tCoordinateSystemContainerType aOld;
+ if( !aCoordinateSystems.empty() )
+ {
+ OSL_ENSURE( aCoordinateSystems.size()<=1, "more than one coordinatesystem is not supported yet by the fileformat" );
aNew.push_back( aCoordinateSystems[0] );
}
{
@@ -530,8 +664,10 @@ void SAL_CALL Diagram::setCoordinateSystems(
std::swap( aOld, m_aCoordSystems );
m_aCoordSystems = aNew;
}
- ModifyListenerHelper::removeListenerFromAllElements( aOld, m_xModifyEventForwarder );
- ModifyListenerHelper::addListenerToAllElements( aNew, m_xModifyEventForwarder );
+ for (auto & xSystem : aOld)
+ xSystem->removeModifyListener(m_xModifyEventForwarder);
+ for (auto & xSystem : aNew)
+ xSystem->addModifyListener(m_xModifyEventForwarder);
fireModifyEvent();
}
@@ -545,28 +681,12 @@ Reference< util::XCloneable > SAL_CALL Diagram::createClone()
// ____ XModifyBroadcaster ____
void SAL_CALL Diagram::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL Diagram::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
@@ -593,36 +713,37 @@ void Diagram::fireModifyEvent()
}
// ____ OPropertySet ____
-uno::Any Diagram::GetDefaultValue( sal_Int32 nHandle ) const
+void Diagram::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticDiagramDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticDiagramDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL Diagram::getInfoHelper()
{
- return *StaticDiagramInfoHelper::get();
+ return StaticDiagramInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL Diagram::getPropertySetInfo()
{
- return *StaticDiagramInfo::get();
+ return StaticDiagramInfo();
}
// ____ XFastPropertySet ____
-void SAL_CALL Diagram::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue )
+void SAL_CALL Diagram::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue )
{
//special treatment for some 3D properties
if( nHandle == PROP_DIAGRAM_PERSPECTIVE )
{
sal_Int32 fPerspective = 20;
if( rValue >>=fPerspective )
- ThreeDHelper::setCameraDistance( this, ThreeDHelper::PerspectiveToCameraDistance( fPerspective ) );
+ setCameraDistance( ThreeDHelper::PerspectiveToCameraDistance( fPerspective ) );
}
else if( nHandle == PROP_DIAGRAM_ROTATION_HORIZONTAL
|| nHandle == PROP_DIAGRAM_ROTATION_VERTICAL )
@@ -631,16 +752,16 @@ void SAL_CALL Diagram::setFastPropertyValue( sal_Int32 nHandle, const Any& rValu
if( rValue >>=nNewAngleDegree )
{
sal_Int32 nHorizontal, nVertical;
- ThreeDHelper::getRotationFromDiagram( this, nHorizontal, nVertical );
+ getRotation( nHorizontal, nVertical );
if( nHandle == PROP_DIAGRAM_ROTATION_HORIZONTAL )
nHorizontal = nNewAngleDegree;
else
nVertical = nNewAngleDegree;
- ThreeDHelper::setRotationToDiagram( this, nHorizontal, nVertical );
+ setRotation( nHorizontal, nVertical );
}
}
else
- ::property::OPropertySet::setFastPropertyValue( nHandle, rValue );
+ ::property::OPropertySet::setFastPropertyValue_NoBroadcast( nHandle, rValue );
}
void SAL_CALL Diagram::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
@@ -649,14 +770,14 @@ void SAL_CALL Diagram::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) co
if( nHandle == PROP_DIAGRAM_PERSPECTIVE )
{
sal_Int32 nPerspective = ::basegfx::fround( ThreeDHelper::CameraDistanceToPerspective(
- ThreeDHelper::getCameraDistance( const_cast< Diagram* >( this ) ) ) );
+ const_cast< Diagram* >( this )->getCameraDistance() ) );
rValue <<= nPerspective;
}
else if( nHandle == PROP_DIAGRAM_ROTATION_HORIZONTAL
|| nHandle == PROP_DIAGRAM_ROTATION_VERTICAL )
{
sal_Int32 nHorizontal, nVertical;
- ThreeDHelper::getRotationFromDiagram( const_cast< Diagram* >( this ), nHorizontal, nVertical );
+ const_cast< Diagram* >( this )->getRotation( nHorizontal, nVertical );
sal_Int32 nAngleDegree = 0;
if( nHandle == PROP_DIAGRAM_ROTATION_HORIZONTAL )
nAngleDegree = nHorizontal;
@@ -668,6 +789,42 @@ void SAL_CALL Diagram::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) co
::property::OPropertySet::getFastPropertyValue( rValue,nHandle );
}
+uno::Reference<chart2::XDataTable> SAL_CALL Diagram::getDataTable()
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_xDataTable;
+}
+
+rtl::Reference<::chart::DataTable> Diagram::getDataTableRef() const
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_xDataTable;
+}
+
+void SAL_CALL Diagram::setDataTable(const uno::Reference<chart2::XDataTable>& xDataTable)
+{
+ auto* pDataTable = dynamic_cast<DataTable*>(xDataTable.get());
+ assert(!xDataTable || pDataTable);
+ setDataTable(rtl::Reference<DataTable>(pDataTable));
+}
+
+void Diagram::setDataTable(const rtl::Reference<DataTable>& xNewDataTable)
+{
+ rtl::Reference<DataTable> xOldDataTable;
+ {
+ MutexGuard aGuard(m_aMutex);
+ if (m_xDataTable == xNewDataTable)
+ return;
+ xOldDataTable = m_xDataTable;
+ m_xDataTable = xNewDataTable;
+ }
+ if (xOldDataTable.is())
+ ModifyListenerHelper::removeListener(xOldDataTable, m_xModifyEventForwarder);
+ if (xNewDataTable.is())
+ ModifyListenerHelper::addListener(xNewDataTable, m_xModifyEventForwarder);
+ fireModifyEvent();
+}
+
using impl::Diagram_Base;
IMPLEMENT_FORWARD_XINTERFACE2( Diagram, Diagram_Base, ::property::OPropertySet )
@@ -692,6 +849,1440 @@ css::uno::Sequence< OUString > SAL_CALL Diagram::getSupportedServiceNames()
"com.sun.star.beans.PropertySet" };
}
+DiagramPositioningMode Diagram::getDiagramPositioningMode()
+{
+ DiagramPositioningMode eMode = DiagramPositioningMode::Auto;
+ chart2::RelativePosition aRelPos;
+ chart2::RelativeSize aRelSize;
+ if( (getFastPropertyValue(PROP_DIAGRAM_REL_POS) >>= aRelPos ) &&
+ (getFastPropertyValue(PROP_DIAGRAM_REL_SIZE) >>= aRelSize ) )
+ {
+ bool bPosSizeExcludeAxes=false;
+ getFastPropertyValue(PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS) >>= bPosSizeExcludeAxes;
+ if( bPosSizeExcludeAxes )
+ eMode = DiagramPositioningMode::Excluding;
+ else
+ eMode = DiagramPositioningMode::Including;
+ }
+ return eMode;
+}
+
+
+sal_Int32 Diagram::getCorrectedMissingValueTreatment(
+ const rtl::Reference< ChartType >& xChartType )
+{
+ sal_Int32 nResult = css::chart::MissingValueTreatment::LEAVE_GAP;
+ const uno::Sequence < sal_Int32 > aAvailableMissingValueTreatments(
+ ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) );
+
+ if( getFastPropertyValue( PROP_DIAGRAM_MISSING_VALUE_TREATMENT ) >>= nResult )
+ {
+ //ensure that the set value is supported by this charttype
+ for( sal_Int32 n : aAvailableMissingValueTreatments )
+ if( n == nResult )
+ return nResult; //ok
+ }
+
+ //otherwise use the first supported one
+ if( aAvailableMissingValueTreatments.hasElements() )
+ {
+ nResult = aAvailableMissingValueTreatments[0];
+ return nResult;
+ }
+
+ return nResult;
+}
+
+void Diagram::setGeometry3D( sal_Int32 nNewGeometry )
+{
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ getDataSeries();
+
+ for (auto const& series : aSeriesVec)
+ {
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(
+ series, "Geometry3D", uno::Any( nNewGeometry ));
+ }
+}
+
+sal_Int32 Diagram::getGeometry3D( bool& rbFound, bool& rbAmbiguous )
+{
+ sal_Int32 nCommonGeom( css::chart2::DataPointGeometry3D::CUBOID );
+ rbFound = false;
+ rbAmbiguous = false;
+
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec = getDataSeries();
+
+ if( aSeriesVec.empty())
+ rbAmbiguous = true;
+
+ for (auto const& series : aSeriesVec)
+ {
+ try
+ {
+ sal_Int32 nGeom = 0;
+ if( series->getPropertyValue( "Geometry3D") >>= nGeom )
+ {
+ if( ! rbFound )
+ {
+ // first series
+ nCommonGeom = nGeom;
+ rbFound = true;
+ }
+ // further series: compare for uniqueness
+ else if( nCommonGeom != nGeom )
+ {
+ rbAmbiguous = true;
+ break;
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+
+ return nCommonGeom;
+}
+
+bool Diagram::isPieOrDonutChart()
+{
+ rtl::Reference< ChartType > xChartType = getChartTypeByIndex( 0 );
+
+ if( xChartType .is() )
+ {
+ OUString aChartType = xChartType->getChartType();
+ if( aChartType == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
+ return true;
+ }
+ return false;
+}
+
+bool Diagram::isSupportingFloorAndWall()
+{
+ //pies and donuts currently do not support this because of wrong files from older versions
+ //todo: allow this in future again, if fileversion is available for OLE objects (metastream)
+ //thus the wrong bottom can be removed on import
+
+ const std::vector< rtl::Reference< ChartType > > aTypes = getChartTypes();
+ for( rtl::Reference< ChartType > const & xType : aTypes )
+ {
+ OUString sChartType = xType->getChartType();
+ if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return false;
+ if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ return false;
+ if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return false;
+ }
+ return true;
+}
+
+ /**
+ * This method implements the logic of checking if a series can be moved
+ * forward/backward. Depending on the "bDoMove" parameter the series will
+ * be moved (bDoMove = true) or the function just will test if the
+ * series can be moved without doing the move (bDoMove = false).
+ *
+ * @param xDiagram
+ * Reference to the diagram that contains the series.
+ *
+ * @param xGivenDataSeries
+ * Reference to the series that should moved or tested for moving.
+ *
+ * @param bForward
+ * Direction in which the series should be moved or tested for moving.
+ *
+ * @param bDoMove
+ * Should this function really move the series (true) or just test if it is
+ * possible (false).
+ *
+ *
+ * @returns
+ * in case of bDoMove == true
+ * - True : if the move was done
+ * - False : the move failed
+ * in case of bDoMove == false
+ * - True : the series can be moved
+ * - False : the series can not be moved
+ *
+ */
+static bool lcl_moveSeriesOrCheckIfMoveIsAllowed(
+ Diagram& rDiagram,
+ const rtl::Reference< DataSeries >& xGivenDataSeries,
+ bool bForward,
+ bool bDoMove )
+{
+ bool bMovedOrMoveAllowed = false;
+
+ try
+ {
+ if( !xGivenDataSeries.is() )
+ return false;
+
+ //find position of series.
+ bool bFound = false;
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysList( rDiagram.getBaseCoordinateSystems() );
+
+ for( std::size_t nCS = 0; !bFound && nCS < aCooSysList.size(); ++nCS )
+ {
+ const rtl::Reference< BaseCoordinateSystem > & xCooSys( aCooSysList[nCS] );
+
+ //iterate through all chart types in the current coordinate system
+ std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() );
+ rtl::Reference< ChartType > xFormerChartType;
+
+ for( std::size_t nT = 0; !bFound && nT < aChartTypeList.size(); ++nT )
+ {
+ rtl::Reference< ChartType > xCurrentChartType( aChartTypeList[nT] );
+
+ //iterate through all series in this chart type
+
+ std::vector< rtl::Reference< DataSeries > > aSeriesList = xCurrentChartType->getDataSeries2();
+
+ for( std::size_t nS = 0; !bFound && nS < aSeriesList.size(); ++nS )
+ {
+
+ // We found the series we are interested in!
+ if( xGivenDataSeries==aSeriesList[nS] )
+ {
+ std::size_t nOldSeriesIndex = nS;
+ bFound = true;
+
+ try
+ {
+ sal_Int32 nNewSeriesIndex = nS;
+
+ // tdf#34517 Bringing forward means increasing, backwards means decreasing series position
+ if( !bForward )
+ nNewSeriesIndex--;
+ else
+ nNewSeriesIndex++;
+
+ if( nNewSeriesIndex >= 0 && o3tl::make_unsigned(nNewSeriesIndex) < aSeriesList.size() )
+ {
+ //move series in the same charttype
+ bMovedOrMoveAllowed = true;
+ if( bDoMove )
+ {
+ aSeriesList[ nOldSeriesIndex ] = aSeriesList[ nNewSeriesIndex ];
+ aSeriesList[ nNewSeriesIndex ] = xGivenDataSeries;
+ xCurrentChartType->setDataSeries( aSeriesList );
+ }
+ }
+ else if( nNewSeriesIndex<0 )
+ {
+ //exchange series with former charttype
+ if( xFormerChartType.is() && DiagramHelper::areChartTypesCompatible( xFormerChartType, xCurrentChartType ) )
+ {
+ bMovedOrMoveAllowed = true;
+ if( bDoMove )
+ {
+ std::vector< rtl::Reference< DataSeries > > aOtherSeriesList = xFormerChartType->getDataSeries2();
+ sal_Int32 nOtherSeriesIndex = aOtherSeriesList.size()-1;
+ if( nOtherSeriesIndex >= 0 && o3tl::make_unsigned(nOtherSeriesIndex) < aOtherSeriesList.size() )
+ {
+ rtl::Reference< DataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
+ aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
+ xFormerChartType->setDataSeries(aOtherSeriesList);
+
+ aSeriesList[nOldSeriesIndex] = std::move(xExchangeSeries);
+ xCurrentChartType->setDataSeries(aSeriesList);
+ }
+ }
+ }
+ }
+ else if( nT+1 < aChartTypeList.size() )
+ {
+ //exchange series with next charttype
+ rtl::Reference< ChartType > xOtherChartType( aChartTypeList[nT+1] );
+ if( xOtherChartType.is() && DiagramHelper::areChartTypesCompatible( xOtherChartType, xCurrentChartType ) )
+ {
+ bMovedOrMoveAllowed = true;
+ if( bDoMove )
+ {
+ std::vector< rtl::Reference< DataSeries > > aOtherSeriesList = xOtherChartType->getDataSeries2();
+ if( !aOtherSeriesList.empty() )
+ {
+ rtl::Reference<DataSeries> xExchangeSeries(aOtherSeriesList[0]);
+ aOtherSeriesList[0] = xGivenDataSeries;
+ xOtherChartType->setDataSeries(aOtherSeriesList);
+
+ aSeriesList[nOldSeriesIndex] = std::move(xExchangeSeries);
+ xCurrentChartType->setDataSeries(aSeriesList);
+ }
+ }
+ }
+ }
+ }
+ catch( const util::CloseVetoException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ }
+ }
+ xFormerChartType = xCurrentChartType;
+ }
+ }
+ }
+ catch( const util::CloseVetoException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ return bMovedOrMoveAllowed;
+}
+
+bool Diagram::isSeriesMoveable(
+ const rtl::Reference< DataSeries >& xGivenDataSeries,
+ bool bForward )
+{
+ const bool bDoMove = false;
+
+ bool bIsMoveable = lcl_moveSeriesOrCheckIfMoveIsAllowed(
+ *this, xGivenDataSeries, bForward, bDoMove );
+
+ return bIsMoveable;
+}
+
+bool Diagram::moveSeries( const rtl::Reference< DataSeries >& xGivenDataSeries, bool bForward )
+{
+ const bool bDoMove = true;
+
+ bool bMoved = lcl_moveSeriesOrCheckIfMoveIsAllowed(
+ *this, xGivenDataSeries, bForward, bDoMove );
+
+ return bMoved;
+}
+
+std::vector< rtl::Reference< ChartType > > Diagram::getChartTypes()
+{
+ std::vector< rtl::Reference< ChartType > > aResult;
+ try
+ {
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : getBaseCoordinateSystems() )
+ {
+ const std::vector< rtl::Reference< ChartType > > & aChartTypeSeq( coords->getChartTypes2());
+ aResult.insert( aResult.end(), aChartTypeSeq.begin(), aChartTypeSeq.end() );
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ return aResult;
+}
+
+rtl::Reference< ChartType > Diagram::getChartTypeByIndex( sal_Int32 nIndex )
+{
+ rtl::Reference< ChartType > xChartType;
+
+ //iterate through all coordinate systems
+ sal_Int32 nTypesSoFar = 0;
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : getBaseCoordinateSystems() )
+ {
+ const std::vector< rtl::Reference< ChartType > > & aChartTypeList( coords->getChartTypes2() );
+ if( nIndex >= 0 && o3tl::make_unsigned(nIndex) < nTypesSoFar + aChartTypeList.size() )
+ {
+ xChartType = aChartTypeList[nIndex - nTypesSoFar];
+ break;
+ }
+ nTypesSoFar += aChartTypeList.size();
+ }
+
+ return xChartType;
+}
+
+bool Diagram::isSupportingDateAxis()
+{
+ return ::chart::ChartTypeHelper::isSupportingDateAxis( getChartTypeByIndex( 0 ), 0 );
+}
+
+static std::vector< rtl::Reference< Axis > > lcl_getAxisHoldingCategoriesFromDiagram(
+ Diagram& rDiagram )
+{
+ std::vector< rtl::Reference< Axis > > aRet;
+
+ // return first x-axis as fall-back
+ rtl::Reference< Axis > xFallBack;
+ try
+ {
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : rDiagram.getBaseCoordinateSystems() )
+ {
+ OSL_ASSERT( xCooSys.is());
+ for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
+ {
+ const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
+ for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
+ {
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( nN,nI );
+ OSL_ASSERT( xAxis.is());
+ if( xAxis.is())
+ {
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ if( aScaleData.Categories.is() || (aScaleData.AxisType == chart2::AxisType::CATEGORY) )
+ {
+ aRet.push_back(xAxis);
+ }
+ if( (nN == 0) && !xFallBack.is())
+ xFallBack = xAxis;
+ }
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2" );
+ }
+
+ if( aRet.empty() )
+ aRet.push_back(xFallBack);
+
+ return aRet;
+}
+
+uno::Reference< chart2::data::XLabeledDataSequence > Diagram::getCategories()
+{
+ uno::Reference< chart2::data::XLabeledDataSequence > xResult;
+
+ try
+ {
+ std::vector< rtl::Reference< Axis > > aCatAxes(
+ lcl_getAxisHoldingCategoriesFromDiagram( *this ));
+ //search for first categories
+ if (aCatAxes.empty())
+ return xResult;
+
+ rtl::Reference< Axis > xCatAxis(aCatAxes[0]);
+ if( !xCatAxis.is())
+ return xResult;
+
+ chart2::ScaleData aScaleData( xCatAxis->getScaleData());
+ if( !aScaleData.Categories.is() )
+ return xResult;
+
+ xResult = aScaleData.Categories;
+ uno::Reference<beans::XPropertySet> xProp(xResult->getValues(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ xProp->setPropertyValue( "Role", uno::Any( OUString("categories") ) );
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ return xResult;
+}
+
+void Diagram::setCategories(
+ const uno::Reference< chart2::data::XLabeledDataSequence >& xCategories,
+ bool bSetAxisType /* = false */,
+ bool bCategoryAxis /* = true */ )
+{
+ std::vector< rtl::Reference< Axis > > aCatAxes(
+ lcl_getAxisHoldingCategoriesFromDiagram( *this ));
+
+ for (const rtl::Reference< Axis >& xCatAxis : aCatAxes)
+ {
+ if( xCatAxis.is())
+ {
+ chart2::ScaleData aScaleData( xCatAxis->getScaleData());
+ aScaleData.Categories = xCategories;
+ if( bSetAxisType )
+ {
+ if( bCategoryAxis )
+ aScaleData.AxisType = chart2::AxisType::CATEGORY;
+ else if( aScaleData.AxisType == chart2::AxisType::CATEGORY || aScaleData.AxisType == chart2::AxisType::DATE )
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+ }
+ xCatAxis->setScaleData( aScaleData );
+ }
+ }
+}
+
+bool Diagram::isCategory()
+{
+ try
+ {
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : getBaseCoordinateSystems() )
+ {
+ for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
+ {
+ const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
+ for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
+ {
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( nN,nI );
+ OSL_ASSERT( xAxis.is());
+ if( xAxis.is())
+ {
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ if( aScaleData.AxisType == chart2::AxisType::CATEGORY || aScaleData.AxisType == chart2::AxisType::DATE )
+ return true;
+ }
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ return false;
+}
+
+std::vector< std::vector< rtl::Reference< DataSeries > > >
+Diagram::getDataSeriesGroups()
+{
+ std::vector< std::vector< rtl::Reference< DataSeries > > > aResult;
+
+ //iterate through all coordinate systems
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : getBaseCoordinateSystems() )
+ {
+ //iterate through all chart types in the current coordinate system
+ for( rtl::Reference< ChartType > const & chartType : coords->getChartTypes2() )
+ {
+ aResult.push_back( chartType->getDataSeries2() );
+ }
+ }
+ return aResult;
+}
+
+std::vector< rtl::Reference< ::chart::DataSeries > >
+ Diagram::getDataSeries()
+{
+ std::vector< rtl::Reference< DataSeries > > aResult;
+ try
+ {
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : getBaseCoordinateSystems() )
+ {
+ for( rtl::Reference< ChartType> const & chartType : coords->getChartTypes2() )
+ {
+ const std::vector< rtl::Reference< DataSeries > > aSeriesSeq( chartType->getDataSeries2() );
+ aResult.insert( aResult.end(), aSeriesSeq.begin(), aSeriesSeq.end() );
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ return aResult;
+}
+
+rtl::Reference< ChartType > Diagram::getChartTypeOfSeries(
+ const rtl::Reference< DataSeries >& xGivenDataSeries )
+{
+ if( !xGivenDataSeries.is() )
+ return nullptr;
+
+ //iterate through the model to find the given xSeries
+ //the found parent indicates the charttype
+
+ //iterate through all coordinate systems
+
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : getBaseCoordinateSystems() )
+ {
+ //iterate through all chart types in the current coordinate system
+ const std::vector< rtl::Reference< ChartType > > & aChartTypeList( xCooSys->getChartTypes2() );
+ for( rtl::Reference< ChartType > const & xChartType : aChartTypeList )
+ {
+ //iterate through all series in this chart type
+ for( rtl::Reference< DataSeries > const & dataSeries : xChartType->getDataSeries2() )
+ {
+ if( xGivenDataSeries==dataSeries )
+ return xChartType;
+ }
+ }
+ }
+ return nullptr;
+}
+
+rtl::Reference< Axis > Diagram::getAttachedAxis(
+ const rtl::Reference< DataSeries >& xSeries )
+{
+ return AxisHelper::getAxis( 1, DiagramHelper::isSeriesAttachedToMainAxis( xSeries ), this );
+}
+
+bool Diagram::attachSeriesToAxis( bool bAttachToMainAxis
+ , const rtl::Reference< DataSeries >& xDataSeries
+ , const uno::Reference< uno::XComponentContext > & xContext
+ , bool bAdaptAxes )
+{
+ bool bChanged = false;
+
+ //set property at axis
+
+ sal_Int32 nNewAxisIndex = bAttachToMainAxis ? 0 : 1;
+ sal_Int32 nOldAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
+ rtl::Reference< Axis > xOldAxis = getAttachedAxis( xDataSeries );
+
+ if( nOldAxisIndex != nNewAxisIndex )
+ {
+ try
+ {
+ xDataSeries->setPropertyValue( "AttachedAxisIndex", uno::Any( nNewAxisIndex ) );
+ bChanged = true;
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+
+ if( bChanged )
+ {
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( 1, bAttachToMainAxis, this );
+ if(!xAxis.is()) //create an axis if necessary
+ xAxis = AxisHelper::createAxis( 1, bAttachToMainAxis, this, xContext );
+ if( bAdaptAxes )
+ {
+ AxisHelper::makeAxisVisible( xAxis );
+ AxisHelper::hideAxisIfNoDataIsAttached( xOldAxis, this );
+ }
+ }
+
+ return bChanged;
+}
+
+void Diagram::replaceCoordinateSystem(
+ const rtl::Reference< BaseCoordinateSystem > & xCooSysToReplace,
+ const rtl::Reference< BaseCoordinateSystem > & xReplacement )
+{
+ // update the coordinate-system container
+ try
+ {
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories = getCategories();
+
+ // move chart types of xCooSysToReplace to xReplacement
+ xReplacement->setChartTypes( xCooSysToReplace->getChartTypes());
+
+ removeCoordinateSystem( xCooSysToReplace );
+ addCoordinateSystem( xReplacement );
+
+ if( xCategories.is() )
+ setCategories( xCategories );
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+}
+
+sal_Int32 Diagram::getDimension()
+{
+ // -1: not yet set
+ sal_Int32 nResult = -1;
+
+ try
+ {
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : getBaseCoordinateSystems() )
+ {
+ if(xCooSys.is())
+ {
+ nResult = xCooSys->getDimension();
+ break;
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ return nResult;
+}
+
+void Diagram::setDimension( sal_Int32 nNewDimensionCount )
+{
+ if( getDimension() == nNewDimensionCount )
+ return;
+
+ try
+ {
+ bool rbFound = false;
+ bool rbAmbiguous = true;
+ StackMode eStackMode = getStackMode( rbFound, rbAmbiguous );
+ bool bIsSupportingOnlyDeepStackingFor3D=false;
+
+ //change all coordinate systems:
+ auto aCoordSystems = getBaseCoordinateSystems();
+ for( rtl::Reference<BaseCoordinateSystem> const & xOldCooSys : aCoordSystems )
+ {
+ rtl::Reference< BaseCoordinateSystem > xNewCooSys;
+
+ const std::vector< rtl::Reference< ChartType > > aChartTypeList( xOldCooSys->getChartTypes2() );
+ for( rtl::Reference< ChartType > const & xChartType : aChartTypeList )
+ {
+ bIsSupportingOnlyDeepStackingFor3D = ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( xChartType );
+ if(!xNewCooSys.is())
+ {
+ xNewCooSys = dynamic_cast<BaseCoordinateSystem*>(xChartType->createCoordinateSystem( nNewDimensionCount ).get());
+ assert(xNewCooSys);
+ break;
+ }
+ //@todo make sure that all following charttypes are also capable of the new dimension
+ //otherwise separate them in a different group
+ //BM: might be done in replaceCoordinateSystem()
+ }
+
+ // replace the old coordinate system at all places where it was used
+ replaceCoordinateSystem( xOldCooSys, xNewCooSys );
+ }
+
+ //correct stack mode if necessary
+ if( nNewDimensionCount==3 && eStackMode != StackMode::ZStacked && bIsSupportingOnlyDeepStackingFor3D )
+ setStackMode( StackMode::ZStacked );
+ else if( nNewDimensionCount==2 && eStackMode == StackMode::ZStacked )
+ setStackMode( StackMode::NONE );
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+}
+
+void Diagram::setStackMode( StackMode eStackMode )
+{
+ try
+ {
+ bool bValueFound = false;
+ bool bIsAmbiguous = false;
+ StackMode eOldStackMode = getStackMode( bValueFound, bIsAmbiguous );
+
+ if( eStackMode == eOldStackMode && !bIsAmbiguous )
+ return;
+
+ chart2::StackingDirection eNewDirection = chart2::StackingDirection_NO_STACKING;
+ if( eStackMode == StackMode::YStacked || eStackMode == StackMode::YStackedPercent )
+ eNewDirection = chart2::StackingDirection_Y_STACKING;
+ else if( eStackMode == StackMode::ZStacked )
+ eNewDirection = chart2::StackingDirection_Z_STACKING;
+
+ uno::Any aNewDirection( eNewDirection );
+
+ bool bPercent = false;
+ if( eStackMode == StackMode::YStackedPercent )
+ bPercent = true;
+
+ //iterate through all coordinate systems
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : getBaseCoordinateSystems() )
+ {
+ //set correct percent stacking
+ const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(1);
+ for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
+ {
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( 1,nI );
+ if( xAxis.is())
+ {
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ if( (aScaleData.AxisType==chart2::AxisType::PERCENT) != bPercent )
+ {
+ if( bPercent )
+ aScaleData.AxisType = chart2::AxisType::PERCENT;
+ else
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+ xAxis->setScaleData( aScaleData );
+ }
+ }
+ }
+ //iterate through all chart types in the current coordinate system
+ const std::vector< rtl::Reference< ChartType > > & aChartTypeList( xCooSys->getChartTypes2() );
+ if (aChartTypeList.empty())
+ continue;
+
+ rtl::Reference< ChartType > xChartType( aChartTypeList[0] );
+
+ //iterate through all series in this chart type
+ for( rtl::Reference< DataSeries > const & dataSeries : xChartType->getDataSeries2() )
+ {
+ dataSeries->setPropertyValue( "StackingDirection", aNewDirection );
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+}
+
+StackMode Diagram::getStackMode( bool& rbFound, bool& rbAmbiguous )
+{
+ rbFound=false;
+ rbAmbiguous=false;
+
+ StackMode eGlobalStackMode = StackMode::NONE;
+
+ //iterate through all coordinate systems
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : getBaseCoordinateSystems() )
+ {
+ //iterate through all chart types in the current coordinate system
+ std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() );
+ for( std::size_t nT = 0; nT < aChartTypeList.size(); ++nT )
+ {
+ rtl::Reference< ChartType > xChartType( aChartTypeList[nT] );
+
+ StackMode eLocalStackMode = DiagramHelper::getStackModeFromChartType(
+ xChartType, rbFound, rbAmbiguous, xCooSys );
+
+ if( rbFound && eLocalStackMode != eGlobalStackMode && nT>0 )
+ {
+ rbAmbiguous = true;
+ return eGlobalStackMode;
+ }
+
+ eGlobalStackMode = eLocalStackMode;
+ }
+ }
+
+ return eGlobalStackMode;
+}
+
+void Diagram::setVertical( bool bVertical /* = true */ )
+{
+ try
+ {
+ uno::Any aValue;
+ aValue <<= bVertical;
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : getBaseCoordinateSystems() )
+ {
+ bool bChanged = false;
+ bool bOldSwap = false;
+ if( !(xCooSys->getPropertyValue("SwapXAndYAxis") >>= bOldSwap)
+ || bVertical != bOldSwap )
+ bChanged = true;
+
+ if( bChanged )
+ xCooSys->setPropertyValue("SwapXAndYAxis", aValue);
+
+ const sal_Int32 nDimensionCount = xCooSys->getDimension();
+ sal_Int32 nDimIndex = 0;
+ for (nDimIndex=0; nDimIndex < nDimensionCount; ++nDimIndex)
+ {
+ const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nDimIndex);
+ for (sal_Int32 nI = 0; nI <= nMaximumScaleIndex; ++nI)
+ {
+ rtl::Reference<Axis> xAxis = xCooSys->getAxisByDimension2(nDimIndex,nI);
+ if (!xAxis.is())
+ continue;
+
+ //adapt title rotation only when axis swapping has changed
+ if (!bChanged)
+ continue;
+
+ Reference< beans::XPropertySet > xTitleProps( xAxis->getTitleObject(), uno::UNO_QUERY );
+ if (!xTitleProps.is())
+ continue;
+
+ double fAngleDegree = 0.0;
+ xTitleProps->getPropertyValue("TextRotation") >>= fAngleDegree;
+ if (fAngleDegree != 0.0 &&
+ !rtl::math::approxEqual(fAngleDegree, 90.0))
+ continue;
+
+ double fNewAngleDegree = 0.0;
+ if( !bVertical && nDimIndex == 1 )
+ fNewAngleDegree = 90.0;
+ else if( bVertical && nDimIndex == 0 )
+ fNewAngleDegree = 90.0;
+
+ xTitleProps->setPropertyValue("TextRotation", uno::Any(fNewAngleDegree));
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+}
+
+bool Diagram::getVertical( bool& rbFound, bool& rbAmbiguous )
+{
+ bool bValue = false;
+ rbFound = false;
+ rbAmbiguous = false;
+
+ for (rtl::Reference<BaseCoordinateSystem> const & coords : getBaseCoordinateSystems())
+ {
+ bool bCurrent = false;
+ if (coords->getPropertyValue("SwapXAndYAxis") >>= bCurrent)
+ {
+ if (!rbFound)
+ {
+ bValue = bCurrent;
+ rbFound = true;
+ }
+ else if (bCurrent != bValue)
+ {
+ // ambiguous -> choose always first found
+ rbAmbiguous = true;
+ }
+ }
+ }
+ return bValue;
+}
+
+Diagram::tTemplateWithServiceName
+ Diagram::getTemplate(
+ const rtl::Reference< ::chart::ChartTypeManager > & xChartTypeManager )
+{
+ tTemplateWithServiceName aResult;
+
+ if( !xChartTypeManager )
+ return aResult;
+
+ Sequence< OUString > aServiceNames( xChartTypeManager->getAvailableServiceNames());
+ const sal_Int32 nLength = aServiceNames.getLength();
+
+ bool bTemplateFound = false;
+
+ for( sal_Int32 i = 0; ! bTemplateFound && i < nLength; ++i )
+ {
+ try
+ {
+ rtl::Reference< ::chart::ChartTypeTemplate > xTempl =
+ xChartTypeManager->createTemplate( aServiceNames[ i ] );
+
+ if (xTempl.is() && xTempl->matchesTemplate2(this, true))
+ {
+ aResult.xChartTypeTemplate = xTempl;
+ aResult.sServiceName = aServiceNames[ i ];
+ bTemplateFound = true;
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+
+ return aResult;
+}
+
+std::vector< rtl::Reference< RegressionCurveModel > >
+ Diagram::getAllRegressionCurvesNotMeanValueLine()
+{
+ std::vector< rtl::Reference< RegressionCurveModel > > aResult;
+ std::vector< rtl::Reference< DataSeries > > aSeries( getDataSeries());
+ for (auto const& elem : aSeries)
+ {
+ for( rtl::Reference< RegressionCurveModel > const & curve : elem->getRegressionCurves2() )
+ {
+ if( ! RegressionCurveHelper::isMeanValueLine( curve ))
+ aResult.push_back( curve );
+ }
+ }
+
+ return aResult;
+}
+
+double Diagram::getCameraDistance()
+{
+ double fCameraDistance = FIXED_SIZE_FOR_3D_CHART_VOLUME;
+
+ try
+ {
+ drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
+ getFastPropertyValue( PROP_SCENE_CAMERA_GEOMETRY ) >>= aCG;
+ ::basegfx::B3DVector aVRP( BaseGFXHelper::Position3DToB3DVector( aCG.vrp ) );
+ fCameraDistance = aVRP.getLength();
+
+ ThreeDHelper::ensureCameraDistanceRange( fCameraDistance );
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ return fCameraDistance;
+}
+
+void Diagram::setCameraDistance(double fCameraDistance )
+{
+ try
+ {
+ if( fCameraDistance <= 0 )
+ fCameraDistance = FIXED_SIZE_FOR_3D_CHART_VOLUME;
+
+ drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
+ getFastPropertyValue( PROP_SCENE_CAMERA_GEOMETRY ) >>= aCG;
+ ::basegfx::B3DVector aVRP( BaseGFXHelper::Position3DToB3DVector( aCG.vrp ) );
+ if( ::basegfx::fTools::equalZero( aVRP.getLength() ) )
+ aVRP = ::basegfx::B3DVector(0,0,1);
+ aVRP.setLength(fCameraDistance);
+ aCG.vrp = BaseGFXHelper::B3DVectorToPosition3D( aVRP );
+
+ setFastPropertyValue( PROP_SCENE_CAMERA_GEOMETRY, uno::Any( aCG ));
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+}
+
+static bool lcl_isRightAngledAxesSetAndSupported( Diagram& rDiagram )
+{
+ bool bRightAngledAxes = false;
+ rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes"
+ if(bRightAngledAxes)
+ {
+ if( ChartTypeHelper::isSupportingRightAngledAxes(
+ rDiagram.getChartTypeByIndex( 0 ) ) )
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+void Diagram::getRotation( sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree )
+{
+ double fXAngle, fYAngle, fZAngle;
+ getRotationAngle( fXAngle, fYAngle, fZAngle );
+
+ if( !lcl_isRightAngledAxesSetAndSupported( *this ) )
+ {
+ ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
+ rnHorizontalAngleDegree, rnVerticalAngleDegree, fXAngle, fYAngle, fZAngle);
+ rnVerticalAngleDegree*=-1;
+ }
+ else
+ {
+ rnHorizontalAngleDegree = basegfx::fround(basegfx::rad2deg(fXAngle));
+ rnVerticalAngleDegree = basegfx::fround(-1.0 * basegfx::rad2deg(fYAngle));
+ // nZRotation = basegfx::fround(-1.0 * basegfx::rad2deg(fZAngle));
+ }
+
+ rnHorizontalAngleDegree = NormAngle180(rnHorizontalAngleDegree);
+ rnVerticalAngleDegree = NormAngle180(rnVerticalAngleDegree);
+}
+
+void Diagram::setRotation( sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree )
+{
+ //todo: x and y is not equal to horz and vert in case of RightAngledAxes==false
+ double fXAngle = basegfx::deg2rad(nHorizontalAngleDegree);
+ double fYAngle = basegfx::deg2rad(-1 * nVerticalYAngleDegree);
+ double fZAngle = 0.0;
+
+ if( !lcl_isRightAngledAxesSetAndSupported( *this ) )
+ ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
+ nHorizontalAngleDegree, -1*nVerticalYAngleDegree, fXAngle, fYAngle, fZAngle );
+
+ setRotationAngle( fXAngle, fYAngle, fZAngle );
+}
+
+static ::basegfx::B3DHomMatrix lcl_getCameraMatrix( Diagram& rDiagram )
+{
+ drawing::HomogenMatrix aCameraMatrix;
+
+ drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
+ rDiagram.getFastPropertyValue( PROP_SCENE_CAMERA_GEOMETRY ) >>= aCG; // "D3DCameraGeometry"
+
+ ::basegfx::B3DVector aVPN( BaseGFXHelper::Direction3DToB3DVector( aCG.vpn ) );
+ ::basegfx::B3DVector aVUP( BaseGFXHelper::Direction3DToB3DVector( aCG.vup ) );
+
+ //normalize vectors:
+ aVPN.normalize();
+ aVUP.normalize();
+
+ ::basegfx::B3DVector aCross = ::basegfx::cross( aVUP, aVPN );
+
+ //first line is VUP x VPN
+ aCameraMatrix.Line1.Column1 = aCross[0];
+ aCameraMatrix.Line1.Column2 = aCross[1];
+ aCameraMatrix.Line1.Column3 = aCross[2];
+ aCameraMatrix.Line1.Column4 = 0.0;
+
+ //second line is VUP
+ aCameraMatrix.Line2.Column1 = aVUP[0];
+ aCameraMatrix.Line2.Column2 = aVUP[1];
+ aCameraMatrix.Line2.Column3 = aVUP[2];
+ aCameraMatrix.Line2.Column4 = 0.0;
+
+ //third line is VPN
+ aCameraMatrix.Line3.Column1 = aVPN[0];
+ aCameraMatrix.Line3.Column2 = aVPN[1];
+ aCameraMatrix.Line3.Column3 = aVPN[2];
+ aCameraMatrix.Line3.Column4 = 0.0;
+
+ //fourth line is 0 0 0 1
+ aCameraMatrix.Line4.Column1 = 0.0;
+ aCameraMatrix.Line4.Column2 = 0.0;
+ aCameraMatrix.Line4.Column3 = 0.0;
+ aCameraMatrix.Line4.Column4 = 1.0;
+
+ return BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aCameraMatrix );
+}
+
+static double lcl_shiftAngleToIntervalMinusPiToPi( double fAngleRad )
+{
+ //valid range: ]-Pi,Pi]
+ while( fAngleRad<=-M_PI )
+ fAngleRad+=(2*M_PI);
+ while( fAngleRad>M_PI )
+ fAngleRad-=(2*M_PI);
+ return fAngleRad;
+}
+
+void Diagram::getRotationAngle( double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad )
+{
+ //takes the camera and the transformation matrix into account
+
+ rfXAngleRad = rfYAngleRad = rfZAngleRad = 0.0;
+
+ //get camera rotation
+ ::basegfx::B3DHomMatrix aFixCameraRotationMatrix( lcl_getCameraMatrix( *this ) );
+ BaseGFXHelper::ReduceToRotationMatrix( aFixCameraRotationMatrix );
+
+ //get scene rotation
+ ::basegfx::B3DHomMatrix aSceneRotation;
+ {
+ drawing::HomogenMatrix aHomMatrix;
+ // "D3DTransformMatrix"
+ if( getFastPropertyValue( PROP_SCENE_TRANSF_MATRIX ) >>= aHomMatrix )
+ {
+ aSceneRotation = BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHomMatrix );
+ BaseGFXHelper::ReduceToRotationMatrix( aSceneRotation );
+ }
+ }
+
+ ::basegfx::B3DHomMatrix aResultRotation = aFixCameraRotationMatrix * aSceneRotation;
+ ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix( aResultRotation ) );
+
+ rfXAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getX());
+ rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getY());
+ rfZAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getZ());
+
+ if(rfZAngleRad<-M_PI_2 || rfZAngleRad>M_PI_2)
+ {
+ rfZAngleRad-=M_PI;
+ rfXAngleRad-=M_PI;
+ rfYAngleRad=(M_PI-rfYAngleRad);
+
+ rfXAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfXAngleRad);
+ rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfYAngleRad);
+ rfZAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfZAngleRad);
+ }
+}
+
+static ::basegfx::B3DHomMatrix lcl_getInverseRotationMatrix( Diagram& rDiagram )
+{
+ ::basegfx::B3DHomMatrix aInverseRotation;
+ double fXAngleRad=0.0;
+ double fYAngleRad=0.0;
+ double fZAngleRad=0.0;
+ rDiagram.getRotationAngle( fXAngleRad, fYAngleRad, fZAngleRad );
+ aInverseRotation.rotate( 0.0, 0.0, -fZAngleRad );
+ aInverseRotation.rotate( 0.0, -fYAngleRad, 0.0 );
+ aInverseRotation.rotate( -fXAngleRad, 0.0, 0.0 );
+ return aInverseRotation;
+}
+
+static void lcl_rotateLights( const ::basegfx::B3DHomMatrix& rLightRotation, Diagram& rDiagram )
+{
+ ::basegfx::B3DHomMatrix aLightRotation( rLightRotation );
+ BaseGFXHelper::ReduceToRotationMatrix( aLightRotation );
+
+ // "D3DSceneLightDirection1","D3DSceneLightOn1",
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_1, PROP_SCENE_LIGHT_ON_1, aLightRotation );
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_2, PROP_SCENE_LIGHT_ON_2, aLightRotation );
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_3, PROP_SCENE_LIGHT_ON_3, aLightRotation );
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_4, PROP_SCENE_LIGHT_ON_4, aLightRotation );
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_5, PROP_SCENE_LIGHT_ON_5, aLightRotation );
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_6, PROP_SCENE_LIGHT_ON_6, aLightRotation );
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_7, PROP_SCENE_LIGHT_ON_7, aLightRotation );
+ lcl_RotateLightSource( rDiagram, PROP_SCENE_LIGHT_DIRECTION_8, PROP_SCENE_LIGHT_ON_8, aLightRotation );
+}
+
+void Diagram::setRotationAngle(
+ double fXAngleRad, double fYAngleRad, double fZAngleRad )
+{
+ //the rotation of the camera is not touched but taken into account
+ //the rotation difference is applied to the transformation matrix
+
+ //the light sources will be adapted also
+
+ try
+ {
+ //remind old rotation for adaptation of light directions
+ ::basegfx::B3DHomMatrix aInverseOldRotation( lcl_getInverseRotationMatrix( *this ) );
+
+ ::basegfx::B3DHomMatrix aInverseCameraRotation;
+ {
+ ::basegfx::B3DTuple aR( BaseGFXHelper::GetRotationFromMatrix(
+ lcl_getCameraMatrix( *this ) ) );
+ aInverseCameraRotation.rotate( 0.0, 0.0, -aR.getZ() );
+ aInverseCameraRotation.rotate( 0.0, -aR.getY(), 0.0 );
+ aInverseCameraRotation.rotate( -aR.getX(), 0.0, 0.0 );
+ }
+
+ ::basegfx::B3DHomMatrix aCumulatedRotation;
+ aCumulatedRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
+
+ //calculate new scene matrix
+ ::basegfx::B3DHomMatrix aSceneRotation = aInverseCameraRotation*aCumulatedRotation;
+ BaseGFXHelper::ReduceToRotationMatrix( aSceneRotation );
+
+ //set new rotation to transformation matrix ("D3DTransformMatrix")
+ setFastPropertyValue(
+ PROP_SCENE_TRANSF_MATRIX, uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation )));
+
+ //rotate lights if RightAngledAxes are not set or not supported
+ bool bRightAngledAxes = false;
+ getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes;
+ if(!bRightAngledAxes || !ChartTypeHelper::isSupportingRightAngledAxes(
+ getChartTypeByIndex( 0 ) ) )
+ {
+ ::basegfx::B3DHomMatrix aNewRotation;
+ aNewRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
+ lcl_rotateLights( aNewRotation*aInverseOldRotation, *this );
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+}
+
+static bool lcl_isEqual( const drawing::Direction3D& rA, const drawing::Direction3D& rB )
+{
+ return ::rtl::math::approxEqual(rA.DirectionX, rB.DirectionX)
+ && ::rtl::math::approxEqual(rA.DirectionY, rB.DirectionY)
+ && ::rtl::math::approxEqual(rA.DirectionZ, rB.DirectionZ);
+}
+static bool lcl_isSimpleScheme( drawing::ShadeMode aShadeMode
+ , sal_Int32 nRoundedEdges
+ , sal_Int32 nObjectLines
+ , const rtl::Reference< Diagram >& xDiagram )
+{
+ if(aShadeMode!=drawing::ShadeMode_FLAT)
+ return false;
+ if(nRoundedEdges!=0)
+ return false;
+ if(nObjectLines==0)
+ {
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) );
+ return ChartTypeHelper::noBordersForSimpleScheme( xChartType );
+ }
+ if(nObjectLines!=1)
+ return false;
+ return true;
+}
+static bool lcl_isRealisticScheme( drawing::ShadeMode aShadeMode
+ , sal_Int32 nRoundedEdges
+ , sal_Int32 nObjectLines )
+{
+ if(aShadeMode!=drawing::ShadeMode_SMOOTH)
+ return false;
+ if(nRoundedEdges!=5)
+ return false;
+ if(nObjectLines!=0)
+ return false;
+ return true;
+}
+static bool lcl_isLightScheme( Diagram& rDiagram, bool bRealistic )
+{
+ bool bIsOn = false;
+ // "D3DSceneLightOn2" / UNO_NAME_3D_SCENE_LIGHTON_2
+ rDiagram.getFastPropertyValue( PROP_SCENE_LIGHT_ON_2 ) >>= bIsOn;
+ if(!bIsOn)
+ return false;
+
+ rtl::Reference< ChartType > xChartType( rDiagram.getChartTypeByIndex( 0 ) );
+
+ sal_Int32 nColor = 0;
+ // "D3DSceneLightColor2" / UNO_NAME_3D_SCENE_LIGHTCOLOR_2
+ rDiagram.getFastPropertyValue( PROP_SCENE_LIGHT_COLOR_2 ) >>= nColor;
+ if( nColor != ::chart::ChartTypeHelper::getDefaultDirectLightColor( !bRealistic, xChartType ) )
+ return false;
+
+ sal_Int32 nAmbientColor = 0;
+ // "D3DSceneAmbientColor" / UNO_NAME_3D_SCENE_AMBIENTCOLOR
+ rDiagram.getFastPropertyValue( PROP_SCENE_AMBIENT_COLOR ) >>= nAmbientColor;
+ if( nAmbientColor != ::chart::ChartTypeHelper::getDefaultAmbientLightColor( !bRealistic, xChartType ) )
+ return false;
+
+ drawing::Direction3D aDirection(0,0,0);
+ // "D3DSceneLightDirection2" / UNO_NAME_3D_SCENE_LIGHTDIRECTION_2
+ rDiagram.getFastPropertyValue( PROP_SCENE_LIGHT_DIRECTION_2 ) >>= aDirection;
+
+ drawing::Direction3D aDefaultDirection( bRealistic
+ ? ChartTypeHelper::getDefaultRealisticLightDirection(xChartType)
+ : ChartTypeHelper::getDefaultSimpleLightDirection(xChartType) );
+
+ //rotate default light direction when right angled axes are off but supported
+ {
+ bool bRightAngledAxes = false;
+ rDiagram.getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bRightAngledAxes; // "RightAngledAxes"
+ if(!bRightAngledAxes)
+ {
+ if( ChartTypeHelper::isSupportingRightAngledAxes(
+ rDiagram.getChartTypeByIndex( 0 ) ) )
+ {
+ ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( rDiagram ) );
+ BaseGFXHelper::ReduceToRotationMatrix( aRotation );
+ ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aDefaultDirection ) );
+ aLightVector = aRotation*aLightVector;
+ aDefaultDirection = BaseGFXHelper::B3DVectorToDirection3D( aLightVector );
+ }
+ }
+ }
+
+ return lcl_isEqual( aDirection, aDefaultDirection );
+}
+static bool lcl_isRealisticLightScheme( Diagram& rDiagram )
+{
+ return lcl_isLightScheme( rDiagram, true /*bRealistic*/ );
+}
+static bool lcl_isSimpleLightScheme( Diagram& rDiagram )
+{
+ return lcl_isLightScheme( rDiagram, false /*bRealistic*/ );
+}
+
+ThreeDLookScheme Diagram::detectScheme()
+{
+ ThreeDLookScheme aScheme = ThreeDLookScheme::ThreeDLookScheme_Unknown;
+
+ sal_Int32 nRoundedEdges;
+ sal_Int32 nObjectLines;
+ ThreeDHelper::getRoundedEdgesAndObjectLines( this, nRoundedEdges, nObjectLines );
+
+ //get shade mode and light settings:
+ drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH );
+ try
+ {
+ getFastPropertyValue( PROP_SCENE_SHADE_MODE )>>= aShadeMode; // "D3DSceneShadeMode"
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ if( lcl_isSimpleScheme( aShadeMode, nRoundedEdges, nObjectLines, this ) )
+ {
+ if( lcl_isSimpleLightScheme(*this) )
+ aScheme = ThreeDLookScheme::ThreeDLookScheme_Simple;
+ }
+ else if( lcl_isRealisticScheme( aShadeMode, nRoundedEdges, nObjectLines ) )
+ {
+ if( lcl_isRealisticLightScheme(*this) )
+ aScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
+ }
+
+ return aScheme;
+}
+
+static void lcl_setRealisticScheme( drawing::ShadeMode& rShadeMode
+ , sal_Int32& rnRoundedEdges
+ , sal_Int32& rnObjectLines )
+{
+ rShadeMode = drawing::ShadeMode_SMOOTH;
+ rnRoundedEdges = 5;
+ rnObjectLines = 0;
+}
+
+static void lcl_setSimpleScheme( drawing::ShadeMode& rShadeMode
+ , sal_Int32& rnRoundedEdges
+ , sal_Int32& rnObjectLines
+ , const rtl::Reference< Diagram >& xDiagram )
+{
+ rShadeMode = drawing::ShadeMode_FLAT;
+ rnRoundedEdges = 0;
+
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) );
+ rnObjectLines = ChartTypeHelper::noBordersForSimpleScheme( xChartType ) ? 0 : 1;
+}
+void Diagram::setScheme( ThreeDLookScheme aScheme )
+{
+ if( aScheme == ThreeDLookScheme::ThreeDLookScheme_Unknown )
+ return;
+
+ drawing::ShadeMode aShadeMode;
+ sal_Int32 nRoundedEdges;
+ sal_Int32 nObjectLines;
+
+ if( aScheme == ThreeDLookScheme::ThreeDLookScheme_Simple )
+ lcl_setSimpleScheme(aShadeMode,nRoundedEdges,nObjectLines,this);
+ else
+ lcl_setRealisticScheme(aShadeMode,nRoundedEdges,nObjectLines);
+
+ try
+ {
+ ThreeDHelper::setRoundedEdgesAndObjectLines( this, nRoundedEdges, nObjectLines );
+
+ drawing::ShadeMode aOldShadeMode;
+ if( ! (getFastPropertyValue( PROP_SCENE_SHADE_MODE)>>=aOldShadeMode) ||
+ aOldShadeMode != aShadeMode )
+ {
+ setFastPropertyValue( PROP_SCENE_SHADE_MODE, uno::Any( aShadeMode )); // "D3DSceneShadeMode"
+ }
+
+ lcl_setLightsForScheme( *this, aScheme );
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+}
+
+void Diagram::setDefaultRotation( bool bPieOrDonut )
+{
+ drawing::CameraGeometry aCameraGeo( ThreeDHelper::getDefaultCameraGeometry( bPieOrDonut ) );
+ // "D3DCameraGeometry"
+ setFastPropertyValue( PROP_SCENE_CAMERA_GEOMETRY, uno::Any( aCameraGeo ));
+
+ ::basegfx::B3DHomMatrix aSceneRotation;
+ if( bPieOrDonut )
+ aSceneRotation.rotate( -M_PI/3.0, 0, 0 );
+ // "D3DTransformMatrix"
+ setFastPropertyValue( PROP_SCENE_TRANSF_MATRIX,
+ uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation )));
+}
+
+void Diagram::switchRightAngledAxes( bool bRightAngledAxes )
+{
+ try
+ {
+ bool bOldRightAngledAxes = false;
+ getFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES ) >>= bOldRightAngledAxes; // "RightAngledAxes"
+ if( bOldRightAngledAxes!=bRightAngledAxes)
+ {
+ setFastPropertyValue( PROP_DIAGRAM_RIGHT_ANGLED_AXES, uno::Any( bRightAngledAxes ));
+ if(bRightAngledAxes)
+ {
+ ::basegfx::B3DHomMatrix aInverseRotation( lcl_getInverseRotationMatrix( *this ) );
+ lcl_rotateLights( aInverseRotation, *this );
+ }
+ else
+ {
+ ::basegfx::B3DHomMatrix aCompleteRotation( lcl_getCompleteRotationMatrix( *this ) );
+ lcl_rotateLights( aCompleteRotation, *this );
+ }
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+}
+
} // namespace chart
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/chart2/source/model/main/FormattedString.cxx b/chart2/source/model/main/FormattedString.cxx
index 0d6e733a2c31..dbd5876b978a 100644
--- a/chart2/source/model/main/FormattedString.cxx
+++ b/chart2/source/model/main/FormattedString.cxx
@@ -17,13 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "FormattedString.hxx"
+#include <FormattedString.hxx>
#include <CharacterProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
namespace com::sun::star::uno { class XComponentContext; }
@@ -33,61 +32,36 @@ using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Sequence;
using ::osl::MutexGuard;
-namespace
+namespace chart
{
-
-struct StaticFormattedStringDefaults_Initializer
+const ::chart::tPropertyValueMap & StaticFormattedStringDefaults()
{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- ::chart::CharacterProperties::AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
+ static ::chart::tPropertyValueMap aStaticDefaults = []
+ {
+ ::chart::tPropertyValueMap aMap;
+ ::chart::CharacterProperties::AddDefaultsToMap( aMap );
+ return aMap;
+ }();
+ return aStaticDefaults;
};
+} // namespace chart
-struct StaticFormattedStringDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticFormattedStringDefaults_Initializer >
-{
-};
-
-struct StaticFormattedStringInfoHelper_Initializer
+namespace
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticFormattedStringInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticFormattedStringInfoHelper_Initializer >
+::cppu::OPropertyArrayHelper& StaticFormattedStringInfoHelper()
{
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
-struct StaticFormattedStringInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticFormattedStringInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticFormattedStringInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticFormattedStringInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -96,20 +70,19 @@ namespace chart
{
FormattedString::FormattedString() :
- ::property::OPropertySet( m_aMutex ),
- m_aString(),
m_aType(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT),
- m_aGuid(),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_bDataLabelsRange(false),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
FormattedString::FormattedString( const FormattedString & rOther ) :
impl::FormattedString_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
+ ::property::OPropertySet( rOther ),
m_aString( rOther.m_aString ),
m_aType(rOther.m_aType),
m_aGuid(rOther.m_aGuid),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_bDataLabelsRange(rOther.m_bDataLabelsRange),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
FormattedString::~FormattedString()
@@ -174,31 +147,47 @@ void SAL_CALL FormattedString::setGuid( const OUString& guid )
}
-// ____ XModifyBroadcaster ____
-void SAL_CALL FormattedString::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+sal_Bool SAL_CALL FormattedString::getDataLabelsRange()
+{
+ MutexGuard aGuard( m_aMutex);
+ return m_bDataLabelsRange;
+}
+
+void SAL_CALL FormattedString::setDataLabelsRange( sal_Bool dataLabelsRange )
{
- try
{
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
+ MutexGuard aGuard( m_aMutex);
+ m_bDataLabelsRange = dataLabelsRange;
}
- catch( const uno::Exception & )
+ //don't keep the mutex locked while calling out
+ fireModifyEvent();
+}
+
+OUString SAL_CALL FormattedString::getCellRange()
+{
+ MutexGuard aGuard( m_aMutex);
+ return m_aCellRange;
+}
+
+void SAL_CALL FormattedString::setCellRange( const OUString& cellRange )
+{
{
- DBG_UNHANDLED_EXCEPTION("chart2");
+ MutexGuard aGuard( m_aMutex);
+ m_aCellRange = cellRange;
}
+ //don't keep the mutex locked while calling out
+ fireModifyEvent();
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL FormattedString::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+{
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL FormattedString::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
@@ -225,25 +214,28 @@ void FormattedString::fireModifyEvent()
}
// ____ OPropertySet ____
-uno::Any FormattedString::GetDefaultValue( sal_Int32 nHandle ) const
+void FormattedString::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticFormattedStringDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticFormattedStringDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL FormattedString::getInfoHelper()
{
- return *StaticFormattedStringInfoHelper::get();
+ return StaticFormattedStringInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL FormattedString::getPropertySetInfo()
{
- return *StaticFormattedStringInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticFormattedStringInfoHelper() ) );
+ return xPropertySetInfo;
}
using impl::FormattedString_Base;
diff --git a/chart2/source/model/main/GridProperties.cxx b/chart2/source/model/main/GridProperties.cxx
index 44d3fffd8c67..a495f631f7e2 100644
--- a/chart2/source/model/main/GridProperties.cxx
+++ b/chart2/source/model/main/GridProperties.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "GridProperties.hxx"
+#include <GridProperties.hxx>
#include <LinePropertiesHelper.hxx>
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
@@ -25,7 +25,6 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
namespace com::sun::star::beans { class XPropertySetInfo; }
namespace com::sun::star::uno { class XComponentContext; }
@@ -54,71 +53,38 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticGridDefaults_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::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_GRID_SHOW, false );
-
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue< sal_Int32 >(
- rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_COLOR, 0xb3b3b3 ); // gray30
- }
-};
-
-struct StaticGridDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticGridDefaults_Initializer >
-{
-};
-
-struct StaticGridInfoHelper_Initializer
+const ::chart::tPropertyValueMap & StaticGridDefaults()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_GRID_SHOW, false );
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue< sal_Int32 >(
+ aTmp, ::chart::LinePropertiesHelper::PROP_LINE_COLOR, 0xb3b3b3 ); // gray30
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
-struct StaticGridInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticGridInfoHelper_Initializer >
+::cppu::OPropertyArrayHelper& StaticGridInfoHelper()
{
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-struct StaticGridInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticGridInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticGridInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticGridInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -127,14 +93,13 @@ namespace chart
{
GridProperties::GridProperties() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
GridProperties::GridProperties( const GridProperties & rOther ) :
impl::GridProperties_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
}
@@ -142,24 +107,27 @@ GridProperties::~GridProperties()
{}
// ____ OPropertySet ____
-uno::Any GridProperties::GetDefaultValue( sal_Int32 nHandle ) const
+void GridProperties::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticGridDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticGridDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL GridProperties::getInfoHelper()
{
- return *StaticGridInfoHelper::get();
+ return StaticGridInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL GridProperties::getPropertySetInfo()
{
- return *StaticGridInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticGridInfoHelper() ) );
+ return xPropertySetInfo;
}
// ____ XCloneable ____
@@ -171,28 +139,12 @@ uno::Reference< util::XCloneable > SAL_CALL GridProperties::createClone()
// ____ XModifyBroadcaster ____
void SAL_CALL GridProperties::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL GridProperties::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx
index 4c3b9f0e5167..f72868b58cb5 100644
--- a/chart2/source/model/main/Legend.cxx
+++ b/chart2/source/model/main/Legend.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "Legend.hxx"
+#include <Legend.hxx>
#include <LinePropertiesHelper.hxx>
#include <FillProperties.hxx>
#include <CharacterProperties.hxx>
@@ -31,7 +31,6 @@
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
#include <algorithm>
@@ -106,78 +105,53 @@ void lcl_AddPropertiesToVector(
}
-struct StaticLegendDefaults_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 );
- ::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
-
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_EXPANSION, css::chart::ChartLegendExpansion_HIGH );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_OVERLAY, false );
-
- float fDefaultCharHeight = 10.0;
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
- }
-};
+} // namespace
-struct StaticLegendDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticLegendDefaults_Initializer >
+namespace chart
{
-};
-
-struct StaticLegendInfoHelper_Initializer
+const ::chart::tPropertyValueMap& StaticLegendDefaults()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
- ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ ::chart::FillProperties::AddDefaultsToMap( aTmp );
+ ::chart::CharacterProperties::AddDefaultsToMap( aTmp );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_LEGEND_EXPANSION, css::chart::ChartLegendExpansion_HIGH );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_LEGEND_SHOW, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_LEGEND_OVERLAY, false );
+
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
+} // namespace chart
-struct StaticLegendInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLegendInfoHelper_Initializer >
-{
-};
-
-struct StaticLegendInfo_Initializer
+namespace
{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLegendInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticLegendInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLegendInfo_Initializer >
+::cppu::OPropertyArrayHelper& StaticLegendInfoHelper()
{
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -186,15 +160,14 @@ namespace chart
{
Legend::Legend() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
}
Legend::Legend( const Legend & rOther ) :
impl::Legend_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
}
@@ -211,28 +184,12 @@ Reference< util::XCloneable > SAL_CALL Legend::createClone()
// ____ XModifyBroadcaster ____
void SAL_CALL Legend::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL Legend::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
@@ -254,24 +211,27 @@ void Legend::firePropertyChangeEvent()
}
// ____ OPropertySet ____
-Any Legend::GetDefaultValue( sal_Int32 nHandle ) const
+void Legend::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticLegendDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticLegendDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL Legend::getInfoHelper()
{
- return *StaticLegendInfoHelper::get();
+ return StaticLegendInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL Legend::getPropertySetInfo()
{
- return *StaticLegendInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticLegendInfoHelper() ) );
+ return xPropertySetInfo;
}
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx
index 5dda4cb5a7b4..deae689d7a2b 100644
--- a/chart2/source/model/main/PageBackground.cxx
+++ b/chart2/source/model/main/PageBackground.cxx
@@ -18,15 +18,17 @@
*/
#include "PageBackground.hxx"
+#include <comphelper/lok.hxx>
#include <LinePropertiesHelper.hxx>
#include <FillProperties.hxx>
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
+#include <svtools/colorcfg.hxx>
+#include <sfx2/viewsh.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
#include <vector>
#include <algorithm>
@@ -40,70 +42,47 @@ using ::com::sun::star::beans::Property;
namespace
{
-struct StaticPageBackgroundDefaults_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 );
-
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
- }
+const ::chart::tPropertyValueMap& StaticPageBackgroundDefaults()
+{
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ ::chart::FillProperties::AddDefaultsToMap( aTmp );
+
+ // override other defaults
+ Color aDocColor = COL_WHITE;
+ if (comphelper::LibreOfficeKit::isActive()) {
+ aDocColor = COL_AUTO;
+ } else {
+ if (SfxViewShell* pCurrentSh = SfxViewShell::Current()) {
+ aDocColor = pCurrentSh->GetColorConfigColor(svtools::DOCCOLOR);
+ } else {
+ aDocColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+ }
+ }
+ ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::FillProperties::PROP_FILL_COLOR, aDocColor );
+ ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
-struct StaticPageBackgroundDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPageBackgroundDefaults_Initializer >
+::cppu::OPropertyArrayHelper& StaticPageBackgroundInfoHelper()
{
-};
-
-struct StaticPageBackgroundInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::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() );
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
- return comphelper::containerToSequence( aProperties );
- }
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-};
-
-struct StaticPageBackgroundInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticPageBackgroundInfoHelper_Initializer >
-{
-};
-
-struct StaticPageBackgroundInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticPageBackgroundInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticPageBackgroundInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticPageBackgroundInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -112,19 +91,26 @@ namespace chart
{
PageBackground::PageBackground() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
PageBackground::PageBackground( const PageBackground & rOther ) :
impl::PageBackground_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
PageBackground::~PageBackground()
{}
+// ____ XTypeProvider ____
+uno::Sequence< css::uno::Type > SAL_CALL PageBackground::getTypes()
+{
+ return ::comphelper::concatSequences(
+ impl::PageBackground_Base::getTypes(),
+ ::property::OPropertySet::getTypes());
+}
+
// ____ XCloneable ____
uno::Reference< util::XCloneable > SAL_CALL PageBackground::createClone()
{
@@ -132,51 +118,38 @@ uno::Reference< util::XCloneable > SAL_CALL PageBackground::createClone()
}
// ____ OPropertySet ____
-uno::Any PageBackground::GetDefaultValue( sal_Int32 nHandle ) const
+void PageBackground::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticPageBackgroundDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticPageBackgroundDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL PageBackground::getInfoHelper()
{
- return *StaticPageBackgroundInfoHelper::get();
+ return StaticPageBackgroundInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL PageBackground::getPropertySetInfo()
{
- return *StaticPageBackgroundInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticPageBackgroundInfoHelper() ) );
+ return xPropertySetInfo;
}
// ____ XModifyBroadcaster ____
void SAL_CALL PageBackground::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL PageBackground::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
diff --git a/chart2/source/model/main/PageBackground.hxx b/chart2/source/model/main/PageBackground.hxx
index 9157eb9d90c9..2aef8bd45ebe 100644
--- a/chart2/source/model/main/PageBackground.hxx
+++ b/chart2/source/model/main/PageBackground.hxx
@@ -16,18 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_PAGEBACKGROUND_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_PAGEBACKGROUND_HXX
+#pragma once
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <MutexContainer.hxx>
#include <OPropertySet.hxx>
#include <cppuhelper/implbase.hxx>
-
#include <comphelper/uno3.hxx>
+#include <ModifyListenerHelper.hxx>
namespace chart
{
@@ -43,7 +39,6 @@ typedef ::cppu::WeakImplHelper<
}
class PageBackground final :
- public MutexContainer,
public impl::PageBackground_Base,
public ::property::OPropertySet
{
@@ -59,11 +54,13 @@ public:
/// merge XInterface implementations
DECLARE_XINTERFACE()
-private:
explicit PageBackground( const PageBackground & rOther );
+ // ____ XTypeProvider ____
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -81,6 +78,8 @@ private:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+private:
+
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -93,12 +92,9 @@ private:
virtual void firePropertyChangeEvent() override;
using OPropertySet::disposing;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_PAGEBACKGROUND_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/PolarCoordinateSystem.cxx b/chart2/source/model/main/PolarCoordinateSystem.cxx
index 5ec3252ae582..0807415dac24 100644
--- a/chart2/source/model/main/PolarCoordinateSystem.cxx
+++ b/chart2/source/model/main/PolarCoordinateSystem.cxx
@@ -31,7 +31,8 @@ using ::com::sun::star::uno::Sequence;
namespace
{
-const char CHART2_COOSYSTEM_POLAR_SERVICE_NAME[] = "com.sun.star.chart2.CoordinateSystems.Polar";
+constexpr OUString CHART2_COOSYSTEM_POLAR_SERVICE_NAME
+ = u"com.sun.star.chart2.CoordinateSystems.Polar"_ustr;
}
diff --git a/chart2/source/model/main/StockBar.cxx b/chart2/source/model/main/StockBar.cxx
index 22e082ad06b3..5d7efdc5f0d9 100644
--- a/chart2/source/model/main/StockBar.cxx
+++ b/chart2/source/model/main/StockBar.cxx
@@ -23,8 +23,6 @@
#include <UserDefinedProperties.hxx>
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <tools/diagnose_ex.h>
#include <algorithm>
@@ -38,69 +36,36 @@ using ::com::sun::star::beans::Property;
namespace
{
-struct StaticStockBarInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& StaticStockBarInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-private:
- static uno::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() );
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticStockBarInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticStockBarInfoHelper_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
-struct StaticStockBarInfo_Initializer
+const ::chart::tPropertyValueMap & StaticStockBarDefaults()
{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticStockBarInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ ::chart::FillProperties::AddDefaultsToMap( aTmp );
-struct StaticStockBarInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticStockBarInfo_Initializer >
-{
-};
-
-struct StaticStockBarDefaults_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 );
-
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); // white
- }
-};
-
-struct StaticStockBarDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticStockBarDefaults_Initializer >
-{
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( aTmp, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); // white
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
} // anonymous namespace
@@ -109,8 +74,7 @@ namespace chart
{
StockBar::StockBar( bool bRisingCourse ) :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
if( ! bRisingCourse )
{
@@ -125,13 +89,21 @@ StockBar::StockBar( bool bRisingCourse ) :
StockBar::StockBar( const StockBar & rOther ) :
impl::StockBar_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
StockBar::~StockBar()
{}
+// ____ XTypeProvider ____
+uno::Sequence< css::uno::Type > SAL_CALL StockBar::getTypes()
+{
+ return ::comphelper::concatSequences(
+ impl::StockBar_Base::getTypes(),
+ ::property::OPropertySet::getTypes());
+}
+
// ____ XCloneable ____
uno::Reference< util::XCloneable > SAL_CALL StockBar::createClone()
{
@@ -139,51 +111,38 @@ uno::Reference< util::XCloneable > SAL_CALL StockBar::createClone()
}
// ____ OPropertySet ____
-uno::Any StockBar::GetDefaultValue( sal_Int32 nHandle ) const
+void StockBar::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticStockBarDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticStockBarDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL StockBar::getInfoHelper()
{
- return *StaticStockBarInfoHelper::get();
+ return StaticStockBarInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL StockBar::getPropertySetInfo()
{
- return *StaticStockBarInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticStockBarInfoHelper() ) );
+ return xPropertySetInfo;
}
// ____ XModifyBroadcaster ____
void SAL_CALL StockBar::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL StockBar::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx
index a42374ce5f51..10551ce6e318 100644
--- a/chart2/source/model/main/Title.cxx
+++ b/chart2/source/model/main/Title.cxx
@@ -17,7 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "Title.hxx"
+#include <Title.hxx>
+#include <CharacterProperties.hxx>
#include <LinePropertiesHelper.hxx>
#include <FillProperties.hxx>
#include <CloneHelper.hxx>
@@ -30,7 +31,6 @@
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
#include <vector>
#include <algorithm>
@@ -140,86 +140,56 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
-struct StaticTitleDefaults_Initializer
+const ::chart::tPropertyValueMap& StaticTitleDefaults()
{
- ::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 );
-
- // ParagraphProperties
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_PARA_ADJUST,
- css::style::ParagraphAdjust_CENTER );
- // PROP_TITLE_PARA_LAST_LINE_ADJUST
-
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_LEFT_MARGIN, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_RIGHT_MARGIN, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_TOP_MARGIN, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_BOTTOM_MARGIN, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_PARA_IS_HYPHENATION, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_VISIBLE, true );
-
- // own properties
- ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_TITLE_TEXT_ROTATION, 0.0 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_TEXT_STACKED, false );
-
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
- }
-};
-
-struct StaticTitleDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticTitleDefaults_Initializer >
-{
-};
-
-struct StaticTitleInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticTitleInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticTitleInfoHelper_Initializer >
-{
-};
-
-struct StaticTitleInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticTitleInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+
+ ::chart::CharacterProperties::AddDefaultsToMap( aTmp );
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ ::chart::FillProperties::AddDefaultsToMap( aTmp );
+
+ // ParagraphProperties
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_TITLE_PARA_ADJUST,
+ css::style::ParagraphAdjust_CENTER );
+ // PROP_TITLE_PARA_LAST_LINE_ADJUST
+
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aTmp, PROP_TITLE_PARA_LEFT_MARGIN, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aTmp, PROP_TITLE_PARA_RIGHT_MARGIN, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aTmp, PROP_TITLE_PARA_TOP_MARGIN, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aTmp, PROP_TITLE_PARA_BOTTOM_MARGIN, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_TITLE_PARA_IS_HYPHENATION, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_TITLE_VISIBLE, true );
+
+ // own properties
+ ::chart::PropertyHelper::setPropertyValueDefault< double >( aTmp, PROP_TITLE_TEXT_ROTATION, 0.0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_TITLE_TEXT_STACKED, false );
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
+ ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
-struct StaticTitleInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticTitleInfo_Initializer >
+::cppu::OPropertyArrayHelper& StaticTitleInfoHelper()
{
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -228,14 +198,13 @@ namespace chart
{
Title::Title() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
Title::Title( const Title & rOther ) :
impl::Title_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
CloneHelper::CloneRefSequence<chart2::XFormattedString>(
rOther.m_aStrings, m_aStrings );
@@ -283,51 +252,38 @@ void SAL_CALL Title::setText( const uno::Sequence< uno::Reference< chart2::XForm
}
// ____ OPropertySet ____
-uno::Any Title::GetDefaultValue( sal_Int32 nHandle ) const
+void Title::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticTitleDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticTitleDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL Title::getInfoHelper()
{
- return *StaticTitleInfoHelper::get();
+ return StaticTitleInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL Title::getPropertySetInfo()
{
- return *StaticTitleInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticTitleInfoHelper() ) );
+ return xPropertySetInfo;
}
// ____ XModifyBroadcaster ____
void SAL_CALL Title::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL Title::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
diff --git a/chart2/source/model/main/UndoManager.cxx b/chart2/source/model/main/UndoManager.cxx
index f295bc288eb2..3688863b3883 100644
--- a/chart2/source/model/main/UndoManager.cxx
+++ b/chart2/source/model/main/UndoManager.cxx
@@ -18,9 +18,9 @@
*/
#include "UndoManager.hxx"
+#include <ChartModel.hxx>
#include <ChartViewHelper.hxx>
-#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/NoSupportException.hpp>
@@ -49,12 +49,11 @@ namespace chart
class UndoManager_Impl : public ::framework::IUndoManagerImplementation
{
public:
- UndoManager_Impl( UndoManager& i_antiImpl, ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ UndoManager_Impl( UndoManager& i_antiImpl, ::chart::ChartModel& i_parent, ::osl::Mutex& i_mutex )
:m_rAntiImpl( i_antiImpl )
,m_rParent( i_parent )
,m_rMutex( i_mutex )
,m_bDisposed( false )
- ,m_aUndoManager()
,m_aUndoHelper( *this )
{
m_aUndoManager.SetMaxUndoActionCount(
@@ -71,7 +70,7 @@ namespace chart
virtual Reference< XUndoManager > getThis() override;
// attribute access
- ::cppu::OWeakObject& getParent() { return m_rParent; }
+ ::chart::ChartModel& getParent() { return m_rParent; }
::framework::UndoManagerHelper& getUndoHelper() { return m_aUndoHelper; }
// public interface
@@ -84,7 +83,7 @@ namespace chart
private:
UndoManager& m_rAntiImpl;
- ::cppu::OWeakObject& m_rParent;
+ ::chart::ChartModel& m_rParent;
::osl::Mutex& m_rMutex;
bool m_bDisposed;
@@ -173,7 +172,7 @@ namespace chart
using impl::UndoManagerMethodGuard;
- UndoManager::UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ UndoManager::UndoManager( ::chart::ChartModel& i_parent, ::osl::Mutex& i_mutex )
:m_pImpl( new impl::UndoManager_Impl( *this, i_parent, i_mutex ) )
{
}
@@ -182,12 +181,12 @@ namespace chart
{
}
- void SAL_CALL UndoManager::acquire() throw ()
+ void SAL_CALL UndoManager::acquire() noexcept
{
m_pImpl->getParent().acquire();
}
- void SAL_CALL UndoManager::release() throw ()
+ void SAL_CALL UndoManager::release() noexcept
{
m_pImpl->getParent().release();
}
@@ -226,7 +225,7 @@ namespace chart
UndoManagerMethodGuard aGuard( *m_pImpl );
m_pImpl->getUndoHelper().undo( aGuard );
- ChartViewHelper::setViewToDirtyState( Reference< XModel >( getParent(), UNO_QUERY ) );
+ ChartViewHelper::setViewToDirtyState( &m_pImpl->getParent() );
}
void SAL_CALL UndoManager::redo( )
@@ -234,7 +233,7 @@ namespace chart
UndoManagerMethodGuard aGuard( *m_pImpl );
m_pImpl->getUndoHelper().redo( aGuard );
- ChartViewHelper::setViewToDirtyState( Reference< XModel >( getParent(), UNO_QUERY ) );
+ ChartViewHelper::setViewToDirtyState( &m_pImpl->getParent() );
}
sal_Bool SAL_CALL UndoManager::isUndoPossible( )
diff --git a/chart2/source/model/main/UndoManager.hxx b/chart2/source/model/main/UndoManager.hxx
index c599113d45cb..c20dcef6643d 100644
--- a/chart2/source/model/main/UndoManager.hxx
+++ b/chart2/source/model/main/UndoManager.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_UNDOMANAGER_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_UNDOMANAGER_HXX
+#pragma once
#include <com/sun/star/document/XUndoManager.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
@@ -29,6 +28,7 @@
namespace chart
{
+class ChartModel;
namespace impl
{
@@ -41,12 +41,12 @@ namespace chart
class UndoManager : public impl::UndoManager_Base
{
public:
- UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex );
+ UndoManager( ::chart::ChartModel& i_parent, ::osl::Mutex& i_mutex );
virtual ~UndoManager();
// XInterface
- 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;
// XComponent equivalents
void disposing();
@@ -89,6 +89,4 @@ namespace chart
} // namespace chart
-#endif // INCLUDED_CHART2_SOURCE_MODEL_MAIN_UNDOMANAGER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/main/Wall.cxx b/chart2/source/model/main/Wall.cxx
index 5ba8aaf18401..1bbe133de905 100644
--- a/chart2/source/model/main/Wall.cxx
+++ b/chart2/source/model/main/Wall.cxx
@@ -24,7 +24,6 @@
#include <PropertyHelper.hxx>
#include <ModifyListenerHelper.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <tools/diagnose_ex.h>
#include <vector>
#include <algorithm>
@@ -36,69 +35,21 @@ using ::com::sun::star::beans::Property;
namespace
{
-struct StaticWallDefaults_Initializer
+::cppu::OPropertyArrayHelper& StaticWallInfoHelper()
{
- ::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 );
-
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
- }
-};
-
-struct StaticWallDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticWallDefaults_Initializer >
-{
-};
-
-struct StaticWallInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::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 StaticWallInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticWallInfoHelper_Initializer >
-{
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-struct StaticWallInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticWallInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticWallInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticWallInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -107,19 +58,26 @@ namespace chart
{
Wall::Wall() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
Wall::Wall( const Wall & rOther ) :
impl::Wall_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
Wall::~Wall()
{}
+// ____ XTypeProvider ____
+uno::Sequence< css::uno::Type > SAL_CALL Wall::getTypes()
+{
+ return ::comphelper::concatSequences(
+ impl::Wall_Base::getTypes(),
+ ::property::OPropertySet::getTypes());
+}
+
// ____ XCloneable ____
uno::Reference< util::XCloneable > SAL_CALL Wall::createClone()
{
@@ -127,51 +85,47 @@ uno::Reference< util::XCloneable > SAL_CALL Wall::createClone()
}
// ____ OPropertySet ____
-uno::Any Wall::GetDefaultValue( sal_Int32 nHandle ) const
-{
- const tPropertyValueMap& rStaticDefaults = *StaticWallDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
- if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+void Wall::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
+{
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ ::chart::FillProperties::AddDefaultsToMap( aTmp );
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+ return aTmp;
+ }();
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
+ if( aFound == aStaticDefaults.end() )
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL Wall::getInfoHelper()
{
- return *StaticWallInfoHelper::get();
+ return StaticWallInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL Wall::getPropertySetInfo()
{
- return *StaticWallInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticWallInfoHelper() ) );
+ return xPropertySetInfo;
}
// ____ XModifyBroadcaster ____
void SAL_CALL Wall::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL Wall::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
diff --git a/chart2/source/model/main/Wall.hxx b/chart2/source/model/main/Wall.hxx
index a3112a614bda..6cae798959c1 100644
--- a/chart2/source/model/main/Wall.hxx
+++ b/chart2/source/model/main/Wall.hxx
@@ -16,17 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_WALL_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_WALL_HXX
+#pragma once
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <MutexContainer.hxx>
#include <OPropertySet.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
+#include <ModifyListenerHelper.hxx>
namespace chart
{
@@ -41,7 +38,6 @@ typedef ::cppu::WeakImplHelper<
}
class Wall final :
- public MutexContainer,
public impl::Wall_Base,
public ::property::OPropertySet
{
@@ -52,11 +48,13 @@ public:
/// merge XInterface implementations
DECLARE_XINTERFACE()
-private:
explicit Wall( const Wall & rOther );
+ // ____ XTypeProvider ____
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -74,6 +72,7 @@ private:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+private:
// ____ XModifyListener ____
virtual void SAL_CALL modified(
const css::lang::EventObject& aEvent ) override;
@@ -88,12 +87,9 @@ private:
private:
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_MAIN_WALL_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/AreaChartType.cxx b/chart2/source/model/template/AreaChartType.cxx
index 840bdba036d7..b0581ddc8837 100644
--- a/chart2/source/model/template/AreaChartType.cxx
+++ b/chart2/source/model/template/AreaChartType.cxx
@@ -44,6 +44,11 @@ uno::Reference< util::XCloneable > SAL_CALL AreaChartType::createClone()
return uno::Reference< util::XCloneable >( new AreaChartType( *this ));
}
+rtl::Reference< ChartType > AreaChartType::cloneChartType() const
+{
+ return new AreaChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL AreaChartType::getChartType()
{
diff --git a/chart2/source/model/template/AreaChartType.hxx b/chart2/source/model/template/AreaChartType.hxx
index acb76ef106cb..8ca01e1f3afd 100644
--- a/chart2/source/model/template/AreaChartType.hxx
+++ b/chart2/source/model/template/AreaChartType.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_AREACHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_AREACHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
namespace chart
{
@@ -37,6 +36,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit AreaChartType( const AreaChartType & rOther );
@@ -49,7 +50,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_AREACHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx
index 401dc6971dc9..2ffad2a416fc 100644
--- a/chart2/source/model/template/AreaChartTypeTemplate.cxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx
@@ -18,15 +18,15 @@
*/
#include "AreaChartTypeTemplate.hxx"
-#include <servicenames_charttypes.hxx>
-#include <DiagramHelper.hxx>
+#include "AreaChartType.hxx"
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
@@ -54,58 +54,19 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticAreaChartTypeTemplateDefaults_Initializer
+::cppu::OPropertyArrayHelper& StaticAreaChartTypeTemplateInfoHelper()
{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aStaticDefaults, PROP_AREA_TEMPLATE_DIMENSION, 2 );
- return &aStaticDefaults;
- }
-};
-
-struct StaticAreaChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticAreaChartTypeTemplateDefaults_Initializer >
-{
-};
-
-struct StaticAreaChartTypeTemplateInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticAreaChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticAreaChartTypeTemplateInfoHelper_Initializer >
-{
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
-struct StaticAreaChartTypeTemplateInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticAreaChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticAreaChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticAreaChartTypeTemplateInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -120,7 +81,6 @@ AreaChartTypeTemplate::AreaChartTypeTemplate(
StackMode eStackMode,
sal_Int32 nDim /* = 2 */ ) :
ChartTypeTemplate( xContext, rServiceName ),
- ::property::OPropertySet( m_aMutex ),
m_eStackMode( eStackMode )
{
setFastPropertyValue_NoBroadcast( PROP_AREA_TEMPLATE_DIMENSION, uno::Any( nDim ));
@@ -130,24 +90,32 @@ AreaChartTypeTemplate::~AreaChartTypeTemplate()
{}
// ____ OPropertySet ____
-uno::Any AreaChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+void AreaChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticAreaChartTypeTemplateDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
- if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aTmp, PROP_AREA_TEMPLATE_DIMENSION, 2 );
+ return aTmp;
+ }();
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
+ if( aFound == aStaticDefaults.end() )
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL AreaChartTypeTemplate::getInfoHelper()
{
- return *StaticAreaChartTypeTemplateInfoHelper::get();
+ return StaticAreaChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL AreaChartTypeTemplate::getPropertySetInfo()
{
- return *StaticAreaChartTypeTemplateInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticAreaChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
}
sal_Int32 AreaChartTypeTemplate::getDimension() const
@@ -172,59 +140,41 @@ StackMode AreaChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ )
return m_eStackMode;
}
-// ____ XChartTypeTemplate ____
-void SAL_CALL AreaChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+// ____ ChartTypeTemplate ____
+void AreaChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) );
}
-void SAL_CALL AreaChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram >& xDiagram )
+void AreaChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
- ChartTypeTemplate::resetStyles( xDiagram );
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ ChartTypeTemplate::resetStyles2( xDiagram );
+ std::vector< rtl::Reference< ::chart::DataSeries > > aSeriesVec(
+ xDiagram->getDataSeries());
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY);
- if( xState.is() &&
- xProp.is() &&
- xProp->getPropertyValue( "BorderStyle") == aLineStyleAny )
+ if( series->getPropertyValue( "BorderStyle") == aLineStyleAny )
{
- xState->setPropertyToDefault( "BorderStyle");
+ series->setPropertyToDefault( "BorderStyle");
}
}
}
-Reference< chart2::XChartType > AreaChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > AreaChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
-
- try
- {
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_AREA ), uno::UNO_QUERY_THROW );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
+ return new AreaChartType();
}
-Reference< chart2::XChartType > SAL_CALL AreaChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > AreaChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) );
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
return xResult;
}
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.hxx b/chart2/source/model/template/AreaChartTypeTemplate.hxx
index e56be9833937..76a5bfd4c890 100644
--- a/chart2/source/model/template/AreaChartTypeTemplate.hxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.hxx
@@ -16,21 +16,18 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_AREACHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_AREACHARTTYPETEMPLATE_HXX
+#pragma once
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <StackMode.hxx>
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
#include <comphelper/uno3.hxx>
namespace chart
{
class AreaChartTypeTemplate :
- public MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
@@ -49,27 +46,27 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
- // ____ XChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ // ____ ChartTypeTemplate ____
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
- virtual void SAL_CALL resetStyles(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override;
+ virtual void resetStyles2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
@@ -80,7 +77,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_AREACHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/BarChartType.cxx b/chart2/source/model/template/BarChartType.cxx
index 87675e3f140d..2a94db82ba2a 100644
--- a/chart2/source/model/template/BarChartType.cxx
+++ b/chart2/source/model/template/BarChartType.cxx
@@ -45,6 +45,11 @@ uno::Reference< util::XCloneable > SAL_CALL BarChartType::createClone()
return uno::Reference< util::XCloneable >( new BarChartType( *this ));
}
+rtl::Reference< ChartType > BarChartType::cloneChartType() const
+{
+ return new BarChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL BarChartType::getChartType()
{
@@ -53,11 +58,7 @@ OUString SAL_CALL BarChartType::getChartType()
uno::Sequence< OUString > BarChartType::getSupportedPropertyRoles()
{
- uno::Sequence< OUString > aPropRoles(2);
- aPropRoles[0] = "FillColor";
- aPropRoles[1] = "BorderColor";
-
- return aPropRoles;
+ return { "FillColor", "BorderColor" };
}
OUString SAL_CALL BarChartType::getImplementationName()
diff --git a/chart2/source/model/template/BarChartType.hxx b/chart2/source/model/template/BarChartType.hxx
index 4d090c783ebb..cceaf05777f0 100644
--- a/chart2/source/model/template/BarChartType.hxx
+++ b/chart2/source/model/template/BarChartType.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BARCHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BARCHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
namespace chart
{
@@ -37,6 +36,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit BarChartType( const BarChartType & rOther );
@@ -51,7 +52,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BARCHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx
index dce1ffbb09d9..2b649ec43364 100644
--- a/chart2/source/model/template/BarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.cxx
@@ -18,17 +18,16 @@
*/
#include "BarChartTypeTemplate.hxx"
-#include <DiagramHelper.hxx>
-#include <servicenames_charttypes.hxx>
+#include "ColumnChartType.hxx"
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
@@ -62,64 +61,19 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticBarChartTypeTemplateDefaults_Initializer
+::cppu::OPropertyArrayHelper& StaticBarChartTypeTemplateInfoHelper()
{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_BAR_TEMPLATE_DIMENSION, 2 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BAR_TEMPLATE_GEOMETRY3D, ::chart2::DataPointGeometry3D::CUBOID );
- }
-};
-
-struct StaticBarChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBarChartTypeTemplateDefaults_Initializer >
-{
-};
-
-struct StaticBarChartTypeTemplateInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticBarChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBarChartTypeTemplateInfoHelper_Initializer >
-{
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
-struct StaticBarChartTypeTemplateInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBarChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticBarChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBarChartTypeTemplateInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -135,7 +89,6 @@ BarChartTypeTemplate::BarChartTypeTemplate(
BarDirection eDirection,
sal_Int32 nDim /* = 2 */ ) :
ChartTypeTemplate( xContext, rServiceName ),
- ::property::OPropertySet( m_aMutex ),
m_eStackMode( eStackMode ),
m_eBarDirection( eDirection ),
m_nDim( nDim )
@@ -159,19 +112,19 @@ bool BarChartTypeTemplate::isSwapXAndY() const
return (m_eBarDirection == HORIZONTAL);
}
-// ____ XChartTypeTemplate ____
-sal_Bool SAL_CALL BarChartTypeTemplate::matchesTemplate(
- const Reference< chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties )
+// ____ ChartTypeTemplate ____
+bool BarChartTypeTemplate::matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties )
{
- bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+ bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties );
//check BarDirection
if( bResult )
{
bool bFound = false;
bool bAmbiguous = false;
- bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ bool bVertical = xDiagram->getVertical( bFound, bAmbiguous );
if( m_eBarDirection == HORIZONTAL )
bResult = bVertical;
else if( m_eBarDirection == VERTICAL )
@@ -185,7 +138,7 @@ sal_Bool SAL_CALL BarChartTypeTemplate::matchesTemplate(
{
bool bGeomFound = false, bGeomAmbiguous = false;
- sal_Int32 aCommonGeom = DiagramHelper::getGeometry3D( xDiagram, bGeomFound, bGeomAmbiguous );
+ sal_Int32 aCommonGeom = xDiagram->getGeometry3D( bGeomFound, bGeomAmbiguous );
if( !bGeomAmbiguous )
{
@@ -196,61 +149,57 @@ sal_Bool SAL_CALL BarChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > BarChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
-{
- Reference< chart2::XChartType > xResult;
-
- try
- {
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- return xResult;
+rtl::Reference< ChartType > BarChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+{
+ return new ColumnChartType();
}
-Reference< chart2::XChartType > SAL_CALL BarChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > BarChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) );
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
return xResult;
}
// ____ OPropertySet ____
-uno::Any BarChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+void BarChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticBarChartTypeTemplateDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
- if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ static ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aTmp, PROP_BAR_TEMPLATE_DIMENSION, 2 );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_BAR_TEMPLATE_GEOMETRY3D, ::chart2::DataPointGeometry3D::CUBOID );
+ return aTmp;
+ }();
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
+ if( aFound == aStaticDefaults.end() )
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL BarChartTypeTemplate::getInfoHelper()
{
- return *StaticBarChartTypeTemplateInfoHelper::get();
+ return StaticBarChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL BarChartTypeTemplate::getPropertySetInfo()
{
- return *StaticBarChartTypeTemplateInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticBarChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
}
-void SAL_CALL BarChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void BarChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) );
if( getDimension() != 3 )
return;
@@ -268,39 +217,32 @@ void SAL_CALL BarChartTypeTemplate::applyStyle(
}
}
-void SAL_CALL BarChartTypeTemplate::resetStyles(
- const Reference< chart2::XDiagram >& xDiagram )
+void BarChartTypeTemplate::resetStyles2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram )
{
- ChartTypeTemplate::resetStyles( xDiagram );
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ ChartTypeTemplate::resetStyles2( xDiagram );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec(
+ xDiagram->getDataSeries());
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
- if( xState.is())
+ if( getDimension() == 3 )
+ series->setPropertyToDefault( "Geometry3D");
+ if( series->getPropertyValue( "BorderStyle") == aLineStyleAny )
{
- if( getDimension() == 3 )
- xState->setPropertyToDefault( "Geometry3D");
- Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY );
- if( xProp.is() &&
- xProp->getPropertyValue( "BorderStyle") == aLineStyleAny )
- {
- xState->setPropertyToDefault( "BorderStyle");
- }
+ series->setPropertyToDefault( "BorderStyle");
}
}
- DiagramHelper::setVertical( xDiagram, false );
+ xDiagram->setVertical( false );
}
void BarChartTypeTemplate::createCoordinateSystems(
- const Reference< chart2::XCoordinateSystemContainer > & xCooSysCnt )
+ const rtl::Reference< ::chart::Diagram > & xDiagram )
{
- ChartTypeTemplate::createCoordinateSystems( xCooSysCnt );
+ ChartTypeTemplate::createCoordinateSystems( xDiagram );
- Reference< chart2::XDiagram > xDiagram( xCooSysCnt, uno::UNO_QUERY );
- DiagramHelper::setVertical( xDiagram, m_eBarDirection == HORIZONTAL );
+ xDiagram->setVertical( m_eBarDirection == HORIZONTAL );
}
IMPLEMENT_FORWARD_XINTERFACE2( BarChartTypeTemplate, ChartTypeTemplate, OPropertySet )
diff --git a/chart2/source/model/template/BarChartTypeTemplate.hxx b/chart2/source/model/template/BarChartTypeTemplate.hxx
index 593a1f7fecdd..ab56869e71cd 100644
--- a/chart2/source/model/template/BarChartTypeTemplate.hxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.hxx
@@ -16,21 +16,18 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BARCHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BARCHARTTYPETEMPLATE_HXX
+#pragma once
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
#include <comphelper/uno3.hxx>
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <StackMode.hxx>
namespace chart
{
class BarChartTypeTemplate :
- public MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
@@ -56,37 +53,35 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
- // ____ XChartTypeTemplate ____
- virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ // ____ ChartTypeTemplate ____
+ virtual bool matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
- virtual void SAL_CALL resetStyles(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override;
-
- // ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual void resetStyles2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram ) override;
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
virtual bool isSwapXAndY() const override;
virtual void createCoordinateSystems(
- const css::uno::Reference< css::chart2::XCoordinateSystemContainer > & xCooSysCnt ) override;
+ const rtl::Reference< ::chart::Diagram > & xDiagram ) override;
private:
StackMode m_eStackMode;
@@ -96,7 +91,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BARCHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx
index 4abdbb826467..bd8bf287d96a 100644
--- a/chart2/source/model/template/BubbleChartType.cxx
+++ b/chart2/source/model/template/BubbleChartType.cxx
@@ -21,6 +21,7 @@
#include <PropertyHelper.hxx>
#include <servicenames_charttypes.hxx>
#include <CartesianCoordinateSystem.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <AxisIndexDefines.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
@@ -35,55 +36,16 @@ using ::com::sun::star::uno::Reference;
namespace
{
-struct StaticBubbleChartTypeDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- return &aStaticDefaults;
- }
-};
-
-struct StaticBubbleChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBubbleChartTypeDefaults_Initializer >
-{
-};
-
-struct StaticBubbleChartTypeInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticBubbleChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBubbleChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticBubbleChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBubbleChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticBubbleChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBubbleChartTypeInfo_Initializer >
+::cppu::OPropertyArrayHelper& StaticBubbleChartTypeInfoHelper()
{
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -109,16 +71,21 @@ uno::Reference< util::XCloneable > SAL_CALL BubbleChartType::createClone()
return uno::Reference< util::XCloneable >( new BubbleChartType( *this ));
}
+rtl::Reference< ChartType > BubbleChartType::cloneChartType() const
+{
+ return new BubbleChartType( *this );
+}
+
// ____ XChartType ____
-Reference< chart2::XCoordinateSystem > SAL_CALL
- BubbleChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+rtl::Reference< ::chart::BaseCoordinateSystem >
+ BubbleChartType::createCoordinateSystem2( sal_Int32 DimensionCount )
{
- Reference< chart2::XCoordinateSystem > xResult(
- new CartesianCoordinateSystem( DimensionCount ));
+ rtl::Reference< CartesianCoordinateSystem > xResult =
+ new CartesianCoordinateSystem( DimensionCount );
for( sal_Int32 i=0; i<DimensionCount; ++i )
{
- Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( i, MAIN_AXIS_INDEX );
if( !xAxis.is() )
{
OSL_FAIL("a created coordinate system should have an axis for each dimension");
@@ -147,20 +114,12 @@ OUString SAL_CALL BubbleChartType::getChartType()
uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
{
- uno::Sequence< OUString > aMandRolesSeq(4);
- aMandRolesSeq[0] = "label";
- aMandRolesSeq[1] = "values-x";
- aMandRolesSeq[2] = "values-y";
- aMandRolesSeq[3] = "values-size";
- return aMandRolesSeq;
+ return { "label", "values-x", "values-y", "values-size" };
}
uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedPropertyRoles()
{
- uno::Sequence< OUString > aPropertyRoles(2);
- aPropertyRoles[0] = "FillColor";
- aPropertyRoles[1] = "BorderColor";
- return aPropertyRoles;
+ return { "FillColor", "BorderColor" };
}
OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
@@ -169,25 +128,28 @@ OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
}
// ____ OPropertySet ____
-uno::Any BubbleChartType::GetDefaultValue( sal_Int32 nHandle ) const
-{
- const tPropertyValueMap& rStaticDefaults = *StaticBubbleChartTypeDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
- if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+void BubbleChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
+{
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
+ if( aFound == aStaticDefaults.end() )
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartType::getInfoHelper()
{
- return *StaticBubbleChartTypeInfoHelper::get();
+ return StaticBubbleChartTypeInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL BubbleChartType::getPropertySetInfo()
{
- return *StaticBubbleChartTypeInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticBubbleChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
}
OUString SAL_CALL BubbleChartType::getImplementationName()
diff --git a/chart2/source/model/template/BubbleChartType.hxx b/chart2/source/model/template/BubbleChartType.hxx
index e37a01ac25e1..a2afa7e6941d 100644
--- a/chart2/source/model/template/BubbleChartType.hxx
+++ b/chart2/source/model/template/BubbleChartType.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLECHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLECHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
namespace chart
{
@@ -37,6 +36,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit BubbleChartType( const BubbleChartType & rOther );
@@ -46,12 +47,10 @@ private:
getSupportedMandatoryRoles() override;
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedPropertyRoles() override;
- virtual css::uno::Reference< css::chart2::XCoordinateSystem > SAL_CALL
- createCoordinateSystem( ::sal_Int32 DimensionCount ) override;
virtual OUString SAL_CALL getRoleOfSequenceForSeriesLabel() override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -62,11 +61,11 @@ private:
// ____ XCloneable ____
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+
+ virtual rtl::Reference< ::chart::BaseCoordinateSystem >
+ createCoordinateSystem2( sal_Int32 DimensionCount ) override;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLECHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
index 90ec1a75db21..55f39ef0669b 100644
--- a/chart2/source/model/template/BubbleChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
@@ -18,14 +18,14 @@
*/
#include "BubbleChartTypeTemplate.hxx"
+#include "BubbleChartType.hxx"
#include "BubbleDataInterpreter.hxx"
-#include <servicenames_charttypes.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <PropertyHelper.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
@@ -38,56 +38,16 @@ using ::com::sun::star::beans::Property;
namespace
{
-struct StaticBubbleChartTypeTemplateDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- return &aStaticDefaults;
- }
-};
-
-struct StaticBubbleChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBubbleChartTypeTemplateDefaults_Initializer >
-{
-};
-
-struct StaticBubbleChartTypeTemplateInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticBubbleChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBubbleChartTypeTemplateInfoHelper_Initializer >
-{
-};
-
-struct StaticBubbleChartTypeTemplateInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBubbleChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticBubbleChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBubbleChartTypeTemplateInfo_Initializer >
+::cppu::OPropertyArrayHelper & StaticBubbleChartTypeTemplateInfoHelper()
{
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -99,8 +59,7 @@ BubbleChartTypeTemplate::BubbleChartTypeTemplate(
Reference<
uno::XComponentContext > const & xContext,
const OUString & rServiceName ) :
- ChartTypeTemplate( xContext, rServiceName ),
- ::property::OPropertySet( m_aMutex )
+ ChartTypeTemplate( xContext, rServiceName )
{
}
@@ -108,24 +67,27 @@ BubbleChartTypeTemplate::~BubbleChartTypeTemplate()
{}
// ____ OPropertySet ____
-uno::Any BubbleChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
-{
- const tPropertyValueMap& rStaticDefaults = *StaticBubbleChartTypeTemplateDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
- if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+void BubbleChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
+{
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
+ if( aFound == aStaticDefaults.end() )
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartTypeTemplate::getInfoHelper()
{
- return *StaticBubbleChartTypeTemplateInfoHelper::get();
+ return StaticBubbleChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL BubbleChartTypeTemplate::getPropertySetInfo()
{
- return *StaticBubbleChartTypeTemplateInfo::get();
+ static const uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticBubbleChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
}
sal_Int32 BubbleChartTypeTemplate::getDimension() const
@@ -138,13 +100,13 @@ StackMode BubbleChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */
return StackMode::NONE;
}
-void SAL_CALL BubbleChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void BubbleChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) );
}
@@ -154,36 +116,19 @@ sal_Bool SAL_CALL BubbleChartTypeTemplate::supportsCategories()
return false;
}
-Reference< chart2::XChartType > BubbleChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > BubbleChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
-
- try
- {
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
+ return new BubbleChartType();
}
-Reference< chart2::XChartType > SAL_CALL BubbleChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > BubbleChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
+ xResult = new BubbleChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
}
@@ -195,7 +140,7 @@ Reference< chart2::XChartType > SAL_CALL BubbleChartTypeTemplate::getChartTypeFo
return xResult;
}
-Reference< chart2::XDataInterpreter > SAL_CALL BubbleChartTypeTemplate::getDataInterpreter()
+rtl::Reference< DataInterpreter > BubbleChartTypeTemplate::getDataInterpreter2()
{
if( ! m_xDataInterpreter.is())
m_xDataInterpreter.set( new BubbleDataInterpreter );
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.hxx b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
index b771d6f57545..8a59e5e72817 100644
--- a/chart2/source/model/template/BubbleChartTypeTemplate.hxx
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
@@ -16,19 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLECHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLECHARTTYPETEMPLATE_HXX
+#pragma once
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
#include <comphelper/uno3.hxx>
namespace chart
{
class BubbleChartTypeTemplate :
- public MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
@@ -45,26 +42,27 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
- // ____ XChartTypeTemplate ____
+ // ____ ChartTypeTemplate ____
virtual sal_Bool SAL_CALL supportsCategories() override;
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual css::uno::Reference< css::chart2::XDataInterpreter > SAL_CALL getDataInterpreter() override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
@@ -72,7 +70,4 @@ protected:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLECHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx
index 3078d3590a42..bb468fd9723d 100644
--- a/chart2/source/model/template/BubbleDataInterpreter.cxx
+++ b/chart2/source/model/template/BubbleDataInterpreter.cxx
@@ -17,17 +17,19 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstddef>
+
#include "BubbleDataInterpreter.hxx"
#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <CommonConverters.hxx>
-#include <com/sun/star/chart2/data/XDataSink.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-using namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -35,8 +37,7 @@ using ::com::sun::star::uno::Sequence;
namespace chart
{
-BubbleDataInterpreter::BubbleDataInterpreter() :
- DataInterpreter()
+BubbleDataInterpreter::BubbleDataInterpreter()
{
}
@@ -45,25 +46,25 @@ BubbleDataInterpreter::~BubbleDataInterpreter()
}
// ____ XDataInterpreter ____
-chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
+InterpretedData BubbleDataInterpreter::interpretDataSource(
const Reference< chart2::data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& aArguments,
- const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ const std::vector< rtl::Reference< DataSeries > >& aSeriesToReUse )
{
if( ! xSource.is())
return InterpretedData();
- Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aData = DataInterpreter::getDataSequences(xSource);
- Reference< data::XLabeledDataSequence > xValuesX;
- vector< Reference< data::XLabeledDataSequence > > aYValuesVector;
- vector< Reference< data::XLabeledDataSequence > > aSizeValuesVector;
+ uno::Reference< chart2::data::XLabeledDataSequence > xValuesX;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aYValuesVector;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSizeValuesVector;
- Reference< data::XLabeledDataSequence > xCategories;
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories;
bool bHasCategories = HasCategories( aArguments, aData );
bool bUseCategoriesAsX = UseCategoriesAsX( aArguments );
- sal_Int32 nDataSeqCount = aData.getLength();
+ sal_Int32 nDataSeqCount = aData.size();
bool bSetXValues = bHasCategories ? ( (nDataSeqCount-1) > 2 && (nDataSeqCount-1) % 2 != 0 )
:( nDataSeqCount > 2 && nDataSeqCount % 2 != 0 );
@@ -76,7 +77,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
{
if( bHasCategories && !bCategoriesUsed )
{
- xCategories.set( aData[nDataIdx] );
+ xCategories = aData[nDataIdx];
if( xCategories.is())
{
SetRole( xCategories->getValues(), "categories");
@@ -90,7 +91,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
}
else if( !xValuesX.is() && bSetXValues )
{
- xValuesX.set( aData[nDataIdx] );
+ xValuesX = aData[nDataIdx];
if( xValuesX.is())
SetRole( xValuesX->getValues(), "values-x");
}
@@ -116,8 +117,8 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
}
// create DataSeries
- sal_Int32 nSeriesIndex = 0;
- vector< Reference< XDataSeries > > aSeriesVec;
+ std::size_t nSeriesIndex = 0;
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec;
aSeriesVec.reserve( aSizeValuesVector.size());
Reference< data::XLabeledDataSequence > xClonedXValues = xValuesX;
@@ -125,7 +126,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
for( size_t nN = 0; nN < aSizeValuesVector.size(); ++nN, ++nSeriesIndex )
{
- vector< Reference< data::XLabeledDataSequence > > aNewData;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aNewData;
if( xValuesX.is() )
{
if( nN > 0 && xCloneableX.is() )
@@ -136,53 +137,48 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
aNewData.push_back( aYValuesVector[nN] );
aNewData.push_back(aSizeValuesVector[nN]);
- Reference< XDataSeries > xSeries;
- if( nSeriesIndex < aSeriesToReUse.getLength())
- xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ rtl::Reference< DataSeries > xSeries;
+ if( nSeriesIndex < aSeriesToReUse.size())
+ xSeries = aSeriesToReUse[nSeriesIndex];
else
- xSeries.set( new DataSeries );
- OSL_ASSERT( xSeries.is() );
- Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
- OSL_ASSERT( xSink.is() );
- xSink->setData( comphelper::containerToSequence( aNewData ) );
+ xSeries = new DataSeries;
+ assert( xSeries.is() );
+ xSeries->setData( aNewData );
aSeriesVec.push_back( xSeries );
}
- Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
- aSeries[0] = comphelper::containerToSequence( aSeriesVec );
- return InterpretedData( aSeries, xCategories );
+ return { { aSeriesVec }, xCategories };
}
-chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
- const chart2::InterpretedData& aInterpretedData )
+InterpretedData BubbleDataInterpreter::reinterpretDataSeries(
+ const InterpretedData& aInterpretedData )
{
InterpretedData aResult( aInterpretedData );
sal_Int32 i=0;
- Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
- const sal_Int32 nCount = aSeries.getLength();
+ std::vector< rtl::Reference< DataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ const sal_Int32 nCount = aSeries.size();
for( ; i<nCount; ++i )
{
try
{
- Reference< data::XDataSource > xSeriesSource( aSeries[i], uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aNewSequences;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aNewSequences;
- Reference< data::XLabeledDataSequence > xValuesSize(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, "values-size" ));
- Reference< data::XLabeledDataSequence > xValuesY(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, "values-y" ));
- Reference< data::XLabeledDataSequence > xValuesX(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, "values-x" ));
+ uno::Reference< chart2::data::XLabeledDataSequence > xValuesSize(
+ DataSeriesHelper::getDataSequenceByRole( aSeries[i], "values-size" ));
+ uno::Reference< chart2::data::XLabeledDataSequence > xValuesY(
+ DataSeriesHelper::getDataSequenceByRole( aSeries[i], "values-y" ));
+ uno::Reference< chart2::data::XLabeledDataSequence > xValuesX(
+ DataSeriesHelper::getDataSequenceByRole( aSeries[i], "values-x" ));
if( ! xValuesX.is() ||
! xValuesY.is() ||
! xValuesSize.is() )
{
- vector< Reference< data::XLabeledDataSequence > > aValueSeqVec(
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aValueSeqVec(
DataSeriesHelper::getAllDataSequencesByRole(
- xSeriesSource->getDataSequences(), "values" ));
+ aSeries[i]->getDataSequences2(), "values" ));
if( xValuesX.is())
aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesX ));
if( xValuesY.is())
@@ -195,7 +191,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
if( ! xValuesSize.is() &&
aValueSeqVec.size() > nIndex )
{
- xValuesSize.set( aValueSeqVec[nIndex++] );
+ xValuesSize = aValueSeqVec[nIndex++];
if( xValuesSize.is())
SetRole( xValuesSize->getValues(), "values-size");
}
@@ -203,7 +199,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
if( ! xValuesY.is() &&
aValueSeqVec.size() > nIndex )
{
- xValuesY.set( aValueSeqVec[nIndex++] );
+ xValuesY = aValueSeqVec[nIndex++];
if( xValuesY.is())
SetRole( xValuesY->getValues(), "values-y");
}
@@ -211,7 +207,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
if( ! xValuesX.is() &&
aValueSeqVec.size() > nIndex )
{
- xValuesX.set( aValueSeqVec[nIndex++] );
+ xValuesX = aValueSeqVec[nIndex++];
if( xValuesX.is())
SetRole( xValuesY->getValues(), "values-x");
}
@@ -222,27 +218,21 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
{
if( xValuesX.is() )
{
- aNewSequences.realloc(3);
- aNewSequences[0] = xValuesX;
- aNewSequences[1] = xValuesY;
- aNewSequences[2] = xValuesSize;
+ aNewSequences = { xValuesX, xValuesY, xValuesSize };
}
else
{
- aNewSequences.realloc(2);
- aNewSequences[0] = xValuesY;
- aNewSequences[1] = xValuesSize;
+ aNewSequences = { xValuesY, xValuesSize };
}
}
else
{
- aNewSequences.realloc(1);
- aNewSequences[0] = xValuesSize;
+ aNewSequences = { xValuesSize };
}
}
- const Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences());
- if( aSeqs.getLength() != aNewSequences.getLength() )
+ const std::vector< uno::Reference< data::XLabeledDataSequence > > & aSeqs = aSeries[i]->getDataSequences2();
+ if( aSeqs.size() != aNewSequences.size() )
{
#if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
for( auto const & j : aSeqs )
@@ -250,8 +240,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
assert( (j == xValuesY || j == xValuesX || j == xValuesSize) && "All sequences should be used" );
}
#endif
- Reference< data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY_THROW );
- xSink->setData( aNewSequences );
+ aSeries[i]->setData( aNewSequences );
}
}
catch( const uno::Exception & )
@@ -263,17 +252,15 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
return aResult;
}
-sal_Bool SAL_CALL BubbleDataInterpreter::isDataCompatible(
- const chart2::InterpretedData& aInterpretedData )
+bool BubbleDataInterpreter::isDataCompatible(
+ const InterpretedData& aInterpretedData )
{
- const Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
- for( Reference< XDataSeries > const & dataSeries : aSeries )
+ const std::vector< rtl::Reference< DataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ for( rtl::Reference< DataSeries > const & dataSeries : aSeries )
{
try
{
- Reference< data::XDataSource > xSrc( dataSeries, uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
- if( aSeq.getLength() != 3 )
+ if( dataSeries->getDataSequences2().size() != 3 )
return false;
}
catch( const uno::Exception & )
diff --git a/chart2/source/model/template/BubbleDataInterpreter.hxx b/chart2/source/model/template/BubbleDataInterpreter.hxx
index 43921262ed2a..ff4b56de615a 100644
--- a/chart2/source/model/template/BubbleDataInterpreter.hxx
+++ b/chart2/source/model/template/BubbleDataInterpreter.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLEDATAINTERPRETER_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLEDATAINTERPRETER_HXX
+#pragma once
-#include "DataInterpreter.hxx"
+#include <DataInterpreter.hxx>
namespace chart
{
@@ -31,20 +30,17 @@ public:
virtual ~BubbleDataInterpreter() override;
protected:
- // ____ XDataInterpreter ____
- virtual css::chart2::InterpretedData SAL_CALL interpretDataSource(
+ // ____ DataInterpreter ____
+ virtual InterpretedData interpretDataSource(
const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aSeriesToReUse ) override;
- virtual css::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
- const css::chart2::InterpretedData& aInterpretedData ) override;
- virtual sal_Bool SAL_CALL isDataCompatible(
- const css::chart2::InterpretedData& aInterpretedData ) override;
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& aSeriesToReUse ) override;
+ virtual InterpretedData reinterpretDataSeries(
+ const InterpretedData& aInterpretedData ) override;
+ virtual bool isDataCompatible(
+ const InterpretedData& aInterpretedData ) override;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_BUBBLEDATAINTERPRETER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/CandleStickChartType.cxx b/chart2/source/model/template/CandleStickChartType.cxx
index af0c1f04f52b..247a68406808 100644
--- a/chart2/source/model/template/CandleStickChartType.cxx
+++ b/chart2/source/model/template/CandleStickChartType.cxx
@@ -24,7 +24,7 @@
#include <servicenames_charttypes.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace com::sun::star::uno { class XComponentContext; }
@@ -79,66 +79,17 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticCandleStickChartTypeDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- // must match default in CTOR!
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_JAPANESE, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_SHOW_FIRST, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW, true );
- }
-};
-
-struct StaticCandleStickChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticCandleStickChartTypeDefaults_Initializer >
-{
-};
-
-struct StaticCandleStickChartTypeInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticCandleStickChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticCandleStickChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticCandleStickChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticCandleStickChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticCandleStickChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticCandleStickChartTypeInfo_Initializer >
+::cppu::OPropertyArrayHelper& StaticCandleStickChartTypeInfoHelper()
{
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -206,6 +157,11 @@ uno::Reference< util::XCloneable > SAL_CALL CandleStickChartType::createClone()
return uno::Reference< util::XCloneable >( new CandleStickChartType( *this ));
}
+rtl::Reference< ChartType > CandleStickChartType::cloneChartType() const
+{
+ return new CandleStickChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL CandleStickChartType::getChartType()
{
@@ -263,25 +219,36 @@ OUString SAL_CALL CandleStickChartType::getRoleOfSequenceForSeriesLabel()
}
// ____ OPropertySet ____
-uno::Any CandleStickChartType::GetDefaultValue( sal_Int32 nHandle ) const
+void CandleStickChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticCandleStickChartTypeDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
- if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ static const ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ // must match default in CTOR!
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_CANDLESTICKCHARTTYPE_JAPANESE, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_CANDLESTICKCHARTTYPE_SHOW_FIRST, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW, true );
+ return aTmp;
+ }();
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
+ if( aFound == aStaticDefaults.end() )
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL CandleStickChartType::getInfoHelper()
{
- return *StaticCandleStickChartTypeInfoHelper::get();
+ return StaticCandleStickChartTypeInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL CandleStickChartType::getPropertySetInfo()
{
- return *StaticCandleStickChartTypeInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticCandleStickChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
}
void SAL_CALL CandleStickChartType::setFastPropertyValue_NoBroadcast(
diff --git a/chart2/source/model/template/CandleStickChartType.hxx b/chart2/source/model/template/CandleStickChartType.hxx
index b3f8d37ec306..822422aac85f 100644
--- a/chart2/source/model/template/CandleStickChartType.hxx
+++ b/chart2/source/model/template/CandleStickChartType.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CANDLESTICKCHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CANDLESTICKCHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
namespace chart
{
@@ -37,6 +36,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit CandleStickChartType( const CandleStickChartType & rOther );
@@ -49,7 +50,7 @@ private:
virtual OUString SAL_CALL getRoleOfSequenceForSeriesLabel() override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -69,7 +70,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_CANDLESTICKCHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx
index 999f7c1ede96..9448a766071c 100644
--- a/chart2/source/model/template/ChartType.cxx
+++ b/chart2/source/model/template/ChartType.cxx
@@ -17,16 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "ChartType.hxx"
+#include <ChartType.hxx>
#include <CartesianCoordinateSystem.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <CloneHelper.hxx>
#include <AxisIndexDefines.hxx>
#include <ModifyListenerHelper.hxx>
+#include <DataSeries.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
@@ -38,20 +40,19 @@ namespace chart
{
ChartType::ChartType() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_bNotifyChanges( true )
{}
ChartType::ChartType( const ChartType & rOther ) :
impl::ChartType_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_bNotifyChanges( true )
{
{
SolarMutexGuard g; // access to rOther.m_aDataSeries
- CloneHelper::CloneRefVector<css::chart2::XDataSeries>(
+ CloneHelper::CloneRefVector(
rOther.m_aDataSeries, m_aDataSeries);
}
ModifyListenerHelper::addListenerToAllElements( m_aDataSeries, m_xModifyEventForwarder );
@@ -67,12 +68,18 @@ ChartType::~ChartType()
Reference< chart2::XCoordinateSystem > SAL_CALL
ChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
{
- Reference< chart2::XCoordinateSystem > xResult(
- new CartesianCoordinateSystem( DimensionCount ));
+ return createCoordinateSystem2(DimensionCount);
+}
+
+rtl::Reference< BaseCoordinateSystem >
+ ChartType::createCoordinateSystem2( ::sal_Int32 DimensionCount )
+{
+ rtl::Reference< CartesianCoordinateSystem > xResult =
+ new CartesianCoordinateSystem( DimensionCount );
for( sal_Int32 i=0; i<DimensionCount; ++i )
{
- Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( i, MAIN_AXIS_INDEX );
if( !xAxis.is() )
{
OSL_FAIL("a created coordinate system should have an axis for each dimension");
@@ -98,10 +105,7 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
Sequence< OUString > SAL_CALL ChartType::getSupportedMandatoryRoles()
{
- Sequence< OUString > aDefaultSeq(2);
- aDefaultSeq[0] = "label";
- aDefaultSeq[1] = "values-y";
- return aDefaultSeq;
+ return { "label", "values-y" };
}
Sequence< OUString > SAL_CALL ChartType::getSupportedOptionalRoles()
@@ -120,11 +124,11 @@ OUString SAL_CALL ChartType::getRoleOfSequenceForSeriesLabel()
}
void ChartType::impl_addDataSeriesWithoutNotification(
- const Reference< chart2::XDataSeries >& xDataSeries )
+ const rtl::Reference< DataSeries >& xDataSeries )
{
if( std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xDataSeries )
!= m_aDataSeries.end())
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException("dataseries not found", static_cast<cppu::OWeakObject*>(this), 1);
m_aDataSeries.push_back( xDataSeries );
ModifyListenerHelper::addListener( xDataSeries, m_xModifyEventForwarder );
@@ -133,6 +137,13 @@ void ChartType::impl_addDataSeriesWithoutNotification(
// ____ XDataSeriesContainer ____
void SAL_CALL ChartType::addDataSeries( const Reference< chart2::XDataSeries >& xDataSeries )
{
+ rtl::Reference<DataSeries> xTmp = dynamic_cast<DataSeries*>(xDataSeries.get());
+ assert(xTmp);
+ addDataSeries(xTmp);
+}
+
+void ChartType::addDataSeries( const rtl::Reference< DataSeries >& xDataSeries )
+{
SolarMutexGuard g;
impl_addDataSeriesWithoutNotification( xDataSeries );
@@ -141,13 +152,19 @@ void SAL_CALL ChartType::addDataSeries( const Reference< chart2::XDataSeries >&
void SAL_CALL ChartType::removeDataSeries( const Reference< chart2::XDataSeries >& xDataSeries )
{
+ rtl::Reference<DataSeries> xTmp = dynamic_cast<DataSeries*>(xDataSeries.get());
+ assert(xTmp);
+ removeDataSeries(xTmp);
+}
+
+void ChartType::removeDataSeries( const rtl::Reference< DataSeries >& xDataSeries )
+{
if( !xDataSeries.is())
throw container::NoSuchElementException();
SolarMutexGuard g;
- tDataSeriesContainerType::iterator aIt(
- std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xDataSeries ) );
+ auto aIt = std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xDataSeries );
if( aIt == m_aDataSeries.end())
throw container::NoSuchElementException(
@@ -163,18 +180,29 @@ Sequence< Reference< chart2::XDataSeries > > SAL_CALL ChartType::getDataSeries()
{
SolarMutexGuard g;
- return comphelper::containerToSequence( m_aDataSeries );
+ return comphelper::containerToSequence< Reference< chart2::XDataSeries > >( m_aDataSeries );
}
void SAL_CALL ChartType::setDataSeries( const Sequence< Reference< chart2::XDataSeries > >& aDataSeries )
{
+ std::vector< rtl::Reference<DataSeries> > aTmp;
+ for (auto const & i : aDataSeries)
+ {
+ auto p = dynamic_cast<DataSeries*>(i.get());
+ assert(p);
+ aTmp.push_back(p);
+ }
+ setDataSeries(aTmp);
+}
+
+void ChartType::setDataSeries( const std::vector< rtl::Reference< DataSeries > >& aDataSeries )
+{
SolarMutexGuard g;
m_bNotifyChanges = false;
try
{
- const Sequence< Reference< chart2::XDataSeries > > aOldSeries( getDataSeries() );
- for( auto const & i : aOldSeries )
+ for( auto const & i : m_aDataSeries )
ModifyListenerHelper::removeListener( i, m_xModifyEventForwarder );
m_aDataSeries.clear();
@@ -191,39 +219,18 @@ void SAL_CALL ChartType::setDataSeries( const Sequence< Reference< chart2::XData
}
// ____ OPropertySet ____
-uno::Any ChartType::GetDefaultValue( sal_Int32 /* nHandle */ ) const
+void ChartType::GetDefaultValue( sal_Int32 /* nHandle */, uno::Any& rAny ) const
{
- return uno::Any();
+ rAny.clear();
}
namespace
{
-struct StaticChartTypeInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( Sequence< beans::Property >{} );
- return &aPropHelper;
- }
-};
-
-struct StaticChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticChartTypeInfo_Initializer >
+::cppu::OPropertyArrayHelper& StaticChartTypeInfoHelper()
{
+ static ::cppu::OPropertyArrayHelper aPropHelper( Sequence< beans::Property >{} );
+ return aPropHelper;
};
}
@@ -231,13 +238,15 @@ struct StaticChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans:
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL ChartType::getInfoHelper()
{
- return *StaticChartTypeInfoHelper::get();
+ return StaticChartTypeInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL ChartType::getPropertySetInfo()
{
- return *StaticChartTypeInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo( StaticChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
}
// ____ XModifyBroadcaster ____
@@ -245,8 +254,7 @@ void SAL_CALL ChartType::addModifyListener( const uno::Reference< util::XModifyL
{
try
{
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
catch( const uno::Exception & )
{
@@ -258,8 +266,7 @@ void SAL_CALL ChartType::removeModifyListener( const uno::Reference< util::XModi
{
try
{
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index c0bcc0a03d33..2e6753444d99 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -33,13 +33,13 @@
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <tools/diagnose_ex.h>
#include <sal/log.hxx>
#include <algorithm>
#include <iterator>
#include <o3tl/functional.hxx>
#include <map>
+#include <utility>
using namespace ::com::sun::star;
@@ -89,6 +89,8 @@ enum TemplateId
TEMPLATE_PIEALLEXPLODED,
TEMPLATE_DONUT,
TEMPLATE_DONUTALLEXPLODED,
+ TEMPLATE_BAROFPIE,
+ TEMPLATE_PIEOFPIE,
TEMPLATE_THREEDPIE,
TEMPLATE_THREEDPIEALLEXPLODED,
TEMPLATE_THREEDDONUT,
@@ -163,6 +165,9 @@ const tTemplateMapType & lcl_DefaultChartTypeMap()
{"com.sun.star.chart2.template.PieAllExploded", TEMPLATE_PIEALLEXPLODED},
{"com.sun.star.chart2.template.Donut", TEMPLATE_DONUT},
{"com.sun.star.chart2.template.DonutAllExploded", TEMPLATE_DONUTALLEXPLODED},
+ {"com.sun.star.chart2.template.BarOfPie", TEMPLATE_BAROFPIE},
+ {"com.sun.star.chart2.template.PieOfPie", TEMPLATE_PIEOFPIE},
+ {"com.sun.star.chart2.template.DonutAllExploded", TEMPLATE_DONUTALLEXPLODED},
{"com.sun.star.chart2.template.ThreeDPie", TEMPLATE_THREEDPIE},
{"com.sun.star.chart2.template.ThreeDPieAllExploded", TEMPLATE_THREEDPIEALLEXPLODED},
{"com.sun.star.chart2.template.ThreeDDonut", TEMPLATE_THREEDDONUT},
@@ -213,8 +218,8 @@ namespace chart
ChartTypeManager::ChartTypeManager(
uno::Reference<
- uno::XComponentContext > const & xContext ) :
- m_xContext( xContext )
+ uno::XComponentContext > xContext ) :
+ m_xContext(std::move( xContext ))
{}
ChartTypeManager::~ChartTypeManager()
@@ -224,312 +229,307 @@ ChartTypeManager::~ChartTypeManager()
uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
const OUString& aServiceSpecifier )
{
- uno::Reference< uno::XInterface > xResult;
+ return static_cast<cppu::OWeakObject*>(createTemplate(aServiceSpecifier).get());
+}
+
+rtl::Reference< ::chart::ChartTypeTemplate > ChartTypeManager::createTemplate(
+ const OUString& aServiceSpecifier )
+{
TemplateId nId = lcl_GetTemplateIdForService( aServiceSpecifier );
- if( nId == TEMPLATE_NOT_FOUND )
+ rtl::Reference< ::chart::ChartTypeTemplate > xTemplate;
+ switch( nId )
{
- try
- {
- xResult = m_xContext->getServiceManager()->createInstanceWithContext(
- aServiceSpecifier, m_xContext );
- }
-// catch( registry::InvalidValueException & ex )
- catch( const uno::Exception & )
+ // Point (category x axis)
+ case TEMPLATE_SYMBOL:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, true, false ));
+ break;
+ case TEMPLATE_STACKEDSYMBOL:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, true, false ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDSYMBOL:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, true, false ));
+ break;
+ // Line (category x axis)
+ case TEMPLATE_LINE:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, false ));
+ break;
+ case TEMPLATE_STACKEDLINE:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, false ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDLINE:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, false ));
+ break;
+ case TEMPLATE_LINESYMBOL:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, true ));
+ break;
+ case TEMPLATE_STACKEDLINESYMBOL:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, true ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDLINESYMBOL:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, true ));
+ break;
+ case TEMPLATE_THREEDLINE:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, false, true, 3 ));
+ break;
+ case TEMPLATE_STACKEDTHREEDLINE:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, false, true, 3 ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDTHREEDLINE:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, false, true, 3 ));
+ break;
+ case TEMPLATE_THREEDLINEDEEP:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::ZStacked, false, true, 3 ));
+ break;
+
+ // Bar/Column
+ case TEMPLATE_COLUMN:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, BarChartTypeTemplate::VERTICAL ));
+ break;
+ case TEMPLATE_STACKEDCOLUMN:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, BarChartTypeTemplate::VERTICAL ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDCOLUMN:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, BarChartTypeTemplate::VERTICAL ));
+ break;
+ case TEMPLATE_BAR:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, BarChartTypeTemplate::HORIZONTAL ));
+ break;
+ case TEMPLATE_STACKEDBAR:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, BarChartTypeTemplate::HORIZONTAL ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDBAR:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, BarChartTypeTemplate::HORIZONTAL ));
+ break;
+ case TEMPLATE_THREEDCOLUMNDEEP:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::ZStacked, BarChartTypeTemplate::VERTICAL, 3 ));
+ break;
+ case TEMPLATE_THREEDCOLUMNFLAT:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, BarChartTypeTemplate::VERTICAL, 3 ));
+ break;
+ case TEMPLATE_STACKEDTHREEDCOLUMNFLAT:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, BarChartTypeTemplate::VERTICAL, 3 ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, BarChartTypeTemplate::VERTICAL, 3 ));
+ break;
+ case TEMPLATE_THREEDBARDEEP:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::ZStacked, BarChartTypeTemplate::HORIZONTAL, 3 ));
+ break;
+ case TEMPLATE_THREEDBARFLAT:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, BarChartTypeTemplate::HORIZONTAL, 3 ));
+ break;
+ case TEMPLATE_STACKEDTHREEDBARFLAT:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, BarChartTypeTemplate::HORIZONTAL, 3 ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, BarChartTypeTemplate::HORIZONTAL, 3 ));
+ break;
+
+ // Combi-Chart Line/Column
+ case TEMPLATE_COLUMNWITHLINE:
+ case TEMPLATE_STACKEDCOLUMNWITHLINE:
{
- // couldn't create service via factory
+ StackMode eMode = ( nId == TEMPLATE_COLUMNWITHLINE )
+ ? StackMode::NONE
+ : StackMode::YStacked;
- // As XMultiServiceFactory does not specify, what to do in case
- // createInstance is called with an unknown service-name, this
- // function will just return an empty XInterface.
- DBG_UNHANDLED_EXCEPTION("chart2");
- SAL_WARN("chart2", "Couldn't instantiate service: "<< aServiceSpecifier );
- xResult.set( nullptr );
+ xTemplate.set( new ColumnLineChartTypeTemplate( m_xContext, aServiceSpecifier, eMode, 1 ));
}
- }
- else
- {
- uno::Reference< chart2::XChartTypeTemplate > xTemplate;
- switch( nId )
- {
- // Point (category x axis)
- case TEMPLATE_SYMBOL:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, true, false ));
- break;
- case TEMPLATE_STACKEDSYMBOL:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, true, false ));
- break;
- case TEMPLATE_PERCENTSTACKEDSYMBOL:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, true, false ));
- break;
- // Line (category x axis)
- case TEMPLATE_LINE:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, false ));
- break;
- case TEMPLATE_STACKEDLINE:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, false ));
- break;
- case TEMPLATE_PERCENTSTACKEDLINE:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, false ));
- break;
- case TEMPLATE_LINESYMBOL:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, true ));
- break;
- case TEMPLATE_STACKEDLINESYMBOL:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, true ));
- break;
- case TEMPLATE_PERCENTSTACKEDLINESYMBOL:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, true ));
- break;
- case TEMPLATE_THREEDLINE:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, false, true, 3 ));
- break;
- case TEMPLATE_STACKEDTHREEDLINE:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, false, true, 3 ));
- break;
- case TEMPLATE_PERCENTSTACKEDTHREEDLINE:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, false, true, 3 ));
- break;
- case TEMPLATE_THREEDLINEDEEP:
- xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::ZStacked, false, true, 3 ));
- break;
-
- // Bar/Column
- case TEMPLATE_COLUMN:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, BarChartTypeTemplate::VERTICAL ));
- break;
- case TEMPLATE_STACKEDCOLUMN:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, BarChartTypeTemplate::VERTICAL ));
- break;
- case TEMPLATE_PERCENTSTACKEDCOLUMN:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, BarChartTypeTemplate::VERTICAL ));
- break;
- case TEMPLATE_BAR:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, BarChartTypeTemplate::HORIZONTAL ));
- break;
- case TEMPLATE_STACKEDBAR:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, BarChartTypeTemplate::HORIZONTAL ));
- break;
- case TEMPLATE_PERCENTSTACKEDBAR:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, BarChartTypeTemplate::HORIZONTAL ));
- break;
- case TEMPLATE_THREEDCOLUMNDEEP:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::ZStacked, BarChartTypeTemplate::VERTICAL, 3 ));
- break;
- case TEMPLATE_THREEDCOLUMNFLAT:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, BarChartTypeTemplate::VERTICAL, 3 ));
- break;
- case TEMPLATE_STACKEDTHREEDCOLUMNFLAT:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, BarChartTypeTemplate::VERTICAL, 3 ));
- break;
- case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, BarChartTypeTemplate::VERTICAL, 3 ));
- break;
- case TEMPLATE_THREEDBARDEEP:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::ZStacked, BarChartTypeTemplate::HORIZONTAL, 3 ));
- break;
- case TEMPLATE_THREEDBARFLAT:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, BarChartTypeTemplate::HORIZONTAL, 3 ));
- break;
- case TEMPLATE_STACKEDTHREEDBARFLAT:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, BarChartTypeTemplate::HORIZONTAL, 3 ));
- break;
- case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT:
- xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, BarChartTypeTemplate::HORIZONTAL, 3 ));
- break;
-
- // Combi-Chart Line/Column
- case TEMPLATE_COLUMNWITHLINE:
- case TEMPLATE_STACKEDCOLUMNWITHLINE:
- {
- StackMode eMode = ( nId == TEMPLATE_COLUMNWITHLINE )
- ? StackMode::NONE
- : StackMode::YStacked;
+ break;
- xTemplate.set( new ColumnLineChartTypeTemplate( m_xContext, aServiceSpecifier, eMode, 1 ));
- }
+ // Area
+ case TEMPLATE_AREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::NONE ));
+ break;
+ case TEMPLATE_STACKEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent ));
+ break;
+ case TEMPLATE_THREEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::ZStacked, 3 ));
+ break;
+ case TEMPLATE_STACKEDTHREEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked, 3 ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDTHREEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent, 3 ));
+ break;
+
+ case TEMPLATE_PIE:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_NONE, false, chart2::PieChartSubType_NONE ));
+ break;
+ case TEMPLATE_PIEALLEXPLODED:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_ALL_EXPLODED, false,
+ chart2::PieChartSubType_NONE ));
+ break;
+ case TEMPLATE_DONUT:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_NONE, true, chart2::PieChartSubType_NONE ));
+ break;
+ case TEMPLATE_DONUTALLEXPLODED:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_ALL_EXPLODED, true,
+ chart2::PieChartSubType_NONE ));
+ break;
+ case TEMPLATE_BAROFPIE:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_NONE, false, chart2::PieChartSubType_BAR ));
+ break;
+ case TEMPLATE_PIEOFPIE:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_NONE, false, chart2::PieChartSubType_PIE ));
+ break;
+ case TEMPLATE_THREEDPIE:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_NONE, false, chart2::PieChartSubType_NONE, 3 ));
+ break;
+ case TEMPLATE_THREEDPIEALLEXPLODED:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_ALL_EXPLODED, false,
+ chart2::PieChartSubType_NONE, 3 ));
+ break;
+ case TEMPLATE_THREEDDONUT:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_NONE, true, chart2::PieChartSubType_NONE, 3 ));
+ break;
+ case TEMPLATE_THREEDDONUTALLEXPLODED:
+ xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
+ chart2::PieChartOffsetMode_ALL_EXPLODED, true,
+ chart2::PieChartSubType_NONE, 3 ));
break;
- // Area
- case TEMPLATE_AREA:
- xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::NONE ));
- break;
- case TEMPLATE_STACKEDAREA:
- xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked ));
- break;
- case TEMPLATE_PERCENTSTACKEDAREA:
- xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent ));
- break;
- case TEMPLATE_THREEDAREA:
- xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::ZStacked, 3 ));
- break;
- case TEMPLATE_STACKEDTHREEDAREA:
- xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked, 3 ));
- break;
- case TEMPLATE_PERCENTSTACKEDTHREEDAREA:
- xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent, 3 ));
- break;
-
- case TEMPLATE_PIE:
- xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_NONE, false ));
- break;
- case TEMPLATE_PIEALLEXPLODED:
- xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_ALL_EXPLODED, false ));
- break;
- case TEMPLATE_DONUT:
- xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_NONE, true ));
- break;
- case TEMPLATE_DONUTALLEXPLODED:
- xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_ALL_EXPLODED, true ));
- break;
- case TEMPLATE_THREEDPIE:
- xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_NONE, false, 3 ));
- break;
- case TEMPLATE_THREEDPIEALLEXPLODED:
- xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_ALL_EXPLODED, false, 3 ));
- break;
- case TEMPLATE_THREEDDONUT:
- xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_NONE, true, 3 ));
- break;
- case TEMPLATE_THREEDDONUTALLEXPLODED:
- xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_ALL_EXPLODED, true, 3 ));
- break;
-
- case TEMPLATE_SCATTERLINESYMBOL:
- xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true ));
- break;
- case TEMPLATE_SCATTERLINE:
- xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false ));
- break;
- case TEMPLATE_SCATTERSYMBOL:
- xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true, /* bHasLines */ false ));
- break;
- case TEMPLATE_THREEDSCATTER:
- xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false, /* bHasLines */ true, 3 ));
- break;
-
- // NetChart
- case TEMPLATE_NET:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, true ));
- break;
- case TEMPLATE_NETSYMBOL:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, true, false ));
- break;
- case TEMPLATE_NETLINE:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, false ));
- break;
-
- case TEMPLATE_STACKEDNET:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, true ));
- break;
- case TEMPLATE_STACKEDNETSYMBOL:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, true, false ));
- break;
- case TEMPLATE_STACKEDNETLINE:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, false, true ));
- break;
-
- case TEMPLATE_PERCENTSTACKEDNET:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, true ));
- break;
- case TEMPLATE_PERCENTSTACKEDNETSYMBOL:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, true, false ));
- break;
- case TEMPLATE_PERCENTSTACKEDNETLINE:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, false, true ));
- break;
-
- case TEMPLATE_FILLEDNET:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::NONE, false, false, true ));
- break;
- case TEMPLATE_STACKEDFILLEDNET:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStacked, false, false, true ));
- break;
- case TEMPLATE_PERCENTSTACKEDFILLEDNET:
- xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
- StackMode::YStackedPercent, false, false, true ));
- break;
-
- case TEMPLATE_STOCKLOWHIGHCLOSE:
- xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
- StockChartTypeTemplate::StockVariant::NONE, false ));
- break;
- case TEMPLATE_STOCKOPENLOWHIGHCLOSE:
- xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
- StockChartTypeTemplate::StockVariant::Open, true ));
- break;
- case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE:
- xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
- StockChartTypeTemplate::StockVariant::Volume, false ));
- break;
- case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE:
- xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
- StockChartTypeTemplate::StockVariant::VolumeOpen, true ));
- break;
-
- //BubbleChart
- case TEMPLATE_BUBBLE:
- xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
- break;
- default: break;
+ case TEMPLATE_SCATTERLINESYMBOL:
+ xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true ));
+ break;
+ case TEMPLATE_SCATTERLINE:
+ xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false ));
+ break;
+ case TEMPLATE_SCATTERSYMBOL:
+ xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true, /* bHasLines */ false ));
+ break;
+ case TEMPLATE_THREEDSCATTER:
+ xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false, /* bHasLines */ true, 3 ));
+ break;
+
+ // NetChart
+ case TEMPLATE_NET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, true ));
+ break;
+ case TEMPLATE_NETSYMBOL:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, true, false ));
+ break;
+ case TEMPLATE_NETLINE:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, false ));
+ break;
+
+ case TEMPLATE_STACKEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, true ));
+ break;
+ case TEMPLATE_STACKEDNETSYMBOL:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, true, false ));
+ break;
+ case TEMPLATE_STACKEDNETLINE:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, false, true ));
+ break;
+
+ case TEMPLATE_PERCENTSTACKEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, true ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDNETSYMBOL:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, true, false ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDNETLINE:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, false, true ));
+ break;
+
+ case TEMPLATE_FILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::NONE, false, false, true ));
+ break;
+ case TEMPLATE_STACKEDFILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStacked, false, false, true ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDFILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode::YStackedPercent, false, false, true ));
+ break;
+
+ case TEMPLATE_STOCKLOWHIGHCLOSE:
+ xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StockChartTypeTemplate::StockVariant::NONE, false ));
+ break;
+ case TEMPLATE_STOCKOPENLOWHIGHCLOSE:
+ xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StockChartTypeTemplate::StockVariant::Open, true ));
+ break;
+ case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE:
+ xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StockChartTypeTemplate::StockVariant::Volume, false ));
+ break;
+ case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE:
+ xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StockChartTypeTemplate::StockVariant::VolumeOpen, true ));
+ break;
+
+ //BubbleChart
+ case TEMPLATE_BUBBLE:
+ xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
+ break;
+
+ case TEMPLATE_NOT_FOUND:
+ SAL_WARN("chart2", "Couldn't instantiate service: "<< aServiceSpecifier );
+ assert(false);
+ break;
+
+ default: break;
// case TEMPLATE_SURFACE:
// case TEMPLATE_ADDIN:
// break;
-
- case TEMPLATE_NOT_FOUND:
- OSL_ASSERT( false );
- break;
- }
- xResult.set( xTemplate, uno::UNO_QUERY );
}
- return xResult;
+ return xTemplate;
}
uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstanceWithArguments(
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index 8aafc1fd1d8b..79ed5c7f4c90 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -17,30 +17,36 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "ChartTypeTemplate.hxx"
-#include "DataInterpreter.hxx"
+#include <ChartTypeTemplate.hxx>
+#include <DataInterpreter.hxx>
#include <CommonConverters.hxx>
#include <ChartTypeHelper.hxx>
+#include <ChartType.hxx>
+#include <DataSeriesProperties.hxx>
+#include <DataSource.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
+#include <Diagram.hxx>
#include <DiagramHelper.hxx>
#include <AxisIndexDefines.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <unonames.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <tools/diagnose_ex.h>
+#include <com/sun/star/chart2/XColorScheme.hpp>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/property.hxx>
-#include <comphelper/sequence.hxx>
#include <algorithm>
+#include <cstddef>
+#include <utility>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Reference;
@@ -49,18 +55,17 @@ namespace
{
void lcl_applyDefaultStyle(
- const Reference< XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
sal_Int32 nIndex,
- const Reference< XDiagram > & xDiagram )
+ const rtl::Reference< ::chart::Diagram > & xDiagram )
{
// @deprecated: correct default color should be found by view without
// setting color as hard attribute
if( xSeries.is() && xDiagram.is())
{
- Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
Reference< chart2::XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
- if( xSeriesProp.is() && xColorScheme.is() )
- xSeriesProp->setPropertyValue(
+ if( xColorScheme.is() )
+ xSeries->setPropertyValue(
"Color",
uno::Any( xColorScheme->getColorByIndex( nIndex )));
}
@@ -102,18 +107,17 @@ void lcl_resetLabelPlacementIfDefault( const Reference< beans::XPropertySet >& x
}
}
-void lcl_ensureCorrectMissingValueTreatment( const Reference< chart2::XDiagram >& xDiagram, const Reference< XChartType >& xChartType )
+void lcl_ensureCorrectMissingValueTreatment( const rtl::Reference< ::chart::Diagram >& xDiagram, const rtl::Reference< ::chart::ChartType >& xChartType )
{
- Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
- if( xDiaProp.is() )
+ if( xDiagram.is() )
{
uno::Sequence < sal_Int32 > aAvailableMissingValueTreatment(
::chart::ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) );
if( aAvailableMissingValueTreatment.hasElements() )
- xDiaProp->setPropertyValue( "MissingValueTreatment", uno::Any( aAvailableMissingValueTreatment[0] ) );
+ xDiagram->setPropertyValue( "MissingValueTreatment", uno::Any( aAvailableMissingValueTreatment[0] ) );
else
- xDiaProp->setPropertyValue( "MissingValueTreatment", uno::Any() );
+ xDiagram->setPropertyValue( "MissingValueTreatment", uno::Any() );
}
}
@@ -124,44 +128,39 @@ namespace chart
ChartTypeTemplate::ChartTypeTemplate(
Reference< uno::XComponentContext > const & xContext,
- const OUString & rServiceName ) :
+ OUString aServiceName ) :
m_xContext( xContext ),
- m_aServiceName( rServiceName )
+ m_aServiceName(std::move( aServiceName ))
{
}
ChartTypeTemplate::~ChartTypeTemplate()
{}
-// ____ XChartTypeTemplate ____
-uno::Reference< XDiagram > SAL_CALL ChartTypeTemplate::createDiagramByDataSource(
+// ____ ChartTypeTemplate ____
+rtl::Reference< Diagram > ChartTypeTemplate::createDiagramByDataSource2(
const uno::Reference< data::XDataSource >& xDataSource,
const uno::Sequence< beans::PropertyValue >& aArguments )
{
- Reference< XDiagram > xDia;
+ rtl::Reference< Diagram > xDia;
try
{
// create diagram
- xDia.set(
- GetComponentContext()->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.Diagram",
- GetComponentContext() ),
- uno::UNO_QUERY_THROW );
+ xDia = new Diagram(GetComponentContext());
// modify diagram
- Reference< chart2::XDataInterpreter > xInterpreter( getDataInterpreter());
- chart2::InterpretedData aData(
+ rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter2());
+ InterpretedData aData(
xInterpreter->interpretDataSource(
- xDataSource, aArguments, Sequence< Reference< XDataSeries > >() ));
+ xDataSource, aArguments, {} ));
- const Sequence< Sequence< Reference< XDataSeries > > > aSeries( aData.Series );
sal_Int32 nCount = 0;
- for( auto const & i : aSeries )
+ for( auto const & i : aData.Series )
for( auto const & j : i )
lcl_applyDefaultStyle( j, nCount++, xDia );
- Sequence< Reference< XChartType > > aOldChartTypesSeq;
+ std::vector< rtl::Reference< ChartType > > aOldChartTypesSeq;
FillDiagram( xDia, aData.Series, aData.Categories, aOldChartTypesSeq );
}
catch( const uno::Exception & )
@@ -177,23 +176,23 @@ sal_Bool SAL_CALL ChartTypeTemplate::supportsCategories()
return true;
}
-void SAL_CALL ChartTypeTemplate::changeDiagram( const uno::Reference< XDiagram >& xDiagram )
+void ChartTypeTemplate::changeDiagram( const rtl::Reference< Diagram >& xDiagram )
{
if( ! xDiagram.is())
return;
try
{
- Sequence< Sequence< Reference< XDataSeries > > > aSeriesSeq(
- DiagramHelper::getDataSeriesGroups( xDiagram ));
- Sequence< Reference< XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
- const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.getLength();
+ std::vector< std::vector< rtl::Reference< DataSeries > > > aSeriesSeq =
+ xDiagram->getDataSeriesGroups();
+ std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
+ const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.size();
// chart-type specific interpretation of existing data series
- Reference< chart2::XDataInterpreter > xInterpreter( getDataInterpreter());
- chart2::InterpretedData aData;
+ rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter2());
+ InterpretedData aData;
aData.Series = aSeriesSeq;
- aData.Categories = DiagramHelper::getCategoriesFromDiagram( xDiagram );
+ aData.Categories = xDiagram->getCategories();
if( xInterpreter->isDataCompatible( aData ) )
{
@@ -201,7 +200,7 @@ void SAL_CALL ChartTypeTemplate::changeDiagram( const uno::Reference< XDiagram >
}
else
{
- Reference< data::XDataSource > xSource( xInterpreter->mergeInterpretedData( aData ));
+ rtl::Reference< DataSource > xSource = DataInterpreter::mergeInterpretedData( aData );
// todo: get a "range-union" from the data provider by calling
// OUString aRange = getRangeRepresentationByData( xSource );
// xSource.set( getDataByRangeRepresentation( aRange, aParam ));
@@ -209,16 +208,15 @@ void SAL_CALL ChartTypeTemplate::changeDiagram( const uno::Reference< XDiagram >
Sequence< beans::PropertyValue > aParam;
if( aData.Categories.is())
{
- aParam.realloc( 1 );
- aParam[0] = beans::PropertyValue( "HasCategories", -1, uno::Any( true ),
- beans::PropertyState_DIRECT_VALUE );
+ aParam = { beans::PropertyValue( "HasCategories", -1, uno::Any( true ),
+ beans::PropertyState_DIRECT_VALUE ) };
}
aData = xInterpreter->interpretDataSource( xSource, aParam, aFlatSeriesSeq );
}
aSeriesSeq = aData.Series;
sal_Int32 nIndex = 0;
- for( auto const & i : std::as_const(aSeriesSeq) )
+ for (auto const& i : aSeriesSeq)
for( auto const & j : i )
{
if( nIndex >= nFormerSeriesCount )
@@ -226,21 +224,12 @@ void SAL_CALL ChartTypeTemplate::changeDiagram( const uno::Reference< XDiagram >
}
// remove charttype groups from all coordinate systems
- Sequence< Reference< XChartType > > aOldChartTypesSeq(
- DiagramHelper::getChartTypesFromDiagram(xDiagram) );
+ std::vector< rtl::Reference< ChartType > > aOldChartTypesSeq =
+ xDiagram->getChartTypes();
- Reference< XCoordinateSystemContainer > xCoordSysCnt( xDiagram, uno::UNO_QUERY );
- OSL_ASSERT( xCoordSysCnt.is());
- if( xCoordSysCnt.is())
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() )
{
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCoordSysCnt->getCoordinateSystems());
- for( Reference< XCoordinateSystem > const & coords : aCooSysSeq )
- {
- Reference< XChartTypeContainer > xContainer( coords, uno::UNO_QUERY );
- if( xContainer.is() )
- xContainer->setChartTypes( Sequence< Reference< XChartType > >() );
- }
+ coords->setChartTypes( Sequence< Reference< XChartType > >() );
}
FillDiagram( xDiagram, aSeriesSeq, aData.Categories, aOldChartTypesSeq );
@@ -251,8 +240,8 @@ void SAL_CALL ChartTypeTemplate::changeDiagram( const uno::Reference< XDiagram >
}
}
-void SAL_CALL ChartTypeTemplate::changeDiagramData(
- const Reference< chart2::XDiagram >& xDiagram,
+void ChartTypeTemplate::changeDiagramData(
+ const rtl::Reference< Diagram >& xDiagram,
const Reference< chart2::data::XDataSource >& xDataSource,
const Sequence< beans::PropertyValue >& aArguments )
{
@@ -263,37 +252,34 @@ void SAL_CALL ChartTypeTemplate::changeDiagramData(
try
{
// interpret new data and re-use existing series
- Sequence< Reference< XDataSeries > > aFlatSeriesSeq(
- comphelper::containerToSequence( DiagramHelper::getDataSeriesFromDiagram( xDiagram )));
- const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.getLength();
- Reference< chart2::XDataInterpreter > xInterpreter( getDataInterpreter());
- chart2::InterpretedData aData =
+ std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq =
+ xDiagram->getDataSeries();
+ const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.size();
+ rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter2());
+ InterpretedData aData =
xInterpreter->interpretDataSource( xDataSource, aArguments, aFlatSeriesSeq );
// data series
- Sequence< Sequence< Reference< XDataSeries > > > aSeriesSeq( aData.Series );
-
- sal_Int32 i, j, nIndex = 0;
- for( i=0; i<aSeriesSeq.getLength(); ++i )
- for( j=0; j<aSeriesSeq[i].getLength(); ++j, ++nIndex )
+ sal_Int32 nIndex = 0;
+ for( std::size_t i=0; i<aData.Series.size(); ++i )
+ for( std::size_t j=0; j<aData.Series[i].size(); ++j, ++nIndex )
{
if( nIndex >= nFormerSeriesCount )
{
- lcl_applyDefaultStyle( aSeriesSeq[i][j], nIndex, xDiagram );
- applyStyle( aSeriesSeq[i][j], i, j, aSeriesSeq[i].getLength() );
+ lcl_applyDefaultStyle( aData.Series[i][j], nIndex, xDiagram );
+ applyStyle2( aData.Series[i][j], i, j, aData.Series[i].size() );
}
}
// categories
- DiagramHelper::setCategoriesToDiagram( aData.Categories, xDiagram, true, supportsCategories() );
+ xDiagram->setCategories( aData.Categories, true, supportsCategories() );
- Sequence< Reference< XChartType > > aChartTypes(
- DiagramHelper::getChartTypesFromDiagram( xDiagram ));
- sal_Int32 nMax = std::min( aChartTypes.getLength(), aSeriesSeq.getLength());
- for( i=0; i<nMax; ++i )
+ std::vector< rtl::Reference< ChartType > > aChartTypes =
+ xDiagram->getChartTypes();
+ sal_Int32 nMax = std::min( aChartTypes.size(), aData.Series.size());
+ for( sal_Int32 i=0; i<nMax; ++i )
{
- Reference< XDataSeriesContainer > xDSCnt( aChartTypes[i], uno::UNO_QUERY_THROW );
- xDSCnt->setDataSeries( aSeriesSeq[i] );
+ aChartTypes[i]->setDataSeries( aData.Series[i] );
}
}
catch( const uno::Exception & )
@@ -302,9 +288,9 @@ void SAL_CALL ChartTypeTemplate::changeDiagramData(
}
}
-sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
- const Reference< chart2::XDiagram >& xDiagram,
- sal_Bool /* bAdaptProperties */ )
+bool ChartTypeTemplate::matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool /* bAdaptProperties */ )
{
bool bResult = false;
@@ -313,34 +299,28 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
try
{
- Reference< XCoordinateSystemContainer > xCooSysCnt(
- xDiagram, uno::UNO_QUERY_THROW );
- Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysSeq(
+ xDiagram->getBaseCoordinateSystems());
// need to have at least one coordinate system
- bResult = aCooSysSeq.hasElements();
+ bResult = !aCooSysSeq.empty();
if( bResult )
{
- Sequence< Reference< XChartType > > aFormerlyUsedChartTypes;
- Reference<XChartType> xOldCT = getChartTypeForNewSeries(aFormerlyUsedChartTypes);
+ std::vector< rtl::Reference< ChartType > > aFormerlyUsedChartTypes;
+ rtl::Reference<ChartType> xOldCT = getChartTypeForNewSeries2(aFormerlyUsedChartTypes);
if (!xOldCT.is())
return false;
const OUString aChartTypeToMatch = xOldCT->getChartType();
const sal_Int32 nDimensionToMatch = getDimension();
- for( sal_Int32 nCooSysIdx=0; bResult && (nCooSysIdx < aCooSysSeq.getLength()); ++nCooSysIdx )
+ for( std::size_t nCooSysIdx=0; bResult && (nCooSysIdx < aCooSysSeq.size()); ++nCooSysIdx )
{
// match dimension
bResult = bResult && (aCooSysSeq[nCooSysIdx]->getDimension() == nDimensionToMatch);
- Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
- Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
- for( sal_Int32 nCTIdx=0; bResult && (nCTIdx < aChartTypeSeq.getLength()); ++nCTIdx )
+ const std::vector< rtl::Reference< ChartType > > & aChartTypeSeq( aCooSysSeq[nCooSysIdx]->getChartTypes2());
+ for( std::size_t nCTIdx=0; bResult && (nCTIdx < aChartTypeSeq.size()); ++nCTIdx )
{
- if (!aChartTypeSeq[nCTIdx].is())
- return false;
-
// match chart type
bResult = bResult && aChartTypeSeq[nCTIdx]->getChartType() == aChartTypeToMatch;
bool bFound=false;
@@ -363,7 +343,7 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XDataInterpreter > SAL_CALL ChartTypeTemplate::getDataInterpreter()
+rtl::Reference< DataInterpreter > ChartTypeTemplate::getDataInterpreter2()
{
if( ! m_xDataInterpreter.is())
m_xDataInterpreter.set( new DataInterpreter );
@@ -371,15 +351,14 @@ Reference< chart2::XDataInterpreter > SAL_CALL ChartTypeTemplate::getDataInterpr
return m_xDataInterpreter;
}
-void SAL_CALL ChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void ChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 /* nSeriesIndex */,
::sal_Int32 /* nSeriesCount */ )
{
// sset stacking mode
- Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
- if( !xSeriesProp.is())
+ if( !xSeries.is())
return;
try
@@ -392,16 +371,17 @@ void SAL_CALL ChartTypeTemplate::applyStyle(
: (eStackMode == StackMode::ZStacked )
? chart2::StackingDirection_Z_STACKING
: chart2::StackingDirection_NO_STACKING );
- xSeriesProp->setPropertyValue( "StackingDirection", aPropValue );
+ xSeries->setPropertyValue( "StackingDirection", aPropValue );
//ensure valid label placement
{
uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
getChartTypeForIndex( nChartTypeIndex ), isSwapXAndY(), xSeries ) );
- lcl_ensureCorrectLabelPlacement( xSeriesProp, aAvailablePlacements );
+ lcl_ensureCorrectLabelPlacement( xSeries, aAvailablePlacements );
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
lcl_ensureCorrectLabelPlacement( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), aAvailablePlacements );
}
@@ -412,88 +392,63 @@ void SAL_CALL ChartTypeTemplate::applyStyle(
}
}
-void ChartTypeTemplate::applyStyles( const Reference< chart2::XDiagram >& xDiagram )
+void ChartTypeTemplate::applyStyles( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
// apply chart-type specific styles, like "symbols on" for example
- Sequence< Sequence< Reference< XDataSeries > > > aNewSeriesSeq(
- DiagramHelper::getDataSeriesGroups( xDiagram ));
- for( sal_Int32 i=0; i<aNewSeriesSeq.getLength(); ++i )
+ std::vector< std::vector< rtl::Reference< DataSeries > > > aNewSeriesSeq(
+ xDiagram->getDataSeriesGroups());
+ for( std::size_t i=0; i<aNewSeriesSeq.size(); ++i )
{
- const sal_Int32 nNumSeries = aNewSeriesSeq[i].getLength();
+ const sal_Int32 nNumSeries = aNewSeriesSeq[i].size();
for( sal_Int32 j=0; j<nNumSeries; ++j )
- applyStyle( aNewSeriesSeq[i][j], i, j, nNumSeries );
+ applyStyle2( aNewSeriesSeq[i][j], i, j, nNumSeries );
}
//ensure valid empty cell handling (for first chart type...)
lcl_ensureCorrectMissingValueTreatment( xDiagram, getChartTypeForIndex( 0 ) );
}
-void SAL_CALL ChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram >& xDiagram )
+void ChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
// reset number format if we had percent stacking on
bool bPercent = (getStackMode(0) == StackMode::YStackedPercent);
if( bPercent )
{
- const Sequence< Reference< chart2::XAxis > > aAxisSeq( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
- for( Reference< chart2::XAxis > const & axis : aAxisSeq )
+ const std::vector< rtl::Reference< Axis > > aAxisSeq( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
+ for( rtl::Reference< Axis > const & axis : aAxisSeq )
{
if( AxisHelper::getDimensionIndexOfAxis( axis, xDiagram )== 1 )
{
- Reference< beans::XPropertySet > xAxisProp( axis, uno::UNO_QUERY );
- if( xAxisProp.is())
- {
- // set number format to source format
- xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(true));
- xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any());
- }
+ // set number format to source format
+ axis->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(true));
+ axis->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any());
}
}
}
//reset label placement if default
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() )
{
- uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( xCooSysContainer.is() )
+ //iterate through all chart types in the current coordinate system
+ for( rtl::Reference< ChartType > const & xChartType : xCooSys->getChartTypes2() )
{
- const uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSysList )
+ //iterate through all series in this chart type
+ for( rtl::Reference< DataSeries > const & xSeries : xChartType->getDataSeries2() )
{
- //iterate through all chart types in the current coordinate system
- uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
- OSL_ASSERT( xChartTypeContainer.is());
- if( !xChartTypeContainer.is() )
+ uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
+ xChartType, isSwapXAndY(), xSeries ) );
+ if(!aAvailablePlacements.hasElements())
continue;
- const uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- for( uno::Reference< XChartType > const & xChartType : aChartTypeList )
- {
- //iterate through all series in this chart type
- uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
- OSL_ASSERT( xDataSeriesContainer.is());
- if( !xDataSeriesContainer.is() )
- continue;
-
- const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
- for( Reference< XDataSeries > const & xSeries : aSeriesList )
- {
- Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
- if(!xSeries.is() || !xSeriesProp.is() )
- continue;
- uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
- xChartType, isSwapXAndY(), xSeries ) );
- if(!aAvailablePlacements.hasElements())
- continue;
+ sal_Int32 nDefaultPlacement = aAvailablePlacements[0];
- sal_Int32 nDefaultPlacement = aAvailablePlacements[0];
+ lcl_resetLabelPlacementIfDefault( xSeries, nDefaultPlacement );
- lcl_resetLabelPlacementIfDefault( xSeriesProp, nDefaultPlacement );
-
- uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
- for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
- lcl_resetLabelPlacementIfDefault( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), nDefaultPlacement );
- }
- }
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ lcl_resetLabelPlacementIfDefault( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), nDefaultPlacement );
}
}
}
@@ -522,36 +477,36 @@ bool ChartTypeTemplate::isSwapXAndY() const
}
void ChartTypeTemplate::createCoordinateSystems(
- const Reference< chart2::XCoordinateSystemContainer > & xOutCooSysCnt )
+ const rtl::Reference< ::chart::Diagram > & xDiagram )
{
- if( ! xOutCooSysCnt.is())
+ if( ! xDiagram.is())
return;
- Sequence< Reference< XChartType > > aFormerlyUsedChartTypes;
- Reference< XChartType > xChartType( getChartTypeForNewSeries(aFormerlyUsedChartTypes));
+ std::vector< rtl::Reference< ChartType > > aFormerlyUsedChartTypes;
+ rtl::Reference< ChartType > xChartType( getChartTypeForNewSeries2(aFormerlyUsedChartTypes));
if( ! xChartType.is())
return;
- Reference< XCoordinateSystem > xCooSys( xChartType->createCoordinateSystem( getDimension()));
+ rtl::Reference< BaseCoordinateSystem > xCooSys = xChartType->createCoordinateSystem2( getDimension());
if( ! xCooSys.is())
{
// chart type wants no coordinate systems
- xOutCooSysCnt->setCoordinateSystems( Sequence< Reference< XCoordinateSystem > >());
+ xDiagram->setCoordinateSystems( Sequence< Reference< XCoordinateSystem > >());
return;
}
// #i69680# make grid of first y-axis visible (was in the CooSys CTOR before)
if( xCooSys->getDimension() >= 2 )
{
- Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension( 1, 0 ));
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( 1, 0 );
if( xAxis.is())
- AxisHelper::makeGridVisible( xAxis->getGridProperties() );
+ AxisHelper::makeGridVisible( xAxis->getGridProperties2() );
}
- Sequence< Reference< XCoordinateSystem > > aCoordinateSystems(
- xOutCooSysCnt->getCoordinateSystems());
+ std::vector< rtl::Reference< BaseCoordinateSystem > > aCoordinateSystems(
+ xDiagram->getBaseCoordinateSystems());
- if( aCoordinateSystems.hasElements())
+ if( !aCoordinateSystems.empty() )
{
bool bOk = true;
- for( sal_Int32 i=0; bOk && i<aCoordinateSystems.getLength(); ++i )
+ for( std::size_t i=0; bOk && i<aCoordinateSystems.size(); ++i )
bOk = bOk && ( xCooSys->getCoordinateSystemType() == aCoordinateSystems[i]->getCoordinateSystemType() &&
(xCooSys->getDimension() == aCoordinateSystems[i]->getDimension()) );
// coordinate systems are ok
@@ -561,9 +516,9 @@ void ChartTypeTemplate::createCoordinateSystems(
}
//copy as much info from former coordinate system as possible:
- if( aCoordinateSystems.hasElements() )
+ if( !aCoordinateSystems.empty() )
{
- Reference< XCoordinateSystem > xOldCooSys( aCoordinateSystems[0] );
+ rtl::Reference< BaseCoordinateSystem > xOldCooSys( aCoordinateSystems[0] );
sal_Int32 nMaxDimensionCount = std::min( xCooSys->getDimension(), xOldCooSys->getDimension() );
for(sal_Int32 nDimensionIndex=0; nDimensionIndex<nMaxDimensionCount; nDimensionIndex++)
@@ -571,7 +526,7 @@ void ChartTypeTemplate::createCoordinateSystems(
const sal_Int32 nMaximumAxisIndex = xOldCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
for(sal_Int32 nAxisIndex=0; nAxisIndex<=nMaximumAxisIndex; ++nAxisIndex)
{
- uno::Reference< XAxis > xAxis( xOldCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
+ rtl::Reference< Axis > xAxis = xOldCooSys->getAxisByDimension2( nDimensionIndex, nAxisIndex );
if( xAxis.is())
{
xCooSys->setAxisByDimension( nDimensionIndex, xAxis, nAxisIndex );
@@ -581,25 +536,21 @@ void ChartTypeTemplate::createCoordinateSystems(
}
// set new coordinate systems
- aCoordinateSystems.realloc( 1 );
- aCoordinateSystems[0] = xCooSys;
+ aCoordinateSystems = { xCooSys };
- xOutCooSysCnt->setCoordinateSystems( aCoordinateSystems );
+ xDiagram->setCoordinateSystems( aCoordinateSystems );
}
void ChartTypeTemplate::adaptScales(
- const Sequence< Reference< chart2::XCoordinateSystem > > & aCooSysSeq,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysSeq,
const Reference< data::XLabeledDataSequence > & xCategories //@todo: in future there may be more than one sequence of categories (e.g. charttype with categories at x and y axis )
)
{
bool bSupportsCategories( supportsCategories() );
- for( Reference< XCoordinateSystem > const & xCooSys : aCooSysSeq )
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : aCooSysSeq )
{
try
{
- if( !xCooSys.is() )
- continue;
-
// attach categories to first axis
sal_Int32 nDim( xCooSys->getDimension());
if( nDim > 0 )
@@ -608,17 +559,23 @@ void ChartTypeTemplate::adaptScales(
const sal_Int32 nMaxIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionX);
for(sal_Int32 nI=0; nI<=nMaxIndex; ++nI)
{
- Reference< XAxis > xAxis( xCooSys->getAxisByDimension(nDimensionX,nI) );
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2(nDimensionX,nI);
if( xAxis.is())
{
ScaleData aData( xAxis->getScaleData() );
aData.Categories = xCategories;
if(bSupportsCategories)
{
- Reference< XChartType > xChartType(getChartTypeForNewSeries(Sequence< Reference< XChartType > >()));
+ rtl::Reference< ChartType > xChartType = getChartTypeForNewSeries2({});
if( aData.AxisType == AxisType::CATEGORY )
{
- aData.ShiftedCategoryPosition = m_aServiceName.indexOf("Column") != -1 || m_aServiceName.indexOf("Bar") != -1 || m_aServiceName.endsWith("Close");
+ // Shift for Column, Hi-Lo-Close, and regular
+ // Bar types, but not BarOfPie
+ aData.ShiftedCategoryPosition =
+ m_aServiceName.indexOf("Column") != -1 ||
+ (m_aServiceName.indexOf("Bar") != -1 &&
+ !m_aServiceName.indexOf("BarOfPie")) ||
+ m_aServiceName.endsWith("Close");
}
bool bSupportsDates = ::chart::ChartTypeHelper::isSupportingDateAxis( xChartType, nDimensionX );
if( aData.AxisType != AxisType::CATEGORY && ( aData.AxisType != AxisType::DATE || !bSupportsDates) )
@@ -641,7 +598,7 @@ void ChartTypeTemplate::adaptScales(
const sal_Int32 nMaxIndex = xCooSys->getMaximumAxisIndexByDimension(1);
for(sal_Int32 nI=0; nI<=nMaxIndex; ++nI)
{
- Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension( 1,nI ));
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( 1,nI );
if( xAxis.is())
{
bool bPercent = (getStackMode(0) == StackMode::YStackedPercent);
@@ -666,18 +623,18 @@ void ChartTypeTemplate::adaptScales(
}
}
-void ChartTypeTemplate::adaptDiagram( const Reference< XDiagram > & /* xDiagram */ )
+void ChartTypeTemplate::adaptDiagram( const rtl::Reference< ::chart::Diagram > & /* xDiagram */ )
{
- }
+}
void ChartTypeTemplate::createAxes(
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys )
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys )
{
//create missing axes
- if( !rCoordSys.hasElements() )
+ if( rCoordSys.empty() )
return;
- Reference< XCoordinateSystem > xCooSys( rCoordSys[0] );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( rCoordSys[0] );
if(!xCooSys.is())
return;
@@ -704,14 +661,14 @@ void ChartTypeTemplate::createAxes(
}
void ChartTypeTemplate::adaptAxes(
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys )
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys )
{
//adapt properties of existing axes and remove superfluous axes
- if( !rCoordSys.hasElements() )
+ if( rCoordSys.empty() )
return;
- for( Reference< XCoordinateSystem > const & xCooSys : rCoordSys )
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : rCoordSys )
{
if( !xCooSys.is() )
continue;
@@ -721,7 +678,7 @@ void ChartTypeTemplate::adaptAxes(
sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension( nDim );
for( sal_Int32 nAxisIndex=0; nAxisIndex<=nMaxAxisIndex; nAxisIndex++ )
{
- Reference< XAxis > xAxis( AxisHelper::getAxis( nDim, nAxisIndex, xCooSys ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDim, nAxisIndex, xCooSys );
if( !xAxis.is() )
continue;
@@ -731,13 +688,9 @@ void ChartTypeTemplate::adaptAxes(
bool bPercent = (getStackMode(0) == StackMode::YStackedPercent);
if( bPercent && nDim == 1 )
{
- Reference< beans::XPropertySet > xAxisProp( xAxis, uno::UNO_QUERY );
- if( xAxisProp.is())
- {
- // set number format to source format
- xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(true));
- xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any());
- }
+ // set number format to source format
+ xAxis->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(true));
+ xAxis->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any());
}
}
}
@@ -751,19 +704,18 @@ sal_Int32 ChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension )
}
void ChartTypeTemplate::FillDiagram(
- const Reference< XDiagram >& xDiagram,
- const Sequence< Sequence< Reference< XDataSeries > > >& aSeriesSeq,
- const Reference< data::XLabeledDataSequence >& xCategories,
- const Sequence< Reference< XChartType > >& aOldChartTypesSeq )
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ const std::vector< std::vector< rtl::Reference< DataSeries > > >& aSeriesSeq,
+ const uno::Reference< chart2::data::XLabeledDataSequence >& xCategories,
+ const std::vector< rtl::Reference< ChartType > >& aOldChartTypesSeq )
{
adaptDiagram( xDiagram );
try
{
// create coordinate systems and scales
- Reference< XCoordinateSystemContainer > xCoordSysCnt( xDiagram, uno::UNO_QUERY_THROW );
- createCoordinateSystems( xCoordSysCnt );
- Sequence< Reference< XCoordinateSystem > > aCoordinateSystems( xCoordSysCnt->getCoordinateSystems());
+ createCoordinateSystems( xDiagram );
+ std::vector< rtl::Reference< BaseCoordinateSystem > > aCoordinateSystems( xDiagram->getBaseCoordinateSystems());
createAxes( aCoordinateSystems );
adaptAxes( aCoordinateSystems );
adaptScales( aCoordinateSystems, xCategories );
@@ -779,65 +731,57 @@ void ChartTypeTemplate::FillDiagram(
}
void ChartTypeTemplate::createChartTypes(
- const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
- const Sequence< Reference< XChartType > >& aOldChartTypesSeq )
+ const std::vector< std::vector< rtl::Reference< DataSeries > > > & aSeriesSeq,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< ChartType > >& aOldChartTypesSeq )
{
- if( ! rCoordSys.hasElements() ||
- ! rCoordSys[0].is() )
+ if( rCoordSys.empty() )
return;
try
{
- sal_Int32 nCooSysIdx=0;
- Reference< XChartType > xCT;
- if( !aSeriesSeq.hasElements() )
+ std::size_t nCooSysIdx=0;
+ rtl::Reference< ChartType > xCT;
+ if( aSeriesSeq.empty() )
{
// we need a new chart type
- xCT.set( getChartTypeForNewSeries( aOldChartTypesSeq ));
- Reference< XChartTypeContainer > xCTCnt( rCoordSys[nCooSysIdx], uno::UNO_QUERY_THROW );
- Sequence< Reference< XChartType > > aCTSeq( xCTCnt->getChartTypes());
- aCTSeq.realloc( 1 );
- aCTSeq[0] = xCT;
- xCTCnt->setChartTypes( aCTSeq );
+ xCT = getChartTypeForNewSeries2( aOldChartTypesSeq );
+ rCoordSys[nCooSysIdx]->setChartTypes(std::vector{ xCT });
}
else
{
- for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++nSeriesIdx )
+ for( std::size_t nSeriesIdx=0; nSeriesIdx<aSeriesSeq.size(); ++nSeriesIdx )
{
if( nSeriesIdx == nCooSysIdx )
{
// we need a new chart type
- xCT.set( getChartTypeForNewSeries( aOldChartTypesSeq ));
- Reference< XChartTypeContainer > xCTCnt( rCoordSys[nCooSysIdx], uno::UNO_QUERY_THROW );
- Sequence< Reference< XChartType > > aCTSeq( xCTCnt->getChartTypes());
- if( aCTSeq.hasElements())
+ xCT = getChartTypeForNewSeries2( aOldChartTypesSeq );
+ std::vector< rtl::Reference< ChartType > > aCTSeq( rCoordSys[nCooSysIdx]->getChartTypes2());
+ if( !aCTSeq.empty())
{
aCTSeq[0] = xCT;
- xCTCnt->setChartTypes( aCTSeq );
+ rCoordSys[nCooSysIdx]->setChartTypes( aCTSeq );
}
else
- xCTCnt->addChartType( xCT );
+ rCoordSys[nCooSysIdx]->addChartType( xCT );
- Reference< chart2::XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- xDSCnt->setDataSeries( aSeriesSeq[nSeriesIdx] );
+ xCT->setDataSeries( aSeriesSeq[nSeriesIdx] );
}
else
{
// reuse existing chart type
OSL_ASSERT( xCT.is());
- Reference< chart2::XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aNewSeriesSeq( xDSCnt->getDataSeries());
- sal_Int32 nNewStartIndex = aNewSeriesSeq.getLength();
- aNewSeriesSeq.realloc( nNewStartIndex + aSeriesSeq[nSeriesIdx].getLength() );
+ std::vector< rtl::Reference< DataSeries > > aNewSeriesSeq = xCT->getDataSeries2();
+ sal_Int32 nNewStartIndex = aNewSeriesSeq.size();
+ aNewSeriesSeq.resize( nNewStartIndex + aSeriesSeq[nSeriesIdx].size() );
std::copy( aSeriesSeq[nSeriesIdx].begin(),
aSeriesSeq[nSeriesIdx].end(),
- aNewSeriesSeq.getArray() + nNewStartIndex );
- xDSCnt->setDataSeries( aNewSeriesSeq );
+ aNewSeriesSeq.begin() + nNewStartIndex );
+ xCT->setDataSeries( aNewSeriesSeq );
}
// spread the series over the available coordinate systems
- if( rCoordSys.getLength() > (nCooSysIdx + 1) )
+ if( rCoordSys.size() > (nCooSysIdx + 1) )
++nCooSysIdx;
}
}
@@ -849,27 +793,77 @@ void ChartTypeTemplate::createChartTypes(
}
void ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem(
- const Sequence< Reference< XChartType > > & rOldChartTypesSeq,
- const Reference< XChartType > & xNewChartType )
+ const std::vector< rtl::Reference< ChartType > > & rOldChartTypesSeq,
+ const rtl::Reference< ChartType > & xNewChartType )
{
- Reference< beans::XPropertySet > xDestination( xNewChartType, uno::UNO_QUERY );
- if( !xDestination.is() )
+ if( !xNewChartType.is() )
return;
OUString aNewChartType( xNewChartType->getChartType() );
Reference< beans::XPropertySet > xSource;
- for( Reference< XChartType > const & xOldType : rOldChartTypesSeq )
+ for( rtl::Reference< ChartType > const & xOldType : rOldChartTypesSeq )
{
if( xOldType.is() && xOldType->getChartType() == aNewChartType )
{
- xSource.set( Reference< beans::XPropertySet >(xOldType, uno::UNO_QUERY ) );
+ xSource = xOldType;
if( xSource.is() )
break;
}
}
if( xSource.is() )
- comphelper::copyProperties( xSource, xDestination );
+ comphelper::copyProperties( xSource, xNewChartType );
+}
+
+css::uno::Reference< css::uno::XInterface > ChartTypeTemplate::getDataInterpreter()
+{
+ return static_cast<cppu::OWeakObject*>(getDataInterpreter2().get());
+}
+css::uno::Reference< css::chart2::XDiagram > ChartTypeTemplate::createDiagramByDataSource(
+ const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
+ const css::uno::Sequence< css::beans::PropertyValue >& aArguments )
+{
+ return createDiagramByDataSource2(xDataSource, aArguments);
+}
+void ChartTypeTemplate::changeDiagram(
+ const css::uno::Reference< css::chart2::XDiagram >& xDiagram )
+{
+ changeDiagram(rtl::Reference<Diagram>(dynamic_cast<Diagram*>(xDiagram.get())));
+}
+void ChartTypeTemplate::changeDiagramData(
+ const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
+ const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
+ const css::uno::Sequence< css::beans::PropertyValue >& aArguments )
+{
+ changeDiagramData(rtl::Reference<Diagram>(dynamic_cast<Diagram*>(xDiagram.get())), xDataSource, aArguments);
+}
+sal_Bool ChartTypeTemplate::matchesTemplate(
+ const css::uno::Reference<css::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+{
+ return matchesTemplate2(dynamic_cast<Diagram*>(xDiagram.get()), static_cast<bool>(bAdaptProperties));
+}
+css::uno::Reference< ::css::chart2::XChartType > ChartTypeTemplate::getChartTypeForNewSeries(
+ const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes )
+{
+ std::vector< rtl::Reference< ::chart::ChartType > > aTmp;
+ aTmp.reserve(aFormerlyUsedChartTypes.getLength());
+ for (auto const & rxChartType : aFormerlyUsedChartTypes)
+ aTmp.push_back(dynamic_cast<ChartType*>(rxChartType.get()));
+ return getChartTypeForNewSeries2(aTmp);
+}
+void ChartTypeTemplate::applyStyle(
+ const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+{
+ applyStyle2(dynamic_cast<DataSeries*>(xSeries.get()), nChartTypeIndex, nSeriesIndex, nSeriesCount);
+}
+void ChartTypeTemplate::resetStyles(
+ const css::uno::Reference< css::chart2::XDiagram >& xDiagram )
+{
+ resetStyles2(dynamic_cast<Diagram*>(xDiagram.get()));
}
} // namespace chart
diff --git a/chart2/source/model/template/ColumnChartType.cxx b/chart2/source/model/template/ColumnChartType.cxx
index 4c95b1c1b0b8..cc351e77512b 100644
--- a/chart2/source/model/template/ColumnChartType.cxx
+++ b/chart2/source/model/template/ColumnChartType.cxx
@@ -54,69 +54,19 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticColumnChartTypeDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- Sequence< sal_Int32 > aSeq(2);
-
- aSeq[0] = aSeq[1] = 0;
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_OVERLAP_SEQUENCE, aSeq );
-
- aSeq[0] = aSeq[1] = 100;
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE, aSeq );
- }
-};
-
-struct StaticColumnChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticColumnChartTypeDefaults_Initializer >
-{
-};
-
-struct StaticColumnChartTypeInfoHelper_Initializer
+::cppu::OPropertyArrayHelper & StaticColumnChartTypeInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
+ static ::cppu::OPropertyArrayHelper aPropHelper = []()
+ {
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-};
-
-struct StaticColumnChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticColumnChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticColumnChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticColumnChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticColumnChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticColumnChartTypeInfo_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
} // anonymous namespace
@@ -141,6 +91,11 @@ uno::Reference< util::XCloneable > SAL_CALL ColumnChartType::createClone()
return uno::Reference< util::XCloneable >( new ColumnChartType( *this ));
}
+rtl::Reference< ChartType > ColumnChartType::cloneChartType() const
+{
+ return new ColumnChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL ColumnChartType::getChartType()
{
@@ -149,32 +104,39 @@ OUString SAL_CALL ColumnChartType::getChartType()
uno::Sequence< OUString > ColumnChartType::getSupportedPropertyRoles()
{
- uno::Sequence< OUString > aPropRoles(2);
- aPropRoles[0] = "FillColor";
- aPropRoles[1] = "BorderColor";
-
- return aPropRoles;
+ return { "FillColor", "BorderColor" };
}
// ____ OPropertySet ____
-uno::Any ColumnChartType::GetDefaultValue( sal_Int32 nHandle ) const
-{
- const tPropertyValueMap& rStaticDefaults = *StaticColumnChartTypeDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
- if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+void ColumnChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
+{
+ static const ::chart::tPropertyValueMap aStaticDefaults = []()
+ {
+ ::chart::tPropertyValueMap aTmp;
+ Sequence< sal_Int32 > aSeq{ 0, 0 };
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_BARCHARTTYPE_OVERLAP_SEQUENCE, aSeq );
+ aSeq = { 100, 100 };
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE, aSeq );
+ return aTmp;
+ }();
+ tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
+ if( aFound == aStaticDefaults.end() )
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL ColumnChartType::getInfoHelper()
{
- return *StaticColumnChartTypeInfoHelper::get();
+ return StaticColumnChartTypeInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL ColumnChartType::getPropertySetInfo()
{
- return *StaticColumnChartTypeInfo::get();
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticColumnChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
}
OUString SAL_CALL ColumnChartType::getImplementationName()
diff --git a/chart2/source/model/template/ColumnChartType.hxx b/chart2/source/model/template/ColumnChartType.hxx
index d7b879479bf6..2c6b3d762321 100644
--- a/chart2/source/model/template/ColumnChartType.hxx
+++ b/chart2/source/model/template/ColumnChartType.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNCHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNCHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
namespace chart
{
@@ -37,6 +36,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit ColumnChartType( const ColumnChartType & rOther );
@@ -46,7 +47,7 @@ private:
getSupportedPropertyRoles() override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
@@ -59,7 +60,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNCHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
index 560332b81e98..7e0117cca295 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -18,24 +18,24 @@
*/
#include "ColumnLineChartTypeTemplate.hxx"
+#include "ColumnChartType.hxx"
+#include "LineChartType.hxx"
#include <CommonConverters.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <Diagram.hxx>
#include <DiagramHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <servicenames_charttypes.hxx>
#include "ColumnLineDataInterpreter.hxx"
#include <PropertyHelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
-using namespace ::com::sun::star::chart2;
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -50,69 +50,44 @@ enum
PROP_COL_LINE_NUMBER_OF_LINES
};
-void lcl_AddPropertiesToVector(
- std::vector< Property > & rOutProperties )
+::chart::tPropertyValueMap& StaticColumnLineChartTypeTemplateDefaults()
{
- rOutProperties.emplace_back( "NumberOfLines",
- PROP_COL_LINE_NUMBER_OF_LINES,
- cppu::UnoType<sal_Int32>::get(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ []()
+ {
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_COL_LINE_NUMBER_OF_LINES, 1 );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
}
-struct StaticColumnLineChartTypeTemplateDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aStaticDefaults, PROP_COL_LINE_NUMBER_OF_LINES, 1 );
- return &aStaticDefaults;
- }
-};
-
-struct StaticColumnLineChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticColumnLineChartTypeTemplateDefaults_Initializer >
-{
-};
-
-struct StaticColumnLineChartTypeTemplateInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& StaticColumnLineChartTypeTemplateInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper(
+ []()
+ {
+ std::vector< css::beans::Property > aProperties {
+ { "NumberOfLines",
+ PROP_COL_LINE_NUMBER_OF_LINES,
+ cppu::UnoType<sal_Int32>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT } };
-struct StaticColumnLineChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticColumnLineChartTypeTemplateInfoHelper_Initializer >
-{
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticColumnLineChartTypeTemplateInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticColumnLineChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ return comphelper::containerToSequence( aProperties );
+ }());
+ return aPropHelper;
+}
-struct StaticColumnLineChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticColumnLineChartTypeTemplateInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& StaticColumnLineChartTypeTemplateInfo()
{
-};
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticColumnLineChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
+}
} // anonymous namespace
@@ -126,7 +101,6 @@ ColumnLineChartTypeTemplate::ColumnLineChartTypeTemplate(
StackMode eStackMode,
sal_Int32 nNumberOfLines ) :
ChartTypeTemplate( xContext, rServiceName ),
- ::property::OPropertySet( m_aMutex ),
m_eStackMode( eStackMode )
{
setFastPropertyValue_NoBroadcast( PROP_COL_LINE_NUMBER_OF_LINES, uno::Any( nNumberOfLines ));
@@ -136,41 +110,39 @@ ColumnLineChartTypeTemplate::~ColumnLineChartTypeTemplate()
{}
// ____ OPropertySet ____
-uno::Any ColumnLineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+void ColumnLineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticColumnLineChartTypeTemplateDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticColumnLineChartTypeTemplateDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL ColumnLineChartTypeTemplate::getInfoHelper()
{
- return *StaticColumnLineChartTypeTemplateInfoHelper::get();
+ return StaticColumnLineChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL ColumnLineChartTypeTemplate::getPropertySetInfo()
{
- return *StaticColumnLineChartTypeTemplateInfo::get();
+ return StaticColumnLineChartTypeTemplateInfo();
}
void ColumnLineChartTypeTemplate::createChartTypes(
- const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
- const Sequence< Reference< XChartType > >& aOldChartTypesSeq )
+ const std::vector< std::vector< rtl::Reference< DataSeries > > > & aSeriesSeq,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< ChartType > >& aOldChartTypesSeq )
{
- if( ! rCoordSys.hasElements() ||
- ! rCoordSys[0].is() )
+ if( rCoordSys.empty() )
return;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
- sal_Int32 nNumberOfSeries = aFlatSeriesSeq.getLength();
+ const std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
+ sal_Int32 nNumberOfSeries = aFlatSeriesSeq.size();
sal_Int32 nNumberOfLines = 0;
sal_Int32 nNumberOfColumns = 0;
@@ -194,38 +166,33 @@ void ColumnLineChartTypeTemplate::createChartTypes(
// Columns
- Reference< XChartType > xCT(
- xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartType > xCT = new ColumnChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aOldChartTypesSeq, xCT );
- Reference< XChartTypeContainer > xCTCnt( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
- xCTCnt->setChartTypes( Sequence< Reference< chart2::XChartType > >( &xCT, 1 ));
+ rCoordSys[ 0 ]->setChartTypes( std::vector{xCT} );
if( nNumberOfColumns > 0 )
{
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aColumnSeq( nNumberOfColumns );
+ std::vector< rtl::Reference< DataSeries > > aColumnSeq( nNumberOfColumns );
std::copy( aFlatSeriesSeq.begin(),
aFlatSeriesSeq.begin() + nNumberOfColumns,
- aColumnSeq.getArray());
- xDSCnt->setDataSeries( aColumnSeq );
+ aColumnSeq.begin());
+ xCT->setDataSeries( aColumnSeq );
}
// Lines
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
- xCTCnt.set( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
- xCTCnt->addChartType( xCT );
+ xCT = new LineChartType();
+ rCoordSys[ 0 ]->addChartType( xCT );
if( nNumberOfLines > 0 )
{
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aLineSeq( nNumberOfLines );
+ std::vector< rtl::Reference< DataSeries > > aLineSeq( nNumberOfLines );
std::copy( aFlatSeriesSeq.begin() + nNumberOfColumns,
aFlatSeriesSeq.end(),
- aLineSeq.getArray());
- xDSCnt->setDataSeries( aLineSeq );
+ aLineSeq.begin());
+ xCT->setDataSeries( aLineSeq );
}
}
catch( const uno::Exception & )
@@ -234,13 +201,13 @@ void ColumnLineChartTypeTemplate::createChartTypes(
}
}
-void SAL_CALL ColumnLineChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void ColumnLineChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
if( nChartTypeIndex==0 ) // columns
{
@@ -248,13 +215,9 @@ void SAL_CALL ColumnLineChartTypeTemplate::applyStyle(
}
else if( nChartTypeIndex==1 ) // lines
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
- if( xProp.is() )
- {
- DataSeriesHelper::switchLinesOnOrOff( xProp, true );
- DataSeriesHelper::switchSymbolsOnOrOff( xProp, false, nSeriesIndex );
- DataSeriesHelper::makeLinesThickOrThin( xProp, true );
- }
+ DataSeriesHelper::switchLinesOnOrOff( xSeries, true );
+ DataSeriesHelper::switchSymbolsOnOrOff( xSeries, false, nSeriesIndex );
+ DataSeriesHelper::makeLinesThickOrThin( xSeries, true );
}
}
@@ -266,9 +229,9 @@ StackMode ColumnLineChartTypeTemplate::getStackMode( sal_Int32 nChartTypeIndex )
}
// ____ XChartTypeTemplate ____
-sal_Bool SAL_CALL ColumnLineChartTypeTemplate::matchesTemplate(
- const uno::Reference< XDiagram >& xDiagram,
- sal_Bool bAdaptProperties )
+bool ColumnLineChartTypeTemplate::matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties )
{
bool bResult = false;
@@ -277,35 +240,27 @@ sal_Bool SAL_CALL ColumnLineChartTypeTemplate::matchesTemplate(
try
{
- Reference< chart2::XChartType > xColumnChartType;
- Reference< XCoordinateSystem > xColumnChartCooSys;
- Reference< chart2::XChartType > xLineChartType;
+ rtl::Reference< ChartType > xColumnChartType;
+ rtl::Reference< BaseCoordinateSystem > xColumnChartCooSys;
+ rtl::Reference< ChartType > xLineChartType;
sal_Int32 nNumberOfChartTypes = 0;
- Reference< XCoordinateSystemContainer > xCooSysCnt(
- xDiagram, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( Reference< XCoordinateSystem > const & coords : aCooSysSeq )
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() )
{
- Reference< XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
- for( Reference< XChartType > const & chartType : aChartTypeSeq )
+ const std::vector< rtl::Reference< ChartType > > aChartTypeSeq( coords->getChartTypes2());
+ for( rtl::Reference< ChartType > const & chartType : aChartTypeSeq )
{
- if( chartType.is())
+ ++nNumberOfChartTypes;
+ if( nNumberOfChartTypes > 2 )
+ break;
+ OUString aCTService = chartType->getChartType();
+ if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_COLUMN )
{
- ++nNumberOfChartTypes;
- if( nNumberOfChartTypes > 2 )
- break;
- OUString aCTService = chartType->getChartType();
- if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_COLUMN )
- {
- xColumnChartType.set( chartType );
- xColumnChartCooSys.set( coords );
- }
- else if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_LINE )
- xLineChartType.set( chartType );
+ xColumnChartType = chartType;
+ xColumnChartCooSys = coords;
}
+ else if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_LINE )
+ xLineChartType = chartType;
}
if( nNumberOfChartTypes > 2 )
break;
@@ -330,10 +285,9 @@ sal_Bool SAL_CALL ColumnLineChartTypeTemplate::matchesTemplate(
if( bResult && bAdaptProperties )
{
- Reference< XDataSeriesContainer > xSeriesContainer( xLineChartType, uno::UNO_QUERY );
- if( xSeriesContainer.is() )
+ if( xLineChartType.is() )
{
- sal_Int32 nNumberOfLines = xSeriesContainer->getDataSeries().getLength();
+ sal_Int32 nNumberOfLines = xLineChartType->getDataSeries().getLength();
setFastPropertyValue_NoBroadcast( PROP_COL_LINE_NUMBER_OF_LINES, uno::Any( nNumberOfLines ));
}
}
@@ -348,32 +302,22 @@ sal_Bool SAL_CALL ColumnLineChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > ColumnLineChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
+rtl::Reference< ChartType > ColumnLineChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
{
- Reference< chart2::XChartType > xCT;
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY );
- if(xFact.is())
- {
- if( nChartTypeIndex == 0 )
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY );
- else
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
- }
- return xCT;
+ if( nChartTypeIndex == 0 )
+ return new ColumnChartType();
+ else
+ return new LineChartType();
}
-Reference< XChartType > SAL_CALL ColumnLineChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > ColumnLineChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ xResult = new LineChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
}
catch( const uno::Exception & )
@@ -384,13 +328,13 @@ Reference< XChartType > SAL_CALL ColumnLineChartTypeTemplate::getChartTypeForNew
return xResult;
}
-Reference< XDataInterpreter > SAL_CALL ColumnLineChartTypeTemplate::getDataInterpreter()
+rtl::Reference< DataInterpreter > ColumnLineChartTypeTemplate::getDataInterpreter2()
{
if( ! m_xDataInterpreter.is())
{
sal_Int32 nNumberOfLines = 1;
getFastPropertyValue( PROP_COL_LINE_NUMBER_OF_LINES ) >>= nNumberOfLines;
- m_xDataInterpreter.set( new ColumnLineDataInterpreter( nNumberOfLines ) );
+ m_xDataInterpreter = new ColumnLineDataInterpreter( nNumberOfLines );
}
else
{
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
index 9f04b633d2b3..68f144d6fedb 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
@@ -16,21 +16,18 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNLINECHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNLINECHARTTYPETEMPLATE_HXX
+#pragma once
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <StackMode.hxx>
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
#include <comphelper/uno3.hxx>
namespace chart
{
class ColumnLineChartTypeTemplate :
- public MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
@@ -49,42 +46,40 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
- // ____ XChartTypeTemplate ____
- virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ // ____ ChartTypeTemplate ____
+ virtual bool matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
- virtual css::uno::Reference< css::chart2::XDataInterpreter > SAL_CALL getDataInterpreter() override;
+ virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override;
// ____ ChartTypeTemplate ____
virtual void createChartTypes(
- const css::uno::Sequence<
- css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XDataSeries > > > & aSeriesSeq,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XCoordinateSystem > > & rCoordSys,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XChartType > > & aOldChartTypesSeq
+ const std::vector<
+ std::vector<
+ rtl::Reference<
+ ::chart::DataSeries > > > & aSeriesSeq,
+ const std::vector<
+ rtl::Reference<
+ ::chart::BaseCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
@@ -95,7 +90,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNLINECHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.cxx b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
index b99324d27c00..5cce30cd97a0 100644
--- a/chart2/source/model/template/ColumnLineDataInterpreter.cxx
+++ b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
@@ -18,13 +18,13 @@
*/
#include "ColumnLineDataInterpreter.hxx"
+#include <DataSeries.hxx>
#include <osl/diagnose.h>
#include <algorithm>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-using namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -35,40 +35,39 @@ namespace chart
// explicit
ColumnLineDataInterpreter::ColumnLineDataInterpreter(
sal_Int32 nNumberOfLines ) :
- DataInterpreter(),
m_nNumberOfLines( nNumberOfLines )
{}
ColumnLineDataInterpreter::~ColumnLineDataInterpreter()
{}
-// ____ XDataInterpreter ____
-InterpretedData SAL_CALL ColumnLineDataInterpreter::interpretDataSource(
+// ____ DataInterpreter ____
+InterpretedData ColumnLineDataInterpreter::interpretDataSource(
const Reference< data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& aArguments,
- const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ const std::vector< rtl::Reference< DataSeries > >& aSeriesToReUse )
{
InterpretedData aResult( DataInterpreter::interpretDataSource( xSource, aArguments, aSeriesToReUse ));
// the base class should return one group
- OSL_ASSERT( aResult.Series.getLength() == 1 );
- if( aResult.Series.getLength() == 1 )
+ OSL_ASSERT( aResult.Series.size() == 1 );
+ if( aResult.Series.size() == 1 )
{
- sal_Int32 nNumberOfSeries = aResult.Series[0].getLength();
+ sal_Int32 nNumberOfSeries = aResult.Series[0].size();
// if we have more than one series put the last nNumOfLines ones into a new group
if( nNumberOfSeries > 1 && m_nNumberOfLines > 0 )
{
sal_Int32 nNumOfLines = std::min( m_nNumberOfLines, nNumberOfSeries - 1 );
- aResult.Series.realloc(2);
+ aResult.Series.resize(2);
- Sequence< Reference< XDataSeries > > & rColumnDataSeries = aResult.Series[0];
- Sequence< Reference< XDataSeries > > & rLineDataSeries = aResult.Series[1];
- rLineDataSeries.realloc( nNumOfLines );
- std::copy( rColumnDataSeries.begin() + nNumberOfSeries - nNumOfLines,
- rColumnDataSeries.begin() + nNumberOfSeries,
- rLineDataSeries.getArray() );
- rColumnDataSeries.realloc( nNumberOfSeries - nNumOfLines );
+ std::vector< rtl::Reference< DataSeries > > & rColumnDataSeries = aResult.Series[0];
+ std::vector< rtl::Reference< DataSeries > > & rLineDataSeries = aResult.Series[1];
+ rLineDataSeries.resize( nNumOfLines );
+ std::copy( std::cbegin(rColumnDataSeries) + nNumberOfSeries - nNumOfLines,
+ std::cbegin(rColumnDataSeries) + nNumberOfSeries,
+ rLineDataSeries.begin() );
+ rColumnDataSeries.resize( nNumberOfSeries - nNumOfLines );
}
}
diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.hxx b/chart2/source/model/template/ColumnLineDataInterpreter.hxx
index e6956db4cd30..c2ec75826007 100644
--- a/chart2/source/model/template/ColumnLineDataInterpreter.hxx
+++ b/chart2/source/model/template/ColumnLineDataInterpreter.hxx
@@ -16,27 +16,24 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNLINEDATAINTERPRETER_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNLINEDATAINTERPRETER_HXX
+#pragma once
-#include "DataInterpreter.hxx"
+#include <DataInterpreter.hxx>
namespace chart
{
-
class ColumnLineDataInterpreter : public DataInterpreter
{
public:
- explicit ColumnLineDataInterpreter(
- sal_Int32 nNumberOfLines );
+ explicit ColumnLineDataInterpreter(sal_Int32 nNumberOfLines);
virtual ~ColumnLineDataInterpreter() override;
protected:
- // ____ XDataInterpreter ____
- virtual css::chart2::InterpretedData SAL_CALL interpretDataSource(
- const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
- const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aSeriesToReUse ) override;
+ // ____ DataInterpreter ____
+ virtual InterpretedData interpretDataSource(
+ const css::uno::Reference<css::chart2::data::XDataSource>& xSource,
+ const css::uno::Sequence<css::beans::PropertyValue>& aArguments,
+ const std::vector<rtl::Reference<::chart::DataSeries>>& aSeriesToReUse) override;
private:
sal_Int32 m_nNumberOfLines;
@@ -44,7 +41,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_COLUMNLINEDATAINTERPRETER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx
index 7e85e0b36199..0f5cebc3bbec 100644
--- a/chart2/source/model/template/DataInterpreter.cxx
+++ b/chart2/source/model/template/DataInterpreter.cxx
@@ -17,22 +17,20 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "DataInterpreter.hxx"
+#include <DataInterpreter.hxx>
#include <DataSeries.hxx>
-#include <DataSourceHelper.hxx>
+#include <DataSource.hxx>
#include <DataSeriesHelper.hxx>
#include <CommonConverters.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/chart2/data/XDataSink.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
-#include <vector>
#include <algorithm>
+#include <cstddef>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-using namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -54,10 +52,10 @@ DataInterpreter::~DataInterpreter()
{}
// ____ XDataInterpreter ____
-InterpretedData SAL_CALL DataInterpreter::interpretDataSource(
+InterpretedData DataInterpreter::interpretDataSource(
const Reference< data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& aArguments,
- const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ const std::vector< rtl::Reference< DataSeries > >& aSeriesToReUse )
{
if( ! xSource.is())
return InterpretedData();
@@ -66,10 +64,10 @@ InterpretedData SAL_CALL DataInterpreter::interpretDataSource(
lcl_ShowDataSource( xSource );
#endif
- const Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aData = getDataSequences(xSource);
- Reference< data::XLabeledDataSequence > xCategories;
- vector< Reference< data::XLabeledDataSequence > > aSequencesVec;
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSequencesVec;
// check if we should use categories
@@ -77,13 +75,13 @@ InterpretedData SAL_CALL DataInterpreter::interpretDataSource(
// parse data
bool bCategoriesUsed = false;
- for( Reference< data::XLabeledDataSequence > const & labeledData : aData )
+ for( uno::Reference< chart2::data::XLabeledDataSequence > const & labeledData : aData )
{
try
{
if( bHasCategories && ! bCategoriesUsed )
{
- xCategories.set( labeledData );
+ xCategories = labeledData;
if( xCategories.is())
SetRole( xCategories->getValues(), "categories");
bCategoriesUsed = true;
@@ -102,66 +100,60 @@ InterpretedData SAL_CALL DataInterpreter::interpretDataSource(
}
// create DataSeries
- sal_Int32 nSeriesIndex = 0;
- vector< Reference< XDataSeries > > aSeriesVec;
+ std::size_t nSeriesIndex = 0;
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec;
aSeriesVec.reserve( aSequencesVec.size());
for (auto const& elem : aSequencesVec)
{
- Sequence< Reference< data::XLabeledDataSequence > > aNewData( &elem, 1 );
- Reference< XDataSeries > xSeries;
- if( nSeriesIndex < aSeriesToReUse.getLength())
- xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aNewData { elem };
+ rtl::Reference< DataSeries > xSeries;
+ if( nSeriesIndex < aSeriesToReUse.size())
+ xSeries = aSeriesToReUse[nSeriesIndex];
else
- xSeries.set( new DataSeries );
- OSL_ASSERT( xSeries.is() );
- Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
- OSL_ASSERT( xSink.is() );
- xSink->setData( aNewData );
+ xSeries = new DataSeries;
+ assert( xSeries.is() );
+ xSeries->setData( aNewData );
aSeriesVec.push_back( xSeries );
++nSeriesIndex;
}
- Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
- aSeries[0] = comphelper::containerToSequence( aSeriesVec );
- return InterpretedData( aSeries, xCategories );
+ return { { aSeriesVec }, xCategories };
}
-InterpretedData SAL_CALL DataInterpreter::reinterpretDataSeries(
+InterpretedData DataInterpreter::reinterpretDataSeries(
const InterpretedData& aInterpretedData )
{
InterpretedData aResult( aInterpretedData );
sal_Int32 i=0;
- Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
- const sal_Int32 nCount = aSeries.getLength();
+ std::vector< rtl::Reference< DataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ const sal_Int32 nCount = aSeries.size();
for( ; i<nCount; ++i )
{
try
{
- Reference< data::XDataSource > xSeriesSource( aSeries[i], uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aNewSequences;
+ std::vector< uno::Reference< data::XLabeledDataSequence > > aNewSequences;
// values-y
- Reference< data::XLabeledDataSequence > xValuesY(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, "values-y" ));
+ uno::Reference< data::XLabeledDataSequence > xValuesY =
+ DataSeriesHelper::getDataSequenceByRole( aSeries[i], "values-y" );
// re-use values-... as values-y
if( ! xValuesY.is())
{
- xValuesY.set(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, "values", true ));
+ xValuesY =
+ DataSeriesHelper::getDataSequenceByRole( aSeries[i], "values", true );
if( xValuesY.is())
SetRole( xValuesY->getValues(), "values-y");
}
if( xValuesY.is())
{
- aNewSequences.realloc(1);
- aNewSequences[0] = xValuesY;
+ aNewSequences = { xValuesY };
}
- Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences());
- if( aSeqs.getLength() != aNewSequences.getLength() )
+ const std::vector< uno::Reference< data::XLabeledDataSequence > > & aSeqs = aSeries[i]->getDataSequences2();
+ if( aSeqs.size() != aNewSequences.size() )
{
#ifdef DEBUG_CHART2_TEMPLATE
sal_Int32 j=0;
@@ -170,8 +162,7 @@ InterpretedData SAL_CALL DataInterpreter::reinterpretDataSeries(
assert( aSeqs[j] == xValuesY && "All sequences should be used" );
}
#endif
- Reference< data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY_THROW );
- xSink->setData( aNewSequences );
+ aSeries[i]->setData( aNewSequences );
}
}
catch( const uno::Exception & )
@@ -184,17 +175,15 @@ InterpretedData SAL_CALL DataInterpreter::reinterpretDataSeries(
}
// criterion: all series must have exactly one data::XLabeledDataSequence
-sal_Bool SAL_CALL DataInterpreter::isDataCompatible(
- const chart2::InterpretedData& aInterpretedData )
+bool DataInterpreter::isDataCompatible(
+ const InterpretedData& aInterpretedData )
{
- const Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
- for( Reference< XDataSeries > const & i : aSeries )
+ const std::vector< rtl::Reference< DataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ for( rtl::Reference< DataSeries > const & i : aSeries )
{
try
{
- Reference< data::XDataSource > xSrc( i, uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
- if( aSeq.getLength() != 1 )
+ if( i->getDataSequences2().size() != 1 )
return false;
}
catch( const uno::Exception & )
@@ -259,27 +248,24 @@ private:
} // anonymous namespace
-Reference< data::XDataSource > SAL_CALL DataInterpreter::mergeInterpretedData(
+rtl::Reference< DataSource > DataInterpreter::mergeInterpretedData(
const InterpretedData& aInterpretedData )
{
- vector< Reference< data::XLabeledDataSequence > > aResultVec;
- aResultVec.reserve( aInterpretedData.Series.getLength() +
+ std::vector< Reference< data::XLabeledDataSequence > > aResultVec;
+ aResultVec.reserve( aInterpretedData.Series.size() +
1 // categories
);
if( aInterpretedData.Categories.is())
aResultVec.push_back( aInterpretedData.Categories );
- const Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
- for( Reference< XDataSeries > const & dataSeries : aSeries )
+ const std::vector< rtl::Reference< DataSeries > > aSeries = FlattenSequence( aInterpretedData.Series );
+ for( rtl::Reference< DataSeries > const & dataSeries : aSeries )
{
try
{
- Reference< data::XDataSource > xSrc( dataSeries, uno::UNO_QUERY_THROW );
- const Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
-
// add all sequences of data series
- for( Reference< data::XLabeledDataSequence > const & xAdd : aSeq )
+ for( uno::Reference< data::XLabeledDataSequence > const & xAdd : dataSeries->getDataSequences2() )
{
// only add if sequence is not yet in the result
if( none_of( aResultVec.begin(), aResultVec.end(),
@@ -295,7 +281,13 @@ Reference< data::XDataSource > SAL_CALL DataInterpreter::mergeInterpretedData(
}
}
- return DataSourceHelper::createDataSource( comphelper::containerToSequence( aResultVec ) );
+ return new DataSource(aResultVec);
+}
+
+uno::Any DataInterpreter::getChartTypeSpecificData(
+ const OUString & )
+{
+ return uno::Any();
}
// convenience methods
@@ -335,7 +327,7 @@ void DataInterpreter::SetRole( const Reference< data::XDataSequence > & xSeq, co
uno::Any DataInterpreter::GetProperty(
const Sequence< beans::PropertyValue > & aArguments,
- const OUString & rName )
+ std::u16string_view rName )
{
for( sal_Int32 i=aArguments.getLength(); i--; )
{
@@ -347,14 +339,14 @@ uno::Any DataInterpreter::GetProperty(
bool DataInterpreter::HasCategories(
const Sequence< beans::PropertyValue > & rArguments,
- const Sequence< Reference< data::XLabeledDataSequence > > & rData )
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & rData )
{
bool bHasCategories = false;
if( rArguments.hasElements() )
- GetProperty( rArguments, "HasCategories" ) >>= bHasCategories;
+ GetProperty( rArguments, u"HasCategories" ) >>= bHasCategories;
- for( sal_Int32 nLSeqIdx=0; ! bHasCategories && nLSeqIdx<rData.getLength(); ++nLSeqIdx )
+ for( std::size_t nLSeqIdx=0; ! bHasCategories && nLSeqIdx<rData.size(); ++nLSeqIdx )
bHasCategories = ( rData[nLSeqIdx].is() && GetRole( rData[nLSeqIdx]->getValues() ) == "categories");
return bHasCategories;
@@ -364,7 +356,7 @@ bool DataInterpreter::UseCategoriesAsX( const Sequence< beans::PropertyValue > &
{
bool bUseCategoriesAsX = true;
if( rArguments.hasElements() )
- GetProperty( rArguments, "UseCategoriesAsX" ) >>= bUseCategoriesAsX;
+ GetProperty( rArguments, u"UseCategoriesAsX" ) >>= bUseCategoriesAsX;
return bUseCategoriesAsX;
}
@@ -383,6 +375,17 @@ css::uno::Sequence< OUString > SAL_CALL DataInterpreter::getSupportedServiceName
return { "com.sun.star.chart2.DataInterpreter" };
}
+std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > DataInterpreter::getDataSequences(
+ const css::uno::Reference< css::chart2::data::XDataSource >& xSource)
+{
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aData;
+ for (const Reference< data::XLabeledDataSequence > & rLDS : xSource->getDataSequences() )
+ {
+ aData.push_back(rLDS);
+ }
+ return aData;
+}
+
} // namespace chart
#ifdef DEBUG_CHART2_TEMPLATE
diff --git a/chart2/source/model/template/DataInterpreter.hxx b/chart2/source/model/template/DataInterpreter.hxx
deleted file mode 100644
index 72d3d61e4aab..000000000000
--- a/chart2/source/model/template/DataInterpreter.hxx
+++ /dev/null
@@ -1,79 +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 INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_DATAINTERPRETER_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_DATAINTERPRETER_HXX
-
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/chart2/XDataInterpreter.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-namespace chart
-{
-
-class DataInterpreter : public ::cppu::WeakImplHelper<
- css::chart2::XDataInterpreter,
- css::lang::XServiceInfo >
-{
-public:
- explicit DataInterpreter();
- virtual ~DataInterpreter() override;
-
- /// XServiceInfo declarations
- 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;
-
- // convenience methods
- static OUString GetRole( const css::uno::Reference< css::chart2::data::XDataSequence > & xSeq );
-
- static void SetRole(
- const css::uno::Reference< css::chart2::data::XDataSequence > & xSeq,
- const OUString & rRole );
-
- static css::uno::Any GetProperty(
- const css::uno::Sequence<css::beans::PropertyValue > & aArguments,
- const OUString & rName );
-
- static bool HasCategories(
- const css::uno::Sequence< css::beans::PropertyValue > & rArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rData );
-
- static bool UseCategoriesAsX(
- const css::uno::Sequence< css::beans::PropertyValue > & rArguments );
-
-protected:
- // ____ XDataInterpreter ____
- virtual css::chart2::InterpretedData SAL_CALL interpretDataSource(
- const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
- const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aSeriesToReUse ) override;
- virtual css::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
- const css::chart2::InterpretedData& aInterpretedData ) override;
- virtual sal_Bool SAL_CALL isDataCompatible(
- const css::chart2::InterpretedData& aInterpretedData ) override;
- virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL mergeInterpretedData(
- const css::chart2::InterpretedData& aInterpretedData ) override;
-};
-
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_DATAINTERPRETER_HXX
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/FilledNetChartType.cxx b/chart2/source/model/template/FilledNetChartType.cxx
index 3179317daee5..60672259b905 100644
--- a/chart2/source/model/template/FilledNetChartType.cxx
+++ b/chart2/source/model/template/FilledNetChartType.cxx
@@ -24,7 +24,6 @@
namespace com::sun::star::uno { class XComponentContext; }
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Sequence;
@@ -48,6 +47,11 @@ uno::Reference< util::XCloneable > SAL_CALL FilledNetChartType::createClone()
return uno::Reference< util::XCloneable >( new FilledNetChartType( *this ));
}
+rtl::Reference< ChartType > FilledNetChartType::cloneChartType() const
+{
+ return new FilledNetChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL FilledNetChartType::getChartType()
{
diff --git a/chart2/source/model/template/FilledNetChartType.hxx b/chart2/source/model/template/FilledNetChartType.hxx
index baa2b9efb91b..b2d239aeca36 100644
--- a/chart2/source/model/template/FilledNetChartType.hxx
+++ b/chart2/source/model/template/FilledNetChartType.hxx
@@ -16,40 +16,34 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_FILLEDNETCHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_FILLEDNETCHARTTYPE_HXX
+#pragma once
#include "NetChartType.hxx"
namespace chart
{
-
class FilledNetChartType final : public NetChartType_Base
{
public:
explicit FilledNetChartType();
virtual ~FilledNetChartType() override;
- 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;
+ 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;
+
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
private:
- explicit FilledNetChartType( const FilledNetChartType & rOther );
+ explicit FilledNetChartType(const FilledNetChartType& rOther);
// ____ XChartType ____
virtual OUString SAL_CALL getChartType() override;
// ____ XCloneable ____
- virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+ virtual css::uno::Reference<css::util::XCloneable> SAL_CALL createClone() override;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_FILLEDNETCHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/LineChartType.cxx b/chart2/source/model/template/LineChartType.cxx
index 64b2fe9c146f..e9d7cf808e53 100644
--- a/chart2/source/model/template/LineChartType.cxx
+++ b/chart2/source/model/template/LineChartType.cxx
@@ -43,90 +43,59 @@ enum
PROP_LINECHARTTYPE_SPLINE_ORDER
};
-void lcl_AddPropertiesToVector(
- std::vector< Property > & rOutProperties )
+::chart::tPropertyValueMap& StaticLineChartTypeDefaults()
+{
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ []()
+ {
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_LINECHARTTYPE_CURVE_STYLE, ::chart2::CurveStyle_LINES );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_LINECHARTTYPE_CURVE_RESOLUTION, 20 );
+
+ // todo: check whether order 3 means polygons of order 3 or 2. (see
+ // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_LINECHARTTYPE_SPLINE_ORDER, 3 );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
+}
+
+::cppu::OPropertyArrayHelper& StaticLineChartTypeInfoHelper()
{
- rOutProperties.emplace_back( CHART_UNONAME_CURVE_STYLE,
+ static ::cppu::OPropertyArrayHelper aPropHelper(
+ []()
+ {
+ std::vector< css::beans::Property > aProperties {
+ { CHART_UNONAME_CURVE_STYLE,
PROP_LINECHARTTYPE_CURVE_STYLE,
cppu::UnoType<chart2::CurveStyle>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
-
- rOutProperties.emplace_back( CHART_UNONAME_CURVE_RESOLUTION,
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { CHART_UNONAME_CURVE_RESOLUTION,
PROP_LINECHARTTYPE_CURVE_RESOLUTION,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( CHART_UNONAME_SPLINE_ORDER,
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { CHART_UNONAME_SPLINE_ORDER,
PROP_LINECHARTTYPE_SPLINE_ORDER,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
-}
-
-struct StaticLineChartTypeDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_CURVE_STYLE, ::chart2::CurveStyle_LINES );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_CURVE_RESOLUTION, 20 );
-
- // todo: check whether order 3 means polygons of order 3 or 2. (see
- // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_SPLINE_ORDER, 3 );
- }
-};
-
-struct StaticLineChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticLineChartTypeDefaults_Initializer >
-{
-};
-
-struct StaticLineChartTypeInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
+ | beans::PropertyAttribute::MAYBEDEFAULT } };
- return comphelper::containerToSequence( aProperties );
- }
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-};
-
-struct StaticLineChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLineChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticLineChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLineChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ return comphelper::containerToSequence( aProperties );
+ }());
+ return aPropHelper;
+}
-struct StaticLineChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLineChartTypeInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& StaticLineChartTypeInfo()
{
-};
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticLineChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
+}
} // anonymous namespace
@@ -151,6 +120,11 @@ uno::Reference< util::XCloneable > SAL_CALL LineChartType::createClone()
return uno::Reference< util::XCloneable >( new LineChartType( *this ));
}
+rtl::Reference< ChartType > LineChartType::cloneChartType() const
+{
+ return new LineChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL LineChartType::getChartType()
{
@@ -158,24 +132,25 @@ OUString SAL_CALL LineChartType::getChartType()
}
// ____ OPropertySet ____
-uno::Any LineChartType::GetDefaultValue( sal_Int32 nHandle ) const
+void LineChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticLineChartTypeDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticLineChartTypeDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL LineChartType::getInfoHelper()
{
- return *StaticLineChartTypeInfoHelper::get();
+ return StaticLineChartTypeInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL LineChartType::getPropertySetInfo()
{
- return *StaticLineChartTypeInfo::get();
+ return StaticLineChartTypeInfo();
}
OUString SAL_CALL LineChartType::getImplementationName()
diff --git a/chart2/source/model/template/LineChartType.hxx b/chart2/source/model/template/LineChartType.hxx
index 27ebc7ffb2bf..4c44cca9c349 100644
--- a/chart2/source/model/template/LineChartType.hxx
+++ b/chart2/source/model/template/LineChartType.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_LINECHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_LINECHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
namespace chart
{
@@ -37,6 +36,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit LineChartType( const LineChartType & rOther );
@@ -44,7 +45,7 @@ private:
virtual OUString SAL_CALL getChartType() override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
@@ -57,7 +58,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_LINECHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
index 7989a743529a..e4d347960f18 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -18,10 +18,12 @@
*/
#include "LineChartTypeTemplate.hxx"
-#include <DiagramHelper.hxx>
-#include <servicenames_charttypes.hxx>
+#include "LineChartType.hxx"
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
+#include <ChartType.hxx>
#include <unonames.hxx>
#include <com/sun/star/chart2/CurveStyle.hpp>
@@ -30,8 +32,7 @@
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
@@ -52,89 +53,58 @@ enum
};
-void lcl_AddPropertiesToVector(
- std::vector< Property > & rOutProperties )
+::chart::tPropertyValueMap& StaticLineChartTypeTemplateDefaults()
{
- rOutProperties.emplace_back( CHART_UNONAME_CURVE_STYLE,
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ []()
+ {
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 );
+
+ // todo: check whether order 3 means polygons of order 3 or 2. (see
+ // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, 3 );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
+}
+
+::cppu::OPropertyArrayHelper& StaticLineChartTypeTemplateInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aPropHelper(
+ []()
+ {
+ std::vector< css::beans::Property > aProperties {
+ { CHART_UNONAME_CURVE_STYLE,
PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE,
cppu::UnoType<chart2::CurveStyle>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( CHART_UNONAME_CURVE_RESOLUTION,
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { CHART_UNONAME_CURVE_RESOLUTION,
PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( CHART_UNONAME_SPLINE_ORDER,
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { CHART_UNONAME_SPLINE_ORDER,
PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
-}
-
-struct StaticLineChartTypeTemplateDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 );
-
- // todo: check whether order 3 means polygons of order 3 or 2. (see
- // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, 3 );
- }
-};
-
-struct StaticLineChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticLineChartTypeTemplateDefaults_Initializer >
-{
-};
-
-struct StaticLineChartTypeTemplateInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
+ | beans::PropertyAttribute::MAYBEDEFAULT } };
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticLineChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLineChartTypeTemplateInfoHelper_Initializer >
-{
-};
-
-struct StaticLineChartTypeTemplateInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLineChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ return comphelper::containerToSequence( aProperties );
+ }());
+ return aPropHelper;
+}
-struct StaticLineChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLineChartTypeTemplateInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& StaticLineChartTypeTemplateInfo()
{
-};
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticLineChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
+}
} // anonymous namespace
@@ -150,7 +120,6 @@ LineChartTypeTemplate::LineChartTypeTemplate(
bool bHasLines /* = true */,
sal_Int32 nDim /* = 2 */ ) :
ChartTypeTemplate( xContext, rServiceName ),
- ::property::OPropertySet( m_aMutex ),
m_eStackMode( eStackMode ),
m_bHasSymbols( bSymbols ),
m_bHasLines( bHasLines ),
@@ -162,25 +131,27 @@ LineChartTypeTemplate::LineChartTypeTemplate(
LineChartTypeTemplate::~LineChartTypeTemplate()
{}
+
// ____ OPropertySet ____
-uno::Any LineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+void LineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticLineChartTypeTemplateDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticLineChartTypeTemplateDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL LineChartTypeTemplate::getInfoHelper()
{
- return *StaticLineChartTypeTemplateInfoHelper::get();
+ return StaticLineChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL LineChartTypeTemplate::getPropertySetInfo()
{
- return *StaticLineChartTypeTemplateInfo::get();
+ return StaticLineChartTypeTemplateInfo();
}
sal_Int32 LineChartTypeTemplate::getDimension() const
@@ -193,12 +164,12 @@ StackMode LineChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ )
return m_eStackMode;
}
-// ____ XChartTypeTemplate ____
-sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
- const uno::Reference< chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties )
+// ____ ChartTypeTemplate ____
+bool LineChartTypeTemplate::matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties )
{
- bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+ bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties );
// check symbol-style and line-style
// for a template with symbols (or with lines) it is ok, if there is at least one series
@@ -208,8 +179,8 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
bool bSymbolFound = false;
bool bLineFound = false;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ xDiagram->getDataSeries();
for (auto const& series : aSeriesVec)
{
@@ -217,9 +188,8 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
- bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
+ bool bCurrentHasSymbol = (series->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
if( bCurrentHasSymbol )
@@ -231,7 +201,7 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
break;
}
- bool bCurrentHasLine = (xProp->getPropertyValue( "LineStyle") >>= eLineStyle) &&
+ bool bCurrentHasLine = (series->getPropertyValue( "LineStyle") >>= eLineStyle) &&
( eLineStyle != drawing::LineStyle_NONE );
if( bCurrentHasLine )
@@ -265,12 +235,10 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
{
try
{
- uno::Reference< beans::XPropertySet > xChartTypeProp(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ),
- uno::UNO_QUERY_THROW );
- setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_STYLE) );
- setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) );
- setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) );
+ rtl::Reference< ChartType > xChartType = xDiagram->getChartTypeByIndex( 0 );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, xChartType->getPropertyValue(CHART_UNONAME_CURVE_STYLE) );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartType->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartType->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) );
}
catch( const uno::Exception & )
{
@@ -281,27 +249,20 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > LineChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > LineChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
-
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
- }
+ xResult = new LineChartType();
+
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
catch( const uno::Exception & )
{
@@ -311,30 +272,23 @@ Reference< chart2::XChartType > LineChartTypeTemplate::getChartTypeForIndex( sal
return xResult;
}
-Reference< chart2::XChartType > SAL_CALL LineChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > LineChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ xResult = new LineChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
- }
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
catch( const uno::Exception & )
{
@@ -344,21 +298,19 @@ Reference< chart2::XChartType > SAL_CALL LineChartTypeTemplate::getChartTypeForN
return xResult;
}
-void SAL_CALL LineChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void LineChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
try
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
-
- DataSeriesHelper::switchSymbolsOnOrOff( xProp, m_bHasSymbols, nSeriesIndex );
- DataSeriesHelper::switchLinesOnOrOff( xProp, m_bHasLines );
- DataSeriesHelper::makeLinesThickOrThin( xProp, m_nDim==2 );
+ DataSeriesHelper::switchSymbolsOnOrOff( xSeries, m_bHasSymbols, nSeriesIndex );
+ DataSeriesHelper::switchLinesOnOrOff( xSeries, m_bHasLines );
+ DataSeriesHelper::makeLinesThickOrThin( xSeries, m_nDim==2 );
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/model/template/LineChartTypeTemplate.hxx b/chart2/source/model/template/LineChartTypeTemplate.hxx
index 2663fb11325d..a634fb390aae 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.hxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.hxx
@@ -16,12 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_LINECHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_LINECHARTTYPETEMPLATE_HXX
+#pragma once
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
#include <StackMode.hxx>
#include <comphelper/uno3.hxx>
@@ -29,7 +27,6 @@ namespace chart
{
class LineChartTypeTemplate :
- public MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
@@ -50,27 +47,26 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
- // ____ XChartTypeTemplate ____
- virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ // ____ ChartTypeTemplate ____
+ virtual bool matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
-
- // ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
@@ -84,7 +80,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_LINECHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx
index 95de304b6ae1..cb4512c74884 100644
--- a/chart2/source/model/template/NetChartType.cxx
+++ b/chart2/source/model/template/NetChartType.cxx
@@ -22,6 +22,7 @@
#include <servicenames_charttypes.hxx>
#include <AxisIndexDefines.hxx>
#include <AxisHelper.hxx>
+#include <Axis.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
@@ -47,18 +48,18 @@ NetChartType_Base::NetChartType_Base( const NetChartType_Base & rOther ) :
NetChartType_Base::~NetChartType_Base()
{}
-Reference< XCoordinateSystem > SAL_CALL
- NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount )
+rtl::Reference< ::chart::BaseCoordinateSystem >
+ NetChartType_Base::createCoordinateSystem2( sal_Int32 DimensionCount )
{
if( DimensionCount != 2 )
throw lang::IllegalArgumentException(
"NetChart must be two-dimensional",
static_cast< ::cppu::OWeakObject* >( this ), 0 );
- Reference< XCoordinateSystem > xResult(
- new PolarCoordinateSystem( DimensionCount ));
+ rtl::Reference< PolarCoordinateSystem > xResult =
+ new PolarCoordinateSystem( DimensionCount );
- Reference< XAxis > xAxis( xResult->getAxisByDimension( 0, MAIN_AXIS_INDEX ) );
+ rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( 0, MAIN_AXIS_INDEX );
if( xAxis.is() )
{
ScaleData aScaleData = xAxis->getScaleData();
@@ -68,7 +69,7 @@ Reference< XCoordinateSystem > SAL_CALL
xAxis->setScaleData( aScaleData );
}
- xAxis = xResult->getAxisByDimension( 1, MAIN_AXIS_INDEX );
+ xAxis = xResult->getAxisByDimension2( 1, MAIN_AXIS_INDEX );
if( xAxis.is() )
{
ScaleData aScaleData = xAxis->getScaleData();
@@ -81,53 +82,39 @@ Reference< XCoordinateSystem > SAL_CALL
}
// ____ OPropertySet ____
-uno::Any NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/ ) const
+void NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/, uno::Any& rAny ) const
{
- return uno::Any();
+ rAny.clear();
}
namespace
{
-struct StaticNetChartTypeInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& StaticNetChartTypeInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper(Sequence< beans::Property >{});
- return &aPropHelper;
- }
-};
-
-struct StaticNetChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticNetChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticNetChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticNetChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper(Sequence< beans::Property >{});
+ return aPropHelper;
+}
-struct StaticNetChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticNetChartTypeInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& StaticNetChartTypeInfo()
{
-};
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticNetChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
+}
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper()
{
- return *StaticNetChartTypeInfoHelper::get();
+ return StaticNetChartTypeInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL NetChartType_Base::getPropertySetInfo()
{
- return *StaticNetChartTypeInfo::get();
+ return StaticNetChartTypeInfo();
}
NetChartType::NetChartType()
@@ -147,6 +134,11 @@ uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone()
return uno::Reference< util::XCloneable >( new NetChartType( *this ));
}
+rtl::Reference< ChartType > NetChartType::cloneChartType() const
+{
+ return new NetChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL NetChartType::getChartType()
{
diff --git a/chart2/source/model/template/NetChartType.hxx b/chart2/source/model/template/NetChartType.hxx
index 3d3efed8cfe5..ae414a27c4e1 100644
--- a/chart2/source/model/template/NetChartType.hxx
+++ b/chart2/source/model/template/NetChartType.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_NETCHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_NETCHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
namespace chart
{
@@ -33,18 +32,17 @@ public:
protected:
explicit NetChartType_Base( const NetChartType_Base & rOther );
- // ____ XChartType ____
- virtual css::uno::Reference< css::chart2::XCoordinateSystem > SAL_CALL
- createCoordinateSystem( ::sal_Int32 DimensionCount ) override;
-
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
+
+ virtual rtl::Reference< ::chart::BaseCoordinateSystem >
+ createCoordinateSystem2( sal_Int32 DimensionCount ) override;
};
class NetChartType final : public NetChartType_Base
@@ -60,6 +58,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit NetChartType( const NetChartType & rOther );
@@ -72,7 +72,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_NETCHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
index fed499cb3970..0acd07d7b928 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.cxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -18,20 +18,21 @@
*/
#include "NetChartTypeTemplate.hxx"
-#include <DiagramHelper.hxx>
-#include <servicenames_charttypes.hxx>
+#include "FilledNetChartType.hxx"
+#include "NetChartType.hxx"
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <ChartType.hxx>
#include <com/sun/star/chart2/SymbolStyle.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
namespace chart
{
@@ -58,21 +59,19 @@ StackMode NetChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ )
return m_eStackMode;
}
-void SAL_CALL NetChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void NetChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
try
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
-
- DataSeriesHelper::switchSymbolsOnOrOff( xProp, m_bHasSymbols, nSeriesIndex );
- DataSeriesHelper::switchLinesOnOrOff( xProp, m_bHasLines );
- DataSeriesHelper::makeLinesThickOrThin( xProp, true );
+ DataSeriesHelper::switchSymbolsOnOrOff( xSeries, m_bHasSymbols, nSeriesIndex );
+ DataSeriesHelper::switchLinesOnOrOff( xSeries, m_bHasLines );
+ DataSeriesHelper::makeLinesThickOrThin( xSeries, true );
}
catch( const uno::Exception & )
{
@@ -80,15 +79,12 @@ void SAL_CALL NetChartTypeTemplate::applyStyle(
}
}
-// ____ XChartTypeTemplate ____
-sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
- const Reference< chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties )
+// ____ ChartTypeTemplate ____
+bool NetChartTypeTemplate::matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties )
{
- bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
-
- uno::Reference< beans::XPropertySet > xChartTypeProp(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), uno::UNO_QUERY_THROW );
+ bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties );
if( bResult )
{
@@ -102,8 +98,8 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
bool bSymbolFound = false;
bool bLineFound = false;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ xDiagram->getDataSeries();
for (auto const& series : aSeriesVec)
{
@@ -111,9 +107,8 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
- bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
+ bool bCurrentHasSymbol = (series->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
if( bCurrentHasSymbol )
@@ -125,7 +120,7 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
break;
}
- bool bCurrentHasLine = (xProp->getPropertyValue( "LineStyle") >>= eLineStyle) &&
+ bool bCurrentHasLine = (series->getPropertyValue( "LineStyle") >>= eLineStyle) &&
( eLineStyle != drawing::LineStyle_NONE );
if( bCurrentHasLine )
@@ -157,34 +152,18 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
-
- try
- {
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
-
- if( m_bHasFilledArea )
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ), uno::UNO_QUERY_THROW );
- else
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
+ if( m_bHasFilledArea )
+ return new FilledNetChartType();
+ else
+ return new NetChartType();
}
-Reference< chart2::XChartType > SAL_CALL NetChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > NetChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) );
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
return xResult;
}
diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx
index 369989e6f988..b1f5ac9dbd83 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.hxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_NETCHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_NETCHARTTYPETEMPLATE_HXX
+#pragma once
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <StackMode.hxx>
namespace chart
@@ -39,20 +38,21 @@ public:
virtual ~NetChartTypeTemplate() override;
protected:
- // ____ XChartTypeTemplate ____
- virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ // ____ ChartTypeTemplate ____
+ virtual bool matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
@@ -65,7 +65,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_NETCHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx
index c18c8d11d376..a835f6357f6c 100644
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -20,12 +20,14 @@
#include "PieChartType.hxx"
#include <PropertyHelper.hxx>
#include <PolarCoordinateSystem.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <servicenames_charttypes.hxx>
#include <AxisIndexDefines.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
using namespace ::com::sun::star;
@@ -36,85 +38,54 @@ using ::com::sun::star::uno::Reference;
namespace
{
-enum
+::chart::tPropertyValueMap& StaticPieChartTypeDefaults()
{
- PROP_PIECHARTTYPE_USE_RINGS,
- PROP_PIECHARTTYPE_3DRELATIVEHEIGHT
-};
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ []()
+ {
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, ::chart::PROP_PIECHARTTYPE_USE_RINGS, false );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, ::chart::PROP_PIECHARTTYPE_SUBTYPE, chart2::PieChartSubType_NONE );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
+}
-void lcl_AddPropertiesToVector(
- std::vector< Property > & rOutProperties )
+::cppu::OPropertyArrayHelper& StaticPieChartTypeInfoHelper()
{
- rOutProperties.emplace_back( "UseRings",
- PROP_PIECHARTTYPE_USE_RINGS,
+ static ::cppu::OPropertyArrayHelper aPropHelper(
+ []()
+ {
+ std::vector< css::beans::Property > aProperties {
+ { "UseRings",
+ ::chart::PROP_PIECHARTTYPE_USE_RINGS,
cppu::UnoType<bool>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( "3DRelativeHeight",
- PROP_PIECHARTTYPE_3DRELATIVEHEIGHT,
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { "3DRelativeHeight",
+ ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT,
cppu::UnoType<sal_Int32>::get(),
- beans::PropertyAttribute::MAYBEVOID );
+ beans::PropertyAttribute::MAYBEVOID },
+ { "SubPieType",
+ ::chart::PROP_PIECHARTTYPE_SUBTYPE,
+ cppu::UnoType<chart2::PieChartSubType>::get(),
+ beans::PropertyAttribute::MAYBEDEFAULT }
+ };
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }());
+ return aPropHelper;
}
-struct StaticPieChartTypeDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIECHARTTYPE_USE_RINGS, false );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 );
- }
-};
-
-struct StaticPieChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPieChartTypeDefaults_Initializer >
-{
-};
-
-struct StaticPieChartTypeInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticPieChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticPieChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticPieChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticPieChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticPieChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticPieChartTypeInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& StaticPieChartTypeInfo()
{
-};
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo( StaticPieChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
+}
} // anonymous namespace
@@ -139,21 +110,26 @@ uno::Reference< util::XCloneable > SAL_CALL PieChartType::createClone()
return uno::Reference< util::XCloneable >( new PieChartType( *this ));
}
+rtl::Reference< ChartType > PieChartType::cloneChartType() const
+{
+ return new PieChartType( *this );
+}
+
// ____ XChartType ____
OUString SAL_CALL PieChartType::getChartType()
{
return CHART2_SERVICE_NAME_CHARTTYPE_PIE;
}
-Reference< chart2::XCoordinateSystem > SAL_CALL
- PieChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+rtl::Reference< ::chart::BaseCoordinateSystem >
+ PieChartType::createCoordinateSystem2( sal_Int32 DimensionCount )
{
- Reference< chart2::XCoordinateSystem > xResult(
- new PolarCoordinateSystem( DimensionCount ));
+ rtl::Reference< PolarCoordinateSystem > xResult =
+ new PolarCoordinateSystem( DimensionCount );
for( sal_Int32 i=0; i<DimensionCount; ++i )
{
- Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( i, MAIN_AXIS_INDEX );
if( !xAxis.is() )
{
OSL_FAIL("a created coordinate system should have an axis for each dimension");
@@ -182,33 +158,30 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
uno::Sequence< OUString > PieChartType::getSupportedPropertyRoles()
{
- uno::Sequence< OUString > aPropRoles(2);
- aPropRoles[0] = "FillColor";
- aPropRoles[1] = "BorderColor";
-
- return aPropRoles;
+ return { "FillColor", "BorderColor" };
}
// ____ OPropertySet ____
-uno::Any PieChartType::GetDefaultValue( sal_Int32 nHandle ) const
+void PieChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticPieChartTypeDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticPieChartTypeDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL PieChartType::getInfoHelper()
{
- return *StaticPieChartTypeInfoHelper::get();
+ return StaticPieChartTypeInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL PieChartType::getPropertySetInfo()
{
- return *StaticPieChartTypeInfo::get();
+ return StaticPieChartTypeInfo();
}
OUString SAL_CALL PieChartType::getImplementationName()
diff --git a/chart2/source/model/template/PieChartType.hxx b/chart2/source/model/template/PieChartType.hxx
index 897ec96950f1..083bd78facd3 100644
--- a/chart2/source/model/template/PieChartType.hxx
+++ b/chart2/source/model/template/PieChartType.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_PIECHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_PIECHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
namespace chart
{
@@ -37,18 +37,18 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit PieChartType( const PieChartType & rOther );
// ____ XChartType ____
virtual OUString SAL_CALL getChartType() override;
- virtual css::uno::Reference< css::chart2::XCoordinateSystem > SAL_CALL
- createCoordinateSystem( ::sal_Int32 DimensionCount ) override;
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedPropertyRoles() override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -59,11 +59,11 @@ private:
// ____ XCloneable ____
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+
+ virtual rtl::Reference< ::chart::BaseCoordinateSystem >
+ createCoordinateSystem2( sal_Int32 DimensionCount ) override;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_PIECHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index 964b5d96d5c2..df97c53aaef9 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -18,27 +18,29 @@
*/
#include "PieChartTypeTemplate.hxx"
+#include "PieChartType.hxx"
+#include <BaseCoordinateSystem.hxx>
#include <CommonConverters.hxx>
-#include <DiagramHelper.hxx>
-#include <servicenames_charttypes.hxx>
+#include <ChartType.hxx>
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
+#include <DataSeriesProperties.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
-#include <ThreeDHelper.hxx>
#include <PropertyHelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <officecfg/Office/Compatibility.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <rtl/math.hxx>
#include <algorithm>
using namespace ::com::sun::star;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Sequence;
@@ -52,95 +54,72 @@ enum
PROP_PIE_TEMPLATE_DEFAULT_OFFSET,
PROP_PIE_TEMPLATE_OFFSET_MODE,
PROP_PIE_TEMPLATE_DIMENSION,
- PROP_PIE_TEMPLATE_USE_RINGS
+ PROP_PIE_TEMPLATE_USE_RINGS,
+ PROP_PIE_TEMPLATE_SUB_PIE_TYPE
};
-void lcl_AddPropertiesToVector(
- std::vector< Property > & rOutProperties )
+::chart::tPropertyValueMap& StaticPieChartTypeTemplateDefaults()
{
- rOutProperties.emplace_back( "OffsetMode",
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ []{
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIE_TEMPLATE_OFFSET_MODE, chart2::PieChartOffsetMode_NONE );
+ ::chart::PropertyHelper::setPropertyValueDefault< double >( aOutMap, PROP_PIE_TEMPLATE_DEFAULT_OFFSET, 0.5 );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_PIE_TEMPLATE_DIMENSION, 2 );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIE_TEMPLATE_USE_RINGS, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIE_TEMPLATE_SUB_PIE_TYPE, chart2::PieChartSubType_NONE );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
+}
+
+::cppu::OPropertyArrayHelper& StaticPieChartTypeTemplateInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aPropHelper(
+ []()
+ {
+ std::vector< css::beans::Property > aProperties {
+ { "OffsetMode",
PROP_PIE_TEMPLATE_OFFSET_MODE,
cppu::UnoType<chart2::PieChartOffsetMode>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( "DefaultOffset",
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { "DefaultOffset",
PROP_PIE_TEMPLATE_DEFAULT_OFFSET,
cppu::UnoType<double>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( "Dimension",
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { "Dimension",
PROP_PIE_TEMPLATE_DIMENSION,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( "UseRings",
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { "UseRings",
PROP_PIE_TEMPLATE_USE_RINGS,
cppu::UnoType<bool>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
-}
-
-struct StaticPieChartTypeTemplateDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIE_TEMPLATE_OFFSET_MODE, chart2::PieChartOffsetMode_NONE );
- ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_PIE_TEMPLATE_DEFAULT_OFFSET, 0.5 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_PIE_TEMPLATE_DIMENSION, 2 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIE_TEMPLATE_USE_RINGS, false );
- }
-};
-
-struct StaticPieChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPieChartTypeTemplateDefaults_Initializer >
-{
-};
-
-struct StaticPieChartTypeTemplateInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { "SubPieType",
+ PROP_PIE_TEMPLATE_SUB_PIE_TYPE,
+ cppu::UnoType<chart2::PieChartSubType>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT }
+ };
-struct StaticPieChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticPieChartTypeTemplateInfoHelper_Initializer >
-{
-};
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
-struct StaticPieChartTypeTemplateInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticPieChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ return comphelper::containerToSequence( aProperties );
+ }() );
+ return aPropHelper;
+}
-struct StaticPieChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticPieChartTypeTemplateInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& StaticPieChartTypeTemplateInfo()
{
-};
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticPieChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
+}
} // anonymous namespace
@@ -152,38 +131,40 @@ PieChartTypeTemplate::PieChartTypeTemplate(
uno::XComponentContext > const & xContext,
const OUString & rServiceName,
chart2::PieChartOffsetMode eMode,
- bool bRings /* = false */,
+ bool bRings,
+ chart2::PieChartSubType eSubType,
sal_Int32 nDim /* = 2 */ ) :
- ChartTypeTemplate( xContext, rServiceName ),
- ::property::OPropertySet( m_aMutex )
+ ChartTypeTemplate( xContext, rServiceName )
{
setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_OFFSET_MODE, uno::Any( eMode ));
setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_DIMENSION, uno::Any( nDim ));
setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_USE_RINGS, uno::Any( bRings ));
+ setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_SUB_PIE_TYPE, uno::Any( eSubType ));
}
PieChartTypeTemplate::~PieChartTypeTemplate()
{}
// ____ OPropertySet ____
-uno::Any PieChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+void PieChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticPieChartTypeTemplateDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticPieChartTypeTemplateDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL PieChartTypeTemplate::getInfoHelper()
{
- return *StaticPieChartTypeTemplateInfoHelper::get();
+ return StaticPieChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL PieChartTypeTemplate::getPropertySetInfo()
{
- return *StaticPieChartTypeTemplateInfo::get();
+ return StaticPieChartTypeTemplateInfo();
}
// ____ ChartTypeTemplate ____
@@ -210,14 +191,14 @@ sal_Int32 PieChartTypeTemplate::getAxisCountByDimension( sal_Int32 /*nDimension*
}
void PieChartTypeTemplate::adaptAxes(
- const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > & /*rCoordSys*/ )
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & /*rCoordSys*/ )
{
// hide existing axes
//hhhh todo
}
void PieChartTypeTemplate::adaptScales(
- const Sequence< Reference< chart2::XCoordinateSystem > > & aCooSysSeq,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysSeq,
const Reference< chart2::data::XLabeledDataSequence > & xCategories //@todo: in future there may be more than one sequence of categories (e.g. charttype with categories at x and y axis )
)
{
@@ -226,17 +207,25 @@ void PieChartTypeTemplate::adaptScales(
//remove explicit scalings from radius axis
//and ensure correct orientation of scales for donuts
- for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq )
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysSeq )
{
try
{
- Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 1 /*nDimensionIndex*/,0 /*nAxisIndex*/
- , coords ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( 1 /*nDimensionIndex*/,0 /*nAxisIndex*/
+ , coords );
if( xAxis.is() )
{
chart2::ScaleData aScaleData( xAxis->getScaleData() );
AxisHelper::removeExplicitScaling( aScaleData );
- aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ // tdf#108059 Create new pie/donut charts with clockwise orientation
+ if (!officecfg::Office::Compatibility::View::ClockwisePieChartDirection::get())
+ {
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ }
+ else
+ {
+ aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
+ }
xAxis->setScaleData( aScaleData );
}
@@ -245,7 +234,12 @@ void PieChartTypeTemplate::adaptScales(
if( xAxis.is() )
{
chart2::ScaleData aScaleData( xAxis->getScaleData() );
- aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
+
+ //tdf#123218 Don't reverse the orientation in OOXML-heavy environments
+ if( officecfg::Office::Compatibility::View::ReverseXAxisOrientationDoughnutChart::get() )
+ aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
+ else
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
xAxis->setScaleData( aScaleData );
}
}
@@ -257,35 +251,26 @@ void PieChartTypeTemplate::adaptScales(
}
void PieChartTypeTemplate::createChartTypes(
- const Sequence< Sequence< Reference< chart2::XDataSeries > > > & aSeriesSeq,
- const Sequence< Reference< chart2::XCoordinateSystem > > & rCoordSys,
- const Sequence< Reference< chart2::XChartType > >& /* aOldChartTypesSeq */ )
+ const std::vector< std::vector< rtl::Reference< DataSeries > > > & aSeriesSeq,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< ChartType > >& /* aOldChartTypesSeq */ )
{
- if( ! rCoordSys.hasElements() ||
- ! rCoordSys[0].is() )
+ if( rCoordSys.empty() )
return;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
-
- Reference< chart2::XChartType > xCT(
- xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_PIE ), uno::UNO_QUERY_THROW );
- Reference< beans::XPropertySet > xCTProp( xCT, uno::UNO_QUERY );
- if( xCTProp.is())
+ rtl::Reference< ChartType > xCT = new PieChartType();
+ xCT->setFastPropertyValue(
+ PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings"
+ xCT->setFastPropertyValue(
+ PROP_PIECHARTTYPE_SUBTYPE, getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE )); // "SubType"
+ rCoordSys[0]->setChartTypes( std::vector{xCT} );
+
+ if( !aSeriesSeq.empty() )
{
- xCTProp->setPropertyValue(
- "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
- }
- Reference< chart2::XChartTypeContainer > xCTCnt( rCoordSys[0], uno::UNO_QUERY_THROW );
- xCTCnt->setChartTypes( Sequence< Reference< chart2::XChartType > >( &xCT, 1 ));
-
- if( aSeriesSeq.hasElements() )
- {
- Reference< chart2::XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- Sequence< Reference< chart2::XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
- xDSCnt->setDataSeries( aFlatSeriesSeq );
+ std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq = FlattenSequence( aSeriesSeq );
+ xCT->setDataSeries( aFlatSeriesSeq );
DataSeriesHelper::setStackModeAtSeries(
aFlatSeriesSeq, rCoordSys[0], getStackMode( 0 ));
@@ -298,16 +283,18 @@ void PieChartTypeTemplate::createChartTypes(
}
// ____ XChartTypeTemplate ____
-sal_Bool SAL_CALL PieChartTypeTemplate::matchesTemplate(
- const uno::Reference< chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties )
+bool PieChartTypeTemplate::matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties )
{
- bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+ bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties );
bool bTemplateUsesRings = false;
getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ) >>= bTemplateUsesRings;
chart2::PieChartOffsetMode ePieOffsetMode;
getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE ) >>= ePieOffsetMode;
+ chart2::PieChartSubType eTemplateSubType;
+ getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE ) >>= eTemplateSubType;
//check offset-mode
if( bResult )
@@ -316,21 +303,25 @@ sal_Bool SAL_CALL PieChartTypeTemplate::matchesTemplate(
{
double fOffset=0.0;
bool bAllOffsetsEqual = true;
+ sal_Int32 nOuterSeriesIndex = 0;
+
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ xDiagram->getDataSeries();
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ //tdf#108067 The outer series is the last series in OOXML-heavy environments
+ if( !officecfg::Office::Compatibility::View::ReverseXAxisOrientationDoughnutChart::get() )
+ nOuterSeriesIndex = aSeriesVec.size() - 1;
//check offset of outer series
if( !aSeriesVec.empty() )
{
//@todo in future this will depend on Orientation of the radius axis scale
- Reference< chart2::XDataSeries > xSeries( aSeriesVec[0] );
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
- xProp->getPropertyValue( "Offset") >>= fOffset;
+ rtl::Reference< DataSeries > xSeries( aSeriesVec[nOuterSeriesIndex] );
+ xSeries->getPropertyValue( "Offset") >>= fOffset;
- //get AttributedDataPoints
+ // "AttributedDataPoints"
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -338,7 +329,7 @@ sal_Bool SAL_CALL PieChartTypeTemplate::matchesTemplate(
if(xPointProp.is())
{
double fPointOffset=0.0;
- if( xProp->getPropertyValue( "Offset") >>= fPointOffset )
+ if( xSeries->getPropertyValue( "Offset") >>= fPointOffset )
{
if( ! ::rtl::math::approxEqual( fPointOffset, fOffset ) )
{
@@ -371,35 +362,37 @@ sal_Bool SAL_CALL PieChartTypeTemplate::matchesTemplate(
//check UseRings
if( bResult )
{
- uno::Reference< beans::XPropertySet > xCTProp(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartType > xCTProp = xDiagram->getChartTypeByIndex( 0 );
bool bUseRings = false;
- if( xCTProp->getPropertyValue( "UseRings") >>= bUseRings )
+ if( xCTProp->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= bUseRings ) // "UseRings"
{
bResult = ( bTemplateUsesRings == bUseRings );
}
}
+ if( bResult )
+ {
+ rtl::Reference< ChartType > xCTProp = xDiagram->getChartTypeByIndex( 0 );
+ chart2::PieChartSubType eSubType = chart2::PieChartSubType_NONE;
+ if( xCTProp->getFastPropertyValue( PROP_PIECHARTTYPE_SUBTYPE ) >>= eSubType )
+ {
+ bResult = ( eTemplateSubType == eSubType );
+ }
+ }
return bResult;
}
-Reference< chart2::XChartType > PieChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_PIE ), uno::UNO_QUERY_THROW );
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
- }
-
+ xResult = new PieChartType();
+ xResult->setFastPropertyValue(
+ PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings"
+ xResult->setFastPropertyValue(
+ PROP_PIECHARTTYPE_SUBTYPE, getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE ));
}
catch( const uno::Exception & )
{
@@ -409,25 +402,19 @@ Reference< chart2::XChartType > PieChartTypeTemplate::getChartTypeForIndex( sal_
return xResult;
}
-Reference< chart2::XChartType > SAL_CALL PieChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_PIE ), uno::UNO_QUERY_THROW );
+ xResult = new PieChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
- }
-
+ xResult->setFastPropertyValue(
+ PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings"
+ xResult->setFastPropertyValue(
+ PROP_PIECHARTTYPE_SUBTYPE, getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE ));
}
catch( const uno::Exception & )
{
@@ -437,23 +424,27 @@ Reference< chart2::XChartType > SAL_CALL PieChartTypeTemplate::getChartTypeForNe
return xResult;
}
-void SAL_CALL PieChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void PieChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
try
{
- uno::Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
-
bool bTemplateUsesRings = false;
+ sal_Int32 nOuterSeriesIndex = 0;
getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ) >>= bTemplateUsesRings;
- if( nSeriesIndex == 0 ) //@todo in future this will depend on Orientation of the radius axis scale
+
+ //tdf#108067 The outer series is the last series in OOXML-heavy environments
+ if( !officecfg::Office::Compatibility::View::ReverseXAxisOrientationDoughnutChart::get() )
+ nOuterSeriesIndex = nSeriesCount - 1;
+
+ if( nSeriesIndex == nOuterSeriesIndex ) //@todo in future this will depend on Orientation of the radius axis scale
{
- const OUString aOffsetPropName( "Offset" );
+ static constexpr OUString aOffsetPropName( u"Offset"_ustr );
// get offset mode
chart2::PieChartOffsetMode ePieOffsetMode;
getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE ) >>= ePieOffsetMode;
@@ -464,7 +455,8 @@ void SAL_CALL PieChartTypeTemplate::applyStyle(
double fOffsetToSet = fDefaultOffset;
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- xProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList;
+ // "AttributedDataPoints"
+ xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList;
// determine whether to set the new offset
bool bSetOffset = ( ePieOffsetMode == chart2::PieChartOffsetMode_ALL_EXPLODED );
@@ -474,12 +466,12 @@ void SAL_CALL PieChartTypeTemplate::applyStyle(
// set offset to 0 if the offset was exactly "all exploded"
// before (individual offsets are kept)
double fOffset = 0.0;
- if( (xProp->getPropertyValue( aOffsetPropName ) >>= fOffset) &&
+ if( (xSeries->getPropertyValue( aOffsetPropName ) >>= fOffset) &&
::rtl::math::approxEqual( fOffset, fDefaultOffset ))
{
fOffsetToSet = 0.0;
bSetOffset = true;
- for( auto const & pointIndex : std::as_const(aAttributedDataPointIndexList) )
+ for (auto const& pointIndex : aAttributedDataPointIndexList)
{
uno::Reference< beans::XPropertySet > xPointProp(
xSeries->getDataPointByIndex( pointIndex ));
@@ -501,10 +493,10 @@ void SAL_CALL PieChartTypeTemplate::applyStyle(
if( bSetOffset )
{
// set the offset to the series and to the attributed data points
- xProp->setPropertyValue( aOffsetPropName, uno::Any( fOffsetToSet ));
+ xSeries->setPropertyValue( aOffsetPropName, uno::Any( fOffsetToSet ));
// remove hard attributes from data points
- for( auto const & pointIndex : std::as_const(aAttributedDataPointIndexList) )
+ for (auto const& pointIndex : aAttributedDataPointIndexList)
{
uno::Reference< beans::XPropertyState > xPointState(
xSeries->getDataPointByIndex( pointIndex ), uno::UNO_QUERY );
@@ -518,7 +510,7 @@ void SAL_CALL PieChartTypeTemplate::applyStyle(
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) );
// vary colors by point
- xProp->setPropertyValue( "VaryColorsByPoint", uno::Any( true ));
+ xSeries->setFastPropertyValue( PROP_DATASERIES_VARY_COLORS_BY_POINT, uno::Any( true )); // "VaryColorsByPoint"
}
catch( const uno::Exception & )
{
@@ -526,22 +518,21 @@ void SAL_CALL PieChartTypeTemplate::applyStyle(
}
}
-void SAL_CALL PieChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram >& xDiagram )
+void PieChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
// reset axes and grids
- Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY );
- if( xCooSysCnt.is())
+ if( xDiagram.is())
{
- const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq( xDiagram->getBaseCoordinateSystems());
ChartTypeTemplate::createAxes( aCooSysSeq );
//reset scale orientation
- for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq )
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysSeq )
{
try
{
- Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 0 /*nDimensionIndex*/,0 /*nAxisIndex*/
- , coords ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( 0 /*nDimensionIndex*/,0 /*nAxisIndex*/
+ , coords );
if( xAxis.is() )
{
chart2::ScaleData aScaleData( xAxis->getScaleData() );
@@ -564,40 +555,34 @@ void SAL_CALL PieChartTypeTemplate::resetStyles( const Reference< chart2::XDiagr
}
}
- ChartTypeTemplate::resetStyles( xDiagram );
+ ChartTypeTemplate::resetStyles2( xDiagram );
// vary colors by point,
// line style
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ xDiagram->getDataSeries();
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
- if( xState.is())
+ series->setPropertyToDefault( "VaryColorsByPoint");
+ if( series->getPropertyValue( "BorderStyle") == aLineStyleAny )
{
- xState->setPropertyToDefault( "VaryColorsByPoint");
- Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY );
- if( xProp.is() &&
- xProp->getPropertyValue( "BorderStyle") == aLineStyleAny )
- {
- xState->setPropertyToDefault( "BorderStyle");
- }
+ series->setPropertyToDefault( "BorderStyle");
}
}
//reset scene properties
- ThreeDHelper::setDefaultRotation( uno::Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ), false );
+ xDiagram->setDefaultRotation( false );
}
// ____ XChartTypeTemplate ____
-void PieChartTypeTemplate::adaptDiagram( const uno::Reference< chart2::XDiagram >& xDiagram )
+void PieChartTypeTemplate::adaptDiagram( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
if( !xDiagram.is() )
return;
//different default for scene geometry:
- ThreeDHelper::setDefaultRotation( uno::Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ), true );
+ xDiagram->setDefaultRotation( true );
}
IMPLEMENT_FORWARD_XINTERFACE2( PieChartTypeTemplate, ChartTypeTemplate, OPropertySet )
diff --git a/chart2/source/model/template/PieChartTypeTemplate.hxx b/chart2/source/model/template/PieChartTypeTemplate.hxx
index f11099fdd9f5..b603392e7009 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.hxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.hxx
@@ -16,21 +16,19 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_PIECHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_PIECHARTTYPETEMPLATE_HXX
+#pragma once
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
#include <comphelper/uno3.hxx>
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <com/sun/star/chart2/PieChartOffsetMode.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
namespace chart
{
class PieChartTypeTemplate :
- public MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
@@ -40,6 +38,7 @@ public:
const OUString & rServiceName,
css::chart2::PieChartOffsetMode eMode,
bool bRings,
+ css::chart2::PieChartSubType eSubType,
sal_Int32 nDim = 2 );
virtual ~PieChartTypeTemplate() override;
@@ -50,63 +49,58 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
- // ____ XChartTypeTemplate ____
- virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ // ____ ChartTypeTemplate ____
+ virtual bool matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
- virtual void SAL_CALL resetStyles(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override;
+ virtual void resetStyles2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram ) override;
// ____ ChartTypeTemplate ____
virtual sal_Int32 getDimension() const override;
virtual void adaptDiagram(
- const css::uno::Reference< css::chart2::XDiagram > & xDiagram ) override;
+ const rtl::Reference< ::chart::Diagram > & xDiagram ) override;
virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension ) override;
virtual void adaptAxes(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & rCoordSys ) override;
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys ) override;
virtual void adaptScales(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & aCooSysSeq,
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & aCooSysSeq,
const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xCategories ) override;
virtual void createChartTypes(
- const css::uno::Sequence<
- css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XDataSeries > > >& aSeriesSeq,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XCoordinateSystem > > & rCoordSys,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XChartType > > & aOldChartTypesSeq
+ const std::vector<
+ std::vector<
+ rtl::Reference<
+ ::chart::DataSeries > > >& aSeriesSeq,
+ const std::vector<
+ rtl::Reference<
+ ::chart::BaseCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_PIECHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx
index 10798f9bd455..cee026913b7f 100644
--- a/chart2/source/model/template/ScatterChartType.cxx
+++ b/chart2/source/model/template/ScatterChartType.cxx
@@ -21,6 +21,7 @@
#include <PropertyHelper.hxx>
#include <servicenames_charttypes.hxx>
#include <CartesianCoordinateSystem.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <AxisIndexDefines.hxx>
#include <unonames.hxx>
@@ -46,90 +47,57 @@ enum
PROP_SCATTERCHARTTYPE_SPLINE_ORDER
};
-void lcl_AddPropertiesToVector(
- std::vector< Property > & rOutProperties )
+::chart::tPropertyValueMap& StaticScatterChartTypeDefaults()
{
- rOutProperties.emplace_back( CHART_UNONAME_CURVE_STYLE,
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ []()
+ {
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_SCATTERCHARTTYPE_CURVE_STYLE, chart2::CurveStyle_LINES );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION, 20 );
+
+ // todo: check whether order 3 means polygons of order 3 or 2. (see
+ // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_SCATTERCHARTTYPE_SPLINE_ORDER, 3 );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
+}
+
+::cppu::OPropertyArrayHelper& StaticScatterChartTypeInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aPropHelper(
+ []()
+ {
+ std::vector< css::beans::Property > aProperties {
+ { CHART_UNONAME_CURVE_STYLE,
PROP_SCATTERCHARTTYPE_CURVE_STYLE,
cppu::UnoType<chart2::CurveStyle>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
-
- rOutProperties.emplace_back( CHART_UNONAME_CURVE_RESOLUTION,
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { CHART_UNONAME_CURVE_RESOLUTION,
PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( CHART_UNONAME_SPLINE_ORDER,
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { CHART_UNONAME_SPLINE_ORDER,
PROP_SCATTERCHARTTYPE_SPLINE_ORDER,
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
+ | beans::PropertyAttribute::MAYBEDEFAULT } };
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+ return comphelper::containerToSequence( aProperties );
+ }() );
+ return aPropHelper;
}
-struct StaticScatterChartTypeDefaults_Initializer
+const uno::Reference< beans::XPropertySetInfo >& StaticScatterChartTypeInfo()
{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCATTERCHARTTYPE_CURVE_STYLE, chart2::CurveStyle_LINES );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION, 20 );
-
- // todo: check whether order 3 means polygons of order 3 or 2. (see
- // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_SPLINE_ORDER, 3 );
- }
-};
-
-struct StaticScatterChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticScatterChartTypeDefaults_Initializer >
-{
-};
-
-struct StaticScatterChartTypeInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticScatterChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticScatterChartTypeInfoHelper_Initializer >
-{
-};
-
-struct StaticScatterChartTypeInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticScatterChartTypeInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticScatterChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticScatterChartTypeInfo_Initializer >
-{
-};
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticScatterChartTypeInfoHelper() ) );
+ return xPropertySetInfo;
+}
} // anonymous namespace
@@ -154,16 +122,21 @@ uno::Reference< util::XCloneable > SAL_CALL ScatterChartType::createClone()
return uno::Reference< util::XCloneable >( new ScatterChartType( *this ));
}
+rtl::Reference< ChartType > ScatterChartType::cloneChartType() const
+{
+ return new ScatterChartType( *this );
+}
+
// ____ XChartType ____
-Reference< chart2::XCoordinateSystem > SAL_CALL
- ScatterChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+rtl::Reference< ::chart::BaseCoordinateSystem >
+ ScatterChartType::createCoordinateSystem2( sal_Int32 DimensionCount )
{
- Reference< chart2::XCoordinateSystem > xResult(
- new CartesianCoordinateSystem( DimensionCount ));
+ rtl::Reference< CartesianCoordinateSystem > xResult =
+ new CartesianCoordinateSystem( DimensionCount );
for( sal_Int32 i=0; i<DimensionCount; ++i )
{
- Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ rtl::Reference< Axis > xAxis = xResult->getAxisByDimension2( i, MAIN_AXIS_INDEX );
if( !xAxis.is() )
{
OSL_FAIL("a created coordinate system should have an axis for each dimension");
@@ -192,33 +165,30 @@ OUString SAL_CALL ScatterChartType::getChartType()
uno::Sequence< OUString > SAL_CALL ScatterChartType::getSupportedMandatoryRoles()
{
- uno::Sequence< OUString > aMandRolesSeq(3);
- aMandRolesSeq[0] = "label";
- aMandRolesSeq[1] = "values-x";
- aMandRolesSeq[2] = "values-y";
- return aMandRolesSeq;
+ return { "label", "values-x", "values-y" };
}
// ____ OPropertySet ____
-uno::Any ScatterChartType::GetDefaultValue( sal_Int32 nHandle ) const
+void ScatterChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticScatterChartTypeDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticScatterChartTypeDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartType::getInfoHelper()
{
- return *StaticScatterChartTypeInfoHelper::get();
+ return StaticScatterChartTypeInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL ScatterChartType::getPropertySetInfo()
{
- return *StaticScatterChartTypeInfo::get();
+ return StaticScatterChartTypeInfo();
}
OUString SAL_CALL ScatterChartType::getImplementationName()
diff --git a/chart2/source/model/template/ScatterChartType.hxx b/chart2/source/model/template/ScatterChartType.hxx
index e7f1e24de3cf..f490c108ca56 100644
--- a/chart2/source/model/template/ScatterChartType.hxx
+++ b/chart2/source/model/template/ScatterChartType.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_SCATTERCHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_SCATTERCHARTTYPE_HXX
+#pragma once
-#include "ChartType.hxx"
+#include <ChartType.hxx>
namespace chart
{
@@ -37,6 +36,8 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override;
+ virtual rtl::Reference<ChartType> cloneChartType() const override;
+
private:
explicit ScatterChartType( const ScatterChartType & rOther );
@@ -44,11 +45,9 @@ private:
virtual OUString SAL_CALL getChartType() override;
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedMandatoryRoles() override;
- virtual css::uno::Reference< css::chart2::XCoordinateSystem > SAL_CALL
- createCoordinateSystem( ::sal_Int32 DimensionCount ) override;
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
// ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -59,11 +58,11 @@ private:
// ____ XCloneable ____
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
+
+ virtual rtl::Reference< ::chart::BaseCoordinateSystem >
+ createCoordinateSystem2( sal_Int32 DimensionCount ) override;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_SCATTERCHARTTYPE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index e0dc1cd1183a..3457bfa00126 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -18,9 +18,11 @@
*/
#include "ScatterChartTypeTemplate.hxx"
+#include "ScatterChartType.hxx"
#include "XYDataInterpreter.hxx"
-#include <DiagramHelper.hxx>
-#include <servicenames_charttypes.hxx>
+#include <ChartType.hxx>
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
#include <unonames.hxx>
@@ -31,8 +33,7 @@
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
@@ -53,89 +54,58 @@ enum
};
-void lcl_AddPropertiesToVector(
- std::vector< Property > & rOutProperties )
+const ::chart::tPropertyValueMap& StaticScatterChartTypeTemplateDefaults()
{
- rOutProperties.emplace_back( CHART_UNONAME_CURVE_STYLE,
- PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE,
- cppu::UnoType<chart2::CurveStyle>::get(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( CHART_UNONAME_CURVE_RESOLUTION,
- PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
- cppu::UnoType<sal_Int32>::get(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
- rOutProperties.emplace_back( CHART_UNONAME_SPLINE_ORDER,
- PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER,
- cppu::UnoType<sal_Int32>::get(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
+ static const ::chart::tPropertyValueMap aStaticDefaults =
+ []()
+ {
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 );
+
+ // todo: check whether order 3 means polygons of order 3 or 2. (see
+ // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, 3 );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
}
-struct StaticScatterChartTypeTemplateDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 );
-
- // todo: check whether order 3 means polygons of order 3 or 2. (see
- // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, 3 );
- }
-};
-
-struct StaticScatterChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticScatterChartTypeTemplateDefaults_Initializer >
-{
-};
-
-struct StaticScatterChartTypeTemplateInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticScatterChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticScatterChartTypeTemplateInfoHelper_Initializer >
-{
-};
-struct StaticScatterChartTypeTemplateInfo_Initializer
+::cppu::OPropertyArrayHelper& StaticScatterChartTypeTemplateInfoHelper()
{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticScatterChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
+ static ::cppu::OPropertyArrayHelper aPropHelper(
+ []()
+ {
+ std::vector< css::beans::Property > aProperties {
+ { CHART_UNONAME_CURVE_STYLE,
+ PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE,
+ cppu::UnoType<chart2::CurveStyle>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { CHART_UNONAME_CURVE_RESOLUTION,
+ PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
+ cppu::UnoType<sal_Int32>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT },
+ { CHART_UNONAME_SPLINE_ORDER,
+ PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER,
+ cppu::UnoType<sal_Int32>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT } };
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+ return comphelper::containerToSequence( aProperties );
+ }() );
+ return aPropHelper;
+}
-struct StaticScatterChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticScatterChartTypeTemplateInfo_Initializer >
+const uno::Reference< beans::XPropertySetInfo >& StaticScatterChartTypeTemplateInfo()
{
-};
+ static const uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(StaticScatterChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
+}
} // anonymous namespace
@@ -150,7 +120,6 @@ ScatterChartTypeTemplate::ScatterChartTypeTemplate(
bool bHasLines /* = true */,
sal_Int32 nDim /* = 2 */ ) :
ChartTypeTemplate( xContext, rServiceName ),
- ::property::OPropertySet( m_aMutex ),
m_bHasSymbols( bSymbols ),
m_bHasLines( bHasLines ),
m_nDim( nDim )
@@ -163,24 +132,25 @@ ScatterChartTypeTemplate::~ScatterChartTypeTemplate()
{}
// ____ OPropertySet ____
-uno::Any ScatterChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+void ScatterChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticScatterChartTypeTemplateDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = StaticScatterChartTypeTemplateDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartTypeTemplate::getInfoHelper()
{
- return *StaticScatterChartTypeTemplateInfoHelper::get();
+ return StaticScatterChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL ScatterChartTypeTemplate::getPropertySetInfo()
{
- return *StaticScatterChartTypeTemplateInfo::get();
+ return StaticScatterChartTypeTemplateInfo();
}
sal_Int32 ScatterChartTypeTemplate::getDimension() const
@@ -195,21 +165,19 @@ StackMode ScatterChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex *
return StackMode::NONE;
}
-void SAL_CALL ScatterChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void ScatterChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
try
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
-
- DataSeriesHelper::switchSymbolsOnOrOff( xProp, m_bHasSymbols, nSeriesIndex );
- DataSeriesHelper::switchLinesOnOrOff( xProp, m_bHasLines );
- DataSeriesHelper::makeLinesThickOrThin( xProp, m_nDim==2 );
+ DataSeriesHelper::switchSymbolsOnOrOff( xSeries, m_bHasSymbols, nSeriesIndex );
+ DataSeriesHelper::switchLinesOnOrOff( xSeries, m_bHasLines );
+ DataSeriesHelper::makeLinesThickOrThin( xSeries, m_nDim==2 );
if( m_nDim==3 )
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) );
}
@@ -225,11 +193,11 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::supportsCategories()
return false;
}
-sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
- const Reference< chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties )
+bool ScatterChartTypeTemplate::matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties )
{
- bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+ bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties );
// check symbol-style and line-style
// for a template with symbols (or with lines) it is ok, if there is at least one series
@@ -239,8 +207,8 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
bool bSymbolFound = false;
bool bLineFound = false;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ xDiagram->getDataSeries();
for (auto const& series : aSeriesVec)
{
@@ -248,9 +216,8 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
- bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
+ bool bCurrentHasSymbol = (series->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
if( bCurrentHasSymbol )
@@ -262,7 +229,7 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
break;
}
- bool bCurrentHasLine = (xProp->getPropertyValue( "LineStyle") >>= eLineStyle) &&
+ bool bCurrentHasLine = (series->getPropertyValue( "LineStyle") >>= eLineStyle) &&
( eLineStyle != drawing::LineStyle_NONE );
if( bCurrentHasLine )
@@ -296,9 +263,8 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
{
try
{
- uno::Reference< beans::XPropertySet > xChartTypeProp(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ),
- uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartType > xChartTypeProp =
+ xDiagram->getChartTypeByIndex(0);
setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_STYLE) );
setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) );
setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) );
@@ -312,27 +278,20 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > ScatterChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > ScatterChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ), uno::UNO_QUERY_THROW );
-
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
- }
+ xResult = new ScatterChartType();
+
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
catch( const uno::Exception & )
{
@@ -342,30 +301,23 @@ Reference< chart2::XChartType > ScatterChartTypeTemplate::getChartTypeForIndex(
return xResult;
}
-Reference< chart2::XChartType > SAL_CALL ScatterChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > ScatterChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ), uno::UNO_QUERY_THROW );
+ xResult = new ScatterChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
- }
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
catch( const uno::Exception & )
{
@@ -375,7 +327,7 @@ Reference< chart2::XChartType > SAL_CALL ScatterChartTypeTemplate::getChartTypeF
return xResult;
}
-Reference< chart2::XDataInterpreter > SAL_CALL ScatterChartTypeTemplate::getDataInterpreter()
+rtl::Reference< DataInterpreter > ScatterChartTypeTemplate::getDataInterpreter2()
{
if( ! m_xDataInterpreter.is())
m_xDataInterpreter.set( new XYDataInterpreter );
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.hxx b/chart2/source/model/template/ScatterChartTypeTemplate.hxx
index ee32e200f551..0d7aec7ad188 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.hxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.hxx
@@ -16,19 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_SCATTERCHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_SCATTERCHARTTYPETEMPLATE_HXX
+#pragma once
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
#include <comphelper/uno3.hxx>
namespace chart
{
class ScatterChartTypeTemplate :
- public MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
@@ -48,30 +45,30 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override;
- // ____ XChartTypeTemplate ____
+ // ____ ChartTypeTemplate ____
virtual sal_Bool SAL_CALL supportsCategories() override;
- virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual css::uno::Reference< css::chart2::XDataInterpreter > SAL_CALL getDataInterpreter() override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ virtual bool matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
@@ -84,7 +81,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_SCATTERCHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index 7eb0e1ca51da..b0ff53d2a2c3 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -18,25 +18,25 @@
*/
#include "StockChartTypeTemplate.hxx"
+#include "ColumnChartType.hxx"
+#include "CandleStickChartType.hxx"
+#include "LineChartType.hxx"
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include "StockDataInterpreter.hxx"
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <servicenames_charttypes.hxx>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <PropertyHelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
-#include <vector>
#include <algorithm>
+#include <cstddef>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -78,65 +78,41 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticStockChartTypeTemplateDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_OPEN, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE, false );
- }
-};
-
-struct StaticStockChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticStockChartTypeTemplateDefaults_Initializer >
+::chart::tPropertyValueMap& GetStaticStockChartTypeTemplateDefaults()
{
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ [](){
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_STOCKCHARTTYPE_TEMPLATE_OPEN, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE, false );
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
-struct StaticStockChartTypeTemplateInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& GetStaticStockChartTypeTemplateInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
+ static ::cppu::OPropertyArrayHelper aPropHelper =
+ [](){
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticStockChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticStockChartTypeTemplateInfoHelper_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
-struct StaticStockChartTypeTemplateInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticStockChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-struct StaticStockChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticStockChartTypeTemplateInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& GetStaticStockChartTypeTemplateInfo()
{
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(GetStaticStockChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
};
} // anonymous namespace
@@ -151,7 +127,6 @@ StockChartTypeTemplate::StockChartTypeTemplate(
StockVariant eVariant,
bool bJapaneseStyle ) :
ChartTypeTemplate( xContext, rServiceName ),
- ::property::OPropertySet( m_aMutex ),
m_eStockVariant( eVariant )
{
setFastPropertyValue_NoBroadcast(
@@ -169,25 +144,27 @@ StockChartTypeTemplate::StockChartTypeTemplate(
StockChartTypeTemplate::~StockChartTypeTemplate()
{}
+
// ____ OPropertySet ____
-uno::Any StockChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+void StockChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticStockChartTypeTemplateDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = GetStaticStockChartTypeTemplateDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL StockChartTypeTemplate::getInfoHelper()
{
- return *StaticStockChartTypeTemplateInfoHelper::get();
+ return GetStaticStockChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL StockChartTypeTemplate::getPropertySetInfo()
{
- return *StaticStockChartTypeTemplateInfo::get();
+ return GetStaticStockChartTypeTemplateInfo();
}
sal_Int32 StockChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension )
@@ -206,13 +183,13 @@ sal_Int32 StockChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension
return bHasVolume ? 2 : 1;
}
-void SAL_CALL StockChartTypeTemplate::applyStyle(
- const Reference< chart2::XDataSeries >& xSeries,
+void StockChartTypeTemplate::applyStyle2(
+ const rtl::Reference< DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount )
{
- ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
try
{
sal_Int32 nNewAxisIndex = 0;
@@ -222,9 +199,7 @@ void SAL_CALL StockChartTypeTemplate::applyStyle(
if( bHasVolume && nChartTypeIndex != 0 )
nNewAxisIndex = 1;
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
- if( xProp.is() )
- xProp->setPropertyValue( "AttachedAxisIndex", uno::Any( nNewAxisIndex ) );
+ xSeries->setPropertyValue( "AttachedAxisIndex", uno::Any( nNewAxisIndex ) );
if( bHasVolume && nChartTypeIndex==0 )
{
@@ -234,13 +209,10 @@ void SAL_CALL StockChartTypeTemplate::applyStyle(
else
{
//ensure that lines are on
- if( xProp.is() )
- {
- drawing::LineStyle eStyle = drawing::LineStyle_NONE;
- xProp->getPropertyValue( "LineStyle" ) >>= eStyle;
- if( eStyle == drawing::LineStyle_NONE )
- xProp->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_SOLID ));
- }
+ drawing::LineStyle eStyle = drawing::LineStyle_NONE;
+ xSeries->getPropertyValue( "LineStyle" ) >>= eStyle;
+ if( eStyle == drawing::LineStyle_NONE )
+ xSeries->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_SOLID ));
}
}
@@ -250,66 +222,57 @@ void SAL_CALL StockChartTypeTemplate::applyStyle(
}
}
-void SAL_CALL StockChartTypeTemplate::resetStyles(
- const Reference< chart2::XDiagram >& xDiagram )
+void StockChartTypeTemplate::resetStyles2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram )
{
- ChartTypeTemplate::resetStyles( xDiagram );
+ ChartTypeTemplate::resetStyles2( xDiagram );
if( getDimension() == 3 )
{
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ xDiagram->getDataSeries();
for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY);
- if( xProp.is() )
- xProp->setPropertyValue( "AttachedAxisIndex", uno::Any( sal_Int32(0) ) );
+ series->setPropertyValue( "AttachedAxisIndex", uno::Any( sal_Int32(0) ) );
}
}
- DiagramHelper::setVertical( xDiagram, false );
+ xDiagram->setVertical( false );
}
-Reference< XChartType > StockChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
+rtl::Reference< ChartType > StockChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
{
- Reference< XChartType > xCT;
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY );
- if(xFact.is())
+ rtl::Reference< ChartType > xCT;
+ bool bHasVolume = false;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
+ if( bHasVolume )
{
- bool bHasVolume = false;
- getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
- if( bHasVolume )
- {
- if( nChartTypeIndex == 0 )
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY );
- else if( nChartTypeIndex == 1 )
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY );
- else
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
- }
+ if( nChartTypeIndex == 0 )
+ xCT = new ColumnChartType();
+ else if( nChartTypeIndex == 1 )
+ xCT = new CandleStickChartType();
else
- {
- if( nChartTypeIndex == 0 )
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY );
- else
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
- }
+ xCT = new LineChartType();
+ }
+ else
+ {
+ if( nChartTypeIndex == 0 )
+ xCT = new CandleStickChartType();
+ else
+ xCT = new LineChartType();
}
return xCT;
}
void StockChartTypeTemplate::createChartTypes(
- const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
- const Sequence< Reference< XChartType > >& /* aOldChartTypesSeq */ )
+ const std::vector< std::vector< rtl::Reference< DataSeries > > > & aSeriesSeq,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< ChartType > >& /* aOldChartTypesSeq */ )
{
- if( !rCoordSys.hasElements() )
+ if( rCoordSys.empty() )
return;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
bool bHasVolume = false;
bool bShowFirst = false;
bool bJapaneseStyle = false;
@@ -320,63 +283,49 @@ void StockChartTypeTemplate::createChartTypes(
getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE ) >>= bJapaneseStyle;
getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH ) >>= bShowHighLow;
- sal_Int32 nSeriesIndex = 0;
+ std::size_t nSeriesIndex = 0;
- std::vector< Reference< chart2::XChartType > > aChartTypeVec;
+ std::vector< rtl::Reference< ChartType > > aChartTypeVec;
// Bars (Volume)
if( bHasVolume )
{
// chart type
- Reference< XChartType > xCT(
- xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartType > xCT = new ColumnChartType();
aChartTypeVec.push_back( xCT );
- if( aSeriesSeq.getLength() > nSeriesIndex &&
- aSeriesSeq[nSeriesIndex].hasElements() )
+ if( aSeriesSeq.size() > nSeriesIndex &&
+ !aSeriesSeq[nSeriesIndex].empty() )
{
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
}
++nSeriesIndex;
}
- Reference< XChartType > xCT(
- xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartType > xCT = new CandleStickChartType();
aChartTypeVec.push_back( xCT );
- Reference< beans::XPropertySet > xCTProp( xCT, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue( "Japanese", uno::Any( bJapaneseStyle ));
- xCTProp->setPropertyValue( "ShowFirst", uno::Any( bShowFirst ));
- xCTProp->setPropertyValue( "ShowHighLow", uno::Any( bShowHighLow ));
- }
+ xCT->setPropertyValue( "Japanese", uno::Any( bJapaneseStyle ));
+ xCT->setPropertyValue( "ShowFirst", uno::Any( bShowFirst ));
+ xCT->setPropertyValue( "ShowHighLow", uno::Any( bShowHighLow ));
- if( aSeriesSeq.getLength() > nSeriesIndex &&
- aSeriesSeq[ nSeriesIndex ].hasElements() )
+ if( aSeriesSeq.size() > nSeriesIndex &&
+ !aSeriesSeq[ nSeriesIndex ].empty() )
{
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
}
++nSeriesIndex;
// Lines (remaining series)
- if( aSeriesSeq.getLength() > nSeriesIndex &&
- aSeriesSeq[ nSeriesIndex ].hasElements() )
+ if( aSeriesSeq.size() > nSeriesIndex &&
+ !aSeriesSeq[ nSeriesIndex ].empty() )
{
- xCT.set(
- xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ xCT = new LineChartType();
aChartTypeVec.push_back( xCT );
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
}
- Reference< XChartTypeContainer > xCTCnt( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
- xCTCnt->setChartTypes( comphelper::containerToSequence(aChartTypeVec) );
+ rCoordSys[ 0 ]->setChartTypes( aChartTypeVec );
}
catch( const uno::Exception & )
{
@@ -384,10 +333,10 @@ void StockChartTypeTemplate::createChartTypes(
}
}
-// ____ XChartTypeTemplate ____
-sal_Bool SAL_CALL StockChartTypeTemplate::matchesTemplate(
- const uno::Reference< XDiagram >& xDiagram,
- sal_Bool /* bAdaptProperties */ )
+// ____ ChartTypeTemplate ____
+bool StockChartTypeTemplate::matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool /* bAdaptProperties */ )
{
bool bResult = false;
@@ -402,34 +351,25 @@ sal_Bool SAL_CALL StockChartTypeTemplate::matchesTemplate(
getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_OPEN ) >>= bHasOpenValue;
getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE ) >>= bHasJapaneseStyle;
- Reference< chart2::XChartType > xVolumeChartType;
- Reference< chart2::XChartType > xCandleStickChartType;
- Reference< chart2::XChartType > xLineChartType;
+ rtl::Reference< ChartType > xVolumeChartType;
+ rtl::Reference< ChartType > xCandleStickChartType;
+ rtl::Reference< ChartType > xLineChartType;
sal_Int32 nNumberOfChartTypes = 0;
- Reference< XCoordinateSystemContainer > xCooSysCnt(
- xDiagram, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( Reference< XCoordinateSystem > const & coords : aCooSysSeq )
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() )
{
- Reference< XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
- for( Reference< XChartType > const & chartType : aChartTypeSeq )
+ for( rtl::Reference< ChartType > const & chartType : coords->getChartTypes2() )
{
- if( chartType.is())
- {
- ++nNumberOfChartTypes;
- if( nNumberOfChartTypes > 3 )
- break;
- OUString aCTService = chartType->getChartType();
- if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_COLUMN )
- xVolumeChartType.set( chartType );
- else if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
- xCandleStickChartType.set( chartType );
- else if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_LINE )
- xLineChartType.set( chartType );
- }
+ ++nNumberOfChartTypes;
+ if( nNumberOfChartTypes > 3 )
+ break;
+ OUString aCTService = chartType->getChartType();
+ if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_COLUMN )
+ xVolumeChartType = chartType;
+ else if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
+ xCandleStickChartType = chartType;
+ else if( aCTService == CHART2_SERVICE_NAME_CHARTTYPE_LINE )
+ xLineChartType = chartType;
}
if( nNumberOfChartTypes > 3 )
break;
@@ -440,18 +380,14 @@ sal_Bool SAL_CALL StockChartTypeTemplate::matchesTemplate(
bResult = true;
// check for japanese style
- Reference< beans::XPropertySet > xCTProp( xCandleStickChartType, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- bool bJapaneseProp = false;
- xCTProp->getPropertyValue( "Japanese") >>= bJapaneseProp;
- bResult = bResult && ( bHasJapaneseStyle == bJapaneseProp );
-
- // in old chart japanese == showFirst
- bool bShowFirstProp = false;
- xCTProp->getPropertyValue( "ShowFirst") >>= bShowFirstProp;
- bResult = bResult && ( bHasOpenValue == bShowFirstProp );
- }
+ bool bJapaneseProp = false;
+ xCandleStickChartType->getPropertyValue( "Japanese") >>= bJapaneseProp;
+ bResult = bResult && ( bHasJapaneseStyle == bJapaneseProp );
+
+ // in old chart japanese == showFirst
+ bool bShowFirstProp = false;
+ xCandleStickChartType->getPropertyValue( "ShowFirst") >>= bShowFirstProp;
+ bResult = bResult && ( bHasOpenValue == bShowFirstProp );
}
}
catch( const uno::Exception & )
@@ -462,17 +398,14 @@ sal_Bool SAL_CALL StockChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< XChartType > SAL_CALL StockChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > StockChartTypeTemplate::getChartTypeForNewSeries2(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ xResult = new LineChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
}
catch( const uno::Exception & )
@@ -483,7 +416,7 @@ Reference< XChartType > SAL_CALL StockChartTypeTemplate::getChartTypeForNewSerie
return xResult;
}
-Reference< XDataInterpreter > SAL_CALL StockChartTypeTemplate::getDataInterpreter()
+rtl::Reference< DataInterpreter > StockChartTypeTemplate::getDataInterpreter2()
{
if( ! m_xDataInterpreter.is())
m_xDataInterpreter.set( new StockDataInterpreter( m_eStockVariant ) );
diff --git a/chart2/source/model/template/StockChartTypeTemplate.hxx b/chart2/source/model/template/StockChartTypeTemplate.hxx
index 6a05450f8194..aed35a000919 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.hxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.hxx
@@ -16,19 +16,16 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_STOCKCHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_STOCKCHARTTYPETEMPLATE_HXX
+#pragma once
-#include "ChartTypeTemplate.hxx"
+#include <ChartTypeTemplate.hxx>
#include <OPropertySet.hxx>
-#include <MutexContainer.hxx>
#include <comphelper/uno3.hxx>
namespace chart
{
class StockChartTypeTemplate :
- public MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
@@ -63,7 +60,7 @@ public:
protected:
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// ____ XPropertySet ____
@@ -71,40 +68,37 @@ protected:
getPropertySetInfo() override;
// ____ XChartTypeTemplate ____
- virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
- sal_Bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType > SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
- virtual css::uno::Reference< css::chart2::XDataInterpreter > SAL_CALL getDataInterpreter() override;
- virtual void SAL_CALL applyStyle(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
+ virtual bool matchesTemplate2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
+ bool bAdaptProperties ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries2( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override;
+ virtual void applyStyle2(
+ const rtl::Reference< ::chart::DataSeries >& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount ) override;
- virtual void SAL_CALL resetStyles(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override;
+ virtual void resetStyles2(
+ const rtl::Reference< ::chart::Diagram >& xDiagram ) override;
// ChartTypeTemplate
virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension ) override;
// ____ ChartTypeTemplate ____
virtual void createChartTypes(
- const css::uno::Sequence<
- css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XDataSeries > > >& aSeriesSeq,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XCoordinateSystem > > & rCoordSys,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XChartType > > & aOldChartTypesSeq
+ const std::vector<
+ std::vector<
+ rtl::Reference<
+ ::chart::DataSeries > > >& aSeriesSeq,
+ const std::vector<
+ rtl::Reference<
+ ::chart::BaseCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
private:
@@ -114,7 +108,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_STOCKCHARTTYPETEMPLATE_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/StockDataInterpreter.cxx b/chart2/source/model/template/StockDataInterpreter.cxx
index 15c2891975ad..1575bba1b223 100644
--- a/chart2/source/model/template/StockDataInterpreter.cxx
+++ b/chart2/source/model/template/StockDataInterpreter.cxx
@@ -17,14 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstddef>
+
#include "StockDataInterpreter.hxx"
+#include "StockChartTypeTemplate.hxx"
#include <DataSeries.hxx>
-#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 namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -35,7 +38,6 @@ namespace chart
// explicit
StockDataInterpreter::StockDataInterpreter(
StockChartTypeTemplate::StockVariant eVariant ) :
- DataInterpreter(),
m_eStockVariant( eVariant )
{}
@@ -43,17 +45,17 @@ StockDataInterpreter::~StockDataInterpreter()
{}
// ____ XDataInterpreter ____
-InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
+InterpretedData StockDataInterpreter::interpretDataSource(
const Reference< data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& rArguments,
- const Sequence< Reference< XDataSeries > >& rSeriesToReUse )
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& rSeriesToReUse )
{
if( ! xSource.is())
return InterpretedData();
- Reference< data::XLabeledDataSequence > xCategories;
- Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
- const sal_Int32 nDataCount( aData.getLength());
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aData = DataInterpreter::getDataSequences(xSource);
+ const sal_Int32 nDataCount( aData.size());
// sub-type properties
const StockChartTypeTemplate::StockVariant eVar( GetStockVariant());
@@ -87,14 +89,15 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
sal_Int32 nNumberOfGroups( bHasVolume ? 2 : 1 );
// sequences of data::XLabeledDataSequence per series per group
- Sequence< Sequence< Sequence< Reference< data::XLabeledDataSequence > > > > aSequences( nNumberOfGroups );
- sal_Int32 nBarGroupIndex( 0 );
- sal_Int32 nCandleStickGroupIndex( nNumberOfGroups - 1 );
+ std::vector< std::vector< std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > > > aSequences( nNumberOfGroups );
+ const sal_Int32 nBarGroupIndex( 0 );
+ const sal_Int32 nCandleStickGroupIndex( nNumberOfGroups - 1 );
// allocate space for labeled sequences
if( nRemaining > 0 )
++nCandleStickSeries;
- aSequences[nCandleStickGroupIndex].realloc( nCandleStickSeries );
+ aSequences[nCandleStickGroupIndex].resize( nCandleStickSeries );
+ auto & pCandleStickGroup = aSequences[nCandleStickGroupIndex];
if( bHasVolume )
{
// if there are remaining sequences, the first one is taken for
@@ -102,8 +105,9 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
// is used
if( nRemaining > 1 )
++nVolumeSeries;
- aSequences[nBarGroupIndex].realloc( nVolumeSeries );
+ aSequences[nBarGroupIndex].resize( nVolumeSeries );
}
+ auto & pBarGroup = aSequences[nBarGroupIndex];
// create data
sal_Int32 nSourceIndex = 0; // index into aData sequence
@@ -111,7 +115,7 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
// 1. categories
if( bHasCategories )
{
- xCategories.set( aData[nSourceIndex] );
+ xCategories = aData[nSourceIndex];
++nSourceIndex;
}
@@ -121,8 +125,8 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
// bar
if( bHasVolume )
{
- aSequences[nBarGroupIndex][nLabeledSeqIdx].realloc( 1 );
- aSequences[nBarGroupIndex][nLabeledSeqIdx][0].set( aData[nSourceIndex] );
+ pBarGroup[nLabeledSeqIdx].resize( 1 );
+ pBarGroup[nLabeledSeqIdx][0] = aData[nSourceIndex];
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-y");
++nSourceIndex;
@@ -131,29 +135,30 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
sal_Int32 nSeqIdx = 0;
if( bHasOpenValues )
{
- aSequences[nCandleStickGroupIndex][nLabeledSeqIdx].realloc( 4 );
- aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
+ pCandleStickGroup[nLabeledSeqIdx].resize( 4 );
+ pCandleStickGroup[nLabeledSeqIdx][nSeqIdx] = aData[nSourceIndex];
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-first");
++nSourceIndex;
++nSeqIdx;
}
else
- aSequences[nCandleStickGroupIndex][nLabeledSeqIdx].realloc( 3 );
+ pCandleStickGroup[nLabeledSeqIdx].resize( 3 );
+ auto & pLabeledSeq = pCandleStickGroup[nLabeledSeqIdx];
- aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
+ pLabeledSeq[nSeqIdx] = aData[nSourceIndex];
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-min");
++nSourceIndex;
++nSeqIdx;
- aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
+ pLabeledSeq[nSeqIdx] = aData[nSourceIndex];
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-max");
++nSourceIndex;
++nSeqIdx;
- aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
+ pLabeledSeq[nSeqIdx] = aData[nSourceIndex];
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-last");
++nSourceIndex;
@@ -164,11 +169,11 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
if( bHasVolume && nRemaining > 1 )
{
OSL_ASSERT( nVolumeSeries > nNumOfFullSeries );
- aSequences[nBarGroupIndex][nVolumeSeries - 1].realloc( 1 );
+ pBarGroup[nVolumeSeries - 1].resize( 1 );
OSL_ASSERT( nDataCount > nSourceIndex );
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-y");
- aSequences[nBarGroupIndex][nVolumeSeries - 1][0].set( aData[nSourceIndex] );
+ pBarGroup[nVolumeSeries - 1][0] = aData[nSourceIndex];
++nSourceIndex;
--nRemaining;
OSL_ENSURE( nRemaining, "additional bar should only be used if there is at least one more sequence for a candle stick" );
@@ -179,12 +184,13 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
{
OSL_ASSERT( nCandleStickSeries > nNumOfFullSeries );
const sal_Int32 nSeriesIndex = nCandleStickSeries - 1;
- aSequences[nCandleStickGroupIndex][nSeriesIndex].realloc( nRemaining );
+ pCandleStickGroup[nSeriesIndex].resize( nRemaining );
+ auto & pLabeledSeq = pCandleStickGroup[nSeriesIndex];
OSL_ASSERT( nDataCount > nSourceIndex );
// 1. low
sal_Int32 nSeqIdx( 0 );
- aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
+ pLabeledSeq[nSeqIdx] = aData[nSourceIndex];
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-min");
++nSourceIndex;
@@ -193,7 +199,7 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
// 2. high
if( nSeqIdx < nRemaining )
{
- aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
+ pLabeledSeq[nSeqIdx] = aData[nSourceIndex];
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-max");
++nSourceIndex;
@@ -204,7 +210,7 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
OSL_ENSURE( bHasOpenValues || nSeqIdx >= nRemaining, "could have created full series" );
if( nSeqIdx < nRemaining )
{
- aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
+ pLabeledSeq[nSeqIdx] = aData[nSourceIndex];
if( aData[nSourceIndex].is())
SetRole( aData[nSourceIndex]->getValues(), "values-last");
++nSourceIndex;
@@ -216,25 +222,26 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
}
// create DataSeries
- Sequence< Sequence< Reference< XDataSeries > > > aResultSeries( nNumberOfGroups );
- sal_Int32 nGroupIndex, nReUsedSeriesIdx = 0;
+ std::vector< std::vector< rtl::Reference< DataSeries > > > aResultSeries( nNumberOfGroups );
+ sal_Int32 nGroupIndex;
+ std::size_t nReUsedSeriesIdx = 0;
for( nGroupIndex=0; nGroupIndex<nNumberOfGroups; ++nGroupIndex )
{
- const sal_Int32 nNumSeriesData = aSequences[nGroupIndex].getLength();
- aResultSeries[nGroupIndex].realloc( nNumSeriesData );
+ const sal_Int32 nNumSeriesData = aSequences[nGroupIndex].size();
+ aResultSeries[nGroupIndex].resize( nNumSeriesData );
+ auto & pResultSerie = aResultSeries[nGroupIndex];
for( sal_Int32 nSeriesIdx = 0; nSeriesIdx < nNumSeriesData; ++nSeriesIdx, ++nReUsedSeriesIdx )
{
try
{
- Reference< XDataSeries > xSeries;
- if( nReUsedSeriesIdx < rSeriesToReUse.getLength())
- xSeries.set( rSeriesToReUse[nReUsedSeriesIdx] );
+ rtl::Reference< DataSeries > xSeries;
+ if( nReUsedSeriesIdx < rSeriesToReUse.size())
+ xSeries = rSeriesToReUse[nReUsedSeriesIdx];
else
- xSeries.set( new DataSeries );
- OSL_ASSERT( xSeries.is() );
- Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY_THROW );
- xSink->setData( aSequences[nGroupIndex][nSeriesIdx] );
- aResultSeries[nGroupIndex][nSeriesIdx].set( xSeries );
+ xSeries = new DataSeries;
+ assert( xSeries.is() );
+ xSeries->setData( aSequences[nGroupIndex][nSeriesIdx] );
+ pResultSerie[nSeriesIdx] = xSeries;
}
catch( const uno::Exception & )
{
@@ -243,7 +250,7 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
}
}
- return InterpretedData( aResultSeries, xCategories );
+ return { aResultSeries, xCategories };
}
// criterion: there must be two groups for stock-charts with volume and all
@@ -251,11 +258,11 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
// todo: skip first criterion? (to allow easy switch from stock-chart without
// volume to one with volume)
-sal_Bool SAL_CALL StockDataInterpreter::isDataCompatible(
+bool StockDataInterpreter::isDataCompatible(
const InterpretedData& aInterpretedData )
{
// high/low/close
- sal_Int32 nNumberOfNecessarySequences = 3;
+ std::size_t nNumberOfNecessarySequences = 3;
// open
StockChartTypeTemplate::StockVariant eVar( GetStockVariant());
if( ( eVar == StockChartTypeTemplate::StockVariant::Open ) ||
@@ -266,32 +273,30 @@ sal_Bool SAL_CALL StockDataInterpreter::isDataCompatible(
( eVar == StockChartTypeTemplate::StockVariant::VolumeOpen ));
// 1. correct number of sub-types
- if( aInterpretedData.Series.getLength() < (bHasVolume ? 2 : 1 ))
+ if( aInterpretedData.Series.size() < (bHasVolume ? 2U : 1U ))
return false;
// 2. a. volume -- use default check
if( bHasVolume )
{
if( ! DataInterpreter::isDataCompatible(
- InterpretedData( Sequence< Sequence< Reference< XDataSeries > > >(
- aInterpretedData.Series.getConstArray(), 1 ),
- aInterpretedData.Categories )))
+ { std::vector< std::vector< rtl::Reference< DataSeries > > >{
+ aInterpretedData.Series[0] },
+ aInterpretedData.Categories }))
return false;
}
// 2. b. candlestick
{
- OSL_ASSERT( aInterpretedData.Series.getLength() > (bHasVolume ? 1 : 0));
- const Sequence< Reference< XDataSeries > > aSeries( aInterpretedData.Series[(bHasVolume ? 1 : 0)] );
- if(!aSeries.hasElements())
+ OSL_ASSERT( aInterpretedData.Series.size() > (bHasVolume ? 1U : 0U));
+ const std::vector< rtl::Reference< DataSeries > > & aSeries = aInterpretedData.Series[(bHasVolume ? 1 : 0)];
+ if(aSeries.empty())
return false;
- for( Reference< XDataSeries > const & dataSeries : aSeries )
+ for( rtl::Reference< DataSeries > const & dataSeries : aSeries )
{
try
{
- Reference< data::XDataSource > xSrc( dataSeries, uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
- if( aSeq.getLength() != nNumberOfNecessarySequences )
+ if( dataSeries->getDataSequences2().size() != nNumberOfNecessarySequences )
return false;
}
catch( const uno::Exception & )
@@ -307,13 +312,30 @@ sal_Bool SAL_CALL StockDataInterpreter::isDataCompatible(
return true;
}
-InterpretedData SAL_CALL StockDataInterpreter::reinterpretDataSeries(
+InterpretedData StockDataInterpreter::reinterpretDataSeries(
const InterpretedData& aInterpretedData )
{
// prerequisite: StockDataInterpreter::isDataCompatible() returned true
return aInterpretedData;
}
+uno::Any StockDataInterpreter::getChartTypeSpecificData(
+ const OUString& sKey )
+{
+ if( sKey == "stock variant" )
+ {
+ StockChartTypeTemplate::StockVariant eStockVariant( GetStockVariant());
+ std::map< StockChartTypeTemplate::StockVariant, sal_Int32 > aTranslation {
+ { StockChartTypeTemplate::StockVariant::NONE, 0 },
+ { StockChartTypeTemplate::StockVariant::Open, 1 },
+ { StockChartTypeTemplate::StockVariant::Volume, 2 },
+ { StockChartTypeTemplate::StockVariant::VolumeOpen, 3 }
+ };
+ return uno::Any( aTranslation[eStockVariant] );
+ }
+ return uno::Any();
+}
+
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/StockDataInterpreter.hxx b/chart2/source/model/template/StockDataInterpreter.hxx
index 2bd5b2b61976..4617da5974a9 100644
--- a/chart2/source/model/template/StockDataInterpreter.hxx
+++ b/chart2/source/model/template/StockDataInterpreter.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_STOCKDATAINTERPRETER_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_STOCKDATAINTERPRETER_HXX
+#pragma once
-#include "DataInterpreter.hxx"
+#include <DataInterpreter.hxx>
#include "StockChartTypeTemplate.hxx"
@@ -35,14 +34,16 @@ public:
protected:
// ____ XDataInterpreter ____
- virtual css::chart2::InterpretedData SAL_CALL interpretDataSource(
+ virtual InterpretedData interpretDataSource(
const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aSeriesToReUse ) override;
- virtual sal_Bool SAL_CALL isDataCompatible(
- const css::chart2::InterpretedData& aInterpretedData ) override;
- virtual css::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
- const css::chart2::InterpretedData& aInterpretedData ) override;
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& aSeriesToReUse ) override;
+ virtual bool isDataCompatible(
+ const InterpretedData& aInterpretedData ) override;
+ virtual InterpretedData reinterpretDataSeries(
+ const InterpretedData& aInterpretedData ) override;
+ virtual css::uno::Any getChartTypeSpecificData(
+ const OUString& sKey ) override;
private:
StockChartTypeTemplate::StockVariant m_eStockVariant;
@@ -52,7 +53,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_STOCKDATAINTERPRETER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/XYDataInterpreter.cxx b/chart2/source/model/template/XYDataInterpreter.cxx
index a3fb67fa9202..1fc053f14c24 100644
--- a/chart2/source/model/template/XYDataInterpreter.cxx
+++ b/chart2/source/model/template/XYDataInterpreter.cxx
@@ -17,18 +17,20 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstddef>
+
#include "XYDataInterpreter.hxx"
#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <CommonConverters.hxx>
-#include <com/sun/star/chart2/data/XDataSink.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-using namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -36,8 +38,7 @@ using ::com::sun::star::uno::Sequence;
namespace chart
{
-XYDataInterpreter::XYDataInterpreter() :
- DataInterpreter()
+XYDataInterpreter::XYDataInterpreter()
{
}
@@ -46,33 +47,33 @@ XYDataInterpreter::~XYDataInterpreter()
}
// ____ XDataInterpreter ____
-chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
+InterpretedData XYDataInterpreter::interpretDataSource(
const Reference< chart2::data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& aArguments,
- const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ const std::vector< rtl::Reference< DataSeries > >& aSeriesToReUse )
{
if( ! xSource.is())
return InterpretedData();
- const Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aData = DataInterpreter::getDataSequences(xSource);
- Reference< data::XLabeledDataSequence > xValuesX;
- vector< Reference< data::XLabeledDataSequence > > aSequencesVec;
+ uno::Reference< chart2::data::XLabeledDataSequence > xValuesX;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSequencesVec;
- Reference< data::XLabeledDataSequence > xCategories;
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories;
bool bHasCategories = HasCategories( aArguments, aData );
bool bUseCategoriesAsX = UseCategoriesAsX( aArguments );
// parse data
bool bCategoriesUsed = false;
- bool bSetXValues = aData.getLength()>1;
- for( Reference< data::XLabeledDataSequence > const & labelData : aData )
+ bool bSetXValues = aData.size()>1;
+ for( uno::Reference< chart2::data::XLabeledDataSequence > const & labelData : aData )
{
try
{
if( bHasCategories && ! bCategoriesUsed )
{
- xCategories.set( labelData );
+ xCategories = labelData;
if( xCategories.is())
{
SetRole( xCategories->getValues(), "categories");
@@ -83,7 +84,7 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
}
else if( !xValuesX.is() && bSetXValues )
{
- xValuesX.set( labelData );
+ xValuesX = labelData;
if( xValuesX.is())
SetRole( xValuesX->getValues(), "values-x");
}
@@ -101,16 +102,16 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
}
// create DataSeries
- vector< Reference< XDataSeries > > aSeriesVec;
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec;
aSeriesVec.reserve( aSequencesVec.size());
Reference< data::XLabeledDataSequence > xClonedXValues = xValuesX;
Reference< util::XCloneable > xCloneable( xValuesX, uno::UNO_QUERY );
- sal_Int32 nSeriesIndex = 0;
+ std::size_t nSeriesIndex = 0;
for (auto const& elem : aSequencesVec)
{
- vector< Reference< data::XLabeledDataSequence > > aNewData;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aNewData;
if( nSeriesIndex && xCloneable.is() )
xClonedXValues.set( xCloneable->createClone(), uno::UNO_QUERY );
@@ -119,52 +120,47 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
aNewData.push_back(elem);
- Reference< XDataSeries > xSeries;
- if( nSeriesIndex < aSeriesToReUse.getLength())
- xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ rtl::Reference< DataSeries > xSeries;
+ if( nSeriesIndex < aSeriesToReUse.size())
+ xSeries = aSeriesToReUse[nSeriesIndex];
else
- xSeries.set( new DataSeries );
- OSL_ASSERT( xSeries.is() );
- Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
- OSL_ASSERT( xSink.is() );
- xSink->setData( comphelper::containerToSequence( aNewData ) );
+ xSeries = new DataSeries;
+ assert( xSeries.is() );
+ xSeries->setData( aNewData );
aSeriesVec.push_back( xSeries );
++nSeriesIndex;
}
- Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
- aSeries[0] = comphelper::containerToSequence( aSeriesVec );
- return InterpretedData( aSeries, xCategories );
+ return { { aSeriesVec }, xCategories };
}
-chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries(
- const chart2::InterpretedData& aInterpretedData )
+InterpretedData XYDataInterpreter::reinterpretDataSeries(
+ const InterpretedData& aInterpretedData )
{
InterpretedData aResult( aInterpretedData );
sal_Int32 i=0;
- Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
- const sal_Int32 nCount = aSeries.getLength();
+ std::vector< rtl::Reference< DataSeries > > aSeries = FlattenSequence( aInterpretedData.Series );
+ const sal_Int32 nCount = aSeries.size();
for( ; i<nCount; ++i )
{
try
{
- Reference< data::XDataSource > xSeriesSource( aSeries[i], uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aNewSequences;
+ std::vector< uno::Reference< data::XLabeledDataSequence > > aNewSequences;
// values-y
- Reference< data::XLabeledDataSequence > xValuesY(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, "values-y" ));
- Reference< data::XLabeledDataSequence > xValuesX(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, "values-x" ));
+ uno::Reference< chart2::data::XLabeledDataSequence > xValuesY(
+ DataSeriesHelper::getDataSequenceByRole( aSeries[i], "values-y" ));
+ uno::Reference< chart2::data::XLabeledDataSequence > xValuesX(
+ DataSeriesHelper::getDataSequenceByRole( aSeries[i], "values-x" ));
// re-use values-... as values-x/values-y
if( ! xValuesX.is() ||
! xValuesY.is())
{
- vector< Reference< data::XLabeledDataSequence > > aValueSeqVec(
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aValueSeqVec(
DataSeriesHelper::getAllDataSequencesByRole(
- xSeriesSource->getDataSequences(), "values" ));
+ aSeries[i]->getDataSequences2(), "values" ));
if( xValuesX.is())
aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesX ));
if( xValuesY.is())
@@ -174,7 +170,7 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries(
if( ! xValuesY.is() &&
aValueSeqVec.size() > nIndex )
{
- xValuesY.set( aValueSeqVec[nIndex++] );
+ xValuesY = aValueSeqVec[nIndex++];
if( xValuesY.is())
SetRole( xValuesY->getValues(), "values-y");
}
@@ -182,7 +178,7 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries(
if( ! xValuesX.is() &&
aValueSeqVec.size() > nIndex )
{
- xValuesX.set( aValueSeqVec[nIndex++] );
+ xValuesX = aValueSeqVec[nIndex++];
if( xValuesX.is())
SetRole( xValuesY->getValues(), "values-x");
}
@@ -191,19 +187,16 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries(
{
if( xValuesX.is())
{
- aNewSequences.realloc(2);
- aNewSequences[0] = xValuesX;
- aNewSequences[1] = xValuesY;
+ aNewSequences = { xValuesX, xValuesY };
}
else
{
- aNewSequences.realloc(1);
- aNewSequences[0] = xValuesY;
+ aNewSequences = { xValuesY };
}
}
- const Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences());
- if( aSeqs.getLength() != aNewSequences.getLength() )
+ const std::vector< uno::Reference< data::XLabeledDataSequence > > & aSeqs = aSeries[i]->getDataSequences2();
+ if( aSeqs.size() != aNewSequences.size() )
{
#ifdef DBG_UTIL
for( auto const & j : aSeqs )
@@ -211,8 +204,7 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries(
SAL_WARN_IF((j == xValuesY || j == xValuesX), "chart2.template", "All sequences should be used" );
}
#endif
- Reference< data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY_THROW );
- xSink->setData( aNewSequences );
+ aSeries[i]->setData( aNewSequences );
}
}
catch( const uno::Exception & )
@@ -225,17 +217,15 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries(
}
// criterion: all series must have exactly two data::XLabeledDataSequences
-sal_Bool SAL_CALL XYDataInterpreter::isDataCompatible(
- const chart2::InterpretedData& aInterpretedData )
+bool XYDataInterpreter::isDataCompatible(
+ const InterpretedData& aInterpretedData )
{
- const Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
- for( Reference< XDataSeries > const & dataSeries : aSeries )
+ const std::vector< rtl::Reference< DataSeries > > aSeries = FlattenSequence( aInterpretedData.Series );
+ for( rtl::Reference< DataSeries > const & dataSeries : aSeries )
{
try
{
- Reference< data::XDataSource > xSrc( dataSeries, uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
- if( aSeq.getLength() != 2 )
+ if( dataSeries->getDataSequences2().size() != 2 )
return false;
}
catch( const uno::Exception & )
diff --git a/chart2/source/model/template/XYDataInterpreter.hxx b/chart2/source/model/template/XYDataInterpreter.hxx
index c57889ce880d..56343013da08 100644
--- a/chart2/source/model/template/XYDataInterpreter.hxx
+++ b/chart2/source/model/template/XYDataInterpreter.hxx
@@ -16,10 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_XYDATAINTERPRETER_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_XYDATAINTERPRETER_HXX
+#pragma once
-#include "DataInterpreter.hxx"
+#include <DataInterpreter.hxx>
namespace chart
{
@@ -31,20 +30,17 @@ public:
virtual ~XYDataInterpreter() override;
protected:
- // ____ XDataInterpreter ____
- virtual css::chart2::InterpretedData SAL_CALL interpretDataSource(
+ // ____ DataInterpreter ____
+ virtual InterpretedData interpretDataSource(
const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aSeriesToReUse ) override;
- virtual css::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
- const css::chart2::InterpretedData& aInterpretedData ) override;
- virtual sal_Bool SAL_CALL isDataCompatible(
- const css::chart2::InterpretedData& aInterpretedData ) override;
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& aSeriesToReUse ) override;
+ virtual InterpretedData reinterpretDataSeries(
+ const InterpretedData& aInterpretedData ) override;
+ virtual bool isDataCompatible(
+ const InterpretedData& aInterpretedData ) override;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_XYDATAINTERPRETER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index 77bf0555ec97..b48fd313a91c 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -19,10 +19,15 @@
#include <AxisHelper.hxx>
#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <ChartTypeHelper.hxx>
+#include <ChartType.hxx>
+#include <Axis.hxx>
#include <AxisIndexDefines.hxx>
+#include <DataSource.hxx>
#include <LinePropertiesHelper.hxx>
#include <servicenames_coosystems.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <Scaling.hxx>
#include <ChartModel.hxx>
@@ -31,24 +36,22 @@
#include <ReferenceSizeProvider.hxx>
#include <ExplicitCategoriesProvider.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <GridProperties.hxx>
+#include <o3tl/safeint.hxx>
#include <unotools/saveopt.hxx>
#include <com/sun/star/chart/ChartAxisPosition.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/data/XDataSource.hpp>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <comphelper/sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <cstddef>
#include <map>
namespace chart
@@ -74,16 +77,13 @@ ScaleData AxisHelper::createDefaultScale()
aScaleData.AxisType = chart2::AxisType::REALNUMBER;
aScaleData.AutoDateAxis = true;
aScaleData.ShiftedCategoryPosition = false;
- Sequence< SubIncrement > aSubIncrements(1);
- aSubIncrements[0] = SubIncrement();
- aScaleData.IncrementData.SubIncrements = aSubIncrements;
+ aScaleData.IncrementData.SubIncrements = { SubIncrement() };
return aScaleData;
}
void AxisHelper::removeExplicitScaling( ScaleData& rScaleData )
{
- uno::Any aEmpty;
- rScaleData.Minimum = rScaleData.Maximum = rScaleData.Origin = aEmpty;
+ rScaleData.Minimum = rScaleData.Maximum = rScaleData.Origin = uno::Any();
rScaleData.Scaling = nullptr;
ScaleData aDefaultScale( createDefaultScale() );
rScaleData.IncrementData = aDefaultScale.IncrementData;
@@ -97,10 +97,10 @@ bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling )
&& xServiceName->getServiceName() == "com.sun.star.chart2.LogarithmicScaling";
}
-chart2::ScaleData AxisHelper::getDateCheckedScale( const Reference< chart2::XAxis >& xAxis, ChartModel& rModel )
+chart2::ScaleData AxisHelper::getDateCheckedScale( const rtl::Reference< Axis >& xAxis, ChartModel& rModel )
{
ScaleData aScale = xAxis->getScaleData();
- Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( &rModel ) );
if( aScale.AutoDateAxis && aScale.AxisType == AxisType::CATEGORY )
{
sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
@@ -133,41 +133,33 @@ void AxisHelper::checkDateAxis( chart2::ScaleData& rScale, ExplicitCategoriesPro
}
sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
- const Reference< chart2::XAxis >& xAxis
- , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
- , const Reference<chart2::XChartDocument>& xChartDoc
+ const rtl::Reference< Axis >& xAxis
+ , const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem
+ , const rtl::Reference<ChartModel>& xChartDoc
, bool bSearchForParallelAxisIfNothingIsFound )
{
sal_Int32 nNumberFormatKey(0);
sal_Int32 nAxisIndex = 0;
sal_Int32 nDimensionIndex = 1;
AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex );
- Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier(xChartDoc, uno::UNO_QUERY);
- Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
- if (!xProp.is())
+ if (!xAxis.is())
return 0;
bool bLinkToSource = true;
- xProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource;
- xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey;
+ xAxis->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource;
+ xAxis->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey;
if (bLinkToSource)
{
bool bFormatSet = false;
//check whether we have a percent scale -> use percent format
- ChartModel* pModel = nullptr;
- if( xNumberFormatsSupplier.is() )
+ if (xChartDoc)
{
- pModel = dynamic_cast<ChartModel*>( xChartDoc.get() );
- assert(pModel);
- }
- if (pModel)
- {
- ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *pModel );
+ ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *xChartDoc );
if( aData.AxisType==AxisType::PERCENT )
{
- sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xNumberFormatsSupplier );
+ sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xChartDoc );
if( nPercentFormat != -1 )
{
nNumberFormatKey = nPercentFormat;
@@ -182,27 +174,27 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
if( xSeq.is() && !( xChartDoc.is() && xChartDoc->hasInternalDataProvider()) )
nNumberFormatKey = xSeq->getNumberFormatKeyByIndex( -1 );
else
- nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
+ nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc );
bFormatSet = true;
}
}
else if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() && nDimensionIndex == 0 ) //maybe date axis
{
- Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram() );
- if( DiagramHelper::isSupportingDateAxis( xDiagram ) )
+ rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram() );
+ if( xDiagram->isSupportingDateAxis() )
{
- nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
+ nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc );
}
else
{
- Reference< data::XDataSource > xSource( DataSourceHelper::getUsedData( xChartDoc ) );
+ rtl::Reference< DataSource > xSource = DataSourceHelper::getUsedData( *xChartDoc );
if( xSource.is() )
{
- std::vector< Reference< chart2::data::XLabeledDataSequence > > aXValues(
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aXValues(
DataSeriesHelper::getAllDataSequencesByRole( xSource->getDataSequences(), "values-x" ) );
if( aXValues.empty() )
{
- Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories( xDiagram->getCategories() );
if( xCategories.is() )
{
Reference< data::XDataSequence > xSeq( xCategories->getValues());
@@ -221,7 +213,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
}
}
if( bHasValidDoubles )
- nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
+ nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc );
}
}
}
@@ -238,21 +230,16 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
try
{
- Reference< XChartTypeContainer > xCTCnt( xCorrespondingCoordinateSystem, uno::UNO_QUERY_THROW );
OUString aRoleToMatch;
if( nDimensionIndex == 0 )
aRoleToMatch = "values-x";
- const Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
- for( Reference< XChartType > const & chartType : aChartTypes )
+ const std::vector< rtl::Reference< ChartType > > & aChartTypes( xCorrespondingCoordinateSystem->getChartTypes2());
+ for( rtl::Reference< ChartType > const & chartType : aChartTypes )
{
if( nDimensionIndex != 0 )
aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( chartType );
- Reference< XDataSeriesContainer > xDSCnt( chartType, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries());
- for( Reference< chart2::XDataSeries > const & xDataSeries : aDataSeriesSeq )
+ for( rtl::Reference< DataSeries > const & xDataSeries : chartType->getDataSeries2() )
{
- Reference< data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY_THROW );
-
if( nDimensionIndex == 1 )
{
//only take those series into account that are attached to this axis
@@ -262,7 +249,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
}
Reference< data::XLabeledDataSequence > xLabeledSeq(
- DataSeriesHelper::getDataSequenceByRole( xSource, aRoleToMatch ) );
+ DataSeriesHelper::getDataSequenceByRole( xDataSeries, aRoleToMatch ) );
if( !xLabeledSeq.is() && nDimensionIndex==0 )
{
@@ -315,7 +302,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
if( !bNumberFormatKeyFoundViaAttachedData && nDimensionIndex == 1 )
{
sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1;
- Reference< XAxis > xParallelAxis( AxisHelper::getAxis( 1, nParallelAxisIndex, xCorrespondingCoordinateSystem ) );
+ rtl::Reference< Axis > xParallelAxis = AxisHelper::getAxis( 1, nParallelAxisIndex, xCorrespondingCoordinateSystem );
nNumberFormatKey = AxisHelper::getExplicitNumberFormatKeyForAxis(xParallelAxis, xCorrespondingCoordinateSystem, xChartDoc, false);
}
}
@@ -325,10 +312,10 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
return nNumberFormatKey;
}
-Reference< XAxis > AxisHelper::createAxis(
+rtl::Reference< Axis > AxisHelper::createAxis(
sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex // 0==main or 1==secondary axis
- , const Reference< XCoordinateSystem >& xCooSys
+ , const rtl::Reference< BaseCoordinateSystem >& xCooSys
, const Reference< uno::XComponentContext > & xContext
, ReferenceSizeProvider * pRefSizeProvider )
{
@@ -337,65 +324,53 @@ Reference< XAxis > AxisHelper::createAxis(
if( nDimensionIndex >= xCooSys->getDimension() )
return nullptr;
- Reference< XAxis > xAxis( xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.Axis", xContext ), uno::UNO_QUERY );
+ rtl::Reference< Axis > xAxis = new Axis();
- OSL_ASSERT( xAxis.is());
- if( xAxis.is())
+ xCooSys->setAxisByDimension( nDimensionIndex, xAxis, nAxisIndex );
+
+ if( nAxisIndex>0 )//when inserting secondary axes copy some things from the main axis
{
- xCooSys->setAxisByDimension( nDimensionIndex, xAxis, nAxisIndex );
+ css::chart::ChartAxisPosition eNewAxisPos( css::chart::ChartAxisPosition_END );
- if( nAxisIndex>0 )//when inserting secondary axes copy some things from the main axis
+ rtl::Reference< Axis > xMainAxis = xCooSys->getAxisByDimension2( nDimensionIndex, 0 );
+ if( xMainAxis.is() )
{
- css::chart::ChartAxisPosition eNewAxisPos( css::chart::ChartAxisPosition_END );
-
- Reference< XAxis > xMainAxis( xCooSys->getAxisByDimension( nDimensionIndex, 0 ) );
- if( xMainAxis.is() )
- {
- ScaleData aScale = xAxis->getScaleData();
- ScaleData aMainScale = xMainAxis->getScaleData();
-
- aScale.AxisType = aMainScale.AxisType;
- aScale.AutoDateAxis = aMainScale.AutoDateAxis;
- aScale.Categories = aMainScale.Categories;
- aScale.Orientation = aMainScale.Orientation;
- aScale.ShiftedCategoryPosition = aMainScale.ShiftedCategoryPosition;
-
- xAxis->setScaleData( aScale );
-
- //ensure that the second axis is not placed on the main axis
- Reference< beans::XPropertySet > xMainProp( xMainAxis, uno::UNO_QUERY );
- if( xMainProp.is() )
- {
- css::chart::ChartAxisPosition eMainAxisPos( css::chart::ChartAxisPosition_ZERO );
- xMainProp->getPropertyValue("CrossoverPosition") >>= eMainAxisPos;
- if( eMainAxisPos == css::chart::ChartAxisPosition_END )
- eNewAxisPos = css::chart::ChartAxisPosition_START;
- }
- }
-
- Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
- if( xProp.is() )
- xProp->setPropertyValue("CrossoverPosition", uno::Any(eNewAxisPos) );
+ ScaleData aScale = xAxis->getScaleData();
+ ScaleData aMainScale = xMainAxis->getScaleData();
+
+ aScale.AxisType = aMainScale.AxisType;
+ aScale.AutoDateAxis = aMainScale.AutoDateAxis;
+ aScale.Categories = aMainScale.Categories;
+ aScale.Orientation = aMainScale.Orientation;
+ aScale.ShiftedCategoryPosition = aMainScale.ShiftedCategoryPosition;
+
+ xAxis->setScaleData( aScale );
+
+ //ensure that the second axis is not placed on the main axis
+ css::chart::ChartAxisPosition eMainAxisPos( css::chart::ChartAxisPosition_ZERO );
+ xMainAxis->getPropertyValue("CrossoverPosition") >>= eMainAxisPos;
+ if( eMainAxisPos == css::chart::ChartAxisPosition_END )
+ eNewAxisPos = css::chart::ChartAxisPosition_START;
}
- Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
- if( xProp.is() ) try
- {
- // set correct initial AutoScale
- if( pRefSizeProvider )
- pRefSizeProvider->setValuesAtPropertySet( xProp );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xAxis->setPropertyValue("CrossoverPosition", uno::Any(eNewAxisPos) );
+ }
+
+ try
+ {
+ // set correct initial AutoScale
+ if( pRefSizeProvider )
+ pRefSizeProvider->setValuesAtPropertySet( xAxis );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xAxis;
}
-Reference< XAxis > AxisHelper::createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
- , const Reference< chart2::XDiagram >& xDiagram
+rtl::Reference< Axis > AxisHelper::createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const rtl::Reference< Diagram >& xDiagram
, const Reference< uno::XComponentContext >& xContext
, ReferenceSizeProvider * pRefSizeProvider )
{
@@ -404,7 +379,7 @@ Reference< XAxis > AxisHelper::createAxis( sal_Int32 nDimensionIndex, bool bMain
return nullptr;
sal_Int32 nAxisIndex = bMainAxis ? MAIN_AXIS_INDEX : SECONDARY_AXIS_INDEX;
- Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 );
+ rtl::Reference< BaseCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 );
// create axis
return AxisHelper::createAxis(
@@ -412,7 +387,7 @@ Reference< XAxis > AxisHelper::createAxis( sal_Int32 nDimensionIndex, bool bMain
}
void AxisHelper::showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
- , const Reference< chart2::XDiagram >& xDiagram
+ , const rtl::Reference< Diagram >& xDiagram
, const Reference< uno::XComponentContext >& xContext
, ReferenceSizeProvider * pRefSizeProvider )
{
@@ -420,12 +395,12 @@ void AxisHelper::showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
return;
bool bNewAxisCreated = false;
- Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram );
if( !xAxis.is() && xContext.is() )
{
// create axis
bNewAxisCreated = true;
- xAxis.set( AxisHelper::createAxis( nDimensionIndex, bMainAxis, xDiagram, xContext, pRefSizeProvider ) );
+ xAxis = AxisHelper::createAxis( nDimensionIndex, bMainAxis, xDiagram, xContext, pRefSizeProvider );
}
OSL_ASSERT( xAxis.is());
@@ -434,16 +409,16 @@ void AxisHelper::showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
}
void AxisHelper::showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
- , const Reference< XDiagram >& xDiagram )
+ , const rtl::Reference< Diagram >& xDiagram )
{
if( !xDiagram.is() )
return;
- Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
+ rtl::Reference< BaseCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
if(!xCooSys.is())
return;
- Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys );
if(!xAxis.is())
{
//hhhh todo create axis without axis visibility
@@ -452,27 +427,26 @@ void AxisHelper::showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bo
return;
if( bMainGrid )
- AxisHelper::makeGridVisible( xAxis->getGridProperties() );
+ AxisHelper::makeGridVisible( xAxis->getGridProperties2() );
else
{
- const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ std::vector< rtl::Reference< GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
for( auto const & i : aSubGrids )
AxisHelper::makeGridVisible( i );
}
}
-void AxisHelper::makeAxisVisible( const Reference< XAxis >& xAxis )
+void AxisHelper::makeAxisVisible( const rtl::Reference< Axis >& xAxis )
{
- Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY );
- if( xProps.is() )
+ if( xAxis.is() )
{
- xProps->setPropertyValue( "Show", uno::Any( true ) );
- LinePropertiesHelper::SetLineVisible( xProps );
- xProps->setPropertyValue( "DisplayLabels", uno::Any( true ) );
+ xAxis->setPropertyValue( "Show", uno::Any( true ) );
+ LinePropertiesHelper::SetLineVisible( xAxis );
+ xAxis->setPropertyValue( "DisplayLabels", uno::Any( true ) );
}
}
-void AxisHelper::makeGridVisible( const Reference< beans::XPropertySet >& xGridProperties )
+void AxisHelper::makeGridVisible( const rtl::Reference< GridProperties >& xGridProperties )
{
if( xGridProperties.is() )
{
@@ -482,28 +456,27 @@ void AxisHelper::makeGridVisible( const Reference< beans::XPropertySet >& xGridP
}
void AxisHelper::hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
- , const Reference< XDiagram >& xDiagram )
+ , const rtl::Reference< Diagram >& xDiagram )
{
AxisHelper::makeAxisInvisible( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
}
-void AxisHelper::makeAxisInvisible( const Reference< XAxis >& xAxis )
+void AxisHelper::makeAxisInvisible( const rtl::Reference< Axis >& xAxis )
{
- Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY );
- if( xProps.is() )
+ if( xAxis.is() )
{
- xProps->setPropertyValue( "Show", uno::Any( false ) );
+ xAxis->setPropertyValue( "Show", uno::Any( false ) );
}
}
-void AxisHelper::hideAxisIfNoDataIsAttached( const Reference< XAxis >& xAxis, const Reference< XDiagram >& xDiagram )
+void AxisHelper::hideAxisIfNoDataIsAttached( const rtl::Reference< Axis >& xAxis, const rtl::Reference< Diagram >& xDiagram )
{
//axis is hidden if no data is attached anymore but data is available
bool bOtherSeriesAttachedToThisAxis = false;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector = xDiagram->getDataSeries();
for (auto const& series : aSeriesVector)
{
- uno::Reference< chart2::XAxis > xCurrentAxis = DiagramHelper::getAttachedAxis(series, xDiagram );
+ rtl::Reference< Axis > xCurrentAxis = xDiagram->getAttachedAxis(series);
if( xCurrentAxis==xAxis )
{
bOtherSeriesAttachedToThisAxis = true;
@@ -515,30 +488,30 @@ void AxisHelper::hideAxisIfNoDataIsAttached( const Reference< XAxis >& xAxis, co
}
void AxisHelper::hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
- , const Reference< XDiagram >& xDiagram )
+ , const rtl::Reference< Diagram >& xDiagram )
{
if( !xDiagram.is() )
return;
- Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
+ rtl::Reference< BaseCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
if(!xCooSys.is())
return;
- Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys );
if(!xAxis.is())
return;
if( bMainGrid )
- AxisHelper::makeGridInvisible( xAxis->getGridProperties() );
+ AxisHelper::makeGridInvisible( xAxis->getGridProperties2() );
else
{
- const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
for( auto const & i : aSubGrids)
AxisHelper::makeGridInvisible( i );
}
}
-void AxisHelper::makeGridInvisible( const Reference< beans::XPropertySet >& xGridProperties )
+void AxisHelper::makeGridInvisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties )
{
if( xGridProperties.is() )
{
@@ -547,50 +520,49 @@ void AxisHelper::makeGridInvisible( const Reference< beans::XPropertySet >& xGri
}
bool AxisHelper::isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
- , const Reference< css::chart2::XDiagram >& xDiagram )
+ , const rtl::Reference< Diagram >& xDiagram )
{
bool bRet = false;
- Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
+ rtl::Reference< BaseCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
if(!xCooSys.is())
return bRet;
- Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys );
if(!xAxis.is())
return bRet;
if( bMainGrid )
- bRet = AxisHelper::isGridVisible( xAxis->getGridProperties() );
+ bRet = AxisHelper::isGridVisible( xAxis->getGridProperties2() );
else
{
- Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
- if( aSubGrids.hasElements() )
+ std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
+ if( !aSubGrids.empty() )
bRet = AxisHelper::isGridVisible( aSubGrids[0] );
}
return bRet;
}
-Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemByIndex(
- const Reference< XDiagram >& xDiagram, sal_Int32 nIndex )
+rtl::Reference< ::chart::BaseCoordinateSystem > AxisHelper::getCoordinateSystemByIndex(
+ const rtl::Reference< Diagram >& xDiagram, sal_Int32 nIndex )
{
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if(!xCooSysContainer.is())
+ if(!xDiagram.is())
return nullptr;
- Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems();
- if(0<=nIndex && nIndex<aCooSysList.getLength())
+ auto aCooSysList = xDiagram->getBaseCoordinateSystems();
+ if(0<=nIndex && o3tl::make_unsigned(nIndex) < aCooSysList.size())
return aCooSysList[nIndex];
return nullptr;
}
-Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
- , const Reference< XDiagram >& xDiagram )
+rtl::Reference< Axis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const rtl::Reference< Diagram >& xDiagram )
{
- Reference< XAxis > xRet;
+ rtl::Reference< Axis > xRet;
try
{
- Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 );
- xRet.set( AxisHelper::getAxis( nDimensionIndex, bMainAxis ? 0 : 1, xCooSys ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 );
+ xRet = AxisHelper::getAxis( nDimensionIndex, bMainAxis ? 0 : 1, xCooSys );
}
catch( const uno::Exception & )
{
@@ -598,10 +570,10 @@ Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, bool bMainAxi
return xRet;
}
-Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
- , const Reference< XCoordinateSystem >& xCooSys )
+rtl::Reference< Axis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
+ , const rtl::Reference< BaseCoordinateSystem >& xCooSys )
{
- Reference< XAxis > xRet;
+ rtl::Reference< Axis > xRet;
if(!xCooSys.is())
return xRet;
@@ -613,12 +585,12 @@ Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAx
assert(nAxisIndex >= 0);
assert(nDimensionIndex >= 0);
- xRet.set( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
+ xRet = xCooSys->getAxisByDimension2( nDimensionIndex, nAxisIndex );
return xRet;
}
-Reference< XAxis > AxisHelper::getCrossingMainAxis( const Reference< XAxis >& xAxis
- , const Reference< XCoordinateSystem >& xCooSys )
+rtl::Reference< Axis > AxisHelper::getCrossingMainAxis( const rtl::Reference< Axis >& xAxis
+ , const rtl::Reference< BaseCoordinateSystem >& xCooSys )
{
sal_Int32 nDimensionIndex = 0;
sal_Int32 nAxisIndex = 0;
@@ -627,8 +599,7 @@ Reference< XAxis > AxisHelper::getCrossingMainAxis( const Reference< XAxis >& xA
{
nDimensionIndex=1;
bool bSwapXY = false;
- Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY );
- if( xCooSysProp.is() && (xCooSysProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXY) && bSwapXY )
+ if( (xCooSys->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXY) && bSwapXY )
nDimensionIndex=0;
}
else if( nDimensionIndex==1 )
@@ -638,8 +609,8 @@ Reference< XAxis > AxisHelper::getCrossingMainAxis( const Reference< XAxis >& xA
return AxisHelper::getAxis( nDimensionIndex, 0, xCooSys );
}
-Reference< XAxis > AxisHelper::getParallelAxis( const Reference< XAxis >& xAxis
- , const Reference< XDiagram >& xDiagram )
+rtl::Reference< Axis > AxisHelper::getParallelAxis( const rtl::Reference< Axis >& xAxis
+ , const rtl::Reference< Diagram >& xDiagram )
{
try
{
@@ -659,65 +630,64 @@ Reference< XAxis > AxisHelper::getParallelAxis( const Reference< XAxis >& xAxis
}
bool AxisHelper::isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
- , const Reference< XDiagram >& xDiagram )
+ , const rtl::Reference< Diagram >& xDiagram )
{
return AxisHelper::isAxisVisible( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
}
-bool AxisHelper::isAxisVisible( const Reference< XAxis >& xAxis )
+bool AxisHelper::isAxisVisible( const rtl::Reference< Axis >& xAxis )
{
bool bRet = false;
- Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY );
- if( xProps.is() )
+ if( xAxis.is() )
{
- xProps->getPropertyValue( "Show" ) >>= bRet;
- bRet = bRet && ( LinePropertiesHelper::IsLineVisible( xProps )
- || areAxisLabelsVisible( xProps ) );
+ xAxis->getPropertyValue( "Show" ) >>= bRet;
+ bRet = bRet && ( LinePropertiesHelper::IsLineVisible( xAxis )
+ || areAxisLabelsVisible( xAxis ) );
}
return bRet;
}
-bool AxisHelper::areAxisLabelsVisible( const Reference< beans::XPropertySet >& xAxisProperties )
+bool AxisHelper::areAxisLabelsVisible( const rtl::Reference< Axis >& xAxis )
{
bool bRet = false;
- if( xAxisProperties.is() )
+ if( xAxis.is() )
{
- xAxisProperties->getPropertyValue( "DisplayLabels" ) >>= bRet;
+ xAxis->getPropertyValue( "DisplayLabels" ) >>= bRet;
}
return bRet;
}
-bool AxisHelper::isGridVisible( const Reference< beans::XPropertySet >& xGridProperies )
+bool AxisHelper::isGridVisible( const rtl::Reference< ::chart::GridProperties >& xGridproperties )
{
bool bRet = false;
- if( xGridProperies.is() )
+ if( xGridproperties.is() )
{
- xGridProperies->getPropertyValue( "Show" ) >>= bRet;
- bRet = bRet && LinePropertiesHelper::IsLineVisible( xGridProperies );
+ xGridproperties->getPropertyValue( "Show" ) >>= bRet;
+ bRet = bRet && LinePropertiesHelper::IsLineVisible( xGridproperties );
}
return bRet;
}
-Reference< beans::XPropertySet > AxisHelper::getGridProperties(
- const Reference< XCoordinateSystem >& xCooSys
+rtl::Reference< GridProperties > AxisHelper::getGridProperties(
+ const rtl::Reference< BaseCoordinateSystem >& xCooSys
, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex, sal_Int32 nSubGridIndex )
{
- Reference< beans::XPropertySet > xRet;
+ rtl::Reference< GridProperties > xRet;
- Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ) );
+ rtl::Reference< Axis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ) );
if( xAxis.is() )
{
if( nSubGridIndex<0 )
- xRet.set( xAxis->getGridProperties() );
+ xRet = xAxis->getGridProperties2();
else
{
- Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
- if (nSubGridIndex < aSubGrids.getLength())
- xRet.set( aSubGrids[nSubGridIndex] );
+ std::vector< rtl::Reference< GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
+ if (nSubGridIndex < static_cast<sal_Int32>(aSubGrids.size()))
+ xRet = aSubGrids[nSubGridIndex];
}
}
@@ -725,8 +695,8 @@ Reference< beans::XPropertySet > AxisHelper::getGridProperties(
}
sal_Int32 AxisHelper::getDimensionIndexOfAxis(
- const Reference< XAxis >& xAxis
- , const Reference< XDiagram >& xDiagram )
+ const rtl::Reference< Axis >& xAxis
+ , const rtl::Reference< Diagram >& xDiagram )
{
sal_Int32 nDimensionIndex = -1;
sal_Int32 nCooSysIndex = -1;
@@ -736,8 +706,8 @@ sal_Int32 AxisHelper::getDimensionIndexOfAxis(
}
bool AxisHelper::getIndicesForAxis(
- const Reference< XAxis >& xAxis
- , const Reference< XCoordinateSystem >& xCooSys
+ const rtl::Reference< Axis >& xAxis
+ , const rtl::Reference< BaseCoordinateSystem >& xCooSys
, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex )
{
//returns true if indices are found
@@ -745,29 +715,29 @@ bool AxisHelper::getIndicesForAxis(
rOutDimensionIndex = -1;
rOutAxisIndex = -1;
- if( xCooSys.is() && xAxis.is() )
+ if( !xCooSys || !xAxis )
+ return false;
+
+ rtl::Reference< Axis > xCurrentAxis;
+ sal_Int32 nDimensionCount( xCooSys->getDimension() );
+ for( sal_Int32 nDimensionIndex = 0; nDimensionIndex < nDimensionCount; nDimensionIndex++ )
{
- Reference< XAxis > xCurrentAxis;
- sal_Int32 nDimensionCount( xCooSys->getDimension() );
- for( sal_Int32 nDimensionIndex = 0; nDimensionIndex < nDimensionCount; nDimensionIndex++ )
+ sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
+ for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
{
- sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
- for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
- {
- xCurrentAxis = xCooSys->getAxisByDimension(nDimensionIndex,nAxisIndex);
- if( xCurrentAxis == xAxis )
- {
- rOutDimensionIndex = nDimensionIndex;
- rOutAxisIndex = nAxisIndex;
- return true;
- }
- }
+ xCurrentAxis = xCooSys->getAxisByDimension2(nDimensionIndex,nAxisIndex);
+ if( xCurrentAxis == xAxis )
+ {
+ rOutDimensionIndex = nDimensionIndex;
+ rOutAxisIndex = nAxisIndex;
+ return true;
+ }
}
}
return false;
}
-bool AxisHelper::getIndicesForAxis( const Reference< XAxis >& xAxis, const Reference< XDiagram >& xDiagram
+bool AxisHelper::getIndicesForAxis( const rtl::Reference< Axis >& xAxis, const rtl::Reference< Diagram >& xDiagram
, sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex )
{
//returns true if indices are found
@@ -776,28 +746,24 @@ bool AxisHelper::getIndicesForAxis( const Reference< XAxis >& xAxis, const Refer
rOutDimensionIndex = -1;
rOutAxisIndex = -1;
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if(xCooSysContainer.is())
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysList = xDiagram->getBaseCoordinateSystems();
+ for( std::size_t nC=0; nC < aCooSysList.size(); ++nC )
{
- Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems();
- for( sal_Int32 nC=0; nC<aCooSysList.getLength(); ++nC )
+ if( AxisHelper::getIndicesForAxis( xAxis, aCooSysList[nC], rOutDimensionIndex, rOutAxisIndex ) )
{
- if( AxisHelper::getIndicesForAxis( xAxis, aCooSysList[nC], rOutDimensionIndex, rOutAxisIndex ) )
- {
- rOutCooSysIndex = nC;
- return true;
- }
+ rOutCooSysIndex = nC;
+ return true;
}
}
return false;
}
-std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem(
- const Reference< XCoordinateSystem >& xCooSys
+std::vector< rtl::Reference< Axis > > AxisHelper::getAllAxesOfCoordinateSystem(
+ const rtl::Reference< BaseCoordinateSystem >& xCooSys
, bool bOnlyVisible /* = false */ )
{
- std::vector< Reference< XAxis > > aAxisVector;
+ std::vector< rtl::Reference< Axis > > aAxisVector;
if(xCooSys.is())
{
@@ -812,15 +778,13 @@ std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem(
{
try
{
- Reference< XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( nDimensionIndex, nAxisIndex );
if( xAxis.is() )
{
bool bAddAxis = true;
if( bOnlyVisible )
{
- Reference< beans::XPropertySet > xAxisProp( xAxis, uno::UNO_QUERY );
- if( !xAxisProp.is() ||
- !(xAxisProp->getPropertyValue( "Show") >>= bAddAxis) )
+ if( !(xAxis->getPropertyValue( "Show") >>= bAddAxis) )
bAddAxis = false;
}
if( bAddAxis )
@@ -839,99 +803,89 @@ std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem(
return aAxisVector;
}
-Sequence< Reference< XAxis > > AxisHelper::getAllAxesOfDiagram(
- const Reference< XDiagram >& xDiagram
+std::vector< rtl::Reference< Axis > > AxisHelper::getAllAxesOfDiagram(
+ const rtl::Reference< Diagram >& xDiagram
, bool bOnlyVisible )
{
- std::vector< Reference< XAxis > > aAxisVector;
+ std::vector< rtl::Reference< Axis > > aAxisVector;
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if(xCooSysContainer.is())
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() )
{
- const Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems();
- for( Reference< XCoordinateSystem > const & coords : aCooSysList )
- {
- std::vector< Reference< XAxis > > aAxesPerCooSys( AxisHelper::getAllAxesOfCoordinateSystem( coords, bOnlyVisible ) );
- aAxisVector.insert( aAxisVector.end(), aAxesPerCooSys.begin(), aAxesPerCooSys.end() );
- }
+ std::vector< rtl::Reference< Axis > > aAxesPerCooSys = AxisHelper::getAllAxesOfCoordinateSystem( coords, bOnlyVisible );
+ aAxisVector.insert( aAxisVector.end(), aAxesPerCooSys.begin(), aAxesPerCooSys.end() );
}
- return comphelper::containerToSequence( aAxisVector );
+ return aAxisVector;
}
-Sequence< Reference< beans::XPropertySet > > AxisHelper::getAllGrids( const Reference< XDiagram >& xDiagram )
+std::vector< rtl::Reference< GridProperties > > AxisHelper::getAllGrids( const rtl::Reference< Diagram >& xDiagram )
{
- const Sequence< Reference< XAxis > > aAllAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
- std::vector< Reference< beans::XPropertySet > > aGridVector;
+ const std::vector< rtl::Reference< Axis > > aAllAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
+ std::vector< rtl::Reference< GridProperties > > aGridVector;
- for( Reference< XAxis > const & xAxis : aAllAxes )
+ for( rtl::Reference< Axis > const & xAxis : aAllAxes )
{
- if(!xAxis.is())
- continue;
- Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() );
+ rtl::Reference< GridProperties > xGridProperties( xAxis->getGridProperties2() );
if( xGridProperties.is() )
aGridVector.push_back( xGridProperties );
- const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
- for( Reference< beans::XPropertySet > const & xSubGrid : aSubGrids )
+ std::vector< rtl::Reference< GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
+ for( rtl::Reference< GridProperties > const & xSubGrid : aSubGrids )
{
if( xSubGrid.is() )
aGridVector.push_back( xSubGrid );
}
}
- return comphelper::containerToSequence( aGridVector );
+ return aGridVector;
}
void AxisHelper::getAxisOrGridPossibilities( Sequence< sal_Bool >& rPossibilityList
- , const Reference< XDiagram>& xDiagram, bool bAxis )
+ , const rtl::Reference< Diagram>& xDiagram, bool bAxis )
{
rPossibilityList.realloc(6);
+ sal_Bool* pPossibilityList = rPossibilityList.getArray();
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ sal_Int32 nDimensionCount = -1;
+ if (xDiagram)
+ nDimensionCount = xDiagram->getDimension();
//set possibilities:
sal_Int32 nIndex=0;
- Reference< XChartType > xChartType = DiagramHelper::getChartTypeByIndex( xDiagram, 0 );
+ rtl::Reference< ChartType > xChartType;
+ if (xDiagram)
+ xChartType = xDiagram->getChartTypeByIndex( 0 );
for(nIndex=0;nIndex<3;nIndex++)
- rPossibilityList[nIndex]=ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nIndex);
+ pPossibilityList[nIndex]=ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nIndex);
for(nIndex=3;nIndex<6;nIndex++)
if( bAxis )
- rPossibilityList[nIndex]=ChartTypeHelper::isSupportingSecondaryAxis(xChartType,nDimensionCount);
+ pPossibilityList[nIndex]=ChartTypeHelper::isSupportingSecondaryAxis(xChartType,nDimensionCount);
else
- rPossibilityList[nIndex] = rPossibilityList[nIndex-3];
+ pPossibilityList[nIndex] = rPossibilityList[nIndex-3];
}
-bool AxisHelper::isSecondaryYAxisNeeded( const Reference< XCoordinateSystem >& xCooSys )
+bool AxisHelper::isSecondaryYAxisNeeded( const rtl::Reference< BaseCoordinateSystem >& xCooSys )
{
- Reference< chart2::XChartTypeContainer > xCTCnt( xCooSys, uno::UNO_QUERY );
- if( xCTCnt.is() )
+ if( !xCooSys.is() )
+ return false;
+
+ const std::vector< rtl::Reference< ChartType > > & aChartTypes( xCooSys->getChartTypes2() );
+ for( rtl::Reference< ChartType > const & chartType : aChartTypes )
{
- const Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes() );
- for( Reference< chart2::XChartType > const & chartType : aChartTypes )
+ const std::vector< rtl::Reference< DataSeries > > & aSeriesList = chartType->getDataSeries2();
+ for( sal_Int32 nS = aSeriesList.size(); nS-- ; )
{
- Reference< XDataSeriesContainer > xSeriesContainer( chartType, uno::UNO_QUERY );
- if( !xSeriesContainer.is() )
- continue;
-
- Sequence< Reference< XDataSeries > > aSeriesList( xSeriesContainer->getDataSeries() );
- for( sal_Int32 nS = aSeriesList.getLength(); nS-- ; )
- {
- Reference< beans::XPropertySet > xProp( aSeriesList[nS], uno::UNO_QUERY );
- if(xProp.is())
- {
- sal_Int32 nAttachedAxisIndex = 0;
- if( ( xProp->getPropertyValue( "AttachedAxisIndex" ) >>= nAttachedAxisIndex ) && nAttachedAxisIndex>0 )
- return true;
- }
- }
+ sal_Int32 nAttachedAxisIndex = 0;
+ if( ( aSeriesList[nS]->getPropertyValue( "AttachedAxisIndex" ) >>= nAttachedAxisIndex ) &&
+ nAttachedAxisIndex>0 )
+ return true;
}
}
return false;
}
-bool AxisHelper::shouldAxisBeDisplayed( const Reference< XAxis >& xAxis
- , const Reference< XCoordinateSystem >& xCooSys )
+bool AxisHelper::shouldAxisBeDisplayed( const rtl::Reference< Axis >& xAxis
+ , const rtl::Reference< BaseCoordinateSystem >& xCooSys )
{
bool bRet = false;
@@ -942,7 +896,7 @@ bool AxisHelper::shouldAxisBeDisplayed( const Reference< XAxis >& xAxis
if( AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex ) )
{
sal_Int32 nDimensionCount = xCooSys->getDimension();
- Reference< XChartType > xChartType( AxisHelper::getChartTypeByIndex( xCooSys, 0 ) );
+ rtl::Reference< ChartType > xChartType( AxisHelper::getChartTypeByIndex( xCooSys, 0 ) );
bool bMainAxis = (nAxisIndex==MAIN_AXIS_INDEX);
if( bMainAxis )
@@ -955,31 +909,32 @@ bool AxisHelper::shouldAxisBeDisplayed( const Reference< XAxis >& xAxis
return bRet;
}
-void AxisHelper::getAxisOrGridExcistence( Sequence< sal_Bool >& rExistenceList
- , const Reference< XDiagram>& xDiagram, bool bAxis )
+void AxisHelper::getAxisOrGridExistence( Sequence< sal_Bool >& rExistenceList
+ , const rtl::Reference< Diagram>& xDiagram, bool bAxis )
{
rExistenceList.realloc(6);
+ sal_Bool* pExistenceList = rExistenceList.getArray();
if(bAxis)
{
sal_Int32 nN;
for(nN=0;nN<3;nN++)
- rExistenceList[nN] = AxisHelper::isAxisShown( nN, true, xDiagram );
+ pExistenceList[nN] = AxisHelper::isAxisShown( nN, true, xDiagram );
for(nN=3;nN<6;nN++)
- rExistenceList[nN] = AxisHelper::isAxisShown( nN%3, false, xDiagram );
+ pExistenceList[nN] = AxisHelper::isAxisShown( nN%3, false, xDiagram );
}
else
{
sal_Int32 nN;
for(nN=0;nN<3;nN++)
- rExistenceList[nN] = AxisHelper::isGridShown( nN, 0, true, xDiagram );
+ pExistenceList[nN] = AxisHelper::isGridShown( nN, 0, true, xDiagram );
for(nN=3;nN<6;nN++)
- rExistenceList[nN] = AxisHelper::isGridShown( nN%3, 0, false, xDiagram );
+ pExistenceList[nN] = AxisHelper::isGridShown( nN%3, 0, false, xDiagram );
}
}
-bool AxisHelper::changeVisibilityOfAxes( const Reference< XDiagram >& xDiagram
+bool AxisHelper::changeVisibilityOfAxes( const rtl::Reference< Diagram >& xDiagram
, const Sequence< sal_Bool >& rOldExistenceList
, const Sequence< sal_Bool >& rNewExistenceList
, const Reference< uno::XComponentContext >& xContext
@@ -1002,7 +957,7 @@ bool AxisHelper::changeVisibilityOfAxes( const Reference< XDiagram >& xDiagram
return bChanged;
}
-bool AxisHelper::changeVisibilityOfGrids( const Reference< XDiagram >& xDiagram
+bool AxisHelper::changeVisibilityOfGrids( const rtl::Reference< Diagram >& xDiagram
, const Sequence< sal_Bool >& rOldExistenceList
, const Sequence< sal_Bool >& rNewExistenceList )
{
@@ -1021,48 +976,43 @@ bool AxisHelper::changeVisibilityOfGrids( const Reference< XDiagram >& xDiagram
return bChanged;
}
-Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemOfAxis(
- const Reference< XAxis >& xAxis
- , const Reference< XDiagram >& xDiagram )
+rtl::Reference< BaseCoordinateSystem > AxisHelper::getCoordinateSystemOfAxis(
+ const rtl::Reference< Axis >& xAxis
+ , const rtl::Reference< Diagram >& xDiagram )
{
- Reference< XCoordinateSystem > xRet;
+ if (!xDiagram)
+ return nullptr;
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( xCooSysContainer.is() )
+ rtl::Reference< BaseCoordinateSystem > xRet;
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() )
{
- const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( Reference< XCoordinateSystem > const & xCooSys : aCooSysList )
- {
- std::vector< Reference< XAxis > > aAllAxis( AxisHelper::getAllAxesOfCoordinateSystem( xCooSys ) );
+ std::vector< rtl::Reference< Axis > > aAllAxis = AxisHelper::getAllAxesOfCoordinateSystem( xCooSys );
- std::vector< Reference< XAxis > >::iterator aFound =
- std::find( aAllAxis.begin(), aAllAxis.end(), xAxis );
- if( aFound != aAllAxis.end())
- {
- xRet.set( xCooSys );
- break;
- }
+ auto aFound = std::find( aAllAxis.begin(), aAllAxis.end(), xAxis );
+ if( aFound != aAllAxis.end())
+ {
+ xRet = xCooSys;
+ break;
}
}
return xRet;
}
-Reference< XChartType > AxisHelper::getChartTypeByIndex( const Reference< XCoordinateSystem >& xCooSys, sal_Int32 nIndex )
+rtl::Reference< ChartType > AxisHelper::getChartTypeByIndex( const rtl::Reference< BaseCoordinateSystem >& xCooSys, sal_Int32 nIndex )
{
- Reference< XChartType > xChartType;
+ rtl::Reference< ChartType > xChartType;
- Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
- if( xChartTypeContainer.is() )
+ if( xCooSys.is() )
{
- Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- if( nIndex >= 0 && nIndex < aChartTypeList.getLength() )
- xChartType.set( aChartTypeList[nIndex] );
+ const std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() );
+ if( nIndex >= 0 && o3tl::make_unsigned(nIndex) < aChartTypeList.size() )
+ xChartType = aChartTypeList[nIndex];
}
return xChartType;
}
-void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys )
+void AxisHelper::setRTLAxisLayout( const rtl::Reference< BaseCoordinateSystem >& xCooSys )
{
if( !xCooSys.is() )
return;
@@ -1072,9 +1022,7 @@ void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys
return;
bool bVertical = false;
- Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY );
- if( xCooSysProp.is() )
- xCooSysProp->getPropertyValue( "SwapXAndYAxis" ) >>= bVertical;
+ xCooSys->getPropertyValue( "SwapXAndYAxis" ) >>= bVertical;
sal_Int32 nHorizontalAxisDimension = bVertical ? 1 : 0;
sal_Int32 nVerticalAxisDimension = bVertical ? 0 : 1;
@@ -1082,7 +1030,7 @@ void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys
try
{
//reverse direction for horizontal main axis
- Reference< chart2::XAxis > xHorizontalMainAxis( AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) );
+ rtl::Reference< Axis > xHorizontalMainAxis = AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys );
if( xHorizontalMainAxis.is() )
{
chart2::ScaleData aScale = xHorizontalMainAxis->getScaleData();
@@ -1091,7 +1039,7 @@ void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys
}
//mathematical direction for vertical main axis
- Reference< chart2::XAxis > xVerticalMainAxis( AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) );
+ rtl::Reference< Axis > xVerticalMainAxis = AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys );
if( xVerticalMainAxis.is() )
{
chart2::ScaleData aScale = xVerticalMainAxis->getScaleData();
@@ -1107,7 +1055,7 @@ void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys
try
{
//reverse direction for horizontal secondary axis
- Reference< chart2::XAxis > xHorizontalSecondaryAxis( AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) );
+ rtl::Reference< Axis > xHorizontalSecondaryAxis = AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys );
if( xHorizontalSecondaryAxis.is() )
{
chart2::ScaleData aScale = xHorizontalSecondaryAxis->getScaleData();
@@ -1116,7 +1064,7 @@ void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys
}
//mathematical direction for vertical secondary axis
- Reference< chart2::XAxis > xVerticalSecondaryAxis( AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) );
+ rtl::Reference< Axis > xVerticalSecondaryAxis = AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys );
if( xVerticalSecondaryAxis.is() )
{
chart2::ScaleData aScale = xVerticalSecondaryAxis->getScaleData();
@@ -1130,16 +1078,16 @@ void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys
}
}
-Reference< XChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const Reference< chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex )
+rtl::Reference< ChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const rtl::Reference< Diagram >& xDiagram, const sal_Int32 nAttachedAxisIndex )
{
- Reference< XChartType > xChartType;
- std::vector< Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ rtl::Reference< ChartType > xChartType;
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector = xDiagram->getDataSeries();
for (auto const& series : aSeriesVector)
{
sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex(series);
if( nAttachedAxisIndex == nCurrentIndex )
{
- xChartType = DiagramHelper::getChartTypeOfSeries(xDiagram, series);
+ xChartType = xDiagram->getChartTypeOfSeries(series);
if(xChartType.is())
break;
}
@@ -1149,7 +1097,7 @@ Reference< XChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisInd
bool AxisHelper::isAxisPositioningEnabled()
{
- const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
+ const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(GetODFSaneDefaultVersion());
return nCurrentVersion >= SvtSaveOptions::ODFSVER_012;
}
diff --git a/chart2/source/tools/BaseGFXHelper.cxx b/chart2/source/tools/BaseGFXHelper.cxx
index 9c475bc759d1..17bd4f5e1809 100644
--- a/chart2/source/tools/BaseGFXHelper.cxx
+++ b/chart2/source/tools/BaseGFXHelper.cxx
@@ -60,6 +60,38 @@ namespace chart::BaseGFXHelper
return aRet;
}
+::basegfx::B3DRange getBoundVolume( const std::vector<std::vector<css::drawing::Position3D>>& rPolyPoly )
+{
+ ::basegfx::B3DRange aRet;
+
+ bool bInited = false;
+ sal_Int32 nPolyCount = rPolyPoly.size();
+ for(sal_Int32 nPoly = 0; nPoly < nPolyCount; nPoly++)
+ {
+ sal_Int32 nPointCount = rPolyPoly[nPoly].size();
+ for( sal_Int32 nPoint = 0; nPoint < nPointCount; nPoint++)
+ {
+ if(!bInited)
+ {
+ aRet = ::basegfx::B3DRange(::basegfx::B3DTuple(
+ rPolyPoly[nPoly][nPoint].PositionX
+ , rPolyPoly[nPoly][nPoint].PositionY
+ , rPolyPoly[nPoly][nPoint].PositionZ));
+ bInited = true;
+ }
+ else
+ {
+ aRet.expand( ::basegfx::B3DTuple(
+ rPolyPoly[nPoly][nPoint].PositionX
+ , rPolyPoly[nPoly][nPoint].PositionY
+ , rPolyPoly[nPoly][nPoint].PositionZ));
+ }
+ }
+ }
+
+ return aRet;
+}
+
B2IRectangle makeRectangle( const awt::Point& rPos, const awt::Size& rSize )
{
return B2IRectangle(rPos.X,rPos.Y,rPos.X+rSize.Width,rPos.Y+rSize.Height);
@@ -81,6 +113,12 @@ awt::Size B2IRectangleToAWTSize( const ::basegfx::B2IRectangle& rB2IRectangle )
static_cast< sal_Int32 >( rB2IRectangle.getHeight()));
}
+awt::Rectangle toAwtRectangle(const basegfx::B2IRectangle& rRectangle)
+{
+ return awt::Rectangle(rRectangle.getMinX(), rRectangle.getMinY(),
+ rRectangle.getWidth(), rRectangle.getHeight());
+}
+
B3DVector Direction3DToB3DVector( const Direction3D& rDirection )
{
return B3DVector(
diff --git a/chart2/source/tools/CachedDataSequence.cxx b/chart2/source/tools/CachedDataSequence.cxx
index 4eaf5d8f2743..152b48cf9bd8 100644
--- a/chart2/source/tools/CachedDataSequence.cxx
+++ b/chart2/source/tools/CachedDataSequence.cxx
@@ -23,7 +23,6 @@
#include <comphelper/sequenceashashmap.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
#include <algorithm>
@@ -35,14 +34,11 @@ using ::com::sun::star::uno::Any;
using ::osl::MutexGuard;
// necessary for MS compiler
-using ::comphelper::OPropertyContainer;
-using ::comphelper::OMutexAndBroadcastHelper;
-using ::comphelper::OPropertyArrayUsageHelper;
using ::chart::impl::CachedDataSequence_Base;
namespace
{
-const char lcl_aServiceName[] = "com.sun.star.comp.chart.CachedDataSequence";
+constexpr OUString lcl_aServiceName = u"com.sun.star.comp.chart.CachedDataSequence"_ustr;
enum
{
@@ -56,41 +52,31 @@ namespace chart
{
CachedDataSequence::CachedDataSequence()
- : OPropertyContainer( GetBroadcastHelper()),
- CachedDataSequence_Base( GetMutex()),
- m_eCurrentDataType( NUMERICAL ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ : m_eCurrentDataType( NUMERICAL ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
registerProperties();
}
CachedDataSequence::CachedDataSequence( const Reference< uno::XComponentContext > & /*xContext*/ )
- : OPropertyContainer( GetBroadcastHelper()),
- CachedDataSequence_Base( GetMutex()),
- m_eCurrentDataType( MIXED ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder( ))
+ : m_eCurrentDataType( MIXED ),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
registerProperties();
}
CachedDataSequence::CachedDataSequence( const OUString & rSingleText )
- : OPropertyContainer( GetBroadcastHelper()),
- CachedDataSequence_Base( GetMutex()),
- m_eCurrentDataType( TEXTUAL ),
+ : m_eCurrentDataType( TEXTUAL ),
m_aTextualSequence({rSingleText}),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
registerProperties();
}
CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource )
- : OMutexAndBroadcastHelper(),
- OPropertyContainer( GetBroadcastHelper()),
- OPropertyArrayUsageHelper< CachedDataSequence >(),
- CachedDataSequence_Base( GetMutex()),
- m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
+ : m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
m_sRole( rSource.m_sRole ),
m_eCurrentDataType( rSource.m_eCurrentDataType ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
switch( m_eCurrentDataType )
{
@@ -131,29 +117,11 @@ Sequence< double > CachedDataSequence::Impl_getNumericalData() const
if( m_eCurrentDataType == NUMERICAL )
return m_aNumericalSequence;
- sal_Int32 nSize = ( m_eCurrentDataType == TEXTUAL )
- ? m_aTextualSequence.getLength()
- : m_aMixedSequence.getLength();
-
- Sequence< double > aResult( nSize );
- double * pResultArray = aResult.getArray();
-
if( m_eCurrentDataType == TEXTUAL )
- {
- const OUString * pTextArray = m_aTextualSequence.getConstArray();
- std::transform( pTextArray, pTextArray + nSize,
- pResultArray,
- CommonFunctors::OUStringToDouble() );
- }
- else
- {
- OSL_ASSERT( m_eCurrentDataType == MIXED );
- const Any * pMixedArray = m_aMixedSequence.getConstArray();
- std::transform( pMixedArray, pMixedArray + nSize,
- pResultArray,
- CommonFunctors::AnyToDouble() );
- }
- return aResult;
+ return CommonFunctors::convertToSequence(m_aTextualSequence, CommonFunctors::ToDouble());
+
+ OSL_ASSERT(m_eCurrentDataType == MIXED);
+ return CommonFunctors::convertToSequence(m_aMixedSequence, CommonFunctors::ToDouble());
}
Sequence< OUString > CachedDataSequence::Impl_getTextualData() const
@@ -161,30 +129,11 @@ Sequence< OUString > CachedDataSequence::Impl_getTextualData() const
if( m_eCurrentDataType == TEXTUAL )
return m_aTextualSequence;
- sal_Int32 nSize = ( m_eCurrentDataType == NUMERICAL )
- ? m_aNumericalSequence.getLength()
- : m_aMixedSequence.getLength();
-
- Sequence< OUString > aResult( nSize );
- OUString * pResultArray = aResult.getArray();
-
if( m_eCurrentDataType == NUMERICAL )
- {
- const double * pTextArray = m_aNumericalSequence.getConstArray();
- std::transform( pTextArray, pTextArray + nSize,
- pResultArray,
- CommonFunctors::DoubleToOUString() );
- }
- else
- {
- OSL_ASSERT( m_eCurrentDataType == MIXED );
- const Any * pMixedArray = m_aMixedSequence.getConstArray();
- std::transform( pMixedArray, pMixedArray + nSize,
- pResultArray,
- CommonFunctors::AnyToString() );
- }
+ return CommonFunctors::convertToSequence(m_aNumericalSequence, CommonFunctors::ToString());
- return aResult;
+ OSL_ASSERT(m_eCurrentDataType == MIXED);
+ return CommonFunctors::convertToSequence(m_aMixedSequence, CommonFunctors::ToString());
}
Sequence< Any > CachedDataSequence::Impl_getMixedData() const
@@ -192,34 +141,15 @@ Sequence< Any > CachedDataSequence::Impl_getMixedData() const
if( m_eCurrentDataType == MIXED )
return m_aMixedSequence;
- sal_Int32 nSize = ( m_eCurrentDataType == NUMERICAL )
- ? m_aNumericalSequence.getLength()
- : m_aTextualSequence.getLength();
-
- Sequence< Any > aResult( nSize );
- Any * pResultArray = aResult.getArray();
-
if( m_eCurrentDataType == NUMERICAL )
- {
- const double * pTextArray = m_aNumericalSequence.getConstArray();
- std::transform( pTextArray, pTextArray + nSize,
- pResultArray,
- CommonFunctors::makeAny< double >() );
- }
- else
- {
- OSL_ASSERT( m_eCurrentDataType == TEXTUAL );
- const OUString * pMixedArray = m_aTextualSequence.getConstArray();
- std::transform( pMixedArray, pMixedArray + nSize,
- pResultArray,
- CommonFunctors::makeAny< OUString >() );
- }
+ return CommonFunctors::convertToSequence(m_aNumericalSequence, CommonFunctors::makeAny());
- return aResult;
+ OSL_ASSERT(m_eCurrentDataType == TEXTUAL);
+ return CommonFunctors::convertToSequence(m_aTextualSequence, CommonFunctors::makeAny());
}
-IMPLEMENT_FORWARD_XINTERFACE2( CachedDataSequence, CachedDataSequence_Base, OPropertyContainer )
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( CachedDataSequence, CachedDataSequence_Base, OPropertyContainer )
+IMPLEMENT_FORWARD_XINTERFACE2( CachedDataSequence, CachedDataSequence_Base, comphelper::OPropertyContainer2 )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( CachedDataSequence, CachedDataSequence_Base, comphelper::OPropertyContainer2 )
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL CachedDataSequence::getPropertySetInfo()
@@ -266,7 +196,7 @@ css::uno::Sequence< OUString > SAL_CALL CachedDataSequence::getSupportedServiceN
// ________ XNumericalDataSequence ________
Sequence< double > SAL_CALL CachedDataSequence::getNumericalData()
{
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock aGuard( m_aMutex );
if( m_eCurrentDataType == NUMERICAL )
return m_aNumericalSequence;
@@ -277,7 +207,7 @@ Sequence< double > SAL_CALL CachedDataSequence::getNumericalData()
// ________ XTextualDataSequence ________
Sequence< OUString > SAL_CALL CachedDataSequence::getTextualData()
{
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock aGuard( m_aMutex );
if( m_eCurrentDataType == TEXTUAL )
return m_aTextualSequence;
@@ -288,7 +218,7 @@ Sequence< OUString > SAL_CALL CachedDataSequence::getTextualData()
// ________ XDataSequence ________
Sequence< Any > SAL_CALL CachedDataSequence::getData()
{
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock aGuard( m_aMutex );
return Impl_getMixedData();
}
@@ -310,35 +240,17 @@ Sequence< OUString > SAL_CALL CachedDataSequence::generateLabel( chart2::data::L
Reference< util::XCloneable > SAL_CALL CachedDataSequence::createClone()
{
- CachedDataSequence * pNewSeq = new CachedDataSequence( *this );
-
- return Reference< util::XCloneable >( pNewSeq );
+ return new CachedDataSequence( *this );
}
void SAL_CALL CachedDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL CachedDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// lang::XInitialization:
diff --git a/chart2/source/tools/CharacterProperties.cxx b/chart2/source/tools/CharacterProperties.cxx
index 659ef6d955f3..bf44c6a4c08f 100644
--- a/chart2/source/tools/CharacterProperties.cxx
+++ b/chart2/source/tools/CharacterProperties.cxx
@@ -35,7 +35,9 @@
#include <unotools/lingucfg.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <tools/color.hxx>
#include <vcl/outdev.hxx>
+#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
@@ -339,15 +341,16 @@ void CharacterProperties::AddPropertiesToVector(
void CharacterProperties::AddDefaultsToMap(
::chart::tPropertyValueMap & rOutMap )
{
+ SolarMutexGuard aGuard;
const float fDefaultFontHeight = 13.0;
SvtLinguConfig aLinguConfig;
lang::Locale aDefaultLocale;
- aLinguConfig.GetProperty("DefaultLocale") >>= aDefaultLocale;
+ aLinguConfig.GetProperty(u"DefaultLocale") >>= aDefaultLocale;
lang::Locale aDefaultLocale_CJK;
- aLinguConfig.GetProperty("DefaultLocale_CJK") >>= aDefaultLocale_CJK;
+ aLinguConfig.GetProperty(u"DefaultLocale_CJK") >>= aDefaultLocale_CJK;
lang::Locale aDefaultLocale_CTL;
- aLinguConfig.GetProperty("DefaultLocale_CTL") >>= aDefaultLocale_CTL;
+ aLinguConfig.GetProperty(u"DefaultLocale_CTL") >>= aDefaultLocale_CTL;
using namespace ::com::sun::star::i18n::ScriptType;
LanguageType nLang;
@@ -363,19 +366,19 @@ void CharacterProperties::AddDefaultsToMap(
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_FAMILY, sal_Int16(aFont.GetFamilyType()) );//awt::FontFamily::SWISS
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_CHAR_SET, sal_Int16(aFont.GetCharSet()) );//use awt::CharSet::DONTKNOW instead of SYSTEM to avoid assertion issue 50249
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_PITCH, sal_Int16(aFont.GetPitch()) );//awt::FontPitch::VARIABLE
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_COLOR, -1 ); //automatic color (COL_AUTO)
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COLOR, COL_AUTO ); //automatic color
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CHAR_HEIGHT, fDefaultFontHeight );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE, awt::FontUnderline::NONE );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_UNDERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE_COLOR, COL_AUTO ); //automatic color
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE_HAS_COLOR, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE, awt::FontUnderline::NONE );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_OVERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE_COLOR, COL_AUTO ); //automatic color
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE_HAS_COLOR, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WEIGHT, awt::FontWeight::NORMAL );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_POSTURE, awt::FontSlant_NONE );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_AUTO_KERNING, true );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_KERNING, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_STRIKE_OUT, awt::FontStrikeout::NONE );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_KERNING, sal_Int16(0) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_STRIKE_OUT, awt::FontStrikeout::NONE );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WORD_MODE, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_LOCALE, aDefaultLocale );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_SHADOWED, false );
diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx
index 2d684b059355..6c2420e7bd7c 100644
--- a/chart2/source/tools/ChartModelHelper.cxx
+++ b/chart2/source/tools/ChartModelHelper.cxx
@@ -18,36 +18,29 @@
*/
#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
+#include <DataSource.hxx>
#include <DataSourceHelper.hxx>
#include <ControllerLockGuard.hxx>
-#include <RangeHighlighter.hxx>
#include <InternalDataProvider.hxx>
#include <ChartModel.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <ChartType.hxx>
+#include <DataSeries.hxx>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
-#include <com/sun/star/chart2/data/XDataReceiver.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/embed/XVisualObject.hpp>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-uno::Reference< chart2::data::XRangeHighlighter > ChartModelHelper::createRangeHighlighter(
- const uno::Reference< view::XSelectionSupplier > & xSelectionSupplier )
-{
- return new RangeHighlighter( xSelectionSupplier );
-}
-
-uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDataProvider(
- const uno::Reference< css::chart2::XChartDocument >& xChartDoc, bool bConnectToModel )
+rtl::Reference< InternalDataProvider > ChartModelHelper::createInternalDataProvider(
+ const rtl::Reference<::chart::ChartModel>& xChartDoc, bool bConnectToModel )
{
bool bDefaultDataInColumns(true);
@@ -55,7 +48,8 @@ uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDa
// chart data and use it as default for creating a new InternalDataProvider
if(xChartDoc.is())
{
- css::uno::Reference< css::chart::XChartDocument > xDoc(xChartDoc, uno::UNO_QUERY);
+ // old XChartDocument interface
+ css::uno::Reference< css::chart::XChartDocument > xDoc(static_cast<cppu::OWeakObject*>(xChartDoc.get()), uno::UNO_QUERY);
if(xDoc.is())
{
@@ -80,89 +74,36 @@ uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDa
return new InternalDataProvider( xChartDoc, bConnectToModel, bDefaultDataInColumns );
}
-uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< frame::XModel >& xModel )
-{
- uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- if( xChartDoc.is())
- return ChartModelHelper::findDiagram( xChartDoc );
- return nullptr;
-}
-
-uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< chart2::XChartDocument >& xChartDoc )
+rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const rtl::Reference<::chart::ChartModel>& xModel )
{
- try
+ rtl::Reference< Diagram > xDiagram = xModel->getFirstChartDiagram();
+ if( xDiagram.is() )
{
- if( xChartDoc.is())
- return xChartDoc->getFirstDiagram();
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
+ auto aCooSysSeq( xDiagram->getBaseCoordinateSystems() );
+ if( !aCooSysSeq.empty() )
+ return aCooSysSeq[0];
}
return nullptr;
}
-uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( ChartModel& rModel )
-{
- uno::Reference< XCoordinateSystem > XCooSys;
- uno::Reference< XCoordinateSystemContainer > xCooSysCnt( rModel.getFirstDiagram(), uno::UNO_QUERY );
- if( xCooSysCnt.is() )
- {
- uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
- if( aCooSysSeq.hasElements() )
- XCooSys = aCooSysSeq[0];
- }
- return XCooSys;
-}
-
-uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const uno::Reference< frame::XModel >& xModel )
-{
- uno::Reference< XCoordinateSystem > XCooSys;
- uno::Reference< XCoordinateSystemContainer > xCooSysCnt( ChartModelHelper::findDiagram( xModel ), uno::UNO_QUERY );
- if( xCooSysCnt.is() )
- {
- uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
- if( aCooSysSeq.hasElements() )
- XCooSys = aCooSysSeq[0];
- }
- return XCooSys;
-}
-
-std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
- ChartModel& rModel )
-{
- std::vector< uno::Reference< XDataSeries > > aResult;
-
- uno::Reference< XDiagram > xDiagram = rModel.getFirstDiagram();
- if( xDiagram.is())
- aResult = DiagramHelper::getDataSeriesFromDiagram( xDiagram );
-
- return aResult;
-}
-
-std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
- const uno::Reference< XChartDocument > & xChartDoc )
+std::vector< rtl::Reference< DataSeries > > ChartModelHelper::getDataSeries(
+ const rtl::Reference<::chart::ChartModel> & xChartDoc )
{
- std::vector< uno::Reference< XDataSeries > > aResult;
+ std::vector< rtl::Reference< DataSeries > > aResult;
- uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartDoc );
+ rtl::Reference< Diagram > xDiagram = xChartDoc->getFirstChartDiagram();
if( xDiagram.is())
- aResult = DiagramHelper::getDataSeriesFromDiagram( xDiagram );
+ aResult = xDiagram->getDataSeries();
return aResult;
}
-std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
- const uno::Reference< frame::XModel > & xModel )
-{
- return getDataSeries( uno::Reference< chart2::XChartDocument >( xModel, uno::UNO_QUERY ));
-}
-
-uno::Reference< XChartType > ChartModelHelper::getChartTypeOfSeries(
- const uno::Reference< frame::XModel >& xModel
- , const uno::Reference< XDataSeries >& xGivenDataSeries )
+rtl::Reference< ChartType > ChartModelHelper::getChartTypeOfSeries(
+ const rtl::Reference<::chart::ChartModel>& xModel
+ , const rtl::Reference< DataSeries >& xGivenDataSeries )
{
- return DiagramHelper::getChartTypeOfSeries( ChartModelHelper::findDiagram( xModel ), xGivenDataSeries );
+ rtl::Reference<Diagram> xDiagram = xModel->getFirstChartDiagram();
+ return xDiagram ? xDiagram->getChartTypeOfSeries( xGivenDataSeries ) : nullptr;
}
awt::Size ChartModelHelper::getDefaultPageSize()
@@ -170,22 +111,20 @@ awt::Size ChartModelHelper::getDefaultPageSize()
return awt::Size( 16000, 9000 );
}
-awt::Size ChartModelHelper::getPageSize( const uno::Reference< frame::XModel >& xModel )
+awt::Size ChartModelHelper::getPageSize( const rtl::Reference<::chart::ChartModel>& xModel )
{
awt::Size aPageSize( ChartModelHelper::getDefaultPageSize() );
- uno::Reference< embed::XVisualObject > xVisualObject(xModel,uno::UNO_QUERY);
- OSL_ENSURE(xVisualObject.is(),"need xVisualObject for page size");
- if( xVisualObject.is() )
- aPageSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
+ OSL_ENSURE(xModel.is(),"need xVisualObject for page size");
+ if( xModel.is() )
+ aPageSize = xModel->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
return aPageSize;
}
-void ChartModelHelper::triggerRangeHighlighting( const uno::Reference< frame::XModel >& xModel )
+void ChartModelHelper::triggerRangeHighlighting( const rtl::Reference<::chart::ChartModel>& xModel )
{
- uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xModel, uno::UNO_QUERY );
- if( xDataReceiver.is() )
+ if( xModel.is() )
{
- uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener( xDataReceiver->getRangeHighlighter(), uno::UNO_QUERY );
+ uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener( xModel->getRangeHighlighter(), uno::UNO_QUERY );
//trigger selection of cell range
if( xSelectionChangeListener.is() )
{
@@ -195,21 +134,17 @@ void ChartModelHelper::triggerRangeHighlighting( const uno::Reference< frame::XM
}
}
-bool ChartModelHelper::isIncludeHiddenCells( const uno::Reference< frame::XModel >& xChartModel )
+bool ChartModelHelper::isIncludeHiddenCells( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
bool bIncluded = true; // hidden cells are included by default.
- uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
if (!xDiagram.is())
return bIncluded;
- uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY );
- if (!xProp.is())
- return bIncluded;
-
try
{
- xProp->getPropertyValue("IncludeHiddenCells") >>= bIncluded;
+ xDiagram->getPropertyValue("IncludeHiddenCells") >>= bIncluded;
}
catch( const beans::UnknownPropertyException& )
{
@@ -250,7 +185,7 @@ bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, ChartMod
try
{
- uno::Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( rModel ) );
+ rtl::Reference< DataSource > xUsedData = DataSourceHelper::getUsedData( rModel );
if( xUsedData.is() )
{
uno::Reference< beans::XPropertySet > xProp;
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index 236d066f77d3..b8df30edfbd5 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -18,24 +18,27 @@
*/
#include <ChartTypeHelper.hxx>
+#include <ChartType.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <DataSeriesProperties.hxx>
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
-#include <com/sun/star/chart/MissingValueTreatment.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
namespace chart
{
bool ChartTypeHelper::isSupportingAxisSideBySide(
- const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount )
+ const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount )
{
bool bResult = false;
@@ -56,7 +59,7 @@ bool ChartTypeHelper::isSupportingAxisSideBySide(
return bResult;
}
-bool ChartTypeHelper::isSupportingGeometryProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+bool ChartTypeHelper::isSupportingGeometryProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
//form tab only for 3D-bar and 3D-column charts.
@@ -75,7 +78,7 @@ bool ChartTypeHelper::isSupportingGeometryProperties( const uno::Reference< XCha
return false;
}
-bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+bool ChartTypeHelper::isSupportingStatisticProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
//3D charts, pie, net and stock do not support statistic properties
@@ -100,20 +103,20 @@ bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< XCh
return true;
}
-bool ChartTypeHelper::isSupportingRegressionProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+bool ChartTypeHelper::isSupportingRegressionProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
// note: old chart: only scatter chart
return isSupportingStatisticProperties( xChartType, nDimensionCount );
}
-bool ChartTypeHelper::isSupportingAreaProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+bool ChartTypeHelper::isSupportingAreaProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
//2D line charts, net and stock do not support area properties
//@todo ask charttype itself --> need model change first
if(xChartType.is())
{
- if(nDimensionCount==2)
+ if(nDimensionCount==2)
{
OUString aChartTypeName = xChartType->getChartType();
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) )
@@ -129,7 +132,7 @@ bool ChartTypeHelper::isSupportingAreaProperties( const uno::Reference< XChartTy
return true;
}
-bool ChartTypeHelper::isSupportingSymbolProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+bool ChartTypeHelper::isSupportingSymbolProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
//2D line charts, 2D scatter charts and 2D net charts do support symbols
@@ -150,7 +153,7 @@ bool ChartTypeHelper::isSupportingSymbolProperties( const uno::Reference< XChart
return false;
}
-bool ChartTypeHelper::isSupportingMainAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
+bool ChartTypeHelper::isSupportingMainAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
{
//pie charts do not support axis at all
//no 3rd axis for 2D charts
@@ -168,7 +171,7 @@ bool ChartTypeHelper::isSupportingMainAxis( const uno::Reference< XChartType >&
return true;
}
-bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+bool ChartTypeHelper::isSupportingSecondaryAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
//3D, pie and net charts do not support a secondary axis at all
@@ -190,7 +193,7 @@ bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChartTyp
}
bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties(
- const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+ const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
//2D bar charts do support a this special properties
@@ -210,7 +213,7 @@ bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties(
}
bool ChartTypeHelper::isSupportingBarConnectors(
- const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount )
+ const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
//2D bar charts with stacked series support this
@@ -235,9 +238,9 @@ bool ChartTypeHelper::isSupportingBarConnectors(
return false;
}
-uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const uno::Reference< chart2::XChartType >& xChartType
+uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const rtl::Reference< ChartType >& xChartType
, bool bSwapXAndY
- , const uno::Reference< chart2::XDataSeries >& xSeries )
+ , const rtl::Reference< DataSeries >& xSeries )
{
uno::Sequence < sal_Int32 > aRet;
if( !xChartType.is() )
@@ -247,17 +250,17 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
{
bool bDonut = false;
- uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY_THROW );
- xChartTypeProp->getPropertyValue( "UseRings") >>= bDonut;
+ xChartType->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= bDonut; // "UseRings"
if(!bDonut)
{
- aRet.realloc(4);
+ aRet.realloc(5);
sal_Int32* pSeq = aRet.getArray();
*pSeq++ = css::chart::DataLabelPlacement::AVOID_OVERLAP;
*pSeq++ = css::chart::DataLabelPlacement::OUTSIDE;
*pSeq++ = css::chart::DataLabelPlacement::INSIDE;
*pSeq++ = css::chart::DataLabelPlacement::CENTER;
+ *pSeq++ = css::chart::DataLabelPlacement::CUSTOM;
}
else
{
@@ -285,9 +288,8 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
bool bStacked = false;
{
- uno::Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
chart2::StackingDirection eStacking = chart2::StackingDirection_NO_STACKING;
- xSeriesProp->getPropertyValue( "StackingDirection" ) >>= eStacking;
+ xSeries->getFastPropertyValue( PROP_DATASERIES_STACKING_DIRECTION ) >>= eStacking; // "StackingDirection"
bStacked = (eStacking == chart2::StackingDirection_Y_STACKING);
}
@@ -316,9 +318,8 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
{
bool bStacked = false;
{
- uno::Reference<beans::XPropertySet> xSeriesProp(xSeries, uno::UNO_QUERY);
chart2::StackingDirection eStacking = chart2::StackingDirection_NO_STACKING;
- xSeriesProp->getPropertyValue("StackingDirection") >>= eStacking;
+ xSeries->getFastPropertyValue(PROP_DATASERIES_STACKING_DIRECTION) >>= eStacking; // "StackingDirection"
bStacked = (eStacking == chart2::StackingDirection_Y_STACKING);
}
@@ -366,7 +367,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
return aRet;
}
-bool ChartTypeHelper::isSupportingRightAngledAxes( const uno::Reference< chart2::XChartType >& xChartType )
+bool ChartTypeHelper::isSupportingRightAngledAxes( const rtl::Reference< ChartType >& xChartType )
{
if(xChartType.is())
{
@@ -377,7 +378,7 @@ bool ChartTypeHelper::isSupportingRightAngledAxes( const uno::Reference< chart2:
return true;
}
-bool ChartTypeHelper::isSupportingStartingAngle( const uno::Reference< chart2::XChartType >& xChartType )
+bool ChartTypeHelper::isSupportingStartingAngle( const rtl::Reference< ChartType >& xChartType )
{
if(xChartType.is())
{
@@ -387,7 +388,7 @@ bool ChartTypeHelper::isSupportingStartingAngle( const uno::Reference< chart2::X
}
return false;
}
-bool ChartTypeHelper::isSupportingBaseValue( const uno::Reference< chart2::XChartType >& xChartType )
+bool ChartTypeHelper::isSupportingBaseValue( const rtl::Reference< ChartType >& xChartType )
{
if(xChartType.is())
{
@@ -401,7 +402,7 @@ bool ChartTypeHelper::isSupportingBaseValue( const uno::Reference< chart2::XChar
return false;
}
-bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
+bool ChartTypeHelper::isSupportingAxisPositioning( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
{
if(xChartType.is())
{
@@ -416,7 +417,7 @@ bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2:
return true;
}
-bool ChartTypeHelper::isSupportingDateAxis( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex )
+bool ChartTypeHelper::isSupportingDateAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionIndex )
{
if( nDimensionIndex!=0 )
return false;
@@ -436,7 +437,7 @@ bool ChartTypeHelper::isSupportingDateAxis( const uno::Reference< chart2::XChart
return true;
}
-bool ChartTypeHelper::isSupportingComplexCategory( const uno::Reference< chart2::XChartType >& xChartType )
+bool ChartTypeHelper::isSupportingComplexCategory( const rtl::Reference< ChartType >& xChartType )
{
if( xChartType.is() )
{
@@ -447,7 +448,7 @@ bool ChartTypeHelper::isSupportingComplexCategory( const uno::Reference< chart2:
return true;
}
-bool ChartTypeHelper::isSupportingCategoryPositioning( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount )
+bool ChartTypeHelper::isSupportingCategoryPositioning( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
{
if( xChartType.is() )
{
@@ -463,7 +464,20 @@ bool ChartTypeHelper::isSupportingCategoryPositioning( const uno::Reference< cha
return false;
}
-bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XChartType >& xChartType )
+bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const rtl::Reference< ChartType >& xChartType )
+{
+ if(xChartType.is())
+ {
+ OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ return true;
+ }
+ return false;
+}
+
+bool ChartTypeHelper::noBordersForSimpleScheme( const rtl::Reference< ChartType >& xChartType )
{
if(xChartType.is())
{
@@ -474,7 +488,7 @@ bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XC
return false;
}
-sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType )
+sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const rtl::Reference< ChartType >& xChartType )
{
sal_Int32 nRet = static_cast< sal_Int32 >( 0x808080 ); // grey
if( xChartType .is() )
@@ -494,7 +508,7 @@ sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno::
return nRet;
}
-sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType )
+sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const rtl::Reference< ChartType >& xChartType )
{
sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40
if( xChartType .is() )
@@ -511,7 +525,7 @@ sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const uno:
return nRet;
}
-drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno::Reference< chart2::XChartType >& xChartType )
+drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const rtl::Reference< ChartType >& xChartType )
{
drawing::Direction3D aRet(0.0, 0.0, 1.0);
if( xChartType .is() )
@@ -526,7 +540,7 @@ drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno:
return aRet;
}
-drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const uno::Reference< chart2::XChartType >& xChartType )
+drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const rtl::Reference< ChartType >& xChartType )
{
drawing::Direction3D aRet(0.0, 0.0, 1.0);
if( xChartType .is() )
@@ -541,8 +555,8 @@ drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const u
return aRet;
}
-sal_Int32 ChartTypeHelper::getAxisType( const uno::Reference<
- XChartType >& xChartType, sal_Int32 nDimensionIndex )
+sal_Int32 ChartTypeHelper::getAxisType( const rtl::Reference<
+ ChartType >& xChartType, sal_Int32 nDimensionIndex )
{
//returned is a constant from constant group css::chart2::AxisType
@@ -566,7 +580,7 @@ sal_Int32 ChartTypeHelper::getAxisType( const uno::Reference<
}
sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries(
- const uno::Reference< XChartType >& xChartType,
+ const rtl::Reference< ChartType >& xChartType,
sal_Int32 nNumberOfSeries )
{
if( xChartType.is() )
@@ -576,9 +590,8 @@ sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries(
OUString aChartTypeName = xChartType->getChartType();
if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
{
- uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY_THROW );
bool bDonut = false;
- if( (xChartTypeProp->getPropertyValue( "UseRings") >>= bDonut)
+ if( (xChartType->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= bDonut) // "UseRings"
&& !bDonut )
{
return nNumberOfSeries>0 ? 1 : 0;
@@ -593,7 +606,7 @@ sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries(
return nNumberOfSeries;
}
-uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( const uno::Reference< XChartType >& xChartType )
+uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( const rtl::Reference< ChartType >& xChartType )
{
uno::Sequence < sal_Int32 > aRet;
if( !xChartType.is() )
@@ -654,7 +667,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
return aRet;
}
-bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference< XChartType >& xChartType )
+bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const rtl::Reference< ChartType >& xChartType )
{
if( xChartType.is() )
{
@@ -665,7 +678,7 @@ bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference< XChartTyp
return true;
}
-OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference< ChartType >& xChartType )
{
OUString aRet( "values-y" );
if( !xChartType.is() )
@@ -676,7 +689,7 @@ OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const
return aRet;
}
-OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::Reference< ChartType >& xChartType )
{
OUString aRet( "values-y" );
if( !xChartType.is() )
@@ -688,7 +701,7 @@ OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( co
return aRet;
}
-bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const uno::Reference< XChartType >& xChartType )
+bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const rtl::Reference< ChartType >& xChartType )
{
bool bRet = false;
if( !xChartType.is() )
diff --git a/chart2/source/tools/ChartViewHelper.cxx b/chart2/source/tools/ChartViewHelper.cxx
index a341f8894f14..8011da3c171c 100644
--- a/chart2/source/tools/ChartViewHelper.cxx
+++ b/chart2/source/tools/ChartViewHelper.cxx
@@ -18,40 +18,45 @@
*/
#include <ChartViewHelper.hxx>
+#include <ChartModel.hxx>
#include <servicenames.hxx>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
-void ChartViewHelper::setViewToDirtyState( const uno::Reference< frame::XModel >& xChartModel )
+void ChartViewHelper::setViewToDirtyState(const rtl::Reference<::chart::ChartModel>& xChartModel)
{
try
{
- uno::Reference< lang::XMultiServiceFactory > xFact( xChartModel, uno::UNO_QUERY );
- if( xFact.is() )
+ if (xChartModel.is())
{
- Reference< util::XModifyListener > xModifyListener(
- xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
- if( xModifyListener.is() )
+ Reference<util::XModifyListener> xModifyListener(
+ xChartModel->createInstance(CHART_VIEW_SERVICE_NAME), uno::UNO_QUERY);
+ if (xModifyListener.is())
{
- lang::EventObject aEvent( xChartModel );
- xModifyListener->modified( aEvent );
+ lang::EventObject aEvent(static_cast<cppu::OWeakObject*>(xChartModel.get()));
+ xModifyListener->modified(aEvent);
}
}
}
- catch( const uno::Exception & )
+ catch (const uno::Exception&)
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
}
+
+void ChartViewHelper::setViewToDirtyState_UNO(
+ const css::uno::Reference<css::chart2::XChartDocument>& xChartModel)
+{
+ if (auto pChartModel = dynamic_cast<ChartModel*>(xChartModel.get()))
+ setViewToDirtyState(rtl::Reference(pChartModel));
+}
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/ColorPerPointHelper.cxx b/chart2/source/tools/ColorPerPointHelper.cxx
index 34aeb7866021..bced72bb473a 100644
--- a/chart2/source/tools/ColorPerPointHelper.cxx
+++ b/chart2/source/tools/ColorPerPointHelper.cxx
@@ -18,33 +18,34 @@
*/
#include <ColorPerPointHelper.hxx>
+#include <DataSeries.hxx>
+#include <DataSeriesProperties.hxx>
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <algorithm>
+using namespace ::com::sun::star;
+using namespace ::chart::DataSeriesProperties;
+
namespace chart
{
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
bool ColorPerPointHelper::hasPointOwnColor(
- const css::uno::Reference< css::beans::XPropertySet >& xDataSeriesProperties
+ const rtl::Reference< DataSeries >& xDataSeries
, sal_Int32 nPointIndex
, const css::uno::Reference< css::beans::XPropertySet >& xDataPointProperties //may be NULL this is just for performance
)
{
- if( !xDataSeriesProperties.is() )
+ if( !xDataSeries.is() )
return false;
- if( hasPointOwnProperties( xDataSeriesProperties, nPointIndex ))
+ if( hasPointOwnProperties( xDataSeries, nPointIndex ))
{
uno::Reference< beans::XPropertyState > xPointState( xDataPointProperties, uno::UNO_QUERY );
if( !xPointState.is() )
{
- uno::Reference< XDataSeries > xSeries( xDataSeriesProperties, uno::UNO_QUERY );
- if(xSeries.is())
- xPointState.set( xSeries->getDataPointByIndex( nPointIndex ), uno::UNO_QUERY );
+ xPointState.set( xDataSeries->getDataPointByIndex( nPointIndex ), uno::UNO_QUERY );
}
if( !xPointState.is() )
return false;
@@ -56,17 +57,15 @@ bool ColorPerPointHelper::hasPointOwnColor(
}
bool ColorPerPointHelper::hasPointOwnProperties(
- const css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties
+ const rtl::Reference< ::chart::DataSeries >& xDataSeries
, sal_Int32 nPointIndex )
{
- if( xSeriesProperties.is() )
+ if( xDataSeries.is() )
{
uno::Sequence< sal_Int32 > aIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aIndexList )
+ if( xDataSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aIndexList ) // "AttributedDataPoints"
{
- const sal_Int32 * pBegIt = aIndexList.getConstArray();
- const sal_Int32 * pEndIt = pBegIt + aIndexList.getLength();
- return ( std::find( pBegIt, pEndIt, nPointIndex ) != pEndIt );
+ return (std::find(aIndexList.begin(), aIndexList.end(), nPointIndex) != aIndexList.end());
}
}
diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx
index 01b2c2c758a4..293fa7b11ddf 100644
--- a/chart2/source/tools/CommonConverters.cxx
+++ b/chart2/source/tools/CommonConverters.cxx
@@ -24,9 +24,13 @@
#include <com/sun/star/chart2/data/XDataSequence.hpp>
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
-#include <rtl/math.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+#include <cstddef>
+#include <limits>
namespace chart
{
@@ -88,9 +92,10 @@ drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatri
aM.set(1, 0, rM.get(1, 0));
aM.set(1, 1, rM.get(1, 1));
aM.set(1, 2, rM.get(1, 3));
- aM.set(2, 0, rM.get(3, 0));
- aM.set(2, 1, rM.get(3, 1));
- aM.set(2, 2, rM.get(3, 3));
+ // For this to be a valid 2D transform matrix, the last row must be [0,0,1]
+ assert( rM.get(3, 0) == 0 );
+ assert( rM.get(3, 1) == 0 );
+ assert( rM.get(3, 3) == 1 );
return aM;
}
@@ -103,9 +108,9 @@ drawing::HomogenMatrix3 B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMat
aHM.Line2.Column1 = rM.get(1, 0);
aHM.Line2.Column2 = rM.get(1, 1);
aHM.Line2.Column3 = rM.get(1, 2);
- aHM.Line3.Column1 = rM.get(2, 0);
- aHM.Line3.Column2 = rM.get(2, 1);
- aHM.Line3.Column3 = rM.get(2, 2);
+ aHM.Line3.Column1 = 0;
+ aHM.Line3.Column2 = 0;
+ aHM.Line3.Column3 = 1;
return aHM;
}
@@ -179,6 +184,24 @@ void AddPointToPoly( drawing::PolyPolygonShape3D& rPoly, const drawing::Position
pInnerSequenceZ[nOldPointCount] = rPos.PositionZ;
}
+void AddPointToPoly( std::vector<std::vector<css::drawing::Position3D>>& rPoly, const drawing::Position3D& rPos, sal_Int32 nPolygonIndex )
+{
+ if(nPolygonIndex<0)
+ {
+ OSL_FAIL( "The polygon index needs to be > 0");
+ nPolygonIndex=0;
+ }
+
+ //make sure that we have enough polygons
+ if(o3tl::make_unsigned(nPolygonIndex) >= rPoly.size() )
+ {
+ rPoly.resize(nPolygonIndex+1);
+ }
+
+ std::vector<css::drawing::Position3D>* pOuterSequence = &rPoly[nPolygonIndex];
+ pOuterSequence->push_back(rPos);
+}
+
drawing::Position3D getPointFromPoly( const drawing::PolyPolygonShape3D& rPolygon, sal_Int32 nPointIndex, sal_Int32 nPolyIndex )
{
drawing::Position3D aRet(0.0,0.0,0.0);
@@ -203,13 +226,34 @@ drawing::Position3D getPointFromPoly( const drawing::PolyPolygonShape3D& rPolygo
return aRet;
}
-void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
+drawing::Position3D getPointFromPoly( const std::vector<std::vector<css::drawing::Position3D>>& rPolygon, sal_Int32 nPointIndex, sal_Int32 nPolyIndex )
+{
+ drawing::Position3D aRet(0.0,0.0,0.0);
+
+ if( nPolyIndex>=0 && o3tl::make_unsigned(nPolyIndex)<rPolygon.size())
+ {
+ if(nPointIndex<static_cast<sal_Int32>(rPolygon[nPolyIndex].size()))
+ {
+ aRet = rPolygon[nPolyIndex][nPointIndex];
+ }
+ else
+ {
+ OSL_FAIL("polygon was accessed with a wrong index");
+ }
+ }
+ else
+ {
+ OSL_FAIL("polygon was accessed with a wrong index");
+ }
+ return aRet;
+}
+
+void addPolygon( std::vector<std::vector<css::drawing::Position3D>>& rRet, const std::vector<std::vector<css::drawing::Position3D>>& rAdd )
{
- sal_Int32 nAddOuterCount = rAdd.SequenceX.getLength();
- sal_Int32 nOuterCount = rRet.SequenceX.getLength() + nAddOuterCount;
- rRet.SequenceX.realloc( nOuterCount );
- rRet.SequenceY.realloc( nOuterCount );
- rRet.SequenceZ.realloc( nOuterCount );
+ sal_Int32 nAddOuterCount = rAdd.size();
+ sal_Int32 nOuterCount = rRet.size() + nAddOuterCount;
+ rRet.resize( nOuterCount );
+ auto pSequence = rRet.data();
sal_Int32 nIndex = 0;
sal_Int32 nOuter = nOuterCount - nAddOuterCount;
@@ -218,43 +262,37 @@ void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonSh
if( nIndex >= nAddOuterCount )
break;
- rRet.SequenceX[nOuter] = rAdd.SequenceX[nIndex];
- rRet.SequenceY[nOuter] = rAdd.SequenceY[nIndex];
- rRet.SequenceZ[nOuter] = rAdd.SequenceZ[nIndex];
+ pSequence[nOuter] = rAdd[nIndex];
nIndex++;
}
}
-void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
+void appendPoly( std::vector<std::vector<css::drawing::Position3D>>& rRet, const std::vector<std::vector<css::drawing::Position3D>>& rAdd )
{
- sal_Int32 nOuterCount = std::max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() );
- rRet.SequenceX.realloc(nOuterCount);
- rRet.SequenceY.realloc(nOuterCount);
- rRet.SequenceZ.realloc(nOuterCount);
+ std::size_t nOuterCount = std::max( rRet.size(), rAdd.size() );
+ rRet.resize(nOuterCount);
+ auto pSequence = rRet.data();
- for( sal_Int32 nOuter=0;nOuter<nOuterCount;nOuter++ )
+ for( std::size_t nOuter=0;nOuter<nOuterCount;nOuter++ )
{
- sal_Int32 nOldPointCount = rRet.SequenceX[nOuter].getLength();
+ sal_Int32 nOldPointCount = rRet[nOuter].size();
sal_Int32 nAddPointCount = 0;
- if(nOuter<rAdd.SequenceX.getLength())
- nAddPointCount = rAdd.SequenceX[nOuter].getLength();
+ if(nOuter<rAdd.size())
+ nAddPointCount = rAdd[nOuter].size();
if(!nAddPointCount)
continue;
sal_Int32 nNewPointCount = nOldPointCount + nAddPointCount;
- rRet.SequenceX[nOuter].realloc(nNewPointCount);
- rRet.SequenceY[nOuter].realloc(nNewPointCount);
- rRet.SequenceZ[nOuter].realloc(nNewPointCount);
+ pSequence[nOuter].resize(nNewPointCount);
+ auto pSequence_nOuter = pSequence[nOuter].data();
sal_Int32 nPointTarget=nOldPointCount;
sal_Int32 nPointSource=nAddPointCount;
for( ; nPointSource-- ; nPointTarget++ )
{
- rRet.SequenceX[nOuter][nPointTarget] = rAdd.SequenceX[nOuter][nPointSource];
- rRet.SequenceY[nOuter][nPointTarget] = rAdd.SequenceY[nOuter][nPointSource];
- rRet.SequenceZ[nOuter][nPointTarget] = rAdd.SequenceZ[nOuter][nPointSource];
+ pSequence_nOuter[nPointTarget] = rAdd[nOuter][nPointSource];
}
}
}
@@ -266,16 +304,22 @@ drawing::PolyPolygonShape3D BezierToPoly(
drawing::PolyPolygonShape3D aRet;
aRet.SequenceX.realloc( rPointSequence.getLength() );
+ auto pSequenceX = aRet.SequenceX.getArray();
aRet.SequenceY.realloc( rPointSequence.getLength() );
+ auto pSequenceY = aRet.SequenceY.getArray();
aRet.SequenceZ.realloc( rPointSequence.getLength() );
+ auto pSequenceZ = aRet.SequenceZ.getArray();
sal_Int32 nRealOuter = 0;
for(sal_Int32 nN = 0; nN < rPointSequence.getLength(); nN++)
{
sal_Int32 nInnerLength = rPointSequence[nN].getLength();
- aRet.SequenceX[nN].realloc( nInnerLength );
- aRet.SequenceY[nN].realloc( nInnerLength );
- aRet.SequenceZ[nN].realloc( nInnerLength );
+ pSequenceX[nRealOuter].realloc( nInnerLength );
+ auto pSequenceX_nRealOuter = pSequenceX[nRealOuter].getArray();
+ pSequenceY[nRealOuter].realloc( nInnerLength );
+ auto pSequenceY_nRealOuter = pSequenceY[nRealOuter].getArray();
+ pSequenceZ[nRealOuter].realloc( nInnerLength );
+ auto pSequenceZ_nRealOuter = pSequenceZ[nRealOuter].getArray();
bool bHasOuterFlags = nN < rBezier.Flags.getLength();
@@ -286,16 +330,16 @@ drawing::PolyPolygonShape3D BezierToPoly(
if( !bHasInnerFlags || (rBezier.Flags[nN][nM] == drawing::PolygonFlags_NORMAL) )
{
- aRet.SequenceX[nRealOuter][nRealInner] = rPointSequence[nN][nM].X;
- aRet.SequenceY[nRealOuter][nRealInner] = rPointSequence[nN][nM].Y;
- aRet.SequenceZ[nRealOuter][nRealInner] = 0.0;
+ pSequenceX_nRealOuter[nRealInner] = rPointSequence[nN][nM].X;
+ pSequenceY_nRealOuter[nRealInner] = rPointSequence[nN][nM].Y;
+ pSequenceZ_nRealOuter[nRealInner] = 0.0;
nRealInner++;
}
}
- aRet.SequenceX[nRealOuter].realloc( nRealInner );
- aRet.SequenceY[nRealOuter].realloc( nRealInner );
- aRet.SequenceZ[nRealOuter].realloc( nRealInner );
+ pSequenceX[nRealOuter].realloc( nRealInner );
+ pSequenceY[nRealOuter].realloc( nRealInner );
+ pSequenceZ[nRealOuter].realloc( nRealInner );
if( nRealInner>0 )
nRealOuter++;
@@ -313,22 +357,72 @@ drawing::PointSequenceSequence PolyToPointSequence(
{
drawing::PointSequenceSequence aRet;
aRet.realloc( rPolyPolygon.SequenceX.getLength() );
+ auto pRet = aRet.getArray();
for(sal_Int32 nN = 0; nN < rPolyPolygon.SequenceX.getLength(); nN++)
{
sal_Int32 nInnerLength = rPolyPolygon.SequenceX[nN].getLength();
- aRet[nN].realloc( nInnerLength );
+ pRet[nN].realloc( nInnerLength );
+ auto pRet_nN = pRet[nN].getArray();
for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
{
- aRet[nN][nM].X = static_cast<sal_Int32>(rPolyPolygon.SequenceX[nN][nM]);
- aRet[nN][nM].Y = static_cast<sal_Int32>(rPolyPolygon.SequenceY[nN][nM]);
+ pRet_nN[nM].X = static_cast<sal_Int32>(rPolyPolygon.SequenceX[nN][nM]);
+ pRet_nN[nM].Y = static_cast<sal_Int32>(rPolyPolygon.SequenceY[nN][nM]);
}
}
return aRet;
}
+drawing::PointSequenceSequence PolyToPointSequence(
+ const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon )
+{
+ drawing::PointSequenceSequence aRet;
+ aRet.realloc( rPolyPolygon.size() );
+ auto pRet = aRet.getArray();
+
+ for(std::size_t nN = 0; nN < rPolyPolygon.size(); nN++)
+ {
+ sal_Int32 nInnerLength = rPolyPolygon[nN].size();
+ pRet[nN].realloc( nInnerLength );
+ auto pRet_nN = pRet[nN].getArray();
+ for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
+ {
+ pRet_nN[nM].X = static_cast<sal_Int32>(rPolyPolygon[nN][nM].PositionX);
+ pRet_nN[nM].Y = static_cast<sal_Int32>(rPolyPolygon[nN][nM].PositionY);
+ }
+ }
+ return aRet;
+}
+
+basegfx::B2DPolyPolygon PolyToB2DPolyPolygon(
+ const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon )
+{
+ basegfx::B2DPolyPolygon aRetval;
+
+ for(auto const & nN: rPolyPolygon)
+ {
+ basegfx::B2DPolygon aNewPolygon;
+ sal_Int32 nInnerLength = nN.size();
+ if(nInnerLength)
+ {
+ aNewPolygon.reserve(nInnerLength);
+ for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
+ {
+ auto X = static_cast<sal_Int32>(nN[nM].PositionX);
+ auto Y = static_cast<sal_Int32>(nN[nM].PositionY);
+ aNewPolygon.append(basegfx::B2DPoint(X, Y));
+ }
+ // check for closed state flag
+ basegfx::utils::checkClosed(aNewPolygon);
+ }
+ aRetval.append(std::move(aNewPolygon));
+ }
+
+ return aRetval;
+}
+
void appendPointSequence( drawing::PointSequenceSequence& rTarget
- , drawing::PointSequenceSequence& rAdd )
+ , const drawing::PointSequenceSequence& rAdd )
{
sal_Int32 nAddCount = rAdd.getLength();
if(!nAddCount)
@@ -336,8 +430,9 @@ void appendPointSequence( drawing::PointSequenceSequence& rTarget
sal_Int32 nOldCount = rTarget.getLength();
rTarget.realloc(nOldCount+nAddCount);
+ auto pTarget = rTarget.getArray();
for(sal_Int32 nS=0; nS<nAddCount; nS++ )
- rTarget[nOldCount+nS]=rAdd[nS];
+ pTarget[nOldCount+nS]=rAdd[nS];
}
drawing::Position3D operator+( const drawing::Position3D& rPos
@@ -386,15 +481,6 @@ awt::Size Direction3DToAWTSize( const drawing::Direction3D& rDirection )
return aRet;
}
-uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint )
-{
- uno::Sequence< double > aRet(3);
- aRet[0] = rPoint.getX();
- aRet[1] = rPoint.getY();
- aRet[2] = rPoint.getZ();
- return aRet;
-}
-
drawing::Position3D SequenceToPosition3D( const uno::Sequence< double >& rSeq )
{
OSL_ENSURE(rSeq.getLength()==3,"The sequence needs to have length 3 for conversion into vector");
@@ -406,15 +492,6 @@ drawing::Position3D SequenceToPosition3D( const uno::Sequence< double >& rSeq )
return aRet;
}
-uno::Sequence< double > Position3DToSequence( const drawing::Position3D& rPosition )
-{
- uno::Sequence< double > aRet(3);
- aRet[0] = rPosition.PositionX;
- aRet[1] = rPosition.PositionY;
- aRet[2] = rPosition.PositionZ;
- return aRet;
-}
-
using namespace ::com::sun::star::chart2;
uno::Sequence< double > DataSequenceToDoubleSequence(
@@ -434,10 +511,11 @@ uno::Sequence< double > DataSequenceToDoubleSequence(
{
uno::Sequence< uno::Any > aValues = xDataSequence->getData();
aResult.realloc(aValues.getLength());
+ auto pResult = aResult.getArray();
for(sal_Int32 nN=aValues.getLength();nN--;)
{
- if( !(aValues[nN] >>= aResult[nN]) )
- ::rtl::math::setNan( &aResult[nN] );
+ if( !(aValues[nN] >>= pResult[nN]) )
+ pResult[nN] = std::numeric_limits<double>::quiet_NaN();
}
}
@@ -460,9 +538,10 @@ uno::Sequence< OUString > DataSequenceToStringSequence(
{
uno::Sequence< uno::Any > aValues = xDataSequence->getData();
aResult.realloc(aValues.getLength());
+ auto pResult = aResult.getArray();
for(sal_Int32 nN=aValues.getLength();nN--;)
- aValues[nN] >>= aResult[nN];
+ aValues[nN] >>= pResult[nN];
}
return aResult;
@@ -505,15 +584,15 @@ sal_Int16 getShortForLongAlso( const uno::Any& rAny )
}
bool replaceParamterInString( OUString & rInOutResourceString,
- const OUString & rParamToReplace,
- const OUString & rReplaceWith )
+ std::u16string_view rParamToReplace,
+ std::u16string_view rReplaceWith )
{
sal_Int32 nPos = rInOutResourceString.indexOf( rParamToReplace );
if( nPos == -1 )
return false;
rInOutResourceString = rInOutResourceString.replaceAt( nPos
- , rParamToReplace.getLength(), rReplaceWith );
+ , rParamToReplace.size(), rReplaceWith );
return true;
}
diff --git a/chart2/source/tools/ConfigColorScheme.cxx b/chart2/source/tools/ConfigColorScheme.cxx
index 5645fb22b68f..6ea26d99c5fb 100644
--- a/chart2/source/tools/ConfigColorScheme.cxx
+++ b/chart2/source/tools/ConfigColorScheme.cxx
@@ -20,11 +20,7 @@
#include <ConfigColorScheme.hxx>
#include <unotools/configitem.hxx>
-#include <sal/macros.h>
#include <cppuhelper/supportsservice.hxx>
-#include <comphelper/sequence.hxx>
-
-#include <set>
using namespace ::com::sun::star;
@@ -34,7 +30,7 @@ using ::com::sun::star::uno::Sequence;
namespace
{
-const char aSeriesPropName[] = "Series";
+constexpr OUString aSeriesPropName = u"Series"_ustr;
} // anonymous namespace
@@ -53,7 +49,6 @@ class ChartConfigItem : public ::utl::ConfigItem
public:
explicit ChartConfigItem( ConfigColorScheme & rListener );
- void addPropertyNotification( const OUString & rPropertyName );
uno::Any getProperty( const OUString & aPropertyName );
protected:
@@ -63,32 +58,27 @@ protected:
private:
ConfigColorScheme & m_rListener;
- std::set< OUString > m_aPropertiesToNotify;
};
ChartConfigItem::ChartConfigItem( ConfigColorScheme & rListener ) :
::utl::ConfigItem( "Office.Chart/DefaultColor" ),
m_rListener( rListener )
-{}
+{
+ EnableNotification( { aSeriesPropName } );
+}
void ChartConfigItem::Notify( const Sequence< OUString > & aPropertyNames )
{
for( OUString const & s : aPropertyNames )
{
- if( m_aPropertiesToNotify.find( s ) != m_aPropertiesToNotify.end())
- m_rListener.notify( s );
+ if( s == aSeriesPropName )
+ m_rListener.notify();
}
}
void ChartConfigItem::ImplCommit()
{}
-void ChartConfigItem::addPropertyNotification( const OUString & rPropertyName )
-{
- m_aPropertiesToNotify.insert( rPropertyName );
- EnableNotification( comphelper::containerToSequence( m_aPropertiesToNotify ));
-}
-
uno::Any ChartConfigItem::getProperty( const OUString & aPropertyName )
{
Sequence< uno::Any > aValues(
@@ -122,11 +112,8 @@ void ConfigColorScheme::retrieveConfigColors()
{
m_apChartConfigItem.reset(
new impl::ChartConfigItem( *this ));
- m_apChartConfigItem->addPropertyNotification( aSeriesPropName );
}
- OSL_ASSERT(m_apChartConfigItem);
- if (!m_apChartConfigItem)
- return;
+ assert(m_apChartConfigItem && "this can only be set at this point");
// retrieve colors
uno::Any aValue(
@@ -153,14 +140,13 @@ void ConfigColorScheme::retrieveConfigColors()
0xff00ff, 0x00ffff, 0xffff00
};
- static const sal_Int32 nMaxDefaultColors = SAL_N_ELEMENTS( nDefaultColors );
+ static const sal_Int32 nMaxDefaultColors = std::size( nDefaultColors );
return nDefaultColors[ nIndex % nMaxDefaultColors ];
}
-void ConfigColorScheme::notify( const OUString & rPropertyName )
+void ConfigColorScheme::notify()
{
- if( rPropertyName == aSeriesPropName )
- m_bNeedsUpdate = true;
+ m_bNeedsUpdate = true;
}
OUString SAL_CALL ConfigColorScheme::getImplementationName()
diff --git a/chart2/source/tools/ControllerLockGuard.cxx b/chart2/source/tools/ControllerLockGuard.cxx
index 7719755e9aff..6bfe8e4a95d2 100644
--- a/chart2/source/tools/ControllerLockGuard.cxx
+++ b/chart2/source/tools/ControllerLockGuard.cxx
@@ -19,16 +19,15 @@
#include <ControllerLockGuard.hxx>
#include <ChartModel.hxx>
+#include <utility>
using namespace ::com::sun::star;
-using ::com::sun::star::uno::Reference;
-
namespace chart
{
-ControllerLockGuardUNO::ControllerLockGuardUNO( const uno::Reference< frame::XModel >& xModel ) :
- mxModel( xModel )
+ControllerLockGuardUNO::ControllerLockGuardUNO( rtl::Reference<::chart::ChartModel> xModel ) :
+ mxModel(std::move( xModel ))
{
mxModel->lockControllers();
}
@@ -49,8 +48,8 @@ ControllerLockGuard::~ControllerLockGuard()
mrModel.unlockControllers();
}
-ControllerLockHelper::ControllerLockHelper( const Reference< frame::XModel > & xModel ) :
- m_xModel( xModel )
+ControllerLockHelper::ControllerLockHelper( rtl::Reference<::chart::ChartModel> xModel ) :
+ m_xModel(std::move( xModel ))
{}
ControllerLockHelper::~ControllerLockHelper()
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index 11f6bf2d94b3..45f235cd2810 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -18,34 +18,36 @@
*/
#include <DataSeriesHelper.hxx>
+#include <DataSeries.hxx>
+#include <DataSeriesProperties.hxx>
#include <DataSource.hxx>
+#include <ChartType.hxx>
#include <unonames.hxx>
+#include <Diagram.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <Axis.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart2/DataPointLabel.hpp>
-#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
-#include <com/sun/star/chart2/data/LabelOrigin.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/SymbolStyle.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <comphelper/sequence.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
#include <iterator>
+#include <utility>
#include <vector>
#include <set>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -56,8 +58,8 @@ namespace
class lcl_MatchesRole
{
public:
- explicit lcl_MatchesRole( const OUString & aRole, bool bMatchPrefix ) :
- m_aRole( aRole ),
+ explicit lcl_MatchesRole( OUString aRole, bool bMatchPrefix ) :
+ m_aRole(std::move( aRole )),
m_bMatchPrefix( bMatchPrefix )
{}
@@ -83,80 +85,50 @@ private:
bool m_bMatchPrefix;
};
-Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
- const Reference< chart2::data::XDataSource > & xDataSource )
-{
- Reference< chart2::data::XLabeledDataSequence > xResult;
- const Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences());
-
- for( auto const & labeledData : aSequences )
- {
- OSL_ENSURE( labeledData.is(), "empty LabeledDataSequence" );
- // no values are set but a label exists
- if( labeledData.is() &&
- ( ! labeledData->getValues().is() &&
- labeledData->getLabel().is()))
- {
- xResult.set( labeledData );
- break;
- }
- }
-
- return xResult;
-}
-
void lcl_getCooSysAndChartTypeOfSeries(
- const Reference< chart2::XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
const Reference< chart2::XDiagram > & xDiagram,
- Reference< chart2::XCoordinateSystem > & xOutCooSys,
- Reference< chart2::XChartType > & xOutChartType )
+ rtl::Reference< ::chart::BaseCoordinateSystem > & xOutCooSys,
+ rtl::Reference< ::chart::ChartType > & xOutChartType )
{
- Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY );
- if( !xCooSysCnt.is())
+ if( !xDiagram.is())
return;
+ ::chart::Diagram* pDiagram = dynamic_cast<::chart::Diagram*>(xDiagram.get());
- const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
- for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq )
+ for( rtl::Reference< ::chart::BaseCoordinateSystem > const & coords : pDiagram->getBaseCoordinateSystems() )
{
- Reference< chart2::XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW );
- const Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
- for( Reference< chart2::XChartType > const & chartType : aChartTypes )
+ for( rtl::Reference< ::chart::ChartType > const & chartType : coords->getChartTypes2() )
{
- Reference< chart2::XDataSeriesContainer > xSeriesCnt( chartType, uno::UNO_QUERY );
- if( xSeriesCnt.is())
+ for( rtl::Reference< ::chart::DataSeries > const & dataSeries : chartType->getDataSeries2() )
{
- const Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries());
- for( Reference< chart2::XDataSeries > const & dataSeries : aSeries )
+ if( dataSeries == xSeries )
{
- if( dataSeries == xSeries )
- {
- xOutCooSys.set( coords );
- xOutChartType.set( chartType );
- }
+ xOutCooSys = coords;
+ xOutChartType = chartType;
}
}
}
}
}
-void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries, bool bInsert )
+void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const rtl::Reference< ::chart::DataSeries >& xSeries, bool bInsert )
{
try
{
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( xSeriesProperties.is() )
+ if( xSeries.is() )
{
DataPointLabel aLabelAtSeries;
- xSeriesProperties->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabelAtSeries;
+ xSeries->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabelAtSeries;
aLabelAtSeries.ShowNumber = bInsert;
if( !bInsert )
{
aLabelAtSeries.ShowNumberInPercent = false;
aLabelAtSeries.ShowCategoryName = false;
}
- xSeriesProperties->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabelAtSeries));
+ xSeries->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabelAtSeries));
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -170,8 +142,11 @@ void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2::
{
aLabel.ShowNumberInPercent = false;
aLabel.ShowCategoryName = false;
+ aLabel.ShowCustomLabel = false;
+ aLabel.ShowSeriesName = false;
}
xPointProp->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel));
+ xPointProp->setPropertyValue(CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any());
}
}
}
@@ -200,186 +175,79 @@ OUString getRole( const uno::Reference< chart2::data::XLabeledDataSequence >& xL
return aRet;
}
-Reference< chart2::data::XLabeledDataSequence >
+uno::Reference< chart2::data::XLabeledDataSequence >
getDataSequenceByRole(
const Reference< chart2::data::XDataSource > & xSource,
const OUString& aRole,
bool bMatchPrefix /* = false */ )
{
- Reference< chart2::data::XLabeledDataSequence > aNoResult;
+ uno::Reference< chart2::data::XLabeledDataSequence > aNoResult;
if( ! xSource.is())
return aNoResult;
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aLabeledSeq( xSource->getDataSequences());
-
- const Reference< chart2::data::XLabeledDataSequence > * pBegin = aLabeledSeq.getConstArray();
- const Reference< chart2::data::XLabeledDataSequence > * pEnd = pBegin + aLabeledSeq.getLength();
- const Reference< chart2::data::XLabeledDataSequence > * pMatch =
- std::find_if( pBegin, pEnd, lcl_MatchesRole( aRole, bMatchPrefix ));
-
- if( pMatch != pEnd )
- return *pMatch;
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLabeledSeq( xSource->getDataSequences());
+ try
+ {
+ for (auto const & i : aLabeledSeq)
+ {
+ if (lcl_MatchesRole(aRole, bMatchPrefix)(i))
+ return i;
+ }
+ }
+ catch (const lang::DisposedException&)
+ {
+ TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" );
+ }
return aNoResult;
}
-std::vector< Reference< chart2::data::XLabeledDataSequence > >
+std::vector< uno::Reference< chart2::data::XLabeledDataSequence > >
getAllDataSequencesByRole( const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aDataSequences,
const OUString& aRole )
{
- std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultVec;
- std::copy_if( aDataSequences.begin(), aDataSequences.end(),
- std::back_inserter( aResultVec ),
- lcl_MatchesRole(aRole, /*bMatchPrefix*/true) );
- return aResultVec;
-}
-
-std::vector<Reference<css::chart2::data::XLabeledDataSequence> >
-getAllDataSequences( const uno::Sequence<uno::Reference<chart2::XDataSeries> >& aSeries )
-{
- std::vector< Reference< chart2::data::XLabeledDataSequence > > aSeqVec;
-
- for( uno::Reference<chart2::XDataSeries> const & dataSeries : aSeries )
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aResultVec;
+ for (const auto & i : aDataSequences)
{
- Reference< chart2::data::XDataSource > xSource( dataSeries, uno::UNO_QUERY );
- if( xSource.is())
- {
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
- aSeqVec.insert( aSeqVec.end(), aSeq.begin(), aSeq.end() );
- }
+ if (lcl_MatchesRole(aRole, /*bMatchPrefix*/true)(i))
+ aResultVec.push_back(i);
}
-
- return aSeqVec;
+ return aResultVec;
}
-Reference< chart2::data::XDataSource >
- getDataSource( const Sequence< Reference< chart2::XDataSeries > > & aSeries )
+std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >
+ getAllDataSequencesByRole( const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSequences,
+ const OUString& aRole )
{
- return Reference< chart2::data::XDataSource >(
- new DataSource(comphelper::containerToSequence(getAllDataSequences(aSeries))));
+ std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > aResultVec;
+ std::copy_if( aDataSequences.begin(), aDataSequences.end(),
+ std::back_inserter( aResultVec ),
+ lcl_MatchesRole(aRole, /*bMatchPrefix*/true) );
+ return aResultVec;
}
-namespace
-{
-OUString lcl_getDataSequenceLabel( const Reference< chart2::data::XDataSequence > & xSequence )
+std::vector<uno::Reference<chart2::data::XLabeledDataSequence> >
+getAllDataSequences( const std::vector<rtl::Reference<DataSeries> >& aSeries )
{
- OUString aResult;
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqVec;
- Reference< chart2::data::XTextualDataSequence > xTextSeq( xSequence, uno::UNO_QUERY );
- if( xTextSeq.is())
+ for( rtl::Reference<DataSeries> const & dataSeries : aSeries )
{
- Sequence< OUString > aSeq( xTextSeq->getTextualData());
-
- const sal_Int32 nMax = aSeq.getLength() - 1;
- OUStringBuffer aBuf;
-
- for( sal_Int32 i = 0; i <= nMax; ++i )
- {
- aBuf.append( aSeq[i] );
- if( i < nMax )
- aBuf.append( ' ');
- }
- aResult = aBuf.makeStringAndClear();
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aSeq( dataSeries->getDataSequences2());
+ aSeqVec.insert( aSeqVec.end(), aSeq.begin(), aSeq.end() );
}
- else if( xSequence.is())
- {
- Sequence< uno::Any > aSeq( xSequence->getData());
- const sal_Int32 nMax = aSeq.getLength() - 1;
- OUString aVal;
- OUStringBuffer aBuf;
- double fNum = 0;
-
- for( sal_Int32 i = 0; i <= nMax; ++i )
- {
- if( aSeq[i] >>= aVal )
- {
- aBuf.append( aVal );
- if( i < nMax )
- aBuf.append( ' ');
- }
- else if( aSeq[ i ] >>= fNum )
- {
- aBuf.append( fNum );
- if( i < nMax )
- aBuf.append( ' ');
- }
- }
- aResult = aBuf.makeStringAndClear();
- }
-
- return aResult;
-}
-}
-
-OUString getLabelForLabeledDataSequence(
- const Reference< chart2::data::XLabeledDataSequence > & xLabeledSeq )
-{
- OUString aResult;
- if( xLabeledSeq.is())
- {
- Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel());
- if( xSeq.is() )
- aResult = lcl_getDataSequenceLabel( xSeq );
- if( !xSeq.is() || aResult.isEmpty() )
- {
- // no label set or label content is empty -> use auto-generated one
- Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() );
- if( xValueSeq.is() )
- {
- Sequence< OUString > aLabels( xValueSeq->generateLabel(
- chart2::data::LabelOrigin_SHORT_SIDE ) );
- // no labels returned is interpreted as: auto-generation not
- // supported by sequence
- if( aLabels.hasElements() )
- aResult=aLabels[0];
- else
- {
- //todo?: maybe use the index of the series as name
- //but as the index may change it would be better to have such a name persistent
- //what is not possible at the moment
- //--> maybe use the identifier as part of the name ...
- aResult = lcl_getDataSequenceLabel( xValueSeq );
- }
- }
- }
- }
- return aResult;
+ return aSeqVec;
}
-OUString getDataSeriesLabel(
- const Reference< chart2::XDataSeries > & xSeries,
- const OUString & rLabelSequenceRole )
+rtl::Reference< DataSource >
+ getDataSource( const std::vector< rtl::Reference< DataSeries > > & aSeries )
{
- OUString aResult;
-
- Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
- if( xSource.is())
- {
- Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
- ::chart::DataSeriesHelper::getDataSequenceByRole( xSource, rLabelSequenceRole ));
- if( xLabeledSeq.is())
- aResult = getLabelForLabeledDataSequence( xLabeledSeq );
- else
- {
- // special case: labeled data series with only a label and no values may
- // serve as label
- xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
- if( xLabeledSeq.is())
- {
- Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel());
- if( xSeq.is())
- aResult = lcl_getDataSequenceLabel( xSeq );
- }
- }
-
- }
-
- return aResult;
+ return new DataSource(getAllDataSequences(aSeries));
}
void setStackModeAtSeries(
- const Sequence< Reference< chart2::XDataSeries > > & aSeries,
- const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem,
+ const std::vector< rtl::Reference< DataSeries > > & aSeries,
+ const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem,
StackMode eStackMode )
{
const uno::Any aPropValue(
@@ -391,17 +259,16 @@ void setStackModeAtSeries(
: chart2::StackingDirection_NO_STACKING );
std::set< sal_Int32 > aAxisIndexSet;
- for( Reference< chart2::XDataSeries > const & dataSeries : aSeries )
+ for( rtl::Reference< DataSeries > const & dataSeries : aSeries )
{
try
{
- Reference< beans::XPropertySet > xProp( dataSeries, uno::UNO_QUERY );
- if( xProp.is() )
+ if( dataSeries.is() )
{
- xProp->setPropertyValue( "StackingDirection", aPropValue );
+ dataSeries->setPropertyValue( "StackingDirection", aPropValue );
- sal_Int32 nAxisIndex;
- xProp->getPropertyValue( "AttachedAxisIndex" ) >>= nAxisIndex;
+ sal_Int32 nAxisIndex = 0;
+ dataSeries->getPropertyValue( "AttachedAxisIndex" ) >>= nAxisIndex;
aAxisIndexSet.insert(nAxisIndex);
}
}
@@ -422,8 +289,8 @@ void setStackModeAtSeries(
for (auto const& axisIndex : aAxisIndexSet)
{
- Reference< chart2::XAxis > xAxis(
- xCorrespondingCoordinateSystem->getAxisByDimension(1, axisIndex));
+ rtl::Reference< Axis > xAxis =
+ xCorrespondingCoordinateSystem->getAxisByDimension2(1, axisIndex);
if( xAxis.is())
{
bool bPercent = (eStackMode == StackMode::YStackedPercent);
@@ -441,15 +308,14 @@ void setStackModeAtSeries(
}
}
-sal_Int32 getAttachedAxisIndex( const Reference< chart2::XDataSeries > & xSeries )
+sal_Int32 getAttachedAxisIndex( const rtl::Reference< DataSeries > & xSeries )
{
sal_Int32 nRet = 0;
try
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
- if( xProp.is() )
+ if( xSeries.is() )
{
- xProp->getPropertyValue( "AttachedAxisIndex" ) >>= nRet;
+ xSeries->getFastPropertyValue( PROP_DATASERIES_ATTACHED_AXIS_INDEX ) >>= nRet;
}
}
catch( const uno::Exception & )
@@ -460,8 +326,8 @@ sal_Int32 getAttachedAxisIndex( const Reference< chart2::XDataSeries > & xSeries
}
sal_Int32 getNumberFormatKeyFromAxis(
- const Reference< chart2::XDataSeries > & xSeries,
- const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem,
+ const rtl::Reference< DataSeries > & xSeries,
+ const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem,
sal_Int32 nDimensionIndex,
sal_Int32 nAxisIndex /* = -1 */ )
{
@@ -470,8 +336,8 @@ sal_Int32 getNumberFormatKeyFromAxis(
nAxisIndex = getAttachedAxisIndex( xSeries );
try
{
- Reference< beans::XPropertySet > xAxisProp(
- xCorrespondingCoordinateSystem->getAxisByDimension( nDimensionIndex, nAxisIndex ), uno::UNO_QUERY );
+ rtl::Reference< Axis > xAxisProp =
+ xCorrespondingCoordinateSystem->getAxisByDimension2( nDimensionIndex, nAxisIndex );
if( xAxisProp.is())
xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nResult;
}
@@ -483,43 +349,40 @@ sal_Int32 getNumberFormatKeyFromAxis(
return nResult;
}
-Reference< chart2::XCoordinateSystem > getCoordinateSystemOfSeries(
- const Reference< chart2::XDataSeries > & xSeries,
- const Reference< chart2::XDiagram > & xDiagram )
+rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfSeries(
+ const rtl::Reference< DataSeries > & xSeries,
+ const rtl::Reference< Diagram > & xDiagram )
{
- Reference< chart2::XCoordinateSystem > xResult;
- Reference< chart2::XChartType > xDummy;
+ rtl::Reference< ::chart::BaseCoordinateSystem > xResult;
+ rtl::Reference< ::chart::ChartType > xDummy;
lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xResult, xDummy );
return xResult;
}
-Reference< chart2::XChartType > getChartTypeOfSeries(
- const Reference< chart2::XDataSeries > & xSeries,
- const Reference< chart2::XDiagram > & xDiagram )
+rtl::Reference< ::chart::ChartType > getChartTypeOfSeries(
+ const rtl::Reference< DataSeries > & xSeries,
+ const rtl::Reference< Diagram > & xDiagram )
{
- Reference< chart2::XChartType > xResult;
- Reference< chart2::XCoordinateSystem > xDummy;
+ rtl::Reference< ::chart::ChartType > xResult;
+ rtl::Reference< ::chart::BaseCoordinateSystem > xDummy;
lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xDummy, xResult );
return xResult;
}
void deleteSeries(
- const Reference< chart2::XDataSeries > & xSeries,
- const Reference< chart2::XChartType > & xChartType )
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
+ const rtl::Reference< ::chart::ChartType > & xChartType )
{
try
{
- Reference< chart2::XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY_THROW );
- auto aSeries(
- comphelper::sequenceToContainer<std::vector< Reference< chart2::XDataSeries > > >( xSeriesCnt->getDataSeries()));
- std::vector< Reference< chart2::XDataSeries > >::iterator aIt =
- std::find( aSeries.begin(), aSeries.end(), xSeries );
+ std::vector< rtl::Reference< DataSeries > > aSeries = xChartType->getDataSeries2();
+ auto aIt = std::find( aSeries.begin(), aSeries.end(), xSeries );
if( aIt != aSeries.end())
{
aSeries.erase( aIt );
- xSeriesCnt->setDataSeries( comphelper::containerToSequence( aSeries ));
+ xChartType->setDataSeries( aSeries );
}
}
catch( const uno::Exception & )
@@ -528,14 +391,14 @@ void deleteSeries(
}
}
-void switchSymbolsOnOrOff( const Reference< beans::XPropertySet > & xSeriesProperties,
+void switchSymbolsOnOrOff( const rtl::Reference< DataSeries > & xSeries,
bool bSymbolsOn, sal_Int32 nSeriesIndex )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
chart2::Symbol aSymbProp;
- if( xSeriesProperties->getPropertyValue( "Symbol") >>= aSymbProp )
+ if( xSeries->getPropertyValue( "Symbol") >>= aSymbProp )
{
if( !bSymbolsOn )
aSymbProp.Style = chart2::SymbolStyle_NONE;
@@ -544,55 +407,55 @@ void switchSymbolsOnOrOff( const Reference< beans::XPropertySet > & xSeriesPrope
aSymbProp.Style = chart2::SymbolStyle_STANDARD;
aSymbProp.StandardSymbol = nSeriesIndex;
}
- xSeriesProperties->setPropertyValue( "Symbol", uno::Any( aSymbProp ));
+ xSeries->setPropertyValue( "Symbol", uno::Any( aSymbProp ));
}
//todo: check attributed data points
}
-void switchLinesOnOrOff( const Reference< beans::XPropertySet > & xSeriesProperties, bool bLinesOn )
+void switchLinesOnOrOff( const rtl::Reference< DataSeries > & xSeries, bool bLinesOn )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
if( bLinesOn )
{
// keep line-styles that are not NONE
drawing::LineStyle eLineStyle;
- if( (xSeriesProperties->getPropertyValue( "LineStyle") >>= eLineStyle ) &&
+ if( (xSeries->getPropertyValue( "LineStyle") >>= eLineStyle ) &&
eLineStyle == drawing::LineStyle_NONE )
{
- xSeriesProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_SOLID ) );
+ xSeries->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_SOLID ) );
}
}
else
- xSeriesProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ) );
+ xSeries->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ) );
}
-void makeLinesThickOrThin( const Reference< beans::XPropertySet > & xSeriesProperties, bool bThick )
+void makeLinesThickOrThin( const rtl::Reference< ::chart::DataSeries > & xSeries, bool bThick )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
sal_Int32 nNewValue = bThick ? 80 : 0;
sal_Int32 nOldValue = 0;
- if( (xSeriesProperties->getPropertyValue( "LineWidth") >>= nOldValue ) &&
+ if( (xSeries->getPropertyValue( "LineWidth") >>= nOldValue ) &&
nOldValue != nNewValue )
{
if( !(bThick && nOldValue>0))
- xSeriesProperties->setPropertyValue( "LineWidth", uno::Any( nNewValue ) );
+ xSeries->setPropertyValue( "LineWidth", uno::Any( nNewValue ) );
}
}
-void setPropertyAlsoToAllAttributedDataPoints( const Reference< chart2::XDataSeries >& xSeries,
+void setPropertyAlsoToAllAttributedDataPoints( const rtl::Reference< ::chart::DataSeries >& xSeries,
const OUString& rPropertyName, const uno::Any& rPropertyValue )
{
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( !xSeriesProperties.is() )
+ if( !xSeries.is() )
return;
- xSeriesProperties->setPropertyValue( rPropertyName, rPropertyValue );
+ xSeries->setPropertyValue( rPropertyName, rPropertyValue );
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -601,20 +464,23 @@ void setPropertyAlsoToAllAttributedDataPoints( const Reference< chart2::XDataSer
continue;
xPointProp->setPropertyValue( rPropertyName, rPropertyValue );
if( rPropertyName == "LabelPlacement" )
+ {
xPointProp->setPropertyValue("CustomLabelPosition", uno::Any());
+ xPointProp->setPropertyValue("CustomLabelSize", uno::Any());
+ }
}
}
}
-bool hasAttributedDataPointDifferentValue( const Reference< chart2::XDataSeries >& xSeries,
+bool hasAttributedDataPointDifferentValue( const rtl::Reference< DataSeries >& xSeries,
const OUString& rPropertyName, const uno::Any& rPropertyValue )
{
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( !xSeriesProperties.is() )
+ if( !xSeries.is() )
return false;
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -632,46 +498,6 @@ bool hasAttributedDataPointDifferentValue( const Reference< chart2::XDataSeries
namespace
{
-bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
-{
- if( !xDataSequence.is() )
- return false;
- uno::Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY );
- if( xProp.is() )
- {
- uno::Sequence< sal_Int32 > aHiddenValues;
- try
- {
- xProp->getPropertyValue( "HiddenValues" ) >>= aHiddenValues;
- if( !aHiddenValues.hasElements() )
- return true;
- }
- catch( const uno::Exception& )
- {
- return true;
- }
- }
- return xDataSequence->getData().hasElements();
-}
-
-}
-
-bool hasUnhiddenData( const uno::Reference< chart2::XDataSeries >& xSeries )
-{
- uno::Reference< chart2::data::XDataSource > xDataSource( xSeries, uno::UNO_QUERY );
-
- uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDataSequences = xDataSource->getDataSequences();
-
- for(sal_Int32 nN = aDataSequences.getLength();nN--;)
- {
- if( !aDataSequences[nN].is() )
- continue;
- if( lcl_SequenceHasUnhiddenData( aDataSequences[nN]->getValues() ) )
- return true;
- if( lcl_SequenceHasUnhiddenData( aDataSequences[nN]->getLabel() ) )
- return true;
- }
- return false;
}
sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Reference< chart2::data::XDataSequence >& xDataSequence, bool bTranslate )
@@ -708,17 +534,17 @@ sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Refere
return nIndex;
}
-bool hasDataLabelsAtSeries( const Reference< chart2::XDataSeries >& xSeries )
+bool hasDataLabelsAtSeries( const rtl::Reference< DataSeries >& xSeries )
{
bool bRet = false;
try
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
- if( xProp.is() )
+ if( xSeries.is() )
{
DataPointLabel aLabel;
- if( xProp->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel )
- bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ if( xSeries->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel )
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName
+ || aLabel.ShowSeriesName;
}
}
catch(const uno::Exception &)
@@ -728,16 +554,16 @@ bool hasDataLabelsAtSeries( const Reference< chart2::XDataSeries >& xSeries )
return bRet;
}
-bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries )
+bool hasDataLabelsAtPoints( const rtl::Reference< DataSeries >& xSeries )
{
bool bRet = false;
try
{
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( xSeriesProperties.is() )
+ if( xSeries.is() )
{
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -746,7 +572,9 @@ bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries )
{
DataPointLabel aLabel;
if( xPointProp->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel )
- bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent
+ || aLabel.ShowCategoryName || aLabel.ShowCustomLabel
+ || aLabel.ShowSeriesName;
if( bRet )
break;
}
@@ -761,30 +589,31 @@ bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries )
return bRet;
}
-bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex )
+bool hasDataLabelAtPoint( const rtl::Reference< DataSeries >& xSeries, sal_Int32 nPointIndex )
{
bool bRet = false;
try
{
Reference< beans::XPropertySet > xProp;
- Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
- if( xSeriesProperties.is() )
+ if( xSeries.is() )
{
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
- 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())
+ auto aIt = std::find( aAttributedDataPointIndexList.begin(), aAttributedDataPointIndexList.end(), nPointIndex );
+ if (aIt != aAttributedDataPointIndexList.end())
xProp = xSeries->getDataPointByIndex(nPointIndex);
else
- xProp = xSeriesProperties;
+ xProp = xSeries;
}
if( xProp.is() )
{
DataPointLabel aLabel;
if( xProp->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel )
- bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent
+ || aLabel.ShowCategoryName || aLabel.ShowCustomLabel
+ || aLabel.ShowSeriesName;
}
}
}
@@ -795,12 +624,12 @@ bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_I
return bRet;
}
-void insertDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries )
+void insertDataLabelsToSeriesAndAllPoints( const rtl::Reference< DataSeries >& xSeries )
{
lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, true /*bInsert*/ );
}
-void deleteDataLabelsFromSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries )
+void deleteDataLabelsFromSeriesAndAllPoints( const rtl::Reference< DataSeries >& xSeries )
{
lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, false /*bInsert*/ );
}
@@ -834,7 +663,10 @@ void deleteDataLabelsFromPoint( const Reference< beans::XPropertySet >& xPointPr
aLabel.ShowNumber = false;
aLabel.ShowNumberInPercent = false;
aLabel.ShowCategoryName = false;
+ aLabel.ShowCustomLabel = false;
+ aLabel.ShowSeriesName = false;
xPointProp->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel));
+ xPointProp->setPropertyValue(CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any());
}
}
catch(const uno::Exception &)
diff --git a/chart2/source/tools/DataSource.cxx b/chart2/source/tools/DataSource.cxx
index bdcac98ef1e6..c74687c1485a 100644
--- a/chart2/source/tools/DataSource.cxx
+++ b/chart2/source/tools/DataSource.cxx
@@ -19,6 +19,7 @@
#include <DataSource.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/sequence.hxx>
namespace com::sun::star::uno { class XComponentContext; }
@@ -39,6 +40,12 @@ DataSource::DataSource(
m_aDataSeq( rSequences )
{}
+DataSource::DataSource(
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & rSequences )
+{
+ m_aDataSeq = comphelper::containerToSequence< Reference< chart2::data::XLabeledDataSequence > >(rSequences);
+}
+
DataSource::~DataSource()
{}
diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx
index cb74e60eaa54..dc6c1b9c87f1 100644
--- a/chart2/source/tools/DataSourceHelper.cxx
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -20,7 +20,9 @@
#include <DataSourceHelper.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartTypeManager.hxx>
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <DataSource.hxx>
#include <ControllerLockGuard.hxx>
@@ -28,15 +30,12 @@
#include <LabeledDataSequence.hxx>
#include <unonames.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <tools/diagnose_ex.h>
-
-#include <iterator>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -74,16 +73,15 @@ void lcl_addDataSourceRanges(
void lcl_addErrorBarRanges(
std::vector< OUString > & rOutResult,
- const uno::Reference< XDataSeries > & xDataSeries )
+ const rtl::Reference< DataSeries > & xDataSeries )
{
- uno::Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY );
- if( !xSeriesProp.is())
+ if( !xDataSeries.is())
return;
try
{
uno::Reference< beans::XPropertySet > xErrorBarProp;
- if( ( xSeriesProp->getPropertyValue( CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarProp ) &&
+ if( ( xDataSeries->getPropertyValue( CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarProp ) &&
xErrorBarProp.is())
{
sal_Int32 eStyle = css::chart::ErrorBarStyle::NONE;
@@ -96,7 +94,7 @@ void lcl_addErrorBarRanges(
}
}
- if( ( xSeriesProp->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarProp ) && xErrorBarProp.is())
+ if( ( xDataSeries->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarProp ) && xErrorBarProp.is())
{
sal_Int32 eStyle = css::chart::ErrorBarStyle::NONE;
if( ( xErrorBarProp->getPropertyValue("ErrorBarStyle") >>= eStyle ) &&
@@ -116,12 +114,6 @@ void lcl_addErrorBarRanges(
} // anonymous namespace
-Reference< chart2::data::XDataSource > DataSourceHelper::createDataSource(
- const Sequence< Reference< chart2::data::XLabeledDataSequence > >& rSequences )
-{
- return new DataSource(rSequences);
-}
-
Reference< chart2::data::XDataSequence > DataSourceHelper::createCachedDataSequence()
{
return new ::chart::CachedDataSequence();
@@ -132,20 +124,20 @@ Reference< chart2::data::XDataSequence > DataSourceHelper::createCachedDataSeque
return new ::chart::CachedDataSequence( rSingleText );
}
-Reference< chart2::data::XLabeledDataSequence > DataSourceHelper::createLabeledDataSequence(
+rtl::Reference< LabeledDataSequence > DataSourceHelper::createLabeledDataSequence(
const Reference< chart2::data::XDataSequence >& xValues ,
const Reference< chart2::data::XDataSequence >& xLabels )
{
return new ::chart::LabeledDataSequence( xValues, xLabels );
}
-Reference< chart2::data::XLabeledDataSequence > DataSourceHelper::createLabeledDataSequence(
+rtl::Reference< LabeledDataSequence > DataSourceHelper::createLabeledDataSequence(
const Reference< chart2::data::XDataSequence >& xValues )
{
return new ::chart::LabeledDataSequence( xValues );
}
-Reference< chart2::data::XLabeledDataSequence > DataSourceHelper::createLabeledDataSequence()
+rtl::Reference< LabeledDataSequence > DataSourceHelper::createLabeledDataSequence()
{
return new ::chart::LabeledDataSequence;
}
@@ -157,18 +149,12 @@ uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments(
if( bUseColumns )
eRowSource = css::chart::ChartDataRowSource_COLUMNS;
- uno::Sequence< beans::PropertyValue > aArguments(3);
- aArguments[0] = beans::PropertyValue( "DataRowSource"
- , -1, uno::Any( eRowSource )
- , beans::PropertyState_DIRECT_VALUE );
- aArguments[1] = beans::PropertyValue( "FirstCellAsLabel"
- , -1, uno::Any( bFirstCellAsLabel )
- , beans::PropertyState_DIRECT_VALUE );
- aArguments[2] = beans::PropertyValue( "HasCategories"
- , -1, uno::Any( bHasCategories )
- , beans::PropertyState_DIRECT_VALUE );
-
- return aArguments;
+ return
+ {
+ { "DataRowSource", -1, uno::Any( eRowSource), beans::PropertyState_DIRECT_VALUE },
+ { "FirstCellAsLabel", -1, uno::Any( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE },
+ { "HasCategories", -1, uno::Any( bHasCategories ), beans::PropertyState_DIRECT_VALUE }
+ };
}
uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments(
@@ -178,14 +164,14 @@ uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments(
{
uno::Sequence< beans::PropertyValue > aArguments( createArguments( bUseColumns, bFirstCellAsLabel, bHasCategories ));
aArguments.realloc( aArguments.getLength() + 1 );
- aArguments[aArguments.getLength() - 1] =
+ aArguments.getArray()[aArguments.getLength() - 1] =
beans::PropertyValue( "CellRangeRepresentation"
, -1, uno::Any( rRangeRepresentation )
, beans::PropertyState_DIRECT_VALUE );
if( rSequenceMapping.hasElements() )
{
aArguments.realloc( aArguments.getLength() + 1 );
- aArguments[aArguments.getLength() - 1] =
+ aArguments.getArray()[aArguments.getLength() - 1] =
beans::PropertyValue( "SequenceMapping"
, -1, uno::Any( rSequenceMapping )
, beans::PropertyState_DIRECT_VALUE );
@@ -224,21 +210,25 @@ void DataSourceHelper::readArguments( const uno::Sequence< beans::PropertyValue
}
}
-uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoRectangularFormat(
- const uno::Reference< chart2::XChartDocument >& xChartDoc )
+rtl::Reference< DataSource > DataSourceHelper::pressUsedDataIntoRectangularFormat(
+ const rtl::Reference< ChartModel >& xChartDoc )
{
std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultVector;
//categories are always the first sequence
- Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
+ rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram());
- Reference< chart2::data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ Reference< chart2::data::XLabeledDataSequence > xCategories;
+ if (xDiagram)
+ xCategories = xDiagram->getCategories();
if( xCategories.is() )
aResultVector.push_back( xCategories );
- std::vector< Reference< chart2::XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
- uno::Reference< chart2::data::XDataSource > xSeriesSource(
- DataSeriesHelper::getDataSource( comphelper::containerToSequence(aSeriesVector) ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector;
+ if (xDiagram)
+ aSeriesVector = xDiagram->getDataSeries();
+ uno::Reference< chart2::data::XDataSource > xSeriesSource =
+ DataSeriesHelper::getDataSource( aSeriesVector );
const Sequence< Reference< chart2::data::XLabeledDataSequence > > aDataSequences( xSeriesSource->getDataSequences() );
//the first x-values is always the next sequence //todo ... other x-values get lost for old format
@@ -255,25 +245,24 @@ uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoR
aResultVector.push_back( labeledData );
}
- return new DataSource( comphelper::containerToSequence(aResultVector) );
+ return new DataSource( aResultVector );
}
uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges(
- const uno::Reference< chart2::XDiagram > & xDiagram )
+ const rtl::Reference< Diagram > & xDiagram )
{
std::vector< OUString > aResult;
if( xDiagram.is())
{
- uno::Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ uno::Reference< data::XLabeledDataSequence > xCategories( xDiagram->getCategories() );
if( xCategories.is() )
lcl_addRanges( aResult, xCategories );
- std::vector< uno::Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector( xDiagram->getDataSeries() );
for (auto const& series : aSeriesVector)
{
- uno::Reference< data::XDataSource > xDataSource(series, uno::UNO_QUERY);
- lcl_addDataSourceRanges( aResult, xDataSource );
+ lcl_addDataSourceRanges( aResult, series );
lcl_addErrorBarRanges( aResult, series );
}
}
@@ -281,69 +270,34 @@ uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges(
return comphelper::containerToSequence( aResult );
}
-uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges( const uno::Reference< frame::XModel > & xChartModel )
+uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges( const rtl::Reference<::chart::ChartModel> & xChartModel )
{
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
return getUsedDataRanges( xDiagram );
}
-uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
- const uno::Reference< chart2::XChartDocument >& xChartDoc )
-{
- return pressUsedDataIntoRectangularFormat( xChartDoc );
-}
-
-uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
- const uno::Reference< frame::XModel >& xChartModel )
-{
- std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aResult;
-
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- uno::Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
- if( xCategories.is() )
- aResult.push_back( xCategories );
-
- std::vector< uno::Reference< XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( xChartModel ) );
- for (auto const& series : aSeriesVector)
- {
- uno::Reference< data::XDataSource > xDataSource(series, uno::UNO_QUERY);
- if( !xDataSource.is() )
- continue;
- uno::Sequence< uno::Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
- aResult.insert( aResult.end(), aDataSequences.begin(), aDataSequences.end() );
- }
-
- return uno::Reference< chart2::data::XDataSource >(
- new DataSource( comphelper::containerToSequence( aResult )));
-}
-
-uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
+rtl::Reference< DataSource > DataSourceHelper::getUsedData(
ChartModel& rModel )
{
std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aResult;
- uno::Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
- uno::Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ rtl::Reference< Diagram > xDiagram = rModel.getFirstChartDiagram();
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories( xDiagram->getCategories() );
if( xCategories.is() )
aResult.push_back( xCategories );
- std::vector< uno::Reference< XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( rModel ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector = ChartModelHelper::getDataSeries( &rModel );
for (auto const& series : aSeriesVector)
{
- uno::Reference< data::XDataSource > xDataSource(series, uno::UNO_QUERY);
- if( !xDataSource.is() )
- continue;
- uno::Sequence< uno::Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSequences( series->getDataSequences2() );
aResult.insert( aResult.end(), aDataSequences.begin(), aDataSequences.end() );
}
- return uno::Reference< chart2::data::XDataSource >(
- new DataSource( comphelper::containerToSequence( aResult )));
+ return new DataSource( aResult );
}
bool DataSourceHelper::detectRangeSegmentation(
- const uno::Reference<
- frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, OUString& rOutRangeString
, css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& rOutUseColumns
@@ -352,22 +306,23 @@ bool DataSourceHelper::detectRangeSegmentation(
{
bool bSomethingDetected = false;
- uno::Reference< XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
- if( !xChartDocument.is() )
+ if( !xChartModel.is() )
return bSomethingDetected;
- uno::Reference< data::XDataProvider > xDataProvider( xChartDocument->getDataProvider() );
+ uno::Reference< data::XDataProvider > xDataProvider( xChartModel->getDataProvider() );
if( !xDataProvider.is() )
return bSomethingDetected;
try
{
DataSourceHelper::readArguments(
- xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartDocument ) ),
+ xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartModel ) ),
rOutRangeString, rSequenceMapping, rOutUseColumns, rOutFirstCellAsLabel, rOutHasCategories );
bSomethingDetected = !rOutRangeString.isEmpty();
- uno::Reference< chart2::data::XLabeledDataSequence > xCategories(
- DiagramHelper::getCategoriesFromDiagram( xChartDocument->getFirstDiagram() ));
+ rtl::Reference<Diagram> xDiagram = xChartModel->getFirstChartDiagram();
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories;
+ if (xDiagram)
+ xCategories = xDiagram->getCategories();
rOutHasCategories = xCategories.is();
}
catch( uno::Exception & )
@@ -378,7 +333,7 @@ bool DataSourceHelper::detectRangeSegmentation(
}
bool DataSourceHelper::allArgumentsForRectRangeDetected(
- const uno::Reference< chart2::XChartDocument >& xChartDocument )
+ const rtl::Reference<::chart::ChartModel>& xChartDocument )
{
bool bHasDataRowSource = false;
bool bHasFirstCellAsLabel = false;
@@ -422,30 +377,24 @@ bool DataSourceHelper::allArgumentsForRectRangeDetected(
}
void DataSourceHelper::setRangeSegmentation(
- const uno::Reference< frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, const css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool bUseColumns , bool bFirstCellAsLabel, bool bUseCategories )
{
- uno::Reference< XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
- if( !xChartDocument.is() )
- return;
- uno::Reference< data::XDataProvider > xDataProvider( xChartDocument->getDataProvider() );
+ uno::Reference< data::XDataProvider > xDataProvider( xChartModel->getDataProvider() );
if( !xDataProvider.is() )
return;
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
if( !xDiagram.is() )
return;
- uno::Reference< chart2::XChartTypeManager > xChartTypeManager( xChartDocument->getChartTypeManager() );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartModel->getTypeManager();
if( !xChartTypeManager.is() )
return;
- uno::Reference< lang::XMultiServiceFactory > xTemplateFactory( xChartTypeManager, uno::UNO_QUERY );
- if( !xTemplateFactory.is() )
- return;
OUString aRangeString;
bool bDummy;
uno::Sequence< sal_Int32 > aDummy;
- readArguments( xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartDocument )),
+ readArguments( xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartModel )),
aRangeString, aDummy, bDummy, bDummy, bDummy );
uno::Sequence< beans::PropertyValue > aArguments(
@@ -473,20 +422,17 @@ Sequence< OUString > DataSourceHelper::getRangesFromLabeledDataSequence(
{
if( xValues.is())
{
- aResult.realloc( 2 );
- aResult[0] = xLabel->getSourceRangeRepresentation();
- aResult[1] = xValues->getSourceRangeRepresentation();
+ aResult = { xLabel->getSourceRangeRepresentation(),
+ xValues->getSourceRangeRepresentation() };
}
else
{
- aResult.realloc( 1 );
- aResult[0] = xLabel->getSourceRangeRepresentation();
+ aResult = { xLabel->getSourceRangeRepresentation() };
}
}
else if( xValues.is())
{
- aResult.realloc( 1 );
- aResult[0] = xValues->getSourceRangeRepresentation();
+ aResult = { xValues->getSourceRangeRepresentation() };
}
}
return aResult;
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 5805f929aebb..38aa97265396 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -18,48 +18,43 @@
*/
#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
-#include <ChartTypeHelper.hxx>
+#include <ChartType.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
#include <ExplicitCategoriesProvider.hxx>
-#include <servicenames_charttypes.hxx>
#include <RelativePositionHelper.hxx>
#include <ControllerLockGuard.hxx>
#include <NumberFormatterWrapper.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
-#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
-#include <com/sun/star/chart2/XTitled.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
-#include <com/sun/star/util/CloseVetoException.hpp>
#include <com/sun/star/util/NumberFormat.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <unotools/saveopt.hxx>
-#include <rtl/math.hxx>
+#include <svl/numformat.hxx>
#include <svl/zforlist.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <comphelper/sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
+#include <limits>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-using namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -69,283 +64,10 @@ using ::com::sun::star::chart2::XAnyDescriptionAccess;
namespace chart
{
-DiagramHelper::tTemplateWithServiceName
- DiagramHelper::getTemplateForDiagram(
- const Reference< XDiagram > & xDiagram,
- const Reference< lang::XMultiServiceFactory > & xChartTypeManager )
-{
- DiagramHelper::tTemplateWithServiceName aResult;
-
- if( ! (xChartTypeManager.is() && xDiagram.is()))
- return aResult;
-
- Sequence< OUString > aServiceNames( xChartTypeManager->getAvailableServiceNames());
- const sal_Int32 nLength = aServiceNames.getLength();
-
- bool bTemplateFound = false;
-
- for( sal_Int32 i = 0; ! bTemplateFound && i < nLength; ++i )
- {
- try
- {
- Reference< XChartTypeTemplate > xTempl(
- xChartTypeManager->createInstance( aServiceNames[ i ] ), uno::UNO_QUERY_THROW );
-
- if (xTempl.is() && xTempl->matchesTemplate(xDiagram, true))
- {
- aResult.first = xTempl;
- aResult.second = aServiceNames[ i ];
- bTemplateFound = true;
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- }
-
- return aResult;
-}
-
-void DiagramHelper::setVertical(
- const Reference< XDiagram > & xDiagram,
- bool bVertical /* = true */ )
-{
- try
- {
- Reference< XCoordinateSystemContainer > xCnt( xDiagram, uno::UNO_QUERY );
- if (!xCnt.is())
- return;
-
- const Sequence< Reference<XCoordinateSystem> > aCooSys = xCnt->getCoordinateSystems();
- uno::Any aValue;
- aValue <<= bVertical;
- for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSys )
- {
- Reference< beans::XPropertySet > xProp( xCooSys, uno::UNO_QUERY );
- bool bChanged = false;
- if (xProp.is())
- {
- bool bOldSwap = false;
- if( !(xProp->getPropertyValue("SwapXAndYAxis") >>= bOldSwap)
- || bVertical != bOldSwap )
- bChanged = true;
-
- if( bChanged )
- xProp->setPropertyValue("SwapXAndYAxis", aValue);
- }
-
- if (!xCooSys.is())
- continue;
-
- const sal_Int32 nDimensionCount = xCooSys->getDimension();
- sal_Int32 nDimIndex = 0;
- for (nDimIndex=0; nDimIndex < nDimensionCount; ++nDimIndex)
- {
- const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nDimIndex);
- for (sal_Int32 nI = 0; nI <= nMaximumScaleIndex; ++nI)
- {
- Reference<chart2::XAxis> xAxis = xCooSys->getAxisByDimension(nDimIndex,nI);
- if (!xAxis.is())
- continue;
-
- //adapt title rotation only when axis swapping has changed
- if (!bChanged)
- continue;
-
- Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY );
- if (!xTitled.is())
- continue;
-
- Reference< beans::XPropertySet > xTitleProps( xTitled->getTitleObject(), uno::UNO_QUERY );
- if (!xTitleProps.is())
- continue;
-
- double fAngleDegree = 0.0;
- xTitleProps->getPropertyValue("TextRotation") >>= fAngleDegree;
- if (fAngleDegree != 0.0 &&
- !rtl::math::approxEqual(fAngleDegree, 90.0))
- continue;
-
- double fNewAngleDegree = 0.0;
- if( !bVertical && nDimIndex == 1 )
- fNewAngleDegree = 90.0;
- else if( bVertical && nDimIndex == 0 )
- fNewAngleDegree = 90.0;
-
- xTitleProps->setPropertyValue("TextRotation", uno::Any(fNewAngleDegree));
- }
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
-bool DiagramHelper::getVertical( const uno::Reference< chart2::XDiagram > & xDiagram,
- bool& rbFound, bool& rbAmbiguous )
-{
- bool bValue = false;
- rbFound = false;
- rbAmbiguous = false;
-
- Reference< XCoordinateSystemContainer > xCnt( xDiagram, uno::UNO_QUERY );
- if (!xCnt.is())
- return false;
-
- const Sequence< Reference<XCoordinateSystem> > aCooSys = xCnt->getCoordinateSystems();
-
- for (Reference<XCoordinateSystem> const & coords : aCooSys)
- {
- Reference<beans::XPropertySet> xProp(coords, uno::UNO_QUERY);
- if (!xProp.is())
- continue;
-
- bool bCurrent = false;
- if (xProp->getPropertyValue("SwapXAndYAxis") >>= bCurrent)
- {
- if (!rbFound)
- {
- bValue = bCurrent;
- rbFound = true;
- }
- else if (bCurrent != bValue)
- {
- // ambiguous -> choose always first found
- rbAmbiguous = true;
- }
- }
- }
- return bValue;
-}
-
-void DiagramHelper::setStackMode(
- const Reference< XDiagram > & xDiagram,
- StackMode eStackMode
-)
-{
- try
- {
- bool bValueFound = false;
- bool bIsAmbiguous = false;
- StackMode eOldStackMode = DiagramHelper::getStackMode( xDiagram, bValueFound, bIsAmbiguous );
-
- if( eStackMode == eOldStackMode && !bIsAmbiguous )
- return;
-
- StackingDirection eNewDirection = StackingDirection_NO_STACKING;
- if( eStackMode == StackMode::YStacked || eStackMode == StackMode::YStackedPercent )
- eNewDirection = StackingDirection_Y_STACKING;
- else if( eStackMode == StackMode::ZStacked )
- eNewDirection = StackingDirection_Z_STACKING;
-
- uno::Any aNewDirection( eNewDirection );
-
- bool bPercent = false;
- if( eStackMode == StackMode::YStackedPercent )
- bPercent = true;
-
- //iterate through all coordinate systems
- uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( !xCooSysContainer.is() )
- return;
- const uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSysList )
- {
- //set correct percent stacking
- const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(1);
- for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
- {
- Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension( 1,nI ));
- if( xAxis.is())
- {
- chart2::ScaleData aScaleData = xAxis->getScaleData();
- if( (aScaleData.AxisType==AxisType::PERCENT) != bPercent )
- {
- if( bPercent )
- aScaleData.AxisType = AxisType::PERCENT;
- else
- aScaleData.AxisType = AxisType::REALNUMBER;
- xAxis->setScaleData( aScaleData );
- }
- }
- }
- //iterate through all chart types in the current coordinate system
- uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
- if( !xChartTypeContainer.is() )
- continue;
- uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- if (!aChartTypeList.hasElements())
- continue;
-
- uno::Reference< XChartType > xChartType( aChartTypeList[0] );
-
- //iterate through all series in this chart type
- uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
- OSL_ASSERT( xDataSeriesContainer.is());
- if( !xDataSeriesContainer.is() )
- continue;
-
- const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
- for( uno::Reference< XDataSeries > const & dataSeries : aSeriesList )
- {
- Reference< beans::XPropertySet > xProp( dataSeries, uno::UNO_QUERY );
- if(xProp.is())
- xProp->setPropertyValue( "StackingDirection", aNewDirection );
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
-StackMode DiagramHelper::getStackMode( const Reference< XDiagram > & xDiagram, bool& rbFound, bool& rbAmbiguous )
-{
- rbFound=false;
- rbAmbiguous=false;
-
- StackMode eGlobalStackMode = StackMode::NONE;
-
- //iterate through all coordinate systems
- uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( !xCooSysContainer.is() )
- return eGlobalStackMode;
- const uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSysList )
- {
- //iterate through all chart types in the current coordinate system
- uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
- if( !xChartTypeContainer.is() )
- continue;
- uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
- {
- uno::Reference< XChartType > xChartType( aChartTypeList[nT] );
-
- StackMode eLocalStackMode = DiagramHelper::getStackModeFromChartType(
- xChartType, rbFound, rbAmbiguous, xCooSys );
-
- if( rbFound && eLocalStackMode != eGlobalStackMode && nT>0 )
- {
- rbAmbiguous = true;
- return eGlobalStackMode;
- }
-
- eGlobalStackMode = eLocalStackMode;
- }
- }
-
- return eGlobalStackMode;
-}
-
StackMode DiagramHelper::getStackModeFromChartType(
- const Reference< XChartType > & xChartType,
+ const rtl::Reference< ChartType > & xChartType,
bool& rbFound, bool& rbAmbiguous,
- const Reference< XCoordinateSystem > & xCorrespondingCoordinateSystem )
+ const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem )
{
StackMode eStackMode = StackMode::NONE;
rbFound = false;
@@ -353,23 +75,21 @@ StackMode DiagramHelper::getStackModeFromChartType(
try
{
- Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW );
- Sequence< Reference< chart2::XDataSeries > > aSeries( xDSCnt->getDataSeries());
+ const std::vector< rtl::Reference< DataSeries > > & aSeries = xChartType->getDataSeries2();
chart2::StackingDirection eCommonDirection = chart2::StackingDirection_NO_STACKING;
bool bDirectionInitialized = false;
// first series is irrelevant for stacking, start with second, unless
// there is only one series
- const sal_Int32 nSeriesCount = aSeries.getLength();
+ const sal_Int32 nSeriesCount = aSeries.size();
sal_Int32 i = (nSeriesCount == 1) ? 0: 1;
for( ; i<nSeriesCount; ++i )
{
rbFound = true;
- Reference< beans::XPropertySet > xProp( aSeries[i], uno::UNO_QUERY_THROW );
chart2::StackingDirection eCurrentDirection = eCommonDirection;
// property is not MAYBEVOID
- bool bSuccess = ( xProp->getPropertyValue( "StackingDirection" ) >>= eCurrentDirection );
+ bool bSuccess = ( aSeries[i]->getPropertyValue( "StackingDirection" ) >>= eCurrentDirection );
OSL_ASSERT( bSuccess );
if( ! bDirectionInitialized )
{
@@ -403,8 +123,8 @@ StackMode DiagramHelper::getStackModeFromChartType(
if( nSeriesCount )
nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(aSeries[0]);
- Reference< chart2::XAxis > xAxis(
- xCorrespondingCoordinateSystem->getAxisByDimension( 1,nAxisIndex ));
+ rtl::Reference< Axis > xAxis =
+ xCorrespondingCoordinateSystem->getAxisByDimension2( 1,nAxisIndex );
if( xAxis.is())
{
chart2::ScaleData aScaleData = xAxis->getScaleData();
@@ -424,502 +144,26 @@ StackMode DiagramHelper::getStackModeFromChartType(
return eStackMode;
}
-sal_Int32 DiagramHelper::getDimension( const Reference< XDiagram > & xDiagram )
-{
- // -1: not yet set
- sal_Int32 nResult = -1;
-
- try
- {
- Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY );
- if( xCooSysCnt.is() )
- {
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
-
- for( Reference< XCoordinateSystem > const & xCooSys : aCooSysSeq )
- {
- if(xCooSys.is())
- {
- nResult = xCooSys->getDimension();
- break;
- }
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return nResult;
-}
-
-void DiagramHelper::setDimension(
- const Reference< XDiagram > & xDiagram,
- sal_Int32 nNewDimensionCount )
-{
- if( ! xDiagram.is())
- return;
-
- if( DiagramHelper::getDimension( xDiagram ) == nNewDimensionCount )
- return;
-
- try
- {
- bool rbFound = false;
- bool rbAmbiguous = true;
- StackMode eStackMode = DiagramHelper::getStackMode( xDiagram, rbFound, rbAmbiguous );
- bool bIsSupportingOnlyDeepStackingFor3D=false;
-
- //change all coordinate systems:
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( Reference<XCoordinateSystem> const & xOldCooSys : aCooSysList )
- {
- Reference< XCoordinateSystem > xNewCooSys;
-
- Reference< XChartTypeContainer > xChartTypeContainer( xOldCooSys, uno::UNO_QUERY );
- if( !xChartTypeContainer.is() )
- continue;
-
- const Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- for( Reference< XChartType > const & xChartType : aChartTypeList )
- {
- bIsSupportingOnlyDeepStackingFor3D = ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( xChartType );
- if(!xNewCooSys.is())
- {
- xNewCooSys = xChartType->createCoordinateSystem( nNewDimensionCount );
- break;
- }
- //@todo make sure that all following charttypes are also capable of the new dimension
- //otherwise separate them in a different group
- //BM: might be done in replaceCoordinateSystem()
- }
-
- // replace the old coordinate system at all places where it was used
- DiagramHelper::replaceCoordinateSystem( xDiagram, xOldCooSys, xNewCooSys );
- }
-
- //correct stack mode if necessary
- if( nNewDimensionCount==3 && eStackMode != StackMode::ZStacked && bIsSupportingOnlyDeepStackingFor3D )
- DiagramHelper::setStackMode( xDiagram, StackMode::ZStacked );
- else if( nNewDimensionCount==2 && eStackMode == StackMode::ZStacked )
- DiagramHelper::setStackMode( xDiagram, StackMode::NONE );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
-void DiagramHelper::replaceCoordinateSystem(
- const Reference< XDiagram > & xDiagram,
- const Reference< XCoordinateSystem > & xCooSysToReplace,
- const Reference< XCoordinateSystem > & xReplacement )
-{
- OSL_ASSERT( xDiagram.is());
- if( ! xDiagram.is())
- return;
-
- // update the coordinate-system container
- Reference< XCoordinateSystemContainer > xCont( xDiagram, uno::UNO_QUERY );
- if( !xCont.is())
- return;
-
- try
- {
- Reference< chart2::data::XLabeledDataSequence > xCategories = DiagramHelper::getCategoriesFromDiagram( xDiagram );
-
- // move chart types of xCooSysToReplace to xReplacement
- Reference< XChartTypeContainer > xCTCntCooSys( xCooSysToReplace, uno::UNO_QUERY_THROW );
- Reference< XChartTypeContainer > xCTCntReplacement( xReplacement, uno::UNO_QUERY_THROW );
- xCTCntReplacement->setChartTypes( xCTCntCooSys->getChartTypes());
-
- xCont->removeCoordinateSystem( xCooSysToReplace );
- xCont->addCoordinateSystem( xReplacement );
-
- if( xCategories.is() )
- DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
bool DiagramHelper::isSeriesAttachedToMainAxis(
- const uno::Reference< chart2::XDataSeries >& xDataSeries )
+ const rtl::Reference< ::chart::DataSeries >& xDataSeries )
{
sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
return (nAxisIndex==0);
}
-bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis
- , const uno::Reference< chart2::XDataSeries >& xDataSeries
- , const uno::Reference< chart2::XDiagram >& xDiagram
- , const uno::Reference< uno::XComponentContext > & xContext
- , bool bAdaptAxes )
-{
- bool bChanged = false;
-
- //set property at axis
- Reference< beans::XPropertySet > xProp( xDataSeries, uno::UNO_QUERY_THROW );
-
- sal_Int32 nNewAxisIndex = bAttachToMainAxis ? 0 : 1;
- sal_Int32 nOldAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
- uno::Reference< chart2::XAxis > xOldAxis( DiagramHelper::getAttachedAxis( xDataSeries, xDiagram ) );
-
- if( nOldAxisIndex != nNewAxisIndex )
- {
- try
- {
- xProp->setPropertyValue( "AttachedAxisIndex", uno::Any( nNewAxisIndex ) );
- bChanged = true;
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- }
-
- if( bChanged && xDiagram.is() )
- {
- uno::Reference< XAxis > xAxis( AxisHelper::getAxis( 1, bAttachToMainAxis, xDiagram ) );
- if(!xAxis.is()) //create an axis if necessary
- xAxis = AxisHelper::createAxis( 1, bAttachToMainAxis, xDiagram, xContext );
- if( bAdaptAxes )
- {
- AxisHelper::makeAxisVisible( xAxis );
- AxisHelper::hideAxisIfNoDataIsAttached( xOldAxis, xDiagram );
- }
- }
-
- return bChanged;
-}
-
-uno::Reference< XAxis > DiagramHelper::getAttachedAxis(
- const uno::Reference< XDataSeries >& xSeries,
- const uno::Reference< XDiagram >& xDiagram )
-{
- return AxisHelper::getAxis( 1, DiagramHelper::isSeriesAttachedToMainAxis( xSeries ), xDiagram );
-}
-
-uno::Reference< XChartType > DiagramHelper::getChartTypeOfSeries(
- const uno::Reference< chart2::XDiagram >& xDiagram
- , const uno::Reference< XDataSeries >& xGivenDataSeries )
-{
- if( !xGivenDataSeries.is() )
- return nullptr;
- if(!xDiagram.is())
- return nullptr;
-
- //iterate through the model to find the given xSeries
- //the found parent indicates the charttype
-
- //iterate through all coordinate systems
- uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( !xCooSysContainer.is())
- return nullptr;
-
- const uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSysList )
- {
- //iterate through all chart types in the current coordinate system
- uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
- OSL_ASSERT( xChartTypeContainer.is());
- if( !xChartTypeContainer.is() )
- continue;
- const uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- for( uno::Reference< XChartType > const & xChartType : aChartTypeList )
- {
- //iterate through all series in this chart type
- uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
- OSL_ASSERT( xDataSeriesContainer.is());
- if( !xDataSeriesContainer.is() )
- continue;
-
- const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
- for( uno::Reference< XDataSeries > const & dataSeries : aSeriesList )
- {
- if( xGivenDataSeries==dataSeries )
- return xChartType;
- }
- }
- }
- return nullptr;
-}
-
-std::vector< Reference< XDataSeries > >
- DiagramHelper::getDataSeriesFromDiagram(
- const Reference< XDiagram > & xDiagram )
-{
- std::vector< Reference< XDataSeries > > aResult;
-
- try
- {
- Reference< XCoordinateSystemContainer > xCooSysCnt(
- xDiagram, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( Reference< XCoordinateSystem > const & coords : aCooSysSeq )
- {
- Reference< XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
- for( Reference< XChartType> const & chartType : aChartTypeSeq )
- {
- Reference< XDataSeriesContainer > xDSCnt( chartType, uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() );
- aResult.insert( aResult.end(), aSeriesSeq.begin(), aSeriesSeq.end() );
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return aResult;
-}
-
-Sequence< Sequence< Reference< XDataSeries > > >
- DiagramHelper::getDataSeriesGroups( const Reference< XDiagram > & xDiagram )
-{
- vector< Sequence< Reference< XDataSeries > > > aResult;
-
- //iterate through all coordinate systems
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( xCooSysContainer.is() )
- {
- const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( Reference< XCoordinateSystem > const & coords : aCooSysList )
- {
- //iterate through all chart types in the current coordinate system
- Reference< XChartTypeContainer > xChartTypeContainer( coords, uno::UNO_QUERY );
- if( !xChartTypeContainer.is() )
- continue;
- const Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- for( Reference< XChartType > const & chartType : aChartTypeList )
- {
- Reference< XDataSeriesContainer > xDataSeriesContainer( chartType, uno::UNO_QUERY );
- if( !xDataSeriesContainer.is() )
- continue;
- aResult.push_back( xDataSeriesContainer->getDataSeries() );
- }
- }
- }
- return comphelper::containerToSequence( aResult );
-}
-
-Reference< XChartType >
- DiagramHelper::getChartTypeByIndex( const Reference< XDiagram >& xDiagram, sal_Int32 nIndex )
-{
- Reference< XChartType > xChartType;
-
- //iterate through all coordinate systems
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( ! xCooSysContainer.is())
- return xChartType;
-
- const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- sal_Int32 nTypesSoFar = 0;
- for( Reference< XCoordinateSystem > const & coords : aCooSysList )
- {
- Reference< XChartTypeContainer > xChartTypeContainer( coords, uno::UNO_QUERY );
- if( !xChartTypeContainer.is() )
- continue;
- Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- if( nIndex >= 0 && nIndex < (nTypesSoFar + aChartTypeList.getLength()) )
- {
- xChartType.set( aChartTypeList[nIndex - nTypesSoFar] );
- break;
- }
- nTypesSoFar += aChartTypeList.getLength();
- }
-
- return xChartType;
-}
-
-namespace
-{
-
-std::vector< Reference< XAxis > > lcl_getAxisHoldingCategoriesFromDiagram(
- const Reference< XDiagram > & xDiagram )
-{
- std::vector< Reference< XAxis > > aRet;
-
- // return first x-axis as fall-back
- Reference< XAxis > xFallBack;
- try
- {
- Reference< XCoordinateSystemContainer > xCooSysCnt(
- xDiagram, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( Reference< XCoordinateSystem > const & xCooSys : aCooSysSeq )
- {
- OSL_ASSERT( xCooSys.is());
- for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
- {
- const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
- for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
- {
- Reference< XAxis > xAxis = xCooSys->getAxisByDimension( nN,nI );
- OSL_ASSERT( xAxis.is());
- if( xAxis.is())
- {
- ScaleData aScaleData = xAxis->getScaleData();
- if( aScaleData.Categories.is() || (aScaleData.AxisType == AxisType::CATEGORY) )
- {
- aRet.push_back(xAxis);
- }
- if( (nN == 0) && !xFallBack.is())
- xFallBack.set( xAxis );
- }
- }
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2" );
- }
-
- if( aRet.empty() )
- aRet.push_back(xFallBack);
-
- return aRet;
-}
-
-} // anonymous namespace
-
-bool DiagramHelper::isCategoryDiagram(
- const Reference< XDiagram >& xDiagram )
-{
- try
- {
- Reference< XCoordinateSystemContainer > xCooSysCnt(
- xDiagram, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( Reference< XCoordinateSystem > const & xCooSys : aCooSysSeq )
- {
- OSL_ASSERT( xCooSys.is());
- for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
- {
- const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
- for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI)
- {
- Reference< XAxis > xAxis = xCooSys->getAxisByDimension( nN,nI );
- OSL_ASSERT( xAxis.is());
- if( xAxis.is())
- {
- ScaleData aScaleData = xAxis->getScaleData();
- if( aScaleData.AxisType == AxisType::CATEGORY || aScaleData.AxisType == AxisType::DATE )
- return true;
- }
- }
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return false;
-}
-
-void DiagramHelper::setCategoriesToDiagram(
- const Reference< chart2::data::XLabeledDataSequence >& xCategories,
- const Reference< XDiagram >& xDiagram,
- bool bSetAxisType /* = false */,
- bool bCategoryAxis /* = true */ )
-{
- std::vector< Reference< chart2::XAxis > > aCatAxes(
- lcl_getAxisHoldingCategoriesFromDiagram( xDiagram ));
-
- for (const Reference< chart2::XAxis >& xCatAxis : aCatAxes)
- {
- if( xCatAxis.is())
- {
- ScaleData aScaleData( xCatAxis->getScaleData());
- aScaleData.Categories = xCategories;
- if( bSetAxisType )
- {
- if( bCategoryAxis )
- aScaleData.AxisType = AxisType::CATEGORY;
- else if( aScaleData.AxisType == AxisType::CATEGORY || aScaleData.AxisType == AxisType::DATE )
- aScaleData.AxisType = AxisType::REALNUMBER;
- }
- xCatAxis->setScaleData( aScaleData );
- }
- }
-}
-
-Reference< data::XLabeledDataSequence >
- DiagramHelper::getCategoriesFromDiagram(
- const Reference< XDiagram > & xDiagram )
-{
- Reference< data::XLabeledDataSequence > xResult;
-
- try
- {
- std::vector< Reference< chart2::XAxis > > aCatAxes(
- lcl_getAxisHoldingCategoriesFromDiagram( xDiagram ));
- //search for first categories
- if (!aCatAxes.empty())
- {
- Reference< chart2::XAxis > xCatAxis(aCatAxes[0]);
- if( xCatAxis.is())
- {
- ScaleData aScaleData( xCatAxis->getScaleData());
- if( aScaleData.Categories.is() )
- {
- xResult.set( aScaleData.Categories );
- uno::Reference<beans::XPropertySet> xProp(aScaleData.Categories->getValues(), uno::UNO_QUERY );
- if( xProp.is() )
- {
- try
- {
- xProp->setPropertyValue( "Role", uno::Any( OUString("categories") ) );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- }
- }
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
-}
-
static void lcl_generateAutomaticCategoriesFromChartType(
Sequence< OUString >& rRet,
- const Reference< XChartType >& xChartType )
+ const rtl::Reference< ChartType >& xChartType )
{
if(!xChartType.is())
return;
OUString aMainSeq( xChartType->getRoleOfSequenceForSeriesLabel() );
- Reference< XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY );
- if( !xSeriesCnt.is() )
- return;
- const Sequence< Reference< XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() );
- for( Reference< XDataSeries > const & dataSeries : aSeriesSeq )
+ const std::vector< rtl::Reference< DataSeries > > & aSeriesSeq = xChartType->getDataSeries2();
+ for( rtl::Reference< DataSeries > const & dataSeries : aSeriesSeq )
{
- Reference< data::XDataSource > xDataSource( dataSeries, uno::UNO_QUERY );
- if( !xDataSource.is() )
- continue;
- Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
- ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aMainSeq ));
+ uno::Reference< data::XLabeledDataSequence > xLabeledSeq =
+ ::chart::DataSeriesHelper::getDataSequenceByRole( dataSeries, aMainSeq );
if( !xLabeledSeq.is() )
continue;
Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() );
@@ -931,15 +175,14 @@ static void lcl_generateAutomaticCategoriesFromChartType(
}
}
-Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const Reference< XCoordinateSystem > & xCooSys )
+Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const rtl::Reference< BaseCoordinateSystem > & xCooSys )
{
Sequence< OUString > aRet;
- Reference< XChartTypeContainer > xTypeCntr( xCooSys, uno::UNO_QUERY );
- if( xTypeCntr.is() )
+ if( xCooSys.is() )
{
- const Sequence< Reference< XChartType > > aChartTypes( xTypeCntr->getChartTypes() );
- for( Reference< XChartType > const & chartType : aChartTypes )
+ const std::vector< rtl::Reference< ChartType > > & aChartTypes( xCooSys->getChartTypes2() );
+ for( rtl::Reference< ChartType > const & chartType : aChartTypes )
{
lcl_generateAutomaticCategoriesFromChartType( aRet, chartType );
if( aRet.hasElements() )
@@ -952,14 +195,14 @@ Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const
Sequence< OUString > DiagramHelper::getExplicitSimpleCategories(
ChartModel& rModel )
{
- uno::Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( &rModel ) );
ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, rModel );
return aExplicitCategoriesProvider.getSimpleCategories();
}
namespace
{
-void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, const Reference< XAxis >& xAxis )
+void lcl_switchToDateCategories( const rtl::Reference< ChartModel >& xChartDoc, const Reference< XAxis >& xAxis )
{
if( !xAxis.is() )
return;
@@ -974,21 +217,20 @@ void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, c
if( xDataAccess.is() )
{
Sequence< Sequence< Any > > aAnyCategories( xDataAccess->getAnyRowDescriptions() );
+ auto aAnyCategoriesRange = asNonConstRange(aAnyCategories);
double fTest = 0.0;
- double fNan = 0.0;
- ::rtl::math::setNan( & fNan );
sal_Int32 nN = aAnyCategories.getLength();
for( ; nN--; )
{
- Sequence< Any >& rCat = aAnyCategories[nN];
+ Sequence< Any >& rCat = aAnyCategoriesRange[nN];
if( rCat.getLength() > 1 )
rCat.realloc(1);
if( rCat.getLength() == 1 )
{
- Any& rAny = rCat[0];
+ Any& rAny = rCat.getArray()[0];
if( !(rAny>>=fTest) )
{
- rAny <<= fNan;
+ rAny <<= std::numeric_limits<double>::quiet_NaN();
}
}
}
@@ -996,13 +238,12 @@ void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, c
}
//check the numberformat at the axis
Reference< beans::XPropertySet > xAxisProps( xAxis, uno::UNO_QUERY );
- Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartDoc, uno::UNO_QUERY );
- if( xAxisProps.is() && xNumberFormatsSupplier.is() )
+ if( xAxisProps.is() )
{
sal_Int32 nNumberFormat = -1;
xAxisProps->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
- Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() );
+ Reference< util::XNumberFormats > xNumberFormats( xChartDoc->getNumberFormats() );
if( xNumberFormats.is() )
{
Reference< beans::XPropertySet > xKeyProps;
@@ -1036,7 +277,7 @@ void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, c
xAxis->setScaleData( aScale );
}
-void lcl_switchToTextCategories( const Reference< XChartDocument >& xChartDoc, const Reference< XAxis >& xAxis )
+void lcl_switchToTextCategories( const rtl::Reference< ChartModel >& xChartDoc, const Reference< XAxis >& xAxis )
{
if( !xAxis.is() )
return;
@@ -1053,42 +294,36 @@ void lcl_switchToTextCategories( const Reference< XChartDocument >& xChartDoc, c
}
-void DiagramHelper::switchToDateCategories( const Reference< XChartDocument >& xChartDoc )
+void DiagramHelper::switchToDateCategories( const rtl::Reference<::chart::ChartModel>& xChartDoc )
{
if(xChartDoc.is())
{
ControllerLockGuardUNO aCtrlLockGuard( xChartDoc );
- Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartDoc ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys = ChartModelHelper::getFirstCoordinateSystem( xChartDoc );
if( xCooSys.is() )
{
- Reference< XAxis > xAxis( xCooSys->getAxisByDimension(0,0) );
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2(0,0);
lcl_switchToDateCategories( xChartDoc, xAxis );
}
}
}
-void DiagramHelper::switchToTextCategories( const Reference< XChartDocument >& xChartDoc )
+void DiagramHelper::switchToTextCategories( const rtl::Reference<::chart::ChartModel>& xChartDoc )
{
if(xChartDoc.is())
{
ControllerLockGuardUNO aCtrlLockGuard( xChartDoc );
- Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartDoc ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSys = ChartModelHelper::getFirstCoordinateSystem( xChartDoc );
if( xCooSys.is() )
{
- Reference< XAxis > xAxis( xCooSys->getAxisByDimension(0,0) );
+ rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2(0,0);
lcl_switchToTextCategories( xChartDoc, xAxis );
}
}
}
-bool DiagramHelper::isSupportingDateAxis( const Reference< chart2::XDiagram >& xDiagram )
-{
- return ::chart::ChartTypeHelper::isSupportingDateAxis(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), 0 );
-}
-
bool DiagramHelper::isDateNumberFormat( sal_Int32 nNumberFormat, const Reference< util::XNumberFormats >& xNumberFormats )
{
bool bIsDate = false;
@@ -1148,7 +383,7 @@ sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const Reference< util::XN
// Obtain best matching date, time or datetime format.
nRet = pNumFormatter->GuessDateTimeFormat( nType, fNumber, LANGUAGE_SYSTEM);
// Obtain the corresponding edit format.
- nRet = pNumFormatter->GetEditFormat( fNumber, nRet, nType, LANGUAGE_SYSTEM, nullptr);
+ nRet = pNumFormatter->GetEditFormat( fNumber, nRet, nType, nullptr);
}
return nRet;
}
@@ -1183,38 +418,8 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF
return nRet;
}
-Sequence< Reference< XChartType > >
- DiagramHelper::getChartTypesFromDiagram(
- const Reference< XDiagram > & xDiagram )
-{
- std::vector< Reference< XChartType > > aResult;
-
- if(xDiagram.is())
- {
- try
- {
- Reference< XCoordinateSystemContainer > xCooSysCnt(
- xDiagram, uno::UNO_QUERY_THROW );
- const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( Reference< XCoordinateSystem > const & coords : aCooSysSeq )
- {
- Reference< XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW );
- Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
- aResult.insert( aResult.end(), aChartTypeSeq.begin(), aChartTypeSeq.end() );
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- }
-
- return comphelper::containerToSequence( aResult );
-}
-
-bool DiagramHelper::areChartTypesCompatible( const Reference< ::chart2::XChartType >& xFirstType,
- const Reference< ::chart2::XChartType >& xSecondType )
+bool DiagramHelper::areChartTypesCompatible( const rtl::Reference< ChartType >& xFirstType,
+ const rtl::Reference< ChartType >& xSecondType )
{
if( !xFirstType.is() || !xSecondType.is() )
return false;
@@ -1226,353 +431,6 @@ bool DiagramHelper::areChartTypesCompatible( const Reference< ::chart2::XChartTy
return ( aFirstRoles == aSecondRoles );
}
-namespace
-{
- /**
- * This method implements the logic of checking if a series can be moved
- * forward/backward. Depending on the "bDoMove" parameter the series will
- * be moved (bDoMove = true) or the function just will test if the
- * series can be moved without doing the move (bDoMove = false).
- *
- * @param xDiagram
- * Reference to the diagram that contains the series.
- *
- * @param xGivenDataSeries
- * Reference to the series that should moved or tested for moving.
- *
- * @param bForward
- * Direction in which the series should be moved or tested for moving.
- *
- * @param bDoMove
- * Should this function really move the series (true) or just test if it is
- * possible (false).
- *
- *
- * @returns
- * in case of bDoMove == true
- * - True : if the move was done
- * - False : the move failed
- * in case of bDoMove == false
- * - True : the series can be moved
- * - False : the series can not be moved
- *
- */
-
-bool lcl_moveSeriesOrCheckIfMoveIsAllowed(
- const Reference< XDiagram >& xDiagram,
- const Reference< XDataSeries >& xGivenDataSeries,
- bool bForward,
- bool bDoMove )
-{
- bool bMovedOrMoveAllowed = false;
-
- try
- {
- uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
-
- if( xGivenDataSeries.is() && xCooSysContainer.is() )
- {
- //find position of series.
- bool bFound = false;
- uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
-
- for( sal_Int32 nCS = 0; !bFound && nCS < aCooSysList.getLength(); ++nCS )
- {
- uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
-
- //iterate through all chart types in the current coordinate system
- uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
- OSL_ASSERT( xChartTypeContainer.is());
- if( !xChartTypeContainer.is() )
- continue;
- uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- uno::Reference< XChartType > xFormerChartType;
-
- for( sal_Int32 nT = 0; !bFound && nT < aChartTypeList.getLength(); ++nT )
- {
- uno::Reference< XChartType > xCurrentChartType( aChartTypeList[nT] );
-
- //iterate through all series in this chart type
- uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xCurrentChartType, uno::UNO_QUERY );
- OSL_ASSERT( xDataSeriesContainer.is());
- if( !xDataSeriesContainer.is() )
- continue;
-
- uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
-
- for( sal_Int32 nS = 0; !bFound && nS < aSeriesList.getLength(); ++nS )
- {
-
- // We found the series we are interested in!
- if( xGivenDataSeries==aSeriesList[nS] )
- {
- sal_Int32 nOldSeriesIndex = nS;
- bFound = true;
-
- try
- {
- sal_Int32 nNewSeriesIndex = nS;
-
- // tdf#34517 Bringing forward means increasing, backwards means decreasing series position
- if( !bForward )
- nNewSeriesIndex--;
- else
- nNewSeriesIndex++;
-
- if( nNewSeriesIndex >= 0 && nNewSeriesIndex < aSeriesList.getLength() )
- {
- //move series in the same charttype
- bMovedOrMoveAllowed = true;
- if( bDoMove )
- {
- aSeriesList[ nOldSeriesIndex ] = aSeriesList[ nNewSeriesIndex ];
- aSeriesList[ nNewSeriesIndex ] = xGivenDataSeries;
- xDataSeriesContainer->setDataSeries( aSeriesList );
- }
- }
- else if( nNewSeriesIndex<0 )
- {
- //exchange series with former charttype
- if( xFormerChartType.is() && DiagramHelper::areChartTypesCompatible( xFormerChartType, xCurrentChartType ) )
- {
- bMovedOrMoveAllowed = true;
- if( bDoMove )
- {
- uno::Reference< XDataSeriesContainer > xOtherDataSeriesContainer( xFormerChartType, uno::UNO_QUERY );
- if( xOtherDataSeriesContainer.is() )
- {
- uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() );
- sal_Int32 nOtherSeriesIndex = aOtherSeriesList.getLength()-1;
- if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() )
- {
- uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
- aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
- xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList);
-
- aSeriesList[nOldSeriesIndex]=xExchangeSeries;
- xDataSeriesContainer->setDataSeries(aSeriesList);
- }
- }
- }
- }
- }
- else if( nT+1 < aChartTypeList.getLength() )
- {
- //exchange series with next charttype
- uno::Reference< XChartType > xOtherChartType( aChartTypeList[nT+1] );
- if( xOtherChartType.is() && DiagramHelper::areChartTypesCompatible( xOtherChartType, xCurrentChartType ) )
- {
- bMovedOrMoveAllowed = true;
- if( bDoMove )
- {
- uno::Reference< XDataSeriesContainer > xOtherDataSeriesContainer( xOtherChartType, uno::UNO_QUERY );
- if( xOtherDataSeriesContainer.is() )
- {
- uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() );
- if( aOtherSeriesList.hasElements() )
- {
- uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[0] );
- aOtherSeriesList[0] = xGivenDataSeries;
- xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList);
-
- aSeriesList[nOldSeriesIndex]=xExchangeSeries;
- xDataSeriesContainer->setDataSeries(aSeriesList);
- }
- }
- }
- }
- }
- }
- catch( const util::CloseVetoException& )
- {
- }
- catch( const uno::RuntimeException& )
- {
- }
- }
- }
- xFormerChartType = xCurrentChartType;
- }
- }
- }
- }
- catch( const util::CloseVetoException& )
- {
- }
- catch( const uno::RuntimeException& )
- {
- }
- return bMovedOrMoveAllowed;
-}
-} // anonymous namespace
-
-bool DiagramHelper::isSeriesMoveable(
- const Reference< XDiagram >& xDiagram,
- const Reference< XDataSeries >& xGivenDataSeries,
- bool bForward )
-{
- const bool bDoMove = false;
-
- bool bIsMoveable = lcl_moveSeriesOrCheckIfMoveIsAllowed(
- xDiagram, xGivenDataSeries, bForward, bDoMove );
-
- return bIsMoveable;
-}
-
-bool DiagramHelper::moveSeries( const Reference< XDiagram >& xDiagram, const Reference< XDataSeries >& xGivenDataSeries, bool bForward )
-{
- const bool bDoMove = true;
-
- bool bMoved = lcl_moveSeriesOrCheckIfMoveIsAllowed(
- xDiagram, xGivenDataSeries, bForward, bDoMove );
-
- return bMoved;
-}
-
-bool DiagramHelper::isSupportingFloorAndWall( const Reference<
- chart2::XDiagram >& xDiagram )
-{
- //pies and donuts currently do not support this because of wrong files from older versions
- //todo: allow this in future again, if fileversion is available for OLE objects (metastream)
- //thus the wrong bottom can be removed on import
-
- const Sequence< Reference< chart2::XChartType > > aTypes(
- ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
- for( Reference< chart2::XChartType > const & xType : aTypes )
- {
- if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
- return false;
- if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
- return false;
- if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
- return false;
- }
- return true;
-}
-
-bool DiagramHelper::isPieOrDonutChart( const css::uno::Reference< css::chart2::XDiagram >& xDiagram )
-{
- uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex(
- xDiagram, 0 ) );
-
- if( xChartType .is() )
- {
- OUString aChartType = xChartType->getChartType();
- if( aChartType == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
- return true;
- }
- return false;
-}
-
-sal_Int32 DiagramHelper::getGeometry3D(
- const uno::Reference< chart2::XDiagram > & xDiagram,
- bool& rbFound, bool& rbAmbiguous )
-{
- sal_Int32 nCommonGeom( DataPointGeometry3D::CUBOID );
- rbFound = false;
- rbAmbiguous = false;
-
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
-
- if( aSeriesVec.empty())
- rbAmbiguous = true;
-
- for (auto const& series : aSeriesVec)
- {
- try
- {
- sal_Int32 nGeom = 0;
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
- if( xProp->getPropertyValue( "Geometry3D") >>= nGeom )
- {
- if( ! rbFound )
- {
- // first series
- nCommonGeom = nGeom;
- rbFound = true;
- }
- // further series: compare for uniqueness
- else if( nCommonGeom != nGeom )
- {
- rbAmbiguous = true;
- break;
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- }
-
- return nCommonGeom;
-}
-
-void DiagramHelper::setGeometry3D(
- const Reference< chart2::XDiagram > & xDiagram,
- sal_Int32 nNewGeometry )
-{
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
-
- for (auto const& series : aSeriesVec)
- {
- DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(
- series, "Geometry3D", uno::Any( nNewGeometry ));
- }
-}
-
-sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment(
- const Reference< chart2::XDiagram > & xDiagram,
- const Reference< chart2::XChartType >& xChartType )
-{
- sal_Int32 nResult = css::chart::MissingValueTreatment::LEAVE_GAP;
- const uno::Sequence < sal_Int32 > aAvailableMissingValueTreatments(
- ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) );
-
- uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
- if( xDiaProp.is() && (xDiaProp->getPropertyValue( "MissingValueTreatment" ) >>= nResult) )
- {
- //ensure that the set value is supported by this charttype
- for( sal_Int32 n : aAvailableMissingValueTreatments )
- if( n == nResult )
- return nResult; //ok
- }
-
- //otherwise use the first supported one
- if( aAvailableMissingValueTreatments.hasElements() )
- {
- nResult = aAvailableMissingValueTreatments[0];
- return nResult;
- }
-
- return nResult;
-}
-
-DiagramPositioningMode DiagramHelper::getDiagramPositioningMode( const uno::Reference<
- chart2::XDiagram > & xDiagram )
-{
- DiagramPositioningMode eMode = DiagramPositioningMode_AUTO;
- uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY );
- if( xDiaProps.is() )
- {
- RelativePosition aRelPos;
- RelativeSize aRelSize;
- if( (xDiaProps->getPropertyValue("RelativePosition") >>= aRelPos ) &&
- (xDiaProps->getPropertyValue("RelativeSize") >>= aRelSize ) )
- {
- bool bPosSizeExcludeAxes=false;
- xDiaProps->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxes;
- if( bPosSizeExcludeAxes )
- eMode = DiagramPositioningMode_EXCLUDING;
- else
- eMode = DiagramPositioningMode_INCLUDING;
- }
- }
- return eMode;
-}
-
static void lcl_ensureRange0to1( double& rValue )
{
if(rValue<0.0)
@@ -1581,21 +439,21 @@ static void lcl_ensureRange0to1( double& rValue )
rValue=1.0;
}
-bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >& xChartModel,
+bool DiagramHelper::setDiagramPositioning( const rtl::Reference<::chart::ChartModel>& xChartModel,
const awt::Rectangle& rPosRect /*100th mm*/ )
{
ControllerLockGuardUNO aCtrlLockGuard( xChartModel );
bool bChanged = false;
awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) );
- uno::Reference< beans::XPropertySet > xDiaProps( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
- if( !xDiaProps.is() )
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
+ if( !xDiagram.is() )
return bChanged;
RelativePosition aOldPos;
RelativeSize aOldSize;
- xDiaProps->getPropertyValue("RelativePosition" ) >>= aOldPos;
- xDiaProps->getPropertyValue("RelativeSize" ) >>= aOldSize;
+ xDiagram->getPropertyValue("RelativePosition" ) >>= aOldPos;
+ xDiagram->getPropertyValue("RelativeSize" ) >>= aOldSize;
RelativePosition aNewPos;
aNewPos.Anchor = drawing::Alignment_TOP_LEFT;
@@ -1615,8 +473,8 @@ bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >
if( (aNewPos.Secondary + aNewSize.Secondary) > 1.0 )
aNewPos.Secondary = 1.0 - aNewSize.Secondary;
- xDiaProps->setPropertyValue( "RelativePosition", uno::Any(aNewPos) );
- xDiaProps->setPropertyValue( "RelativeSize", uno::Any(aNewSize) );
+ xDiagram->setPropertyValue( "RelativePosition", uno::Any(aNewPos) );
+ xDiagram->setPropertyValue( "RelativeSize", uno::Any(aNewSize) );
bChanged = (aOldPos.Anchor!=aNewPos.Anchor) ||
(aOldPos.Primary!=aNewPos.Primary) ||
@@ -1626,20 +484,20 @@ bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >
return bChanged;
}
-awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const uno::Reference< frame::XModel >& xChartModel )
+awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
awt::Rectangle aRet(-1,-1,-1,-1);
- uno::Reference< beans::XPropertySet > xDiaProps( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
- if( !xDiaProps.is() )
+ rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
+ if( !xDiagram.is() )
return aRet;
awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) );
RelativePosition aRelPos;
RelativeSize aRelSize;
- xDiaProps->getPropertyValue("RelativePosition" ) >>= aRelPos;
- xDiaProps->getPropertyValue("RelativeSize" ) >>= aRelSize;
+ xDiagram->getPropertyValue("RelativePosition" ) >>= aRelPos;
+ xDiagram->getPropertyValue("RelativeSize" ) >>= aRelSize;
awt::Size aAbsSize(
static_cast< sal_Int32 >( aRelSize.Primary * aPageSize.Width ),
@@ -1660,7 +518,7 @@ bool DiagramHelper::switchDiagramPositioningToExcludingPositioning(
ChartModel& rModel, bool bResetModifiedState, bool bConvertAlsoFromAutoPositioning )
{
//return true if something was changed
- const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
+ const SvtSaveOptions::ODFSaneDefaultVersion nCurrentODFVersion(GetODFSaneDefaultVersion());
if (SvtSaveOptions::ODFSVER_012 < nCurrentODFVersion)
{
uno::Reference< css::chart::XDiagramPositioning > xDiagramPositioning( rModel.getFirstDiagram(), uno::UNO_QUERY );
diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
index 77dd69705211..3d049a44527f 100644
--- a/chart2/source/tools/ErrorBar.cxx
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -33,7 +33,7 @@
#include <com/sun/star/util/Color.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
using namespace ::com::sun::star;
@@ -41,7 +41,7 @@ using namespace ::com::sun::star;
namespace
{
-const char lcl_aServiceName[] = "com.sun.star.comp.chart2.ErrorBar";
+constexpr OUString lcl_aServiceName = u"com.sun.star.comp.chart2.ErrorBar"_ustr;
bool lcl_isInternalData( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq )
{
@@ -53,22 +53,21 @@ const SfxItemPropertySet* GetErrorBarPropertySet()
{
static const SfxItemPropertyMapEntry aErrorBarPropertyMap_Impl[] =
{
- {OUString("ShowPositiveError"),0,cppu::UnoType<bool>::get(), 0, 0},
- {OUString("ShowNegativeError"),1,cppu::UnoType<bool>::get(), 0, 0},
- {OUString("PositiveError"),2,cppu::UnoType<double>::get(),0,0},
- {OUString("NegativeError"),3,cppu::UnoType<double>::get(), 0, 0},
- {OUString("PercentageError"),4,cppu::UnoType<double>::get(), 0, 0},
- {OUString("ErrorBarStyle"),5,cppu::UnoType<sal_Int32>::get(),0,0},
- {OUString("ErrorBarRangePositive"),6,cppu::UnoType<OUString>::get(),0,0}, // read-only for export
- {OUString("ErrorBarRangeNegative"),7,cppu::UnoType<OUString>::get(),0,0}, // read-only for export
- {OUString("Weight"),8,cppu::UnoType<double>::get(),0,0},
- {OUString("LineStyle"),9,cppu::UnoType<css::drawing::LineStyle>::get(),0,0},
- {OUString("LineDash"),10,cppu::UnoType<drawing::LineDash>::get(),0,0},
- {OUString("LineWidth"),11,cppu::UnoType<sal_Int32>::get(),0,0},
- {OUString("LineColor"),12,cppu::UnoType<css::util::Color>::get(),0,0},
- {OUString("LineTransparence"),13,cppu::UnoType<sal_Int16>::get(),0,0},
- {OUString("LineJoint"),14,cppu::UnoType<css::drawing::LineJoint>::get(),0,0},
- { OUString(), 0, css::uno::Type(), 0, 0 }
+ {u"ShowPositiveError"_ustr,0,cppu::UnoType<bool>::get(), 0, 0},
+ {u"ShowNegativeError"_ustr,1,cppu::UnoType<bool>::get(), 0, 0},
+ {u"PositiveError"_ustr,2,cppu::UnoType<double>::get(),0,0},
+ {u"NegativeError"_ustr,3,cppu::UnoType<double>::get(), 0, 0},
+ {u"PercentageError"_ustr,4,cppu::UnoType<double>::get(), 0, 0},
+ {u"ErrorBarStyle"_ustr,5,cppu::UnoType<sal_Int32>::get(),0,0},
+ {u"ErrorBarRangePositive"_ustr,6,cppu::UnoType<OUString>::get(),0,0}, // read-only for export
+ {u"ErrorBarRangeNegative"_ustr,7,cppu::UnoType<OUString>::get(),0,0}, // read-only for export
+ {u"Weight"_ustr,8,cppu::UnoType<double>::get(),0,0},
+ {u"LineStyle"_ustr,9,cppu::UnoType<css::drawing::LineStyle>::get(),0,0},
+ {u"LineDash"_ustr,10,cppu::UnoType<drawing::LineDash>::get(),0,0},
+ {u"LineWidth"_ustr,11,cppu::UnoType<sal_Int32>::get(),0,0},
+ {u"LineColor"_ustr,12,cppu::UnoType<css::util::Color>::get(),0,0},
+ {u"LineTransparence"_ustr,13,cppu::UnoType<sal_Int16>::get(),0,0},
+ {u"LineJoint"_ustr,14,cppu::UnoType<css::drawing::LineJoint>::get(),0,0},
};
static SfxItemPropertySet aPropSet( aErrorBarPropertyMap_Impl );
return &aPropSet;
@@ -91,7 +90,7 @@ ErrorBar::ErrorBar() :
mfNegativeError(0),
mfWeight(1),
meStyle(css::chart::ErrorBarStyle::NONE),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
ErrorBar::ErrorBar( const ErrorBar & rOther ) :
@@ -109,7 +108,7 @@ ErrorBar::ErrorBar( const ErrorBar & rOther ) :
mfNegativeError(rOther.mfNegativeError),
mfWeight(rOther.mfWeight),
meStyle(rOther.meStyle),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
if( ! rOther.m_aDataSequences.empty())
{
@@ -363,9 +362,10 @@ beans::PropertyState ErrorBar::getPropertyState( const OUString& rPropName )
uno::Sequence< beans::PropertyState > ErrorBar::getPropertyStates( const uno::Sequence< OUString >& rPropNames )
{
uno::Sequence< beans::PropertyState > aRet( rPropNames.getLength() );
+ auto aRetRange = asNonConstRange(aRet);
for(sal_Int32 i = 0; i < rPropNames.getLength(); ++i)
{
- aRet[i] = getPropertyState(rPropNames[i]);
+ aRetRange[i] = getPropertyState(rPropNames[i]);
}
return aRet;
}
@@ -400,28 +400,12 @@ void ErrorBar::removeVetoableChangeListener( const OUString&, const css::uno::Re
// ____ XModifyBroadcaster ____
void SAL_CALL ErrorBar::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL ErrorBar::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index c0b232240710..7f6de91b6e82 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -19,18 +19,25 @@
#include <ExplicitCategoriesProvider.hxx>
#include <DiagramHelper.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <DataSourceHelper.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
#include <NumberFormatterWrapper.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <DataSeries.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
+#include <o3tl/compare.hxx>
#include <o3tl/safeint.hxx>
-#include <rtl/math.hxx>
-#include <tools/diagnose_ex.h>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/diagnose_ex.hxx>
+
+#include <limits>
namespace chart
{
@@ -41,12 +48,11 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using std::vector;
-ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2::XCoordinateSystem >& xCooSysModel
+ExplicitCategoriesProvider::ExplicitCategoriesProvider( const rtl::Reference< BaseCoordinateSystem >& xCooSysModel
, ChartModel& rModel )
: m_bDirty(true)
- , m_xCooSysModel( xCooSysModel )
+ , m_xCooSysModel( xCooSysModel.get() )
, mrModel(rModel)
- , m_xOriginalCategories()
, m_bIsExplicitCategoriesInited(false)
, m_bIsDateAxis(false)
, m_bIsAutoDate(false)
@@ -55,7 +61,8 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2:
{
if( xCooSysModel.is() )
{
- uno::Reference< XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) );
+ // TODO: handle different category names on the primary and secondary category axis.
+ rtl::Reference< Axis > xAxis = xCooSysModel->getAxisByDimension2(0,0);
if( xAxis.is() )
{
ScaleData aScale( xAxis->getScaleData() );
@@ -97,10 +104,10 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2:
//->split them in the direction of the first series
//detect whether the first series is a row or a column
bool bSeriesUsesColumns = true;
- std::vector< Reference< XDataSeries > > aSeries( ChartModelHelper::getDataSeries( mrModel ) );
+ std::vector< rtl::Reference< DataSeries > > aSeries = ChartModelHelper::getDataSeries( &mrModel );
if( !aSeries.empty() )
{
- uno::Reference< data::XDataSource > xSeriesSource( aSeries.front(), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeriesSource = aSeries.front();
OUString aStringDummy;
bool bDummy;
uno::Sequence< sal_Int32 > aSeqDummy;
@@ -108,16 +115,15 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2:
aStringDummy, aSeqDummy, bSeriesUsesColumns, bDummy, bDummy );
}
if( bSeriesUsesColumns )
- m_aSplitCategoriesList=aColumns;
+ m_aSplitCategoriesList = comphelper::sequenceToContainer<std::vector<Reference<data::XLabeledDataSequence>>>(aColumns);
else
- m_aSplitCategoriesList=aRows;
+ m_aSplitCategoriesList = comphelper::sequenceToContainer<std::vector<Reference<data::XLabeledDataSequence>>>(aRows);
}
}
}
- if( !m_aSplitCategoriesList.hasElements() )
+ if( m_aSplitCategoriesList.empty() )
{
- m_aSplitCategoriesList.realloc(1);
- m_aSplitCategoriesList[0]=m_xOriginalCategories;
+ m_aSplitCategoriesList = { m_xOriginalCategories };
}
}
}
@@ -140,12 +146,12 @@ Reference< chart2::data::XDataSequence > ExplicitCategoriesProvider::getOriginal
bool ExplicitCategoriesProvider::hasComplexCategories() const
{
- return m_aSplitCategoriesList.getLength() > 1;
+ return m_aSplitCategoriesList.size() > 1;
}
sal_Int32 ExplicitCategoriesProvider::getCategoryLevelCount() const
{
- sal_Int32 nCount = m_aSplitCategoriesList.getLength();
+ sal_Int32 nCount = m_aSplitCategoriesList.size();
if(!nCount)
nCount = 1;
return nCount;
@@ -169,14 +175,15 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr
if(!nCount)
return;
rOutTexts.realloc(nCount);
+ auto pOutTexts = rOutTexts.getArray();
sal_Int32 nAxisNumberFormat = 0;
- Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( &rModel ) );
if( xCooSysModel.is() )
{
- Reference< chart2::XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) );
+ rtl::Reference< Axis > xAxis = xCooSysModel->getAxisByDimension2(0,0);
nAxisNumberFormat = AxisHelper::getExplicitNumberFormatKeyForAxis(
- xAxis, xCooSysModel, uno::Reference<chart2::XChartDocument>(static_cast< ::cppu::OWeakObject* >(&rModel), uno::UNO_QUERY), false );
+ xAxis, xCooSysModel, &rModel, false );
}
Color nLabelColor;
@@ -202,7 +209,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr
aAny>>=aText;
}
}
- rOutTexts[nN] = aText;
+ pOutTexts[nN] = aText;
}
}
@@ -217,8 +224,7 @@ class SplitCategoriesProvider_ForLabeledDataSequences : public SplitCategoriesPr
public:
explicit SplitCategoriesProvider_ForLabeledDataSequences(
- const css::uno::Sequence<
- css::uno::Reference< css::chart2::data::XLabeledDataSequence> >& rSplitCategoriesList
+ const std::vector< Reference< data::XLabeledDataSequence> >& rSplitCategoriesList
, ChartModel& rModel )
: m_rSplitCategoriesList( rSplitCategoriesList )
, mrModel( rModel )
@@ -228,8 +234,7 @@ public:
virtual uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const override;
private:
- const css::uno::Sequence< css::uno::Reference<
- css::chart2::data::XLabeledDataSequence> >& m_rSplitCategoriesList;
+ const std::vector< Reference< data::XLabeledDataSequence> >& m_rSplitCategoriesList;
ChartModel& mrModel;
};
@@ -238,7 +243,7 @@ private:
sal_Int32 SplitCategoriesProvider_ForLabeledDataSequences::getLevelCount() const
{
- return m_rSplitCategoriesList.getLength();
+ return m_rSplitCategoriesList.size();
}
uno::Sequence< OUString > SplitCategoriesProvider_ForLabeledDataSequences::getStringsForLevel( sal_Int32 nLevel ) const
{
@@ -357,6 +362,7 @@ static Sequence< OUString > lcl_getExplicitSimpleCategories(
if(nMaxCategoryCount)
{
aRet.realloc(nMaxCategoryCount);
+ auto pRet = aRet.getArray();
for(sal_Int32 nN=0; nN<nMaxCategoryCount; nN++)
{
OUStringBuffer aText;
@@ -373,7 +379,7 @@ static Sequence< OUString > lcl_getExplicitSimpleCategories(
}
}
}
- aRet[nN]=aText.makeStringAndClear();
+ pRet[nN]=aText.makeStringAndClear();
}
}
return aRet;
@@ -401,13 +407,13 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >&
bool bOwnData = false;
bool bOwnDataAnddAxisHasAnyFormat = false;
bool bOwnDataAnddAxisHasDateFormat = false;
- Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( &rModel ) );
if( xCooSysModel.is() )
{
if( rModel.hasInternalDataProvider() )
{
bOwnData = true;
- Reference< beans::XPropertySet > xAxisProps( xCooSysModel->getAxisByDimension(0,0), uno::UNO_QUERY );
+ rtl::Reference< Axis > xAxisProps = xCooSysModel->getAxisByDimension2(0,0);
sal_Int32 nAxisNumberFormat = 0;
if (xAxisProps.is() && (xAxisProps->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nAxisNumberFormat))
{
@@ -452,11 +458,12 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >&
{
if( aAny.hasValue() && !bContainsEmptyString )//empty string does not count as non date value!
bOnlyDatesFound=false;
- ::rtl::math::setNan( &aDate );
- rDateCategories.push_back( aDate );
+ rDateCategories.push_back( std::numeric_limits<double>::quiet_NaN() );
}
}
- std::sort( rDateCategories.begin(), rDateCategories.end() );
+ std::sort(
+ rDateCategories.begin(), rDateCategories.end(),
+ [](auto x, auto y) { return o3tl::strong_order(x, y) < 0; } );
}
return bAnyDataFound && bOnlyDatesFound;
@@ -476,7 +483,7 @@ void ExplicitCategoriesProvider::init()
{
if(m_bIsDateAxis)
{
- if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ), 0 ) )
+ if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel.get(), 0 ), 0 ) )
m_bIsDateAxis = lcl_fillDateCategories( m_xOriginalCategories->getValues(), m_aDateCategories, m_bIsAutoDate, mrModel );
else
m_bIsDateAxis = false;
@@ -513,7 +520,7 @@ Sequence< OUString > const & ExplicitCategoriesProvider::getSimpleCategories()
}
}
if(!m_aExplicitCategories.hasElements())
- m_aExplicitCategories = DiagramHelper::generateAutomaticCategoriesFromCooSys( m_xCooSysModel );
+ m_aExplicitCategories = DiagramHelper::generateAutomaticCategoriesFromCooSys( m_xCooSysModel.get() );
m_bIsExplicitCategoriesInited = true;
}
return m_aExplicitCategories;
@@ -529,7 +536,7 @@ const std::vector<ComplexCategory>* ExplicitCategoriesProvider::getCategoriesByL
}
OUString ExplicitCategoriesProvider::getCategoryByIndex(
- const Reference< XCoordinateSystem >& xCooSysModel
+ const rtl::Reference< BaseCoordinateSystem >& xCooSysModel
, ChartModel& rModel
, sal_Int32 nIndex )
{
diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
index 7d85b19b5a3d..9c41822d3618 100644
--- a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
@@ -17,6 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <limits>
+#include <string_view>
+
#include <ExponentialRegressionCurveCalculator.hxx>
#include <RegressionCalculationHelper.hxx>
#include <SpecialCharacters.hxx>
@@ -30,12 +35,10 @@ namespace chart
{
ExponentialRegressionCurveCalculator::ExponentialRegressionCurveCalculator()
- : m_fLogSlope(0.0)
- , m_fLogIntercept(0.0)
+ : m_fLogSlope(std::numeric_limits<double>::quiet_NaN())
+ , m_fLogIntercept(std::numeric_limits<double>::quiet_NaN())
, m_fSign(1.0)
{
- ::rtl::math::setNan( & m_fLogSlope );
- ::rtl::math::setNan( & m_fLogIntercept );
}
ExponentialRegressionCurveCalculator::~ExponentialRegressionCurveCalculator()
@@ -61,9 +64,9 @@ void SAL_CALL ExponentialRegressionCurveCalculator::recalculateRegression(
nMax = aValues.first.size();
if( nMax <= 1 )
{
- ::rtl::math::setNan( & m_fLogSlope );
- ::rtl::math::setNan( & m_fLogIntercept );
- ::rtl::math::setNan( & m_fCorrelationCoefficient );// actual it is coefficient of determination
+ m_fLogSlope = std::numeric_limits<double>::quiet_NaN();
+ m_fLogIntercept = std::numeric_limits<double>::quiet_NaN();
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();// actual it is coefficient of determination
return;
}
m_fSign = -1.0;
@@ -112,16 +115,13 @@ void SAL_CALL ExponentialRegressionCurveCalculator::recalculateRegression(
double SAL_CALL ExponentialRegressionCurveCalculator::getCurveValue( double x )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
if( ! ( std::isnan( m_fLogSlope ) ||
std::isnan( m_fLogIntercept )))
{
- fResult = m_fSign * exp(m_fLogIntercept + x * m_fLogSlope);
+ return m_fSign * exp(m_fLogIntercept + x * m_fLogSlope);
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL ExponentialRegressionCurveCalculator::getCurveValues(
@@ -135,11 +135,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL ExponentialRegressionCurveCalcul
isLogarithmicScaling( xScalingY ))
{
// optimize result
- uno::Sequence< geometry::RealPoint2D > aResult( 2 );
- aResult[0].X = min;
- aResult[0].Y = getCurveValue( min );
- aResult[1].X = max;
- aResult[1].Y = getCurveValue( max );
+ uno::Sequence< geometry::RealPoint2D > aResult{ { min, getCurveValue( min ) },
+ { max, getCurveValue( max ) } };
return aResult;
}
@@ -179,13 +176,13 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation(
// if nValueLength not calculated then nullptr
sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr;
if ( m_fSign < 0.0 )
- aTmpBuf.append( OUStringChar(aMinusSign) ).append( " " );
+ aTmpBuf.append( OUStringChar(aMinusSign) + " " );
if ( bHasIntercept )
{
OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fIntercept, pValueLength );
if ( aValueString != "1" ) // aValueString may be rounded to 1 if nValueLength is small
{
- aTmpBuf.append( aValueString ).append( " " );
+ aTmpBuf.append( aValueString + " " );
addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
aTmpBuf.truncate();
}
@@ -199,21 +196,21 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation(
OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogIntercept, pValueLength );
if ( aValueString != "0" ) // aValueString may be rounded to 0 if nValueLength is small
{
- aTmpBuf.append( aValueString ).append( (m_fLogSlope < 0.0) ? OUStringLiteral(" ") : OUStringLiteral(" + ") );
+ aTmpBuf.append( aValueString ).append( (m_fLogSlope < 0.0) ? std::u16string_view(u" ") : std::u16string_view(u" + ") );
}
}
}
if ( m_fLogSlope < 0.0 )
- aTmpBuf.append( OUStringChar(aMinusSign) ).append( " " );
+ aTmpBuf.append( OUStringChar(aMinusSign) + " " );
if ( bHasLogSlope )
{
OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fLogSlope), pValueLength );
if ( aValueString != "1" ) // aValueString may be rounded to 1 if nValueLength is small
{
- aTmpBuf.append( aValueString ).append( " " );
+ aTmpBuf.append( aValueString + " " );
}
}
- aTmpBuf.append( mXName ).append(" )");
+ aTmpBuf.append( mXName + " )");
addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
return aBuf.makeStringAndClear();
diff --git a/chart2/source/tools/FillProperties.cxx b/chart2/source/tools/FillProperties.cxx
index d0c888d748f2..ba3b63c83db1 100644
--- a/chart2/source/tools/FillProperties.cxx
+++ b/chart2/source/tools/FillProperties.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <tools/color.hxx>
+
using namespace ::com::sun::star;
using ::com::sun::star::beans::Property;
@@ -158,23 +160,23 @@ void lcl_AddDefaultsToMap_without_BitmapProperties(
::chart::tPropertyValueMap & rOutMap )
{
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_STYLE, drawing::FillStyle_SOLID );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_COLOR, 0xd9d9d9 ); // gray85
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_TRANSPARENCE, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_COLOR, Color(0xd9, 0xd9, 0xd9) ); // gray85
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_TRANSPARENCE, sal_Int16(0) );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BACKGROUND, false );
}
void lcl_AddDefaultsToMap_only_BitmapProperties(
::chart::tPropertyValueMap & rOutMap )
{
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, sal_Int16(0) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, sal_Int16(0) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, sal_Int16(0) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, sal_Int16(0) );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, true );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, sal_Int32(0) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, sal_Int32(0) );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_MODE, drawing::BitmapMode_REPEAT );
}
diff --git a/chart2/source/tools/FormattedStringHelper.cxx b/chart2/source/tools/FormattedStringHelper.cxx
index ff885494d231..6b881160670f 100644
--- a/chart2/source/tools/FormattedStringHelper.cxx
+++ b/chart2/source/tools/FormattedStringHelper.cxx
@@ -18,8 +18,8 @@
*/
#include <FormattedStringHelper.hxx>
-#include <com/sun/star/chart2/FormattedString.hpp>
-#include <tools/diagnose_ex.h>
+#include <FormattedString.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/property.hxx>
namespace chart
@@ -28,34 +28,29 @@ namespace chart
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-Sequence< Reference< chart2::XFormattedString2 > >
- FormattedStringHelper::createFormattedStringSequence(
- const Reference< uno::XComponentContext > & xContext
- , const OUString & rString
- , const Reference< beans::XPropertySet > & xTextProperties ) throw()
+rtl::Reference< ::chart::FormattedString >
+ FormattedStringHelper::createFormattedString(
+ const OUString & rString
+ , const Reference< beans::XPropertySet > & xTextProperties ) noexcept
{
- Reference< XFormattedString2 > xFormStr;
+ rtl::Reference< FormattedString > xFormStr;
try
{
- if( xContext.is() )
- {
- xFormStr = chart2::FormattedString::create(xContext);
+ xFormStr = new FormattedString();
- xFormStr->setString( rString );
+ xFormStr->setString( rString );
- // set character properties
- comphelper::copyProperties(
- xTextProperties, Reference< beans::XPropertySet >( xFormStr, uno::UNO_QUERY_THROW ) );
- }
+ // set character properties
+ comphelper::copyProperties(
+ xTextProperties, Reference< beans::XPropertySet >( static_cast<cppu::OWeakObject*>(xFormStr.get()), uno::UNO_QUERY_THROW ) );
}
catch( const uno::Exception & )
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
- return Sequence< Reference< XFormattedString2 > >( & xFormStr, 1 );
+ return xFormStr;
}
} //namespace chart
diff --git a/chart2/source/tools/ImplOPropertySet.cxx b/chart2/source/tools/ImplOPropertySet.cxx
deleted file mode 100644
index 7d09a329fc33..000000000000
--- a/chart2/source/tools/ImplOPropertySet.cxx
+++ /dev/null
@@ -1,177 +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 "ImplOPropertySet.hxx"
-#include <CloneHelper.hxx>
-
-#include <algorithm>
-#include <iterator>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/style/XStyle.hpp>
-
-using namespace ::com::sun::star;
-
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Any;
-
-namespace
-{
-
-struct lcl_getPropertyStateByHandle
-{
- explicit lcl_getPropertyStateByHandle(
- const ::property::impl::ImplOPropertySet::tPropertyMap & rMap )
- : m_rMap( rMap )
- {}
-
- beans::PropertyState operator() ( sal_Int32 nHandle )
- {
- if( m_rMap.end() == m_rMap.find( nHandle ))
- return beans::PropertyState_DEFAULT_VALUE;
- return beans::PropertyState_DIRECT_VALUE;
- }
-
-private:
- const ::property::impl::ImplOPropertySet::tPropertyMap & m_rMap;
-};
-
-template< typename K, typename V >
-struct lcl_eraseMapEntry
-{
- explicit lcl_eraseMapEntry( std::map< K, V > & rMap )
- : m_rMap( rMap )
- {}
-
- void operator() ( const K & aKey )
- {
- m_rMap.erase( aKey );
- }
-
-private:
- std::map< K, V > m_rMap;
-};
-
-struct lcl_replaceInterfacePropertiesByClones
-{
- void operator() ( ::property::impl::ImplOPropertySet::tPropertyMap::value_type & rProp )
- {
- if( rProp.second.hasValue() &&
- rProp.second.getValueType().getTypeClass() == uno::TypeClass_INTERFACE )
- {
- Reference< util::XCloneable > xCloneable;
- if( rProp.second >>= xCloneable )
- rProp.second <<= xCloneable->createClone();
- }
- }
-};
-
-} // anonymous namespace
-
-namespace property::impl
-{
-
-ImplOPropertySet::ImplOPropertySet()
-{}
-
-ImplOPropertySet::ImplOPropertySet( const ImplOPropertySet & rOther )
-{
- m_aProperties = rOther.m_aProperties;
-
- // clone interface properties
- std::for_each( m_aProperties.begin(), m_aProperties.end(),
- lcl_replaceInterfacePropertiesByClones());
-
- m_xStyle.set( ::chart::CloneHelper::CreateRefClone< style::XStyle >()( rOther.m_xStyle ));
-}
-
-beans::PropertyState ImplOPropertySet::GetPropertyStateByHandle( sal_Int32 nHandle ) const
-{
- return lcl_getPropertyStateByHandle( m_aProperties ) ( nHandle );
-}
-
-Sequence< beans::PropertyState > ImplOPropertySet::GetPropertyStatesByHandle(
- const std::vector< sal_Int32 > & aHandles ) const
-{
- Sequence< beans::PropertyState > aResult( aHandles.size());
-
- std::transform( aHandles.begin(), aHandles.end(),
- aResult.getArray(),
- lcl_getPropertyStateByHandle( m_aProperties ));
-
- return aResult;
-}
-
-void ImplOPropertySet::SetPropertyToDefault( sal_Int32 nHandle )
-{
- tPropertyMap::iterator aFoundIter( m_aProperties.find( nHandle ) );
-
- if( m_aProperties.end() != aFoundIter )
- {
- m_aProperties.erase( aFoundIter );
- }
-}
-
-void ImplOPropertySet::SetPropertiesToDefault(
- const std::vector< sal_Int32 > & aHandles )
-{
- std::for_each( aHandles.begin(), aHandles.end(),
- lcl_eraseMapEntry< sal_Int32, Any >( m_aProperties ) );
-}
-
-void ImplOPropertySet::SetAllPropertiesToDefault()
-{
- m_aProperties.clear();
-}
-
-bool ImplOPropertySet::GetPropertyValueByHandle(
- Any & rValue,
- sal_Int32 nHandle ) const
-{
- bool bResult = false;
-
- tPropertyMap::const_iterator aFoundIter( m_aProperties.find( nHandle ) );
-
- if( m_aProperties.end() != aFoundIter )
- {
- rValue = (*aFoundIter).second;
- bResult = true;
- }
-
- return bResult;
-}
-
-void ImplOPropertySet::SetPropertyValueByHandle(
- sal_Int32 nHandle, const Any & rValue )
-{
- m_aProperties[ nHandle ] = rValue;
-}
-
-bool ImplOPropertySet::SetStyle( const Reference< style::XStyle > & xStyle )
-{
- if( ! xStyle.is())
- return false;
-
- m_xStyle = xStyle;
- return true;
-}
-
-} // namespace property::impl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/ImplOPropertySet.hxx b/chart2/source/tools/ImplOPropertySet.hxx
deleted file mode 100644
index 98dc53b008b0..000000000000
--- a/chart2/source/tools/ImplOPropertySet.hxx
+++ /dev/null
@@ -1,89 +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 INCLUDED_CHART2_SOURCE_TOOLS_IMPLOPROPERTYSET_HXX
-#define INCLUDED_CHART2_SOURCE_TOOLS_IMPLOPROPERTYSET_HXX
-
-#include <com/sun/star/beans/PropertyState.hpp>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/Any.hxx>
-
-#include <map>
-#include <vector>
-
-namespace com::sun::star::style { class XStyle; }
-
-namespace property
-{
-namespace impl
-{
-
-class ImplOPropertySet
-{
-public:
- ImplOPropertySet();
- explicit ImplOPropertySet( const ImplOPropertySet & rOther );
-
- /** supports states DIRECT_VALUE and DEFAULT_VALUE
- */
- css::beans::PropertyState
- GetPropertyStateByHandle( sal_Int32 nHandle ) const;
-
- css::uno::Sequence< css::beans::PropertyState >
- GetPropertyStatesByHandle( const std::vector< sal_Int32 > & aHandles ) const;
-
- void SetPropertyToDefault( sal_Int32 nHandle );
- void SetPropertiesToDefault( const std::vector< sal_Int32 > & aHandles );
- void SetAllPropertiesToDefault();
-
- /** @param rValue is set to the value for the property given in nHandle. If
- the property is not set, the style chain is searched for any
- instance set there. If there was no value found either in the
- property set itself or any of its styles, rValue remains
- unchanged and false is returned.
-
- @return false if the property is default, true otherwise.
- */
- bool GetPropertyValueByHandle(
- css::uno::Any & rValue,
- sal_Int32 nHandle ) const;
-
- void SetPropertyValueByHandle( sal_Int32 nHandle,
- const css::uno::Any & rValue );
-
- bool SetStyle( const css::uno::Reference< css::style::XStyle > & xStyle );
- const css::uno::Reference< css::style::XStyle >&
- GetStyle() const { return m_xStyle;}
-
- typedef
- std::map< sal_Int32, css::uno::Any >
- tPropertyMap;
-
-private:
- tPropertyMap m_aProperties;
- css::uno::Reference< css::style::XStyle >
- m_xStyle;
-};
-
-} // namespace impl
-} // namespace chart
-
-// INCLUDED_CHART2_SOURCE_TOOLS_IMPLOPROPERTYSET_HXX
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx
index 91a9fbaa16fa..e6e926078eb3 100644
--- a/chart2/source/tools/InternalData.cxx
+++ b/chart2/source/tools/InternalData.cxx
@@ -21,8 +21,10 @@
#include <ResId.hxx>
#include <strings.hrc>
+#include <comphelper/sequence.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
-#include <rtl/math.hxx>
+
#ifdef DEBUG_CHART2_TOOLS
#define DEBUG_INTERNAL_DATA 1
#endif
@@ -33,11 +35,11 @@
#include <algorithm>
#include <iterator>
+#include <limits>
using ::com::sun::star::uno::Sequence;
using namespace ::com::sun::star;
-using namespace ::std;
namespace chart
{
@@ -46,18 +48,16 @@ namespace
{
struct lcl_NumberedStringGenerator
{
- lcl_NumberedStringGenerator( const OUString & rStub, const OUString & rWildcard ) :
+ lcl_NumberedStringGenerator( const OUString & rStub, std::u16string_view rWildcard ) :
m_aStub( rStub ),
m_nCounter( 0 ),
m_nStubStartIndex( rStub.indexOf( rWildcard )),
- m_nWildcardLength( rWildcard.getLength())
+ m_nWildcardLength( rWildcard.size())
{
}
- vector< uno::Any > operator()()
+ std::vector< uno::Any > operator()()
{
- vector< uno::Any > aRet(1);
- aRet[0] <<= m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::number( ++m_nCounter ));
- return aRet;
+ return { uno::Any(m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::number( ++m_nCounter ))) };
}
private:
OUString m_aStub;
@@ -69,11 +69,13 @@ private:
template< typename T >
Sequence< T > lcl_ValarrayToSequence( const std::valarray< T > & rValarray )
{
- // is there a more elegant way of conversion?
- Sequence< T > aResult( rValarray.size());
- for( size_t i = 0; i < rValarray.size(); ++i )
- aResult[i] = rValarray[i];
- return aResult;
+#if defined __GLIBCXX__ && (!defined _GLIBCXX_RELEASE || _GLIBCXX_RELEASE < 12)
+ // workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103022
+ if (!size(rValarray))
+ return Sequence<T>();
+#endif
+
+ return comphelper::containerToSequence(rValarray);
}
} // anonymous namespace
@@ -111,12 +113,12 @@ void InternalData::createDefaultData()
m_aRowLabels.clear();
m_aRowLabels.reserve( m_nRowCount );
generate_n( back_inserter( m_aRowLabels ), m_nRowCount,
- lcl_NumberedStringGenerator( aRowName, "%ROWNUMBER" ));
+ lcl_NumberedStringGenerator( aRowName, u"%ROWNUMBER" ));
m_aColumnLabels.clear();
m_aColumnLabels.reserve( m_nColumnCount );
generate_n( back_inserter( m_aColumnLabels ), m_nColumnCount,
- lcl_NumberedStringGenerator( aColName, "%COLUMNNUMBER" ));
+ lcl_NumberedStringGenerator( aColName, u"%COLUMNNUMBER" ));
}
void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
@@ -130,10 +132,8 @@ void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
m_aColumnLabels.resize( m_nColumnCount );
m_aData.resize( m_nRowCount * m_nColumnCount );
- double fNan;
- ::rtl::math::setNan( & fNan );
// set all values to Nan
- m_aData = fNan;
+ m_aData = std::numeric_limits<double>::quiet_NaN();
for( sal_Int32 nRow=0; nRow<m_nRowCount; ++nRow )
{
@@ -150,9 +150,10 @@ void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
Sequence< Sequence< double > > InternalData::getData() const
{
Sequence< Sequence< double > > aResult( m_nRowCount );
+ auto aResultRange = asNonConstRange(aResult);
for( sal_Int32 i=0; i<m_nRowCount; ++i )
- aResult[i] = lcl_ValarrayToSequence< tDataType::value_type >(
+ aResultRange[i] = lcl_ValarrayToSequence< tDataType::value_type >(
m_aData[ std::slice( i*m_nColumnCount, m_nColumnCount, 1 ) ] );
return aResult;
@@ -173,49 +174,49 @@ Sequence< double > InternalData::getRowValues( sal_Int32 nRowIndex ) const
return Sequence< double >();
}
-void InternalData::setColumnValues( sal_Int32 nColumnIndex, const vector< double > & rNewData )
+void InternalData::setColumnValues( sal_Int32 nColumnIndex, const std::vector< double > & rNewData )
{
if( nColumnIndex < 0 )
return;
enlargeData( nColumnIndex + 1, rNewData.size() );
tDataType aSlice = m_aData[ std::slice( nColumnIndex, m_nRowCount, m_nColumnCount ) ];
- for( vector< double >::size_type i = 0; i < rNewData.size(); ++i )
+ for( std::vector< double >::size_type i = 0; i < rNewData.size(); ++i )
aSlice[i] = rNewData[i];
m_aData[ std::slice( nColumnIndex, m_nRowCount, m_nColumnCount ) ] = aSlice;
}
-void InternalData::setRowValues( sal_Int32 nRowIndex, const vector< double > & rNewData )
+void InternalData::setRowValues( sal_Int32 nRowIndex, const std::vector< double > & rNewData )
{
if( nRowIndex < 0 )
return;
enlargeData( rNewData.size(), nRowIndex+1 );
tDataType aSlice = m_aData[ std::slice( nRowIndex*m_nColumnCount, m_nColumnCount, 1 ) ];
- for( vector< double >::size_type i = 0; i < rNewData.size(); ++i )
+ for( std::vector< double >::size_type i = 0; i < rNewData.size(); ++i )
aSlice[i] = rNewData[i];
m_aData[ std::slice( nRowIndex*m_nColumnCount, m_nColumnCount, 1 ) ]= aSlice;
}
-void InternalData::setComplexColumnLabel( sal_Int32 nColumnIndex, const vector< uno::Any >& rComplexLabel )
+void InternalData::setComplexColumnLabel( sal_Int32 nColumnIndex, std::vector< uno::Any >&& rComplexLabel )
{
if( nColumnIndex < 0 )
return;
- if( nColumnIndex >= static_cast< sal_Int32 >( m_aColumnLabels.size() ) )
+ if( o3tl::make_unsigned(nColumnIndex) >= m_aColumnLabels.size() )
{
m_aColumnLabels.resize(nColumnIndex+1);
enlargeData( nColumnIndex+1, 0 );
}
- m_aColumnLabels[nColumnIndex]=rComplexLabel;
+ m_aColumnLabels[nColumnIndex] = std::move(rComplexLabel);
dump();
}
-void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, const vector< uno::Any >& rComplexLabel )
+void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, std::vector< uno::Any >&& rComplexLabel )
{
if( nRowIndex < 0 )
return;
- if( nRowIndex >= static_cast< sal_Int32 >( m_aRowLabels.size() ) )
+ if( o3tl::make_unsigned(nRowIndex) >= m_aRowLabels.size() )
{
m_aRowLabels.resize(nRowIndex+1);
enlargeData( 0, nRowIndex+1 );
@@ -228,23 +229,23 @@ void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, const vector< uno::A
}
else
{
- m_aRowLabels[nRowIndex] = rComplexLabel;
+ m_aRowLabels[nRowIndex] = std::move(rComplexLabel);
}
}
-vector< uno::Any > InternalData::getComplexColumnLabel( sal_Int32 nColumnIndex ) const
+std::vector< uno::Any > InternalData::getComplexColumnLabel( sal_Int32 nColumnIndex ) const
{
if( nColumnIndex < static_cast< sal_Int32 >( m_aColumnLabels.size() ) )
return m_aColumnLabels[nColumnIndex];
else
- return vector< uno::Any >();
+ return std::vector< uno::Any >();
}
-vector< uno::Any > InternalData::getComplexRowLabel( sal_Int32 nRowIndex ) const
+std::vector< uno::Any > InternalData::getComplexRowLabel( sal_Int32 nRowIndex ) const
{
if( nRowIndex < static_cast< sal_Int32 >( m_aRowLabels.size() ) )
return m_aRowLabels[nRowIndex];
else
- return vector< uno::Any >();
+ return std::vector< uno::Any >();
}
void InternalData::swapRowWithNext( sal_Int32 nRowIndex )
@@ -257,14 +258,10 @@ void InternalData::swapRowWithNext( sal_Int32 nRowIndex )
{
size_t nIndex1 = nColIdx + nRowIndex*m_nColumnCount;
size_t nIndex2 = nIndex1 + m_nColumnCount;
- double fTemp = m_aData[nIndex1];
- m_aData[nIndex1] = m_aData[nIndex2];
- m_aData[nIndex2] = fTemp;
+ std::swap(m_aData[nIndex1], m_aData[nIndex2]);
}
- vector< uno::Any > aTemp( m_aRowLabels[nRowIndex] );
- m_aRowLabels[nRowIndex] = m_aRowLabels[nRowIndex + 1];
- m_aRowLabels[nRowIndex + 1] = aTemp;
+ std::swap(m_aRowLabels[nRowIndex], m_aRowLabels[nRowIndex + 1]);
}
void InternalData::swapColumnWithNext( sal_Int32 nColumnIndex )
@@ -277,14 +274,10 @@ void InternalData::swapColumnWithNext( sal_Int32 nColumnIndex )
{
size_t nIndex1 = nColumnIndex + nRowIdx*m_nColumnCount;
size_t nIndex2 = nIndex1 + 1;
- double fTemp = m_aData[nIndex1];
- m_aData[nIndex1] = m_aData[nIndex2];
- m_aData[nIndex2] = fTemp;
+ std::swap(m_aData[nIndex1], m_aData[nIndex2]);
}
- vector< uno::Any > aTemp( m_aColumnLabels[nColumnIndex] );
- m_aColumnLabels[nColumnIndex] = m_aColumnLabels[nColumnIndex + 1];
- m_aColumnLabels[nColumnIndex + 1] = aTemp;
+ std::swap(m_aColumnLabels[nColumnIndex], m_aColumnLabels[nColumnIndex + 1]);
}
bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount )
@@ -297,9 +290,7 @@ bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount )
if( bGrow )
{
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
for( int nCol=0; nCol<m_nColumnCount; ++nCol )
static_cast< tDataType >(
@@ -323,9 +314,7 @@ void InternalData::insertColumn( sal_Int32 nAfterIndex )
sal_Int32 nNewColumnCount = m_nColumnCount + 1;
sal_Int32 nNewSize( nNewColumnCount * m_nRowCount );
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
int nCol=0;
@@ -344,7 +333,7 @@ void InternalData::insertColumn( sal_Int32 nAfterIndex )
// labels
if( nAfterIndex < static_cast< sal_Int32 >( m_aColumnLabels.size()))
- m_aColumnLabels.insert( m_aColumnLabels.begin() + (nAfterIndex + 1), vector< uno::Any >(1) );
+ m_aColumnLabels.insert( m_aColumnLabels.begin() + (nAfterIndex + 1), std::vector< uno::Any >(1) );
dump();
}
@@ -380,9 +369,7 @@ void InternalData::insertRow( sal_Int32 nAfterIndex )
sal_Int32 nNewRowCount = m_nRowCount + 1;
sal_Int32 nNewSize( m_nColumnCount * nNewRowCount );
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
sal_Int32 nIndex = nAfterIndex + 1;
@@ -404,7 +391,7 @@ void InternalData::insertRow( sal_Int32 nAfterIndex )
// labels
if( nAfterIndex < static_cast< sal_Int32 >( m_aRowLabels.size()))
- m_aRowLabels.insert( m_aRowLabels.begin() + nIndex, vector< uno::Any > (1));
+ m_aRowLabels.insert( m_aRowLabels.begin() + nIndex, std::vector< uno::Any > (1));
dump();
}
@@ -417,9 +404,7 @@ void InternalData::deleteColumn( sal_Int32 nAtIndex )
sal_Int32 nNewColumnCount = m_nColumnCount - 1;
sal_Int32 nNewSize( nNewColumnCount * m_nRowCount );
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
int nCol=0;
@@ -451,9 +436,7 @@ void InternalData::deleteRow( sal_Int32 nAtIndex )
sal_Int32 nNewRowCount = m_nRowCount - 1;
sal_Int32 nNewSize( m_nColumnCount * nNewRowCount );
- double fNan;
- ::rtl::math::setNan( &fNan );
- tDataType aNewData( fNan, nNewSize );
+ tDataType aNewData( std::numeric_limits<double>::quiet_NaN(), nNewSize );
// copy old data
sal_Int32 nIndex = nAtIndex;
@@ -481,9 +464,9 @@ void InternalData::deleteRow( sal_Int32 nAtIndex )
dump();
}
-void InternalData::setComplexRowLabels( const tVecVecAny& rNewRowLabels )
+void InternalData::setComplexRowLabels( tVecVecAny&& rNewRowLabels )
{
- m_aRowLabels = rNewRowLabels;
+ m_aRowLabels = std::move(rNewRowLabels);
sal_Int32 nNewRowCount = static_cast< sal_Int32 >( m_aRowLabels.size() );
if( nNewRowCount < m_nRowCount )
m_aRowLabels.resize( m_nRowCount );
@@ -496,9 +479,9 @@ const InternalData::tVecVecAny& InternalData::getComplexRowLabels() const
return m_aRowLabels;
}
-void InternalData::setComplexColumnLabels( const tVecVecAny& rNewColumnLabels )
+void InternalData::setComplexColumnLabels( tVecVecAny&& rNewColumnLabels )
{
- m_aColumnLabels = rNewColumnLabels;
+ m_aColumnLabels = std::move(rNewColumnLabels);
sal_Int32 nNewColumnCount = static_cast< sal_Int32 >( m_aColumnLabels.size() );
if( nNewColumnCount < m_nColumnCount )
m_aColumnLabels.resize( m_nColumnCount );
@@ -517,22 +500,22 @@ void InternalData::dump() const
// Header
if (!m_aColumnLabels.empty())
{
- svl::GridPrinter aPrinter(1, m_aColumnLabels.size(), true);
+ svl::GridPrinter aPrinter(m_aColumnLabels[0].size(), m_aColumnLabels.size(), true);
for (size_t nCol = 0; nCol < m_aColumnLabels.size(); ++nCol)
{
- if (m_aColumnLabels[nCol].empty())
- continue;
-
- OUString aStr;
- if (m_aColumnLabels[nCol][0] >>= aStr)
- aPrinter.set(0, nCol, aStr);
+ for (size_t nRow = 0; nRow < m_aColumnLabels[nCol].size(); ++nRow)
+ {
+ OUString aStr;
+ if (m_aColumnLabels[nCol].at(nRow) >>= aStr)
+ aPrinter.set(nRow, nCol, aStr);
+ }
}
aPrinter.print("Header");
}
if (!m_aRowLabels.empty())
{
- svl::GridPrinter aPrinter(m_aRowLabels.size(), m_aRowLabels[0].size());
+ svl::GridPrinter aPrinter(m_aRowLabels.size(), m_aRowLabels[0].size(), true);
for (size_t nRow = 0; nRow < m_aRowLabels.size(); ++nRow)
{
for (size_t nCol = 0; nCol < m_aRowLabels[nRow].size(); ++nCol)
@@ -545,7 +528,7 @@ void InternalData::dump() const
aPrinter.print("Row labels");
}
- svl::GridPrinter aPrinter(m_nRowCount, m_nColumnCount);
+ svl::GridPrinter aPrinter(m_nRowCount, m_nColumnCount, true);
for (sal_Int32 nRow = 0; nRow < m_nRowCount; ++nRow)
{
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 9d78d9ffc758..5b95b0a719be 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <rtl/math.hxx>
-
+#include <cstddef>
#include <iterator>
#include <InternalDataProvider.hxx>
@@ -30,23 +29,26 @@
#include <DataSourceHelper.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <ExplicitCategoriesProvider.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <DataSeries.hxx>
#include <com/sun/star/chart2/data/XDataSequence.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/property.hxx>
-#include <tools/diagnose_ex.h>
+#include <o3tl/string_view.hxx>
+#include <comphelper/diagnose_ex.hxx>
+#include <limits>
#include <vector>
#include <algorithm>
namespace com::sun::star::chart2 { class XChartDocument; }
using namespace ::com::sun::star;
-using namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -57,33 +59,21 @@ namespace chart
namespace
{
-const char lcl_aCategoriesRangeName[] = "categories";
+constexpr OUString lcl_aCategoriesRangeName = u"categories"_ustr;
const char lcl_aCategoriesLevelRangeNamePrefix[] = "categoriesL "; //L <-> level
const char lcl_aCategoriesPointRangeNamePrefix[] = "categoriesP "; //P <-> point
-const char lcl_aCategoriesRoleName[] = "categories";
+constexpr OUString lcl_aCategoriesRoleName = u"categories"_ustr;
const char lcl_aLabelRangePrefix[] = "label ";
-const char lcl_aCompleteRange[] = "all";
+constexpr OUString lcl_aCompleteRange = u"all"_ustr;
typedef std::multimap< OUString, uno::WeakReference< chart2::data::XDataSequence > >
lcl_tSequenceMap;
-std::vector< OUString > lcl_AnyToStringSequence( const std::vector< uno::Any >& aAnySeq )
-{
- std::vector< OUString > aResult;
- aResult.resize( aAnySeq.size() );
- int i = 0;
- for (const uno::Any& aAny : aAnySeq)
- aResult[i++] = CommonFunctors::AnyToString()(aAny);
- return aResult;
-}
-
std::vector< uno::Any > lcl_StringToAnyVector( const css::uno::Sequence< OUString >& aStringSeq )
{
std::vector< uno::Any > aResult;
- aResult.resize( aStringSeq.getLength() );
- int i = 0;
- for (const OUString& aStr : aStringSeq)
- aResult[i++] = CommonFunctors::makeAny<OUString>()(aStr);
+ aResult.reserve(aStringSeq.getLength());
+ std::transform(aStringSeq.begin(), aStringSeq.end(), std::back_inserter(aResult), CommonFunctors::makeAny());
return aResult;
}
@@ -112,16 +102,11 @@ struct lcl_internalizeSeries
m_bConnectToModel( bConnectToModel ),
m_bDataInColumns( bDataInColumns )
{}
- void operator() ( const Reference< chart2::XDataSeries > & xSeries )
+ void operator() ( const rtl::Reference< DataSeries > & xSeries )
{
- Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
- Reference< chart2::data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
- if( !(xSource.is() && xSink.is()) )
- return;
-
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aOldSeriesData = xSource->getDataSequences();
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeriesData( aOldSeriesData.getLength() );
- for( sal_Int32 i=0; i<aOldSeriesData.getLength(); ++i )
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aOldSeriesData = xSeries->getDataSequences2();
+ std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aNewSeriesData( aOldSeriesData.size() );
+ for( std::size_t i=0; i<aOldSeriesData.size(); ++i )
{
sal_Int32 nNewIndex( m_bDataInColumns ? m_rInternalData.appendColumn() : m_rInternalData.appendRow() );
OUString aIdentifier( OUString::number( nNewIndex ));
@@ -169,7 +154,7 @@ struct lcl_internalizeSeries
}
}
if( m_bConnectToModel )
- xSink->setData( aNewSeriesData );
+ xSeries->setData( aNewSeriesData );
}
private:
@@ -186,7 +171,7 @@ public:
explicit lcl_copyFromLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- uno::Any operator() ( const vector< uno::Any >& rVector )
+ uno::Any operator() ( const std::vector< uno::Any >& rVector )
{
uno::Any aRet;
if( m_nLevel < static_cast< sal_Int32 >(rVector.size()) )
@@ -205,11 +190,11 @@ public:
explicit lcl_getStringFromLevelVector( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- OUString operator() ( const vector< uno::Any >& rVector )
+ OUString operator() ( const std::vector< uno::Any >& rVector )
{
OUString aString;
if( m_nLevel < static_cast< sal_Int32 >(rVector.size()) )
- aString = CommonFunctors::AnyToString()(rVector[m_nLevel]);
+ aString = CommonFunctors::ToString()(rVector[m_nLevel]);
return aString;
}
@@ -224,9 +209,9 @@ public:
explicit lcl_setAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- vector< uno::Any > operator() ( const vector< uno::Any >& rVector, const uno::Any& rNewValue )
+ std::vector< uno::Any > operator() ( const std::vector< uno::Any >& rVector, const uno::Any& rNewValue )
{
- vector< uno::Any > aRet( rVector );
+ std::vector< uno::Any > aRet( rVector );
if( m_nLevel >= static_cast< sal_Int32 >(aRet.size()) )
aRet.resize( m_nLevel+1 );
aRet[ m_nLevel ]=rNewValue;
@@ -244,9 +229,9 @@ public:
explicit lcl_setAnyAtLevelFromStringSequence( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- vector< uno::Any > operator() ( const vector< uno::Any >& rVector, const OUString& rNewValue )
+ std::vector< uno::Any > operator() ( const std::vector< uno::Any >& rVector, const OUString& rNewValue )
{
- vector< uno::Any > aRet( rVector );
+ std::vector< uno::Any > aRet( rVector );
if( m_nLevel >= static_cast< sal_Int32 >(aRet.size()) )
aRet.resize( m_nLevel+1 );
aRet[ m_nLevel ] <<= rNewValue;
@@ -264,7 +249,7 @@ public:
explicit lcl_insertAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- void operator() ( vector< uno::Any >& rVector )
+ void operator() ( std::vector< uno::Any >& rVector )
{
if( m_nLevel >= static_cast< sal_Int32 >(rVector.size()) )
{
@@ -287,7 +272,7 @@ public:
explicit lcl_removeAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- void operator() ( vector< uno::Any >& rVector )
+ void operator() ( std::vector< uno::Any >& rVector )
{
if( m_nLevel < static_cast<sal_Int32>(rVector.size()) )
{
@@ -306,18 +291,18 @@ InternalDataProvider::InternalDataProvider()
{}
InternalDataProvider::InternalDataProvider(
- const Reference< chart2::XChartDocument > & xChartDoc,
+ const rtl::Reference< ChartModel > & xModel,
bool bConnectToModel,
bool bDefaultDataInColumns)
: m_bDataInColumns( bDefaultDataInColumns )
{
+ if (!xModel.is())
+ return;
try
{
- Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDoc ) );
+ rtl::Reference< Diagram > xDiagram( xModel->getFirstChartDiagram() );
if( xDiagram.is())
{
- Reference< frame::XModel > xChartModel = xChartDoc;
-
//data in columns?
{
OUString aRangeString;
@@ -326,7 +311,7 @@ InternalDataProvider::InternalDataProvider(
uno::Sequence< sal_Int32 > aSequenceMapping;
const bool bSomethingDetected(
DataSourceHelper::detectRangeSegmentation(
- xChartModel, aRangeString, aSequenceMapping, m_bDataInColumns, bFirstCellAsLabel, bHasCategories ));
+ xModel, aRangeString, aSequenceMapping, m_bDataInColumns, bFirstCellAsLabel, bHasCategories ));
// #i120559# if no data was available, restore default
if(!bSomethingDetected && m_bDataInColumns != bDefaultDataInColumns)
@@ -337,13 +322,12 @@ InternalDataProvider::InternalDataProvider(
// categories
{
- vector< vector< uno::Any > > aNewCategories;//inner count is level
+ std::vector< std::vector< uno::Any > > aNewCategories;//inner count is level
{
- ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartModel);
- ExplicitCategoriesProvider aExplicitCategoriesProvider(ChartModelHelper::getFirstCoordinateSystem(xChartModel), rModel);
+ ExplicitCategoriesProvider aExplicitCategoriesProvider(ChartModelHelper::getFirstCoordinateSystem(xModel), *xModel);
- const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
- sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
+ 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 > xLDS( rSplitCategoriesList[nL] );
@@ -359,7 +343,7 @@ InternalDataProvider::InternalDataProvider(
aNewCategories.resize( nLength );
else if( nLength < nCatLength )
aDataSeq.realloc( nCatLength );
- transform( aNewCategories.begin(), aNewCategories.end(), aDataSeq.getConstArray(),
+ transform( aNewCategories.begin(), aNewCategories.end(), aDataSeq.begin(),
aNewCategories.begin(), lcl_setAnyAtLevel(nL) );
}
if( !nLevelCount )
@@ -369,24 +353,24 @@ InternalDataProvider::InternalDataProvider(
aNewCategories.reserve( nLength );
for( sal_Int32 nN=0; nN<nLength; nN++)
{
- vector< uno::Any > aVector(1);
- aVector[0] <<= aSimplecategories[nN];
- aNewCategories.push_back( aVector );
+ aNewCategories.push_back( { uno::Any(aSimplecategories[nN]) } );
}
}
}
if( m_bDataInColumns )
- m_aInternalData.setComplexRowLabels( aNewCategories );
+ m_aInternalData.setComplexRowLabels( std::move(aNewCategories) );
else
- m_aInternalData.setComplexColumnLabels( aNewCategories );
+ m_aInternalData.setComplexColumnLabels( std::move(aNewCategories) );
if( bConnectToModel )
- DiagramHelper::setCategoriesToDiagram( new LabeledDataSequence(
- createDataSequenceByRangeRepresentation( lcl_aCategoriesRangeName )), xDiagram );
+ xDiagram->setCategories(
+ new LabeledDataSequence(
+ createDataSequenceByRangeRepresentation( lcl_aCategoriesRangeName ))
+ );
}
// data series
- std::vector< Reference< chart2::XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( xChartDoc ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( xModel ));
lcl_internalizeSeries ftor( m_aInternalData, *this, bConnectToModel, m_bDataInColumns );
for( const auto& rxScreen : aSeriesVector )
ftor( rxScreen );
@@ -483,29 +467,29 @@ void InternalDataProvider::decreaseMapReferences(
}
}
-Reference< chart2::data::XDataSequence > InternalDataProvider::createDataSequenceAndAddToMap(
+rtl::Reference< UncachedDataSequence > InternalDataProvider::createDataSequenceAndAddToMap(
const OUString & rRangeRepresentation )
{
- Reference<chart2::data::XDataSequence> xSeq = createDataSequenceFromArray(rRangeRepresentation, OUString());
+ rtl::Reference<UncachedDataSequence> xSeq = createDataSequenceFromArray(rRangeRepresentation, u"", u"");
if (xSeq.is())
- return xSeq;
+ return nullptr;
xSeq.set(new UncachedDataSequence(this, rRangeRepresentation));
addDataSequenceToMap(rRangeRepresentation, xSeq);
return xSeq;
}
-uno::Reference<chart2::data::XDataSequence>
-InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, const OUString& rRole )
+rtl::Reference<UncachedDataSequence>
+InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, std::u16string_view rRole, std::u16string_view rRoleQualifier )
{
if (rArrayStr.indexOf('{') != 0 || rArrayStr[rArrayStr.getLength()-1] != '}')
{
// Not an array string.
- return uno::Reference<chart2::data::XDataSequence>();
+ return nullptr;
}
bool bAllNumeric = true;
- uno::Reference<chart2::data::XDataSequence> xSeq;
+ rtl::Reference<UncachedDataSequence> xSeq;
const sal_Unicode* p = rArrayStr.getStr();
const sal_Unicode* pEnd = p + rArrayStr.getLength();
@@ -518,7 +502,14 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
bool bInQuote = false;
for (; p != pEnd; ++p)
{
- if (*p == '"')
+ // Skip next "" within the title text: it's an escaped double quotation mark.
+ if (bInQuote && *p == '"' && *(p + 1) == '"')
+ {
+ if (!pElem)
+ pElem = p;
+ ++p;
+ }
+ else if (*p == '"')
{
bInQuote = !bInQuote;
if (bInQuote)
@@ -534,7 +525,8 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
// Non empty string
if (!aElem.isEmpty())
bAllNumeric = false;
- aRawElems.push_back(aElem);
+ // Restore also escaped double quotation marks
+ aRawElems.push_back(aElem.replaceAll("\"\"", "\""));
pElem = nullptr;
aElem.clear();
@@ -562,8 +554,9 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
aRawElems.push_back(aElem);
}
- if (rRole == "values-y" || rRole == "values-first" || rRole == "values-last" ||
- rRole == "values-min" || rRole == "values-max" || rRole == "values-size")
+ if (rRole == u"values-y" || rRole == u"values-first" || rRole == u"values-last" ||
+ rRole == u"values-min" || rRole == u"values-max" || rRole == u"values-size" ||
+ rRole == u"error-bars-y-positive" || rRole == u"error-bars-y-negative")
{
// Column values. Append a new data column and populate it.
@@ -584,7 +577,7 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
xSeq.set(new UncachedDataSequence(this, aRangeRep));
addDataSequenceToMap(aRangeRep, xSeq);
}
- else if (rRole == "values-x")
+ else if (rRole == u"values-x")
{
std::vector<double> aValues;
aValues.reserve(aRawElems.size());
@@ -611,28 +604,42 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
xSeq.set(new UncachedDataSequence(this, aRangeRep));
addDataSequenceToMap(aRangeRep, xSeq);
}
- else if (rRole == "categories")
+ else if (rRole == u"categories")
{
// Category labels.
+ // Store date categories as numbers.
+ bool bStoreNumeric = rRoleQualifier == u"date";
+ double fValue;
for (size_t i = 0; i < aRawElems.size(); ++i)
{
- std::vector<uno::Any> aLabels(1, uno::Any(aRawElems[i]));
- m_aInternalData.setComplexRowLabel(i, aLabels);
+ if (bStoreNumeric)
+ {
+ bool bGetDouble = bAllNumeric && !aRawElems[i].isEmpty();
+ fValue = bGetDouble ? aRawElems[i].toDouble() :
+ std::numeric_limits<double>::quiet_NaN();
+ }
+ std::vector<uno::Any> aLabels(1,
+ bStoreNumeric ? uno::Any(fValue) : uno::Any(aRawElems[i]));
+ m_aInternalData.setComplexRowLabel(i, std::move(aLabels));
}
xSeq.set(new UncachedDataSequence(this, lcl_aCategoriesRangeName));
addDataSequenceToMap(lcl_aCategoriesRangeName, xSeq);
}
- else if (rRole == "label")
+ else if (rRole == u"label")
{
// Data series label. There should be only one element. This always
// goes to the last data column.
sal_Int32 nColSize = m_aInternalData.getColumnCount();
if (!aRawElems.empty() && nColSize)
{
- std::vector<uno::Any> aLabels(1, uno::Any(aRawElems[0]));
- m_aInternalData.setComplexColumnLabel(nColSize-1, aLabels);
+ // Do not overwrite an existing label (attempted by series with no data values)
+ if (!m_aInternalData.getComplexColumnLabel(nColSize-1)[0].hasValue())
+ {
+ std::vector<uno::Any> aLabels(1, uno::Any(aRawElems[0]));
+ m_aInternalData.setComplexColumnLabel(nColSize-1, std::move(aLabels));
+ }
OUString aRangeRep = lcl_aLabelRangePrefix + OUString::number(nColSize-1);
xSeq.set(new UncachedDataSequence(this, aRangeRep));
@@ -647,8 +654,8 @@ Reference< chart2::data::XDataSequence > InternalDataProvider::createDataSequenc
const OUString & rRangeRepresentation,
const OUString & rRole )
{
- Reference< chart2::data::XDataSequence > xSeq(
- new UncachedDataSequence( this, rRangeRepresentation, rRole ));
+ rtl::Reference< UncachedDataSequence > xSeq =
+ new UncachedDataSequence( this, rRangeRepresentation, rRole );
addDataSequenceToMap( rRangeRepresentation, xSeq );
return xSeq;
}
@@ -662,7 +669,7 @@ sal_Bool SAL_CALL InternalDataProvider::createDataSourcePossible( const Sequence
namespace
{
-sal_Int32 lcl_getInnerLevelCount( const vector< vector< uno::Any > >& rLabels )
+sal_Int32 lcl_getInnerLevelCount( const std::vector< std::vector< uno::Any > >& rLabels )
{
sal_Int32 nCount = 1;//minimum is 1!
for (auto const& elemLabel : rLabels)
@@ -688,7 +695,7 @@ Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createData
{
//return split complex categories if we have any:
std::vector< Reference< chart2::data::XLabeledDataSequence > > aComplexCategories;
- vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ const std::vector< std::vector< uno::Any > > & aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
if( bUseColumns==m_bDataInColumns )
{
sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
@@ -765,22 +772,22 @@ Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createData
Sequence< beans::PropertyValue > SAL_CALL InternalDataProvider::detectArguments(
const Reference< chart2::data::XDataSource >& /* xDataSource */ )
{
- Sequence< beans::PropertyValue > aArguments( 4 );
- aArguments[0] = beans::PropertyValue(
- "CellRangeRepresentation", -1, uno::Any( OUString(lcl_aCompleteRange) ),
- beans::PropertyState_DIRECT_VALUE );
- aArguments[1] = beans::PropertyValue(
- "DataRowSource", -1, uno::Any(
- m_bDataInColumns
- ? css::chart::ChartDataRowSource_COLUMNS
- : css::chart::ChartDataRowSource_ROWS ),
- beans::PropertyState_DIRECT_VALUE );
- // internal data always contains labels and categories
- aArguments[2] = beans::PropertyValue(
- "FirstCellAsLabel", -1, uno::Any( true ), beans::PropertyState_DIRECT_VALUE );
- aArguments[3] = beans::PropertyValue(
- "HasCategories", -1, uno::Any( true ), beans::PropertyState_DIRECT_VALUE );
-
+ Sequence< beans::PropertyValue > aArguments{
+ beans::PropertyValue(
+ "CellRangeRepresentation", -1, uno::Any( lcl_aCompleteRange ),
+ beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "DataRowSource", -1, uno::Any(
+ m_bDataInColumns
+ ? css::chart::ChartDataRowSource_COLUMNS
+ : css::chart::ChartDataRowSource_ROWS ),
+ beans::PropertyState_DIRECT_VALUE ),
+ // internal data always contains labels and categories
+ beans::PropertyValue(
+ "FirstCellAsLabel", -1, uno::Any( true ), beans::PropertyState_DIRECT_VALUE ),
+ beans::PropertyValue(
+ "HasCategories", -1, uno::Any( true ), beans::PropertyState_DIRECT_VALUE )
+ };
// #i85913# Sequence Mapping is not needed for internal data, as it is
// applied to the data when the data source is created.
@@ -805,7 +812,7 @@ Reference< chart2::data::XDataSequence > SAL_CALL InternalDataProvider::createDa
else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
{
// label
- sal_Int32 nIndex = aRangeRepresentation.copy( strlen(lcl_aLabelRangePrefix)).toInt32();
+ sal_Int32 nIndex = o3tl::toInt32(aRangeRepresentation.subView( strlen(lcl_aLabelRangePrefix)));
return createDataSequenceAndAddToMap( lcl_aLabelRangePrefix + OUString::number( nIndex ));
}
else if ( aRangeRepresentation == "last" )
@@ -826,9 +833,9 @@ Reference< chart2::data::XDataSequence > SAL_CALL InternalDataProvider::createDa
Reference<chart2::data::XDataSequence> SAL_CALL
InternalDataProvider::createDataSequenceByValueArray(
- const OUString& aRole, const OUString& aRangeRepresentation )
+ const OUString& aRole, const OUString& aRangeRepresentation, const OUString& aRoleQualifier )
{
- return createDataSequenceFromArray(aRangeRepresentation, aRole);
+ return createDataSequenceFromArray(aRangeRepresentation, aRole, aRoleQualifier);
}
Reference< sheet::XRangeSelection > SAL_CALL InternalDataProvider::getRangeSelection()
@@ -849,7 +856,7 @@ sal_Bool SAL_CALL InternalDataProvider::hasDataByRangeRepresentation( const OUSt
}
else if( aRange.match( lcl_aLabelRangePrefix ))
{
- sal_Int32 nIndex = aRange.copy( strlen(lcl_aLabelRangePrefix)).toInt32();
+ sal_Int32 nIndex = o3tl::toInt32(aRange.subView( strlen(lcl_aLabelRangePrefix)));
bResult = (nIndex < (m_bDataInColumns ? m_aInternalData.getColumnCount(): m_aInternalData.getRowCount()));
}
else
@@ -867,8 +874,8 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
if( aRange.match( lcl_aLabelRangePrefix ) )
{
- auto nIndex = aRange.copy( strlen(lcl_aLabelRangePrefix)).toUInt32();
- vector< uno::Any > aComplexLabel = m_bDataInColumns
+ auto nIndex = o3tl::toUInt32(aRange.subView( strlen(lcl_aLabelRangePrefix)));
+ std::vector< uno::Any > aComplexLabel = m_bDataInColumns
? m_aInternalData.getComplexColumnLabel( nIndex )
: m_aInternalData.getComplexRowLabel( nIndex );
if( !aComplexLabel.empty() )
@@ -876,8 +883,8 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
}
else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
{
- auto nPointIndex = aRange.copy( strlen(lcl_aCategoriesPointRangeNamePrefix) ).toUInt32();
- vector< uno::Any > aComplexCategory = m_bDataInColumns
+ auto nPointIndex = o3tl::toUInt32(aRange.subView( strlen(lcl_aCategoriesPointRangeNamePrefix) ));
+ std::vector< uno::Any > aComplexCategory = m_bDataInColumns
? m_aInternalData.getComplexRowLabel( nPointIndex )
: m_aInternalData.getComplexColumnLabel( nPointIndex );
if( !aComplexCategory.empty() )
@@ -885,18 +892,14 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
}
else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
{
- sal_Int32 nLevel = aRange.copy( strlen(lcl_aCategoriesLevelRangeNamePrefix) ).toInt32();
- vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ sal_Int32 nLevel = o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix) ));
+ const std::vector< std::vector< uno::Any > > & aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
if( nLevel < lcl_getInnerLevelCount( aCategories ) )
- {
- aResult.realloc( aCategories.size() );
- transform( aCategories.begin(), aCategories.end(),
- aResult.getArray(), lcl_copyFromLevel(nLevel) );
- }
+ aResult = CommonFunctors::convertToSequence(aCategories, lcl_copyFromLevel(nLevel));
}
else if( aRange == lcl_aCategoriesRangeName )
{
- vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ const std::vector< std::vector< uno::Any > > & aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
if( nLevelCount == 1 )
{
@@ -905,10 +908,8 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
else
{
// Maybe this 'else' part and the functions is not necessary anymore.
- Sequence< OUString > aLabels = m_bDataInColumns ? getRowDescriptions() : getColumnDescriptions();
- aResult.realloc( aLabels.getLength() );
- transform( aLabels.begin(), aLabels.end(),
- aResult.getArray(), CommonFunctors::makeAny< OUString >() );
+ const Sequence< OUString > aLabels = m_bDataInColumns ? getRowDescriptions() : getColumnDescriptions();
+ aResult = CommonFunctors::convertToSequence(aLabels, CommonFunctors::makeAny());
}
}
else
@@ -916,17 +917,11 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
sal_Int32 nIndex = aRange.toInt32();
if( nIndex >= 0 )
{
- Sequence< double > aData;
- if( m_bDataInColumns )
- aData = m_aInternalData.getColumnValues(nIndex);
- else
- aData = m_aInternalData.getRowValues(nIndex);
+ const Sequence< double > aData = m_bDataInColumns
+ ? m_aInternalData.getColumnValues(nIndex)
+ : m_aInternalData.getRowValues(nIndex);
if( aData.hasElements() )
- {
- aResult.realloc( aData.getLength());
- transform( aData.begin(), aData.end(),
- aResult.getArray(), CommonFunctors::makeAny< double >());
- }
+ aResult = CommonFunctors::convertToSequence(aData, CommonFunctors::makeAny());
}
}
@@ -936,27 +931,27 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
void SAL_CALL InternalDataProvider::setDataByRangeRepresentation(
const OUString& aRange, const Sequence< uno::Any >& aNewData )
{
- auto aNewVector( comphelper::sequenceToContainer<vector< uno::Any >>(aNewData) );
+ auto aNewVector( comphelper::sequenceToContainer<std::vector< uno::Any >>(aNewData) );
if( aRange.match( lcl_aLabelRangePrefix ) )
{
- sal_uInt32 nIndex = aRange.copy( strlen(lcl_aLabelRangePrefix)).toInt32();
+ sal_uInt32 nIndex = o3tl::toInt32(aRange.subView( strlen(lcl_aLabelRangePrefix)));
if( m_bDataInColumns )
- m_aInternalData.setComplexColumnLabel( nIndex, aNewVector );
+ m_aInternalData.setComplexColumnLabel( nIndex, std::move(aNewVector) );
else
- m_aInternalData.setComplexRowLabel( nIndex, aNewVector );
+ m_aInternalData.setComplexRowLabel( nIndex, std::move(aNewVector) );
}
else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
{
- sal_Int32 nPointIndex = aRange.copy( strlen(lcl_aCategoriesLevelRangeNamePrefix)).toInt32();
+ sal_Int32 nPointIndex = o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix)));
if( m_bDataInColumns )
- m_aInternalData.setComplexRowLabel( nPointIndex, aNewVector );
+ m_aInternalData.setComplexRowLabel( nPointIndex, std::move(aNewVector) );
else
- m_aInternalData.setComplexColumnLabel( nPointIndex, aNewVector );
+ m_aInternalData.setComplexColumnLabel( nPointIndex, std::move(aNewVector) );
}
else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
{
- sal_Int32 nLevel = aRange.copy( strlen(lcl_aCategoriesLevelRangeNamePrefix)).toInt32();
- vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+ sal_Int32 nLevel = o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix)));
+ std::vector< std::vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
//ensure equal length
if( aNewVector.size() > aComplexCategories.size() )
@@ -968,29 +963,30 @@ void SAL_CALL InternalDataProvider::setDataByRangeRepresentation(
aComplexCategories.begin(), lcl_setAnyAtLevel(nLevel) );
if( m_bDataInColumns )
- m_aInternalData.setComplexRowLabels( aComplexCategories );
+ m_aInternalData.setComplexRowLabels( std::move(aComplexCategories) );
else
- m_aInternalData.setComplexColumnLabels( aComplexCategories );
+ m_aInternalData.setComplexColumnLabels( std::move(aComplexCategories) );
}
else if( aRange == lcl_aCategoriesRangeName )
{
- vector< vector< uno::Any > > aComplexCategories;
+ std::vector< std::vector< uno::Any > > aComplexCategories;
aComplexCategories.resize( aNewVector.size() );
transform( aComplexCategories.begin(), aComplexCategories.end(), aNewVector.begin(),
aComplexCategories.begin(), lcl_setAnyAtLevel(0) );
if( m_bDataInColumns )
- m_aInternalData.setComplexRowLabels( aComplexCategories );
+ m_aInternalData.setComplexRowLabels( std::move(aComplexCategories) );
else
- m_aInternalData.setComplexColumnLabels( aComplexCategories );
+ m_aInternalData.setComplexColumnLabels( std::move(aComplexCategories) );
}
else
{
sal_Int32 nIndex = aRange.toInt32();
if( nIndex>=0 )
{
- vector< double > aNewDataVec;
+ std::vector< double > aNewDataVec;
+ aNewDataVec.reserve(aNewData.getLength());
transform( aNewData.begin(), aNewData.end(),
- back_inserter( aNewDataVec ), CommonFunctors::AnyToDouble());
+ back_inserter( aNewDataVec ), CommonFunctors::ToDouble());
if( m_bDataInColumns )
m_aInternalData.setColumnValues( nIndex, aNewDataVec );
else
@@ -1042,12 +1038,12 @@ void SAL_CALL InternalDataProvider::insertComplexCategoryLevel( sal_Int32 nLevel
OSL_ENSURE( nLevel> 0, "you can only insert category levels > 0" );//the first categories level cannot be deleted, check the calling code for error
if( nLevel>0 )
{
- vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+ std::vector< std::vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_insertAnyAtLevel(nLevel) );
if( m_bDataInColumns )
- m_aInternalData.setComplexRowLabels( aComplexCategories );
+ m_aInternalData.setComplexRowLabels( std::move(aComplexCategories) );
else
- m_aInternalData.setComplexColumnLabels( aComplexCategories );
+ m_aInternalData.setComplexColumnLabels( std::move(aComplexCategories) );
tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
std::for_each( aRange.first, aRange.second, lcl_setModified());
@@ -1058,12 +1054,12 @@ void SAL_CALL InternalDataProvider::deleteComplexCategoryLevel( sal_Int32 nLevel
OSL_ENSURE( nLevel>0, "you can only delete category levels > 0" );//the first categories level cannot be deleted, check the calling code for error
if( nLevel>0 )
{
- vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+ std::vector< std::vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_removeAnyAtLevel(nLevel) );
if( m_bDataInColumns )
- m_aInternalData.setComplexRowLabels( aComplexCategories );
+ m_aInternalData.setComplexRowLabels( std::move(aComplexCategories) );
else
- m_aInternalData.setComplexColumnLabels( aComplexCategories );
+ m_aInternalData.setComplexColumnLabels( std::move(aComplexCategories) );
tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
std::for_each( aRange.first, aRange.second, lcl_setModified());
@@ -1172,7 +1168,7 @@ OUString SAL_CALL InternalDataProvider::convertRangeToXML( const OUString& aRang
}
else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
{
- sal_Int32 nIndex = aRangeRepresentation.copy( strlen(lcl_aLabelRangePrefix)).toInt32();
+ sal_Int32 nIndex = o3tl::toInt32(aRangeRepresentation.subView( strlen(lcl_aLabelRangePrefix)));
aRange.aUpperLeft.bIsEmpty = false;
aRange.aLowerRight.bIsEmpty = true;
if( m_bDataInColumns )
@@ -1220,7 +1216,14 @@ OUString SAL_CALL InternalDataProvider::convertRangeToXML( const OUString& aRang
OUString SAL_CALL InternalDataProvider::convertRangeFromXML( const OUString& aXMLRange )
{
- const OUString aPivotTableID("PT@");
+ // Handle non-standards-conforming table:cell-range-address="PivotChart", see
+ // <https://bugs.documentfoundation.org/show_bug.cgi?id=112783> "PIVOT CHARTS: Save produces
+ // invalid file because of invalid cell address":
+ if (aXMLRange == "PivotChart") {
+ return "";
+ }
+
+ static constexpr OUString aPivotTableID(u"PT@"_ustr);
if (aXMLRange.startsWith(aPivotTableID))
return aXMLRange.copy(aPivotTableID.getLength());
@@ -1266,53 +1269,35 @@ namespace
{
template< class Type >
-Sequence< Sequence< Type > > lcl_convertVectorVectorToSequenceSequence( const vector< vector< Type > >& rIn )
+Sequence< Sequence< Type > > lcl_convertVectorVectorToSequenceSequence( const std::vector< std::vector< Type > >& rIn )
{
- Sequence< Sequence< Type > > aRet;
- sal_Int32 nOuterCount = rIn.size();
- if( nOuterCount )
- {
- aRet.realloc(nOuterCount);
- for( sal_Int32 nN=0; nN<nOuterCount; nN++)
- aRet[nN]= comphelper::containerToSequence( rIn[nN] );
- }
- return aRet;
+ return CommonFunctors::convertToSequence(rIn, [](auto& v)
+ { return comphelper::containerToSequence(v); });
}
template< class Type >
-vector< vector< Type > > lcl_convertSequenceSequenceToVectorVector( const Sequence< Sequence< Type > >& rIn )
+std::vector< std::vector< Type > > lcl_convertSequenceSequenceToVectorVector( const Sequence< Sequence< Type > >& rIn )
{
- vector< vector< Type > > aRet;
- sal_Int32 nOuterCount = rIn.getLength();
- if( nOuterCount )
- {
- aRet.resize(nOuterCount);
- for( sal_Int32 nN=0; nN<nOuterCount; nN++)
- aRet[nN]= comphelper::sequenceToContainer<vector< Type >>( rIn[nN] );
- }
+ std::vector< std::vector< Type > > aRet;
+ aRet.reserve(rIn.getLength());
+ std::transform(rIn.begin(), rIn.end(), std::back_inserter(aRet),
+ [](auto& s) { return comphelper::sequenceToContainer<std::vector<Type>>(s); });
return aRet;
}
-std::vector< Sequence< OUString > > lcl_convertComplexAnyVectorToStringSequence( const vector< vector< uno::Any > >& rIn )
+Sequence< Sequence< OUString > > lcl_convertComplexAnyVectorToStringSequence( const std::vector< std::vector< uno::Any > >& rIn )
{
- std::vector< Sequence< OUString > > aRet;
- sal_Int32 nOuterCount = rIn.size();
- if( nOuterCount )
- {
- aRet.resize(nOuterCount);
- for( sal_Int32 nN=0; nN<nOuterCount; nN++)
- aRet[nN] = comphelper::containerToSequence(lcl_AnyToStringSequence( rIn[nN] ));
- }
- return aRet;
+ return CommonFunctors::convertToSequence(
+ rIn,
+ [](auto& v) { return CommonFunctors::convertToSequence(v, CommonFunctors::ToString()); });
}
-vector< vector< uno::Any > > lcl_convertComplexStringSequenceToAnyVector( const Sequence< Sequence< OUString > >& rIn )
+std::vector< std::vector< uno::Any > > lcl_convertComplexStringSequenceToAnyVector( const Sequence< Sequence< OUString > >& rIn )
{
- vector< vector< uno::Any > > aRet;
- sal_Int32 nOuterCount = rIn.getLength();
- aRet.reserve(nOuterCount);
- for (sal_Int32 nN = 0; nN < nOuterCount; nN++)
- aRet.push_back( lcl_StringToAnyVector( rIn[nN] ) );
+ std::vector< std::vector< uno::Any > > aRet;
+ aRet.reserve(rIn.getLength());
+ std::transform(rIn.begin(), rIn.end(), std::back_inserter(aRet),
+ [](auto& s) { return lcl_StringToAnyVector(s); });
return aRet;
}
@@ -1337,14 +1322,9 @@ sal_Int32 SplitCategoriesProvider_ForComplexDescriptions::getLevelCount() const
}
uno::Sequence< OUString > SplitCategoriesProvider_ForComplexDescriptions::getStringsForLevel( sal_Int32 nLevel ) const
{
- uno::Sequence< OUString > aResult;
if( nLevel < lcl_getInnerLevelCount( m_rComplexDescriptions ) )
- {
- aResult.realloc( m_rComplexDescriptions.size() );
- transform( m_rComplexDescriptions.begin(), m_rComplexDescriptions.end(),
- aResult.getArray(), lcl_getStringFromLevelVector(nLevel) );
- }
- return aResult;
+ return CommonFunctors::convertToSequence(m_rComplexDescriptions, lcl_getStringFromLevelVector(nLevel));
+ return {};
}
}//anonymous namespace
@@ -1352,17 +1332,17 @@ uno::Sequence< OUString > SplitCategoriesProvider_ForComplexDescriptions::getStr
// ____ XDateCategories ____
Sequence< double > SAL_CALL InternalDataProvider::getDateCategories()
{
- double fNan = InternalDataProvider::getNotANumber();
- double fValue = fNan;
- vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ const std::vector< std::vector< uno::Any > > & aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
sal_Int32 nCount = aCategories.size();
Sequence< double > aDoubles( nCount );
+ auto aDoublesRange = asNonConstRange(aDoubles);
sal_Int32 nN=0;
for (auto const& category : aCategories)
{
- if( !( !category.empty() && (category[0]>>=fValue) ) )
- fValue = fNan;
- aDoubles[nN++]=fValue;
+ double fValue;
+ if( category.empty() || !(category[0]>>=fValue) )
+ fValue = std::numeric_limits<double>::quiet_NaN();
+ aDoublesRange[nN++]=fValue;
}
return aDoubles;
}
@@ -1370,9 +1350,9 @@ Sequence< double > SAL_CALL InternalDataProvider::getDateCategories()
void SAL_CALL InternalDataProvider::setDateCategories( const Sequence< double >& rDates )
{
sal_Int32 nCount = rDates.getLength();
- vector< vector< uno::Any > > aNewCategories;
+ std::vector< std::vector< uno::Any > > aNewCategories;
aNewCategories.reserve(nCount);
- vector< uno::Any > aSingleLabel(1);
+ std::vector< uno::Any > aSingleLabel(1);
for(sal_Int32 nN=0; nN<nCount; ++nN )
{
@@ -1381,9 +1361,9 @@ void SAL_CALL InternalDataProvider::setDateCategories( const Sequence< double >&
}
if( m_bDataInColumns )
- m_aInternalData.setComplexRowLabels( aNewCategories );
+ m_aInternalData.setComplexRowLabels( std::move(aNewCategories) );
else
- m_aInternalData.setComplexColumnLabels( aNewCategories );
+ m_aInternalData.setComplexColumnLabels( std::move(aNewCategories) );
}
// ____ XAnyDescriptionAccess ____
@@ -1407,7 +1387,7 @@ void SAL_CALL InternalDataProvider::setAnyColumnDescriptions( const Sequence< Se
// ____ XComplexDescriptionAccess ____
Sequence< Sequence< OUString > > SAL_CALL InternalDataProvider::getComplexRowDescriptions()
{
- return comphelper::containerToSequence(lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexRowLabels() ));
+ return lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexRowLabels() );
}
void SAL_CALL InternalDataProvider::setComplexRowDescriptions( const Sequence< Sequence< OUString > >& aRowDescriptions )
{
@@ -1415,7 +1395,7 @@ void SAL_CALL InternalDataProvider::setComplexRowDescriptions( const Sequence< S
}
Sequence< Sequence< OUString > > SAL_CALL InternalDataProvider::getComplexColumnDescriptions()
{
- return comphelper::containerToSequence(lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexColumnLabels() ));
+ return lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexColumnLabels() );
}
void SAL_CALL InternalDataProvider::setComplexColumnDescriptions( const Sequence< Sequence< OUString > >& aColumnDescriptions )
{
@@ -1435,30 +1415,30 @@ void SAL_CALL InternalDataProvider::setData( const Sequence< Sequence< double >
void SAL_CALL InternalDataProvider::setRowDescriptions( const Sequence< OUString >& aRowDescriptions )
{
- vector< vector< uno::Any > > aComplexDescriptions( aRowDescriptions.getLength() );
- transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aRowDescriptions.getConstArray(),
+ std::vector< std::vector< uno::Any > > aComplexDescriptions( aRowDescriptions.getLength() );
+ transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aRowDescriptions.begin(),
aComplexDescriptions.begin(), lcl_setAnyAtLevelFromStringSequence(0) );
- m_aInternalData.setComplexRowLabels( aComplexDescriptions );
+ m_aInternalData.setComplexRowLabels( std::move(aComplexDescriptions) );
}
void SAL_CALL InternalDataProvider::setColumnDescriptions( const Sequence< OUString >& aColumnDescriptions )
{
- vector< vector< uno::Any > > aComplexDescriptions( aColumnDescriptions.getLength() );
- transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aColumnDescriptions.getConstArray(),
+ std::vector< std::vector< uno::Any > > aComplexDescriptions( aColumnDescriptions.getLength() );
+ transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aColumnDescriptions.begin(),
aComplexDescriptions.begin(), lcl_setAnyAtLevelFromStringSequence(0) );
- m_aInternalData.setComplexColumnLabels( aComplexDescriptions );
+ m_aInternalData.setComplexColumnLabels( std::move(aComplexDescriptions) );
}
Sequence< OUString > SAL_CALL InternalDataProvider::getRowDescriptions()
{
- vector< vector< uno::Any > > aComplexLabels( m_aInternalData.getComplexRowLabels() );
+ const std::vector< std::vector< uno::Any > > & aComplexLabels( m_aInternalData.getComplexRowLabels() );
SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
return ExplicitCategoriesProvider::getExplicitSimpleCategories( aProvider );
}
Sequence< OUString > SAL_CALL InternalDataProvider::getColumnDescriptions()
{
- vector< vector< uno::Any > > aComplexLabels( m_aInternalData.getComplexColumnLabels() );
+ const std::vector< std::vector< uno::Any > > & aComplexLabels( m_aInternalData.getComplexColumnLabels() );
SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
return ExplicitCategoriesProvider::getExplicitSimpleCategories( aProvider );
}
@@ -1476,9 +1456,7 @@ void SAL_CALL InternalDataProvider::removeChartDataChangeEventListener(
double SAL_CALL InternalDataProvider::getNotANumber()
{
- double fNan;
- ::rtl::math::setNan( & fNan );
- return fNan;
+ return std::numeric_limits<double>::quiet_NaN();
}
sal_Bool SAL_CALL InternalDataProvider::isNotANumber( double nNumber )
diff --git a/chart2/source/tools/LabeledDataSequence.cxx b/chart2/source/tools/LabeledDataSequence.cxx
index c3a896b22ff6..bf7b13443d1d 100644
--- a/chart2/source/tools/LabeledDataSequence.cxx
+++ b/chart2/source/tools/LabeledDataSequence.cxx
@@ -20,7 +20,7 @@
#include <LabeledDataSequence.hxx>
#include <ModifyListenerHelper.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
namespace com::sun::star::uno { class XComponentContext; }
@@ -33,28 +33,50 @@ namespace chart
{
LabeledDataSequence::LabeledDataSequence() :
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{}
LabeledDataSequence::LabeledDataSequence(
- const uno::Reference< chart2::data::XDataSequence > & rValues ) :
- m_xData( rValues ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ uno::Reference< chart2::data::XDataSequence > xValues ) :
+ m_xData(std::move( xValues )),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
ModifyListenerHelper::addListener( m_xData, m_xModifyEventForwarder );
}
LabeledDataSequence::LabeledDataSequence(
- const uno::Reference< chart2::data::XDataSequence > & rValues,
- const uno::Reference< chart2::data::XDataSequence > & rLabel ) :
- m_xData( rValues ),
- m_xLabel( rLabel ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ uno::Reference< chart2::data::XDataSequence > xValues,
+ uno::Reference< chart2::data::XDataSequence > xLabel ) :
+ m_xData(std::move( xValues )),
+ m_xLabel(std::move( xLabel )),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
ModifyListenerHelper::addListener( m_xData, m_xModifyEventForwarder );
ModifyListenerHelper::addListener( m_xLabel, m_xModifyEventForwarder );
}
+LabeledDataSequence::LabeledDataSequence( const LabeledDataSequence& rSource ) :
+ impl::LabeledDataSequence_Base(),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
+{
+ uno::Reference< chart2::data::XDataSequence > xNewValues( rSource.m_xData );
+ uno::Reference< chart2::data::XDataSequence > xNewLabel( rSource.m_xLabel );
+
+ uno::Reference< util::XCloneable > xLabelCloneable( rSource.m_xLabel, uno::UNO_QUERY );
+ if( xLabelCloneable.is())
+ xNewLabel.set( xLabelCloneable->createClone(), uno::UNO_QUERY );
+
+ uno::Reference< util::XCloneable > xValuesCloneable( rSource.m_xData, uno::UNO_QUERY );
+ if( xValuesCloneable.is())
+ xNewValues.set( xValuesCloneable->createClone(), uno::UNO_QUERY );
+
+ m_xData = xNewValues;
+ m_xLabel = xNewLabel;
+
+ ModifyListenerHelper::addListener( m_xData, m_xModifyEventForwarder );
+ ModifyListenerHelper::addListener( m_xLabel, m_xModifyEventForwarder );
+}
+
LabeledDataSequence::~LabeledDataSequence()
{
if( m_xModifyEventForwarder.is())
@@ -120,28 +142,12 @@ uno::Reference< util::XCloneable > SAL_CALL LabeledDataSequence::createClone()
// ____ XModifyBroadcaster ____
void SAL_CALL LabeledDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL LabeledDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
OUString SAL_CALL LabeledDataSequence::getImplementationName()
diff --git a/chart2/source/tools/LegendHelper.cxx b/chart2/source/tools/LegendHelper.cxx
index 6fbd6bf63143..2c52f136398d 100644
--- a/chart2/source/tools/LegendHelper.cxx
+++ b/chart2/source/tools/LegendHelper.cxx
@@ -18,12 +18,14 @@
*/
#include <LegendHelper.hxx>
+#include <Legend.hxx>
#include <ChartModel.hxx>
+#include <Diagram.hxx>
#include <com/sun/star/chart/ChartLegendExpansion.hpp>
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -31,31 +33,30 @@ using ::com::sun::star::uno::Reference;
namespace chart
{
-Reference< chart2::XLegend > LegendHelper::showLegend( ChartModel& rModel
+rtl::Reference< Legend > LegendHelper::showLegend( ChartModel& rModel
, const uno::Reference< uno::XComponentContext >& xContext )
{
- uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( rModel, xContext, true );
- uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY );
- if( xProp.is())
+ rtl::Reference< Legend > xLegend = LegendHelper::getLegend( rModel, xContext, true );
+ if( xLegend.is())
{
- xProp->setPropertyValue( "Show", uno::Any(true) );
+ xLegend->setPropertyValue( "Show", uno::Any(true) );
chart2::RelativePosition aRelativePosition;
- if( !(xProp->getPropertyValue( "RelativePosition") >>= aRelativePosition) )
+ if( !(xLegend->getPropertyValue( "RelativePosition") >>= aRelativePosition) )
{
chart2::LegendPosition ePos = chart2::LegendPosition_LINE_END;
- if( !(xProp->getPropertyValue( "AnchorPosition") >>= ePos ) )
- xProp->setPropertyValue( "AnchorPosition", uno::Any( ePos ));
+ if( !(xLegend->getPropertyValue( "AnchorPosition") >>= ePos ) )
+ xLegend->setPropertyValue( "AnchorPosition", uno::Any( ePos ));
css::chart::ChartLegendExpansion eExpansion =
( ePos == chart2::LegendPosition_LINE_END ||
ePos == chart2::LegendPosition_LINE_START )
? css::chart::ChartLegendExpansion_HIGH
: css::chart::ChartLegendExpansion_WIDE;
- if( !(xProp->getPropertyValue( "Expansion") >>= eExpansion ) )
- xProp->setPropertyValue( "Expansion", uno::Any( eExpansion ));
+ if( !(xLegend->getPropertyValue( "Expansion") >>= eExpansion ) )
+ xLegend->setPropertyValue( "Expansion", uno::Any( eExpansion ));
- xProp->setPropertyValue( "RelativePosition", uno::Any());
+ xLegend->setPropertyValue( "RelativePosition", uno::Any());
}
}
@@ -64,31 +65,29 @@ Reference< chart2::XLegend > LegendHelper::showLegend( ChartModel& rModel
void LegendHelper::hideLegend( ChartModel& rModel )
{
- uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( rModel, nullptr );
- uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY );
- if( xProp.is())
+ rtl::Reference< Legend > xLegend = LegendHelper::getLegend( rModel, nullptr );
+ if( xLegend.is())
{
- xProp->setPropertyValue( "Show", uno::Any(false) );
+ xLegend->setPropertyValue( "Show", uno::Any(false) );
}
}
-uno::Reference< chart2::XLegend > LegendHelper::getLegend(
+rtl::Reference< Legend > LegendHelper::getLegend(
ChartModel& rModel
, const uno::Reference< uno::XComponentContext >& xContext
, bool bCreate )
{
- uno::Reference< chart2::XLegend > xResult;
+ rtl::Reference< Legend > xResult;
try
{
- uno::Reference< chart2::XDiagram > xDia( rModel.getFirstDiagram());
+ rtl::Reference< Diagram > xDia( rModel.getFirstChartDiagram());
if( xDia.is() )
{
- xResult.set( xDia->getLegend() );
+ xResult = xDia->getLegend2();
if( bCreate && !xResult.is() && xContext.is() )
{
- xResult.set( xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.Legend", xContext ), uno::UNO_QUERY );
+ xResult = new Legend();
xDia->setLegend( xResult );
}
}
@@ -105,7 +104,7 @@ uno::Reference< chart2::XLegend > LegendHelper::getLegend(
return xResult;
}
-bool LegendHelper::hasLegend( const uno::Reference< chart2::XDiagram > & xDiagram )
+bool LegendHelper::hasLegend( const rtl::Reference< Diagram > & xDiagram )
{
bool bReturn = false;
if( xDiagram.is())
diff --git a/chart2/source/tools/LifeTime.cxx b/chart2/source/tools/LifeTime.cxx
index 5817db73a2e1..45550b93efdd 100644
--- a/chart2/source/tools/LifeTime.cxx
+++ b/chart2/source/tools/LifeTime.cxx
@@ -20,11 +20,14 @@
#include <LifeTime.hxx>
#include <osl/diagnose.h>
+#include <com/sun/star/document/XStorageChangeListener.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/util/CloseVetoException.hpp>
#include <com/sun/star/util/XCloseListener.hpp>
#include <com/sun/star/util/XCloseable.hpp>
-#include <tools/diagnose_ex.h>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
using namespace ::com::sun::star;
@@ -33,8 +36,7 @@ namespace apphelper
{
LifeTimeManager::LifeTimeManager( lang::XComponent* pComponent )
- : m_aListenerContainer( m_aAccessMutex )
- , m_pComponent(pComponent)
+ : m_pComponent(pComponent)
{
m_bDisposed = false;
m_bInDispose = false;
@@ -85,7 +87,7 @@ void LifeTimeManager::impl_registerApiCall(bool bLongLastingCall)
m_aNoLongLastingCallCountCondition.reset();
}
-void LifeTimeManager::impl_unregisterApiCall(bool bLongLastingCall)
+void LifeTimeManager::impl_unregisterApiCall(std::unique_lock<std::mutex>& rGuard, bool bLongLastingCall)
{
//Mutex needs to be acquired exactly once
//mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
@@ -101,7 +103,7 @@ void LifeTimeManager::impl_unregisterApiCall(bool bLongLastingCall)
if( m_nAccessCount== 0)
{
m_aNoAccessCountCondition.set();
- impl_apiCallCountReachedNull();
+ impl_apiCallCountReachedNull(rGuard);
}
}
@@ -110,7 +112,7 @@ bool LifeTimeManager::dispose()
{
//hold no mutex
{
- osl::MutexGuard aGuard( m_aAccessMutex );
+ std::unique_lock aGuard( m_aAccessMutex );
if( m_bDisposed || m_bInDispose )
{
@@ -122,23 +124,19 @@ bool LifeTimeManager::dispose()
//adding any listener is not allowed anymore
//new calls will not be accepted
//still running calls have the freedom to finish their work without crash
- }
- //no mutex is acquired
- //--do the disposing of listeners after calling this method
- {
uno::Reference< lang::XComponent > xComponent(m_pComponent);
if(xComponent.is())
{
// notify XCLoseListeners
lang::EventObject aEvent( xComponent );
- m_aListenerContainer.disposeAndClear( aEvent );
+ m_aCloseListeners.disposeAndClear( aGuard, aEvent );
+ m_aModifyListeners.disposeAndClear( aGuard, aEvent );
+ m_aStorageChangeListeners.disposeAndClear( aGuard, aEvent );
+ m_aEventListeners.disposeAndClear( aGuard, aEvent );
+ m_aSelectionChangeListeners.disposeAndClear( aGuard, aEvent );
}
- }
- //no mutex is acquired
- {
- osl::MutexGuard aGuard( m_aAccessMutex );
OSL_ENSURE( !m_bDisposed, "dispose was called already" );
m_bDisposed = true;
}
@@ -189,7 +187,7 @@ bool CloseableLifeTimeManager::g_close_startTryClose(bool bDeliverOwnership)
{
//no mutex is allowed to be acquired
{
- osl::MutexGuard aGuard( m_aAccessMutex );
+ std::unique_lock aGuard( m_aAccessMutex );
if( impl_isDisposedOrClosed(false) )
return false;
@@ -217,19 +215,16 @@ bool CloseableLifeTimeManager::g_close_startTryClose(bool bDeliverOwnership)
uno::Reference< util::XCloseable > xCloseable(m_pCloseable);
if(xCloseable.is())
{
+ std::unique_lock aGuard( m_aAccessMutex );
//--call queryClosing on all registered close listeners
- ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer(
- cppu::UnoType<util::XCloseListener>::get());
- if( pIC )
+ if( m_aCloseListeners.getLength(aGuard) )
{
lang::EventObject aEvent( xCloseable );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- uno::Reference< util::XCloseListener > xCloseListener( aIt.next(), uno::UNO_QUERY );
- if(xCloseListener.is())
- xCloseListener->queryClosing( aEvent, bDeliverOwnership );
- }
+ m_aCloseListeners.forEach(aGuard,
+ [&aEvent, bDeliverOwnership](const uno::Reference<util::XCloseListener>& l)
+ {
+ l->queryClosing(aEvent, bDeliverOwnership);
+ });
}
}
}
@@ -245,7 +240,7 @@ bool CloseableLifeTimeManager::g_close_startTryClose(bool bDeliverOwnership)
void CloseableLifeTimeManager::g_close_endTryClose(bool bDeliverOwnership )
{
//this method is called, if the try to close was not successful
- osl::MutexGuard aGuard( m_aAccessMutex );
+ std::unique_lock aGuard( m_aAccessMutex );
impl_setOwnership( bDeliverOwnership, false );
m_bInTryClose = false;
@@ -253,7 +248,7 @@ void CloseableLifeTimeManager::g_close_endTryClose(bool bDeliverOwnership )
//Mutex needs to be acquired exactly once
//mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
- impl_unregisterApiCall(false);
+ impl_unregisterApiCall(aGuard, false);
}
void CloseableLifeTimeManager::g_close_isNeedToCancelLongLastingCalls( bool bDeliverOwnership, util::CloseVetoException const & ex )
@@ -263,7 +258,7 @@ void CloseableLifeTimeManager::g_close_isNeedToCancelLongLastingCalls( bool bDel
//it returns true, if some longlasting calls are running, which might be cancelled
//it throws the given exception, if long calls are running but not cancelable
- osl::MutexGuard aGuard( m_aAccessMutex );
+ std::unique_lock aGuard( m_aAccessMutex );
//this count cannot grow after try of close has started, because we wait in all those methods for end of try closing
if( !m_nLongLastingCallCount )
return;
@@ -275,7 +270,7 @@ void CloseableLifeTimeManager::g_close_isNeedToCancelLongLastingCalls( bool bDel
//Mutex needs to be acquired exactly once
//mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
- impl_unregisterApiCall(false);
+ impl_unregisterApiCall(aGuard, false);
throw ex;
}
@@ -283,15 +278,15 @@ void CloseableLifeTimeManager::g_close_isNeedToCancelLongLastingCalls( bool bDel
void CloseableLifeTimeManager::g_close_endTryClose_doClose()
{
//this method is called, if the try to close was successful
- osl::MutexGuard aGuard( m_aAccessMutex );
+ std::unique_lock aGuard( m_aAccessMutex );
m_bInTryClose = false;
m_aEndTryClosingCondition.set();
//Mutex needs to be acquired exactly once
//mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
- impl_unregisterApiCall(false);
- impl_doClose();
+ impl_unregisterApiCall(aGuard, false);
+ impl_doClose(aGuard);
}
void CloseableLifeTimeManager::impl_setOwnership( bool bDeliverOwnership, bool bMyVeto )
@@ -299,15 +294,15 @@ void CloseableLifeTimeManager::impl_setOwnership( bool bDeliverOwnership, bool b
m_bOwnership = bDeliverOwnership && bMyVeto;
}
-void CloseableLifeTimeManager::impl_apiCallCountReachedNull()
+void CloseableLifeTimeManager::impl_apiCallCountReachedNull(std::unique_lock<std::mutex>& rGuard)
{
//Mutex needs to be acquired exactly once
//mutex will be released inbetween in impl_doClose()
if( m_pCloseable && m_bOwnership )
- impl_doClose();
+ impl_doClose(rGuard);
}
-void CloseableLifeTimeManager::impl_doClose()
+void CloseableLifeTimeManager::impl_doClose(std::unique_lock<std::mutex>& rGuard)
{
//Mutex needs to be acquired exactly once before calling impl_doClose()
@@ -318,28 +313,17 @@ void CloseableLifeTimeManager::impl_doClose()
m_bClosed = true;
- NegativeGuard< osl::Mutex > aNegativeGuard( m_aAccessMutex );
- //mutex is not acquired, mutex will be reacquired at the end of this method automatically
-
uno::Reference< util::XCloseable > xCloseable;
+ xCloseable.set(m_pCloseable);
try
{
- xCloseable.set(m_pCloseable);
if(xCloseable.is())
{
//--call notifyClosing on all registered close listeners
- ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer(
- cppu::UnoType<util::XCloseListener>::get());
- if( pIC )
+ if( m_aCloseListeners.getLength(rGuard) )
{
lang::EventObject aEvent( xCloseable );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- uno::Reference< util::XCloseListener > xListener( aIt.next(), uno::UNO_QUERY );
- if( xListener.is() )
- xListener->notifyClosing( aEvent );
- }
+ m_aCloseListeners.notifyEach(rGuard, &util::XCloseListener::notifyClosing, aEvent);
}
}
}
@@ -348,6 +332,7 @@ void CloseableLifeTimeManager::impl_doClose()
DBG_UNHANDLED_EXCEPTION("chart2");
}
+ rGuard.unlock();
if(xCloseable.is())
{
uno::Reference< lang::XComponent > xComponent( xCloseable, uno::UNO_QUERY );
@@ -357,18 +342,18 @@ void CloseableLifeTimeManager::impl_doClose()
xComponent->dispose();
}
}
- //mutex will be reacquired in destructor of aNegativeGuard
+ rGuard.lock();
}
void CloseableLifeTimeManager::g_addCloseListener( const uno::Reference< util::XCloseListener > & xListener )
{
- osl::MutexGuard aGuard( m_aAccessMutex );
+ std::unique_lock aGuard( m_aAccessMutex );
//Mutex needs to be acquired exactly once; will be released inbetween
if( !impl_canStartApiCall() )
return;
//mutex is acquired
- m_aListenerContainer.addInterface( cppu::UnoType<util::XCloseListener>::get(),xListener );
+ m_aCloseListeners.addInterface( aGuard, xListener );
m_bOwnership = false;
}
@@ -389,9 +374,9 @@ bool CloseableLifeTimeManager::impl_canStartApiCall()
//we need to wait for his end because the result of the preceding call
//is relevant for our behaviour here
- m_aAccessMutex.release();
+ m_aAccessMutex.unlock();
m_aEndTryClosingCondition.wait(); //@todo??? this may block??? try closing
- m_aAccessMutex.acquire();
+ m_aAccessMutex.lock();
if( m_bDisposed || m_bInDispose || m_bClosed )
return false; //return if closed already
}
@@ -424,12 +409,13 @@ LifeTimeGuard::~LifeTimeGuard()
try
{
//do acquire the mutex if it was cleared before
- osl::MutexGuard g(m_rManager.m_aAccessMutex);
+ if (!m_guard.owns_lock())
+ m_guard.lock();
if(m_bCallRegistered)
{
//Mutex needs to be acquired exactly once
//mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
- m_rManager.impl_unregisterApiCall(m_bLongLastingCallRegistered);
+ m_rManager.impl_unregisterApiCall(m_guard, m_bLongLastingCallRegistered);
}
}
catch( uno::Exception& ex )
diff --git a/chart2/source/tools/LinePropertiesHelper.cxx b/chart2/source/tools/LinePropertiesHelper.cxx
index 227ec99b6383..b3c5fc6ccf53 100644
--- a/chart2/source/tools/LinePropertiesHelper.cxx
+++ b/chart2/source/tools/LinePropertiesHelper.cxx
@@ -22,8 +22,10 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <tools/color.hxx>
using namespace ::com::sun::star;
@@ -79,16 +81,23 @@ void LinePropertiesHelper::AddPropertiesToVector(
cppu::UnoType<drawing::LineJoint>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT );
+
+ rOutProperties.emplace_back( "LineCap",
+ PROP_LINE_CAP,
+ cppu::UnoType<drawing::LineCap>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
}
void LinePropertiesHelper::AddDefaultsToMap(
::chart::tPropertyValueMap & rOutMap )
{
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_STYLE, drawing::LineStyle_SOLID );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_WIDTH, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_COLOR, 0x000000 ); // black
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_LINE_TRANSPARENCE, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_WIDTH, sal_Int32(0) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_COLOR, COL_BLACK );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_TRANSPARENCE, sal_Int16(0) );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_JOINT, drawing::LineJoint_ROUND );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_CAP, drawing::LineCap_BUTT );
}
bool LinePropertiesHelper::IsLineVisible( const css::uno::Reference<
diff --git a/chart2/source/tools/LinearRegressionCurveCalculator.cxx b/chart2/source/tools/LinearRegressionCurveCalculator.cxx
index 9cf3492d8e8e..ee836555b1e4 100644
--- a/chart2/source/tools/LinearRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/LinearRegressionCurveCalculator.cxx
@@ -24,8 +24,7 @@ using namespace ::com::sun::star;
namespace chart
{
-LinearRegressionCurveCalculator::LinearRegressionCurveCalculator() :
- PolynomialRegressionCurveCalculator()
+LinearRegressionCurveCalculator::LinearRegressionCurveCalculator()
{}
LinearRegressionCurveCalculator::~LinearRegressionCurveCalculator()
@@ -35,13 +34,15 @@ void LinearRegressionCurveCalculator::setRegressionProperties(
sal_Int32 /*aDegree*/,
sal_Bool aForceIntercept,
double aInterceptValue,
- sal_Int32 aPeriod )
+ sal_Int32 aPeriod,
+ sal_Int32 /*nMovingType*/)
{
PolynomialRegressionCurveCalculator::setRegressionProperties(
1,
aForceIntercept,
aInterceptValue,
- aPeriod);
+ aPeriod,
+ 0);
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL LinearRegressionCurveCalculator::getCurveValues(
@@ -55,11 +56,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL LinearRegressionCurveCalculator:
isLinearScaling( xScalingY ))
{
// optimize result
- uno::Sequence< geometry::RealPoint2D > aResult( 2 );
- aResult[0].X = min;
- aResult[0].Y = getCurveValue( min );
- aResult[1].X = max;
- aResult[1].Y = getCurveValue( max );
+ uno::Sequence< geometry::RealPoint2D > aResult{ { min, getCurveValue( min ) },
+ { max, getCurveValue( max ) } };
return aResult;
}
diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
index c09eab50975c..5e68235d14cd 100644
--- a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
@@ -30,11 +30,9 @@ namespace chart
{
LogarithmicRegressionCurveCalculator::LogarithmicRegressionCurveCalculator() :
- m_fSlope( 0.0 ),
- m_fIntercept( 0.0 )
+ m_fSlope( std::numeric_limits<double>::quiet_NaN() ),
+ m_fIntercept( std::numeric_limits<double>::quiet_NaN() )
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
}
LogarithmicRegressionCurveCalculator::~LogarithmicRegressionCurveCalculator()
@@ -53,9 +51,9 @@ void SAL_CALL LogarithmicRegressionCurveCalculator::recalculateRegression(
const size_t nMax = aValues.first.size();
if( nMax <= 1 ) // at least 2 points
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
- ::rtl::math::setNan( & m_fCorrelationCoefficient );
+ m_fSlope = std::numeric_limits<double>::quiet_NaN();
+ m_fIntercept = std::numeric_limits<double>::quiet_NaN();
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();
return;
}
@@ -89,16 +87,13 @@ void SAL_CALL LogarithmicRegressionCurveCalculator::recalculateRegression(
double SAL_CALL LogarithmicRegressionCurveCalculator::getCurveValue( double x )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
if( ! ( std::isnan( m_fSlope ) ||
std::isnan( m_fIntercept )))
{
- fResult = m_fSlope * log( x ) + m_fIntercept;
+ return m_fSlope * log( x ) + m_fIntercept;
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL LogarithmicRegressionCurveCalculator::getCurveValues(
@@ -112,11 +107,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL LogarithmicRegressionCurveCalcul
isLinearScaling( xScalingY ))
{
// optimize result
- uno::Sequence< geometry::RealPoint2D > aResult( 2 );
- aResult[0].X = min;
- aResult[0].Y = getCurveValue( min );
- aResult[1].X = max;
- aResult[1].Y = getCurveValue( max );
+ uno::Sequence< geometry::RealPoint2D > aResult{ { min, getCurveValue( min ) },
+ { max, getCurveValue( max ) } };
return aResult;
}
@@ -156,17 +148,17 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
{
if( m_fSlope < 0.0 )
{
- aTmpBuf.append( OUStringChar(aMinusSign) ).append( " " );
+ aTmpBuf.append( OUStringChar(aMinusSign) + " " );
}
if( bHasSlope )
{
OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fSlope), pValueLength );
if ( aValueString != "1" ) // aValueString may be rounded to 1 if nValueLength is small
{
- aTmpBuf.append( aValueString ).append( " " );
+ aTmpBuf.append( aValueString + " " );
}
}
- aTmpBuf.append( "ln(" ).append( mXName ).append( ") " );
+ aTmpBuf.append( "ln(" + mXName + ") " );
addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
aTmpBuf.truncate();
@@ -175,7 +167,7 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
}
// add intercept value
if( m_fIntercept < 0.0 )
- aTmpBuf.append( OUStringChar(aMinusSign) ).append( " " );
+ aTmpBuf.append( OUStringChar(aMinusSign) + " " );
OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength );
if ( aValueString != "0" ) // aValueString may be rounded to 0 if nValueLength is small
{
@@ -183,7 +175,7 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
}
- if ( aBuf.toString() == (mYName + " = ") )
+ if ( std::u16string_view(aBuf) == Concat2View(mYName + " = ") )
aBuf.append( "0" );
return aBuf.makeStringAndClear();
diff --git a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
index c9821343b4ec..ac67a12e5e9b 100644
--- a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
@@ -20,7 +20,9 @@
#include <MeanValueRegressionCurveCalculator.hxx>
#include <osl/diagnose.h>
-#include <rtl/math.hxx>
+
+#include <cmath>
+#include <limits>
using namespace ::com::sun::star;
@@ -28,9 +30,8 @@ namespace chart
{
MeanValueRegressionCurveCalculator::MeanValueRegressionCurveCalculator() :
- m_fMeanValue( 0.0 )
+ m_fMeanValue( std::numeric_limits<double>::quiet_NaN() )
{
- ::rtl::math::setNan( & m_fMeanValue );
}
MeanValueRegressionCurveCalculator::~MeanValueRegressionCurveCalculator()
@@ -41,25 +42,22 @@ void SAL_CALL MeanValueRegressionCurveCalculator::recalculateRegression(
const uno::Sequence< double >& /*aXValues*/,
const uno::Sequence< double >& aYValues )
{
- const sal_Int32 nDataLength = aYValues.getLength();
- sal_Int32 nMax = nDataLength;
+ sal_Int32 nMax = aYValues.getLength();
double fSumY = 0.0;
- const double * pY = aYValues.getConstArray();
- for( sal_Int32 i = 0; i < nDataLength; ++i )
+ for (double y : aYValues)
{
- if( std::isnan( pY[i] ) ||
- std::isinf( pY[i] ))
+ if (std::isnan(y) || std::isinf(y))
--nMax;
else
- fSumY += pY[i];
+ fSumY += y;
}
m_fCorrelationCoefficient = 0.0;
if( nMax == 0 )
{
- ::rtl::math::setNan( & m_fMeanValue );
+ m_fMeanValue = std::numeric_limits<double>::quiet_NaN();
}
else
{
@@ -69,12 +67,11 @@ void SAL_CALL MeanValueRegressionCurveCalculator::recalculateRegression(
if( nMax > 1 )
{
double fErrorSum = 0.0;
- for( sal_Int32 i = 0; i < nDataLength; ++i )
+ for (double y : aYValues)
{
- if( !std::isnan( pY[i] ) &&
- !std::isinf( pY[i] ))
+ if (!std::isnan(y) && !std::isinf(y))
{
- double v = m_fMeanValue - pY[i];
+ double v = m_fMeanValue - y;
fErrorSum += (v*v);
}
}
@@ -98,11 +95,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL MeanValueRegressionCurveCalculat
if( bMaySkipPointsInCalculation )
{
// optimize result
- uno::Sequence< geometry::RealPoint2D > aResult( 2 );
- aResult[0].X = min;
- aResult[0].Y = m_fMeanValue;
- aResult[1].X = max;
- aResult[1].Y = m_fMeanValue;
+ uno::Sequence< geometry::RealPoint2D > aResult{ { min, m_fMeanValue },
+ { max, m_fMeanValue } };
return aResult;
}
diff --git a/chart2/source/tools/MediaDescriptorHelper.cxx b/chart2/source/tools/MediaDescriptorHelper.cxx
index 73c326fdcb38..bd217b0fbf8c 100644
--- a/chart2/source/tools/MediaDescriptorHelper.cxx
+++ b/chart2/source/tools/MediaDescriptorHelper.cxx
@@ -33,21 +33,23 @@ MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence<
beans::PropertyValue > & rMediaDescriptor )
: m_aModelProperties(rMediaDescriptor.getLength())
{
+ auto aModelPropertiesRange = asNonConstRange(m_aModelProperties);
css::uno::Sequence< css::beans::PropertyValue >
aRegularProperties(rMediaDescriptor.getLength()); //these are the properties which are described in service com.sun.star.document.MediaDescriptor and not marked as deprecated
+ auto aRegularPropertiesRange = asNonConstRange(aRegularProperties);
impl_init();
sal_Int32 nRegularCount = 0;
sal_Int32 nModelCount = 0;
- auto addRegularProp = [&aRegularProperties, &nRegularCount](const beans::PropertyValue& rRegularProp)
+ auto addRegularProp = [&aRegularPropertiesRange, &nRegularCount](const beans::PropertyValue& rRegularProp)
{
- aRegularProperties[nRegularCount] = rRegularProp;
+ aRegularPropertiesRange[nRegularCount] = rRegularProp;
++nRegularCount;
};
- auto addModelProp = [this, &nModelCount, &addRegularProp](const beans::PropertyValue& rModelProp)
+ auto addModelProp = [&aModelPropertiesRange, &nModelCount, &addRegularProp](const beans::PropertyValue& rModelProp)
{
addRegularProp(rModelProp);
- m_aModelProperties[nModelCount] = rModelProp;
+ aModelPropertiesRange[nModelCount] = rModelProp;
++nModelCount;
};
diff --git a/chart2/source/tools/ModifyListenerCallBack.cxx b/chart2/source/tools/ModifyListenerCallBack.cxx
new file mode 100644
index 000000000000..037ee7a7820d
--- /dev/null
+++ b/chart2/source/tools/ModifyListenerCallBack.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/.
+ *
+ * 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 <ModifyListenerCallBack.hxx>
+#include <comphelper/compbase.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+namespace chart {
+
+typedef comphelper::WeakComponentImplHelper< css::util::XModifyListener >
+ ModifyListenerCallBack_Base;
+
+class ModifyListenerCallBack_impl
+ : public ModifyListenerCallBack_Base
+{
+public:
+ explicit ModifyListenerCallBack_impl( const Link<void*,void>& rCallBack );
+
+ void startListening( const Reference< util::XModifyBroadcaster >& xBroadcaster );
+ void stopListening();
+
+ //XModifyListener
+ virtual void SAL_CALL modified( const lang::EventObject& aEvent ) override;
+
+ //XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& Source ) override;
+
+ using ::comphelper::WeakComponentImplHelperBase::disposing;
+
+private:
+ Link<void*,void> m_aLink;//will be called on modify
+ Reference< util::XModifyBroadcaster > m_xBroadcaster;//broadcaster to listen at
+};
+
+ModifyListenerCallBack_impl::ModifyListenerCallBack_impl( const Link<void*,void>& rCallBack )
+ : m_aLink( rCallBack )
+{
+}
+
+//XModifyListener
+void SAL_CALL ModifyListenerCallBack_impl::modified( const lang::EventObject& /*aEvent*/ )
+{
+ m_aLink.Call(nullptr);
+}
+
+//XEventListener
+void SAL_CALL ModifyListenerCallBack_impl::disposing( const lang::EventObject& /*Source*/ )
+{
+ m_xBroadcaster.clear();
+}
+
+void ModifyListenerCallBack_impl::startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >& xBroadcaster )
+{
+ if( m_xBroadcaster == xBroadcaster )
+ return;
+
+ stopListening();
+ m_xBroadcaster = xBroadcaster;
+ if( m_xBroadcaster.is() )
+ m_xBroadcaster->addModifyListener( this );
+}
+void ModifyListenerCallBack_impl::stopListening()
+{
+ if( m_xBroadcaster.is() )
+ {
+ m_xBroadcaster->removeModifyListener( this );
+ m_xBroadcaster.clear();
+ }
+}
+
+ModifyListenerCallBack::ModifyListenerCallBack( const Link<void*,void>& rCallBack )
+ : pModifyListener_impl( new ModifyListenerCallBack_impl(rCallBack) )
+ , m_xModifyListener( pModifyListener_impl )
+{
+}
+
+ModifyListenerCallBack::~ModifyListenerCallBack()
+{
+ stopListening();
+}
+
+void ModifyListenerCallBack::startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >& xBroadcaster )
+{
+ pModifyListener_impl->startListening( xBroadcaster );
+}
+void ModifyListenerCallBack::stopListening()
+{
+ pModifyListener_impl->stopListening();
+}
+
+} // namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/ModifyListenerHelper.cxx b/chart2/source/tools/ModifyListenerHelper.cxx
index 3266af1d037e..507e79fa32e2 100644
--- a/chart2/source/tools/ModifyListenerHelper.cxx
+++ b/chart2/source/tools/ModifyListenerHelper.cxx
@@ -18,151 +18,42 @@
*/
#include <ModifyListenerHelper.hxx>
-#include <WeakListenerAdapter.hxx>
-
-#include <tools/diagnose_ex.h>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
-namespace
-{
-
-void lcl_fireModifyEvent(
- ::cppu::OBroadcastHelper const & rBroadcastHelper,
- const Reference< uno::XWeak > & xEventSource,
- const lang::EventObject * pEvent )
-{
- ::cppu::OInterfaceContainerHelper * pCntHlp = rBroadcastHelper.getContainer(
- cppu::UnoType<util::XModifyListener>::get());
- if( !pCntHlp )
- return;
-
- lang::EventObject aEventToSend;
- if( pEvent )
- aEventToSend = *pEvent;
- else
- aEventToSend.Source.set( xEventSource );
- OSL_ENSURE( aEventToSend.Source.is(), "Sending event without source" );
-
- ::cppu::OInterfaceIteratorHelper aIt( *pCntHlp );
-
- while( aIt.hasMoreElements())
- {
- Reference< util::XModifyListener > xModListener( aIt.next(), uno::UNO_QUERY );
- if( xModListener.is())
- xModListener->modified( aEventToSend );
- }
-}
-
-struct lcl_weakReferenceToSame
-{
- explicit lcl_weakReferenceToSame( const Reference< util::XModifyListener > & xModListener ) :
- m_xHardRef( xModListener )
- {}
-
- // argument type is same as tListenerMap::value_type&
- bool operator() ( const std::pair<css::uno::WeakReference< css::util::XModifyListener>,
- css::uno::Reference< css::util::XModifyListener> > & xElem )
- {
- Reference< util::XModifyListener > xWeakAsHard( xElem.first );
- if( xWeakAsHard.is())
- return (xWeakAsHard == m_xHardRef);
- return false;
- }
-
-private:
- Reference< util::XModifyListener > m_xHardRef;
-};
-
-} // anonymous namespace
-
-namespace chart::ModifyListenerHelper
-{
-
-uno::Reference< util::XModifyListener > createModifyEventForwarder()
-{
- return new ModifyEventForwarder();
-}
-
-ModifyEventForwarder::ModifyEventForwarder() :
- ::cppu::WeakComponentImplHelper<
- css::util::XModifyBroadcaster,
- css::util::XModifyListener >( m_aMutex ),
- m_aModifyListeners( m_aMutex )
+namespace chart
{
-}
-void ModifyEventForwarder::AddListener( const Reference< util::XModifyListener >& aListener )
+ModifyEventForwarder::ModifyEventForwarder()
{
- try
- {
- Reference< util::XModifyListener > xListenerToAdd( aListener );
-
- Reference< uno::XWeak > xWeak( aListener, uno::UNO_QUERY );
- if( xWeak.is())
- {
- // remember the helper class for later remove
- uno::WeakReference< util::XModifyListener > xWeakRef( aListener );
- xListenerToAdd.set( new WeakModifyListenerAdapter( xWeakRef ));
- m_aListenerMap.emplace_back( xWeakRef, xListenerToAdd );
- }
-
- m_aModifyListeners.addListener( cppu::UnoType<decltype(xListenerToAdd)>::get(), xListenerToAdd );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
-void ModifyEventForwarder::RemoveListener( const Reference< util::XModifyListener >& aListener )
-{
- try
- {
- // look up fitting helper class that has been added
- Reference< util::XModifyListener > xListenerToRemove( aListener );
- tListenerMap::iterator aIt(
- std::find_if( m_aListenerMap.begin(), m_aListenerMap.end(), lcl_weakReferenceToSame( aListener )));
- if( aIt != m_aListenerMap.end())
- {
- xListenerToRemove.set( (*aIt).second );
- // map entry is no longer needed
- m_aListenerMap.erase( aIt );
- }
-
- m_aModifyListeners.removeListener( cppu::UnoType<decltype(aListener)>::get(), xListenerToRemove );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
-void ModifyEventForwarder::DisposeAndClear( const Reference< uno::XWeak > & xSource )
-{
- ::cppu::OInterfaceContainerHelper * pCntHlp = m_aModifyListeners.getContainer(
- cppu::UnoType<util::XModifyListener>::get());
- if( pCntHlp )
- pCntHlp->disposeAndClear( lang::EventObject( xSource ) );
}
// ____ XModifyBroadcaster ____
void SAL_CALL ModifyEventForwarder::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- AddListener( aListener );
+ std::unique_lock aGuard(m_aMutex);
+
+ m_aModifyListeners.addInterface( aGuard, aListener );
}
void SAL_CALL ModifyEventForwarder::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- RemoveListener( aListener );
+ std::unique_lock aGuard(m_aMutex);
+
+ m_aModifyListeners.removeInterface( aGuard, aListener );
}
// ____ XModifyListener ____
void SAL_CALL ModifyEventForwarder::modified( const lang::EventObject& aEvent )
{
- lcl_fireModifyEvent( m_aModifyListeners, Reference< uno::XWeak >(), &aEvent );
+ std::unique_lock aGuard(m_aMutex);
+
+ if( m_aModifyListeners.getLength(aGuard) == 0 )
+ return;
+
+ m_aModifyListeners.notifyEach( aGuard, &util::XModifyListener::modified, aEvent );
}
// ____ XEventListener (base of XModifyListener) ____
@@ -172,10 +63,10 @@ void SAL_CALL ModifyEventForwarder::disposing( const lang::EventObject& /* Sourc
}
// ____ WeakComponentImplHelperBase ____
-void SAL_CALL ModifyEventForwarder::disposing()
+void ModifyEventForwarder::disposing(std::unique_lock<std::mutex>& rGuard)
{
// dispose was called at this
- DisposeAndClear( this );
+ m_aModifyListeners.disposeAndClear( rGuard, lang::EventObject( static_cast<cppu::OWeakObject*>(this) ) );
}
} // namespace chart::ModifyListenerHelper
diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
index 7774bec02a4f..f71262f738b9 100644
--- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
@@ -22,9 +22,13 @@
#include <ResId.hxx>
#include <strings.hrc>
-#include <rtl/math.hxx>
+#include <algorithm>
+#include <limits>
+
+#include <com/sun/star/chart2/MovingAverageType.hpp>
using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
namespace chart
{
@@ -40,40 +44,100 @@ void SAL_CALL MovingAverageRegressionCurveCalculator::recalculateRegression(
const uno::Sequence< double >& aXValues,
const uno::Sequence< double >& aYValues )
{
- ::rtl::math::setNan( & m_fCorrelationCoefficient );
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();
RegressionCalculationHelper::tDoubleVectorPair aValues(
RegressionCalculationHelper::cleanup(
aXValues, aYValues,
RegressionCalculationHelper::isValid()));
- const size_t aSize = aValues.first.size();
-
aYList.clear();
aXList.clear();
- for( size_t i = mPeriod - 1; i < aSize; ++i )
+ // For formulas, see
+ // https://docs.oasis-open.org/office/OpenDocument/v1.3/cs02/part3-schema/OpenDocument-v1.3-cs02-part3-schema.html#property-chart_regression-moving-type
+
+ switch (mnMovingType)
{
- double yAvg;
- yAvg = 0.0;
+ case MovingAverageType::Central:
+ {
+
+ calculateValuesCentral(std::move(aValues));
+ break;
+ }
+
+ case MovingAverageType::AveragedAbscissa:
+ {
+ calculateValues(std::move(aValues), true);
+ break;
+ }
+ case MovingAverageType::Prior:
+ default:
+ {
+ calculateValues(std::move(aValues), false);
+ break;
+ }
+ }
+}
+
+void MovingAverageRegressionCurveCalculator::calculateValuesCentral(
+ RegressionCalculationHelper::tDoubleVectorPair aValues)
+{
+ const size_t aSize = aValues.first.size();
+ if (aSize == 0)
+ return;
+ for (size_t i = mPeriod - 1; i < aSize; ++i)
+ {
+ double yAvg = 0.0;
for (sal_Int32 j = 0; j < mPeriod; j++)
{
yAvg += aValues.second[i - j];
}
yAvg /= mPeriod;
-
- double x = aValues.first[i];
aYList.push_back(yAvg);
+ }
+ sal_Int32 nPeriodLocal = (mPeriod % 2 == 0) ? (mPeriod / 2) : ((mPeriod - 1) / 2);
+ for (size_t i = nPeriodLocal; i < aSize - 1; ++i)
+ {
+ double x = aValues.first[i];
aXList.push_back(x);
}
}
+void MovingAverageRegressionCurveCalculator::calculateValues(
+ RegressionCalculationHelper::tDoubleVectorPair aValues, bool bUseXAvg)
+{
+ const size_t aSize = aValues.first.size();
+ for (size_t i = mPeriod - 1; i < aSize; ++i)
+ {
+ double xAvg = 0.0;
+ double yAvg = 0.0;
+
+ for (sal_Int32 j = 0; j < mPeriod; j++)
+ {
+ xAvg += aValues.first[i - j];
+ yAvg += aValues.second[i - j];
+ }
+ yAvg /= mPeriod;
+ xAvg /= mPeriod;
+
+ aYList.push_back(yAvg);
+ if (bUseXAvg)
+ {
+ aXList.push_back(xAvg);
+ }
+ else
+ {
+ double x = aValues.first[i];
+ aXList.push_back(x);
+ }
+ }
+}
+
double SAL_CALL MovingAverageRegressionCurveCalculator::getCurveValue( double /*x*/ )
{
- double fResult;
- rtl::math::setNan(&fResult);
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL MovingAverageRegressionCurveCalculator::getCurveValues(
@@ -82,13 +146,10 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL MovingAverageRegressionCurveCalc
const uno::Reference< chart2::XScaling >& /*xScalingY*/,
sal_Bool /*bMaySkipPointsInCalculation*/ )
{
- uno::Sequence< geometry::RealPoint2D > aResult( aYList.size() );
-
- for( size_t i = 0; i < aYList.size(); ++i )
- {
- aResult[i].X = aXList[i];
- aResult[i].Y = aYList[i];
- }
+ size_t nSize = std::min(aXList.size(), aYList.size());
+ uno::Sequence< geometry::RealPoint2D > aResult( nSize );
+ std::transform(aXList.begin(), aXList.begin() + nSize, aYList.begin(), aResult.getArray(),
+ [](const auto& x, const auto& y) { return geometry::RealPoint2D(x, y); });
return aResult;
}
@@ -96,7 +157,15 @@ OUString MovingAverageRegressionCurveCalculator::ImplGetRepresentation(
const uno::Reference< util::XNumberFormatter >& /*xNumFormatter*/,
sal_Int32 /*nNumberFormatKey*/, sal_Int32* /*pFormulaLength = nullptr */ ) const
{
- return SchResId( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS );
+ OUString aRet = SchResId( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS );
+ // change text for Moving Average
+ OUString aWildcard( "%PERIOD" );
+ sal_Int32 nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ { // replace period
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), OUString::number(mPeriod) );
+ }
+ return aRet;
}
} // namespace chart
diff --git a/chart2/source/tools/NameContainer.cxx b/chart2/source/tools/NameContainer.cxx
index b5e730ba552e..1cc79a8eaec0 100644
--- a/chart2/source/tools/NameContainer.cxx
+++ b/chart2/source/tools/NameContainer.cxx
@@ -20,7 +20,9 @@
#include <NameContainer.hxx>
#include <com/sun/star/uno/Any.hxx>
- #include <cppuhelper/supportsservice.hxx>
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/supportsservice.hxx>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Sequence;
@@ -29,26 +31,13 @@ using ::com::sun::star::uno::Any;
namespace chart
{
-uno::Reference< container::XNameContainer > createNameContainer(
- const css::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName )
-{
- return new NameContainer( rType, rServicename, rImplementationName );
-}
-NameContainer::NameContainer( const css::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName )
- : m_aType( rType )
- , m_aServicename( rServicename )
- , m_aImplementationName( rImplementationName )
- , m_aMap()
+NameContainer::NameContainer()
{
}
-NameContainer::NameContainer(
- const NameContainer & rOther )
+NameContainer::NameContainer( const NameContainer & rOther )
: impl::NameContainer_Base(rOther)
- , m_aType( rOther.m_aType )
- , m_aServicename( rOther.m_aServicename )
- , m_aImplementationName( rOther.m_aImplementationName )
, m_aMap( rOther.m_aMap )
{
}
@@ -60,7 +49,7 @@ NameContainer::~NameContainer()
//XServiceInfo
OUString SAL_CALL NameContainer::getImplementationName()
{
- return m_aImplementationName;
+ return "com.sun.star.comp.chart.XMLNameSpaceMap";
}
sal_Bool SAL_CALL NameContainer::supportsService( const OUString& ServiceName )
@@ -70,13 +59,13 @@ sal_Bool SAL_CALL NameContainer::supportsService( const OUString& ServiceName )
Sequence< OUString > SAL_CALL NameContainer::getSupportedServiceNames()
{
- return { m_aServicename };
+ return { "com.sun.star.xml.NamespaceMap" };
}
// XNameContainer
void SAL_CALL NameContainer::insertByName( const OUString& rName, const Any& rElement )
{
- if( m_aMap.find( rName ) != m_aMap.end() )
+ if( m_aMap.contains( rName ))
throw container::ElementExistException();
m_aMap.emplace( rName, rElement );
}
@@ -109,14 +98,7 @@ Any SAL_CALL NameContainer::getByName( const OUString& rName )
Sequence< OUString > SAL_CALL NameContainer::getElementNames()
{
- sal_Int32 nCount = m_aMap.size();
- Sequence< OUString > aSeq(nCount);
- sal_Int32 nN = 0;
- for (auto const& elem : m_aMap)
- {
- aSeq[nN++]=elem.first;
- }
- return aSeq;
+ return comphelper::mapKeysToSequence(m_aMap);
}
sal_Bool SAL_CALL NameContainer::hasByName( const OUString& rName )
@@ -132,7 +114,7 @@ sal_Bool SAL_CALL NameContainer::hasElements()
uno::Type SAL_CALL NameContainer::getElementType()
{
- return m_aType;
+ return ::cppu::UnoType<OUString>::get();
}
// XCloneable
diff --git a/chart2/source/tools/NumberFormatterWrapper.cxx b/chart2/source/tools/NumberFormatterWrapper.cxx
index 50f6dc7fb132..e00df1fae04e 100644
--- a/chart2/source/tools/NumberFormatterWrapper.cxx
+++ b/chart2/source/tools/NumberFormatterWrapper.cxx
@@ -18,8 +18,8 @@
*/
#include <NumberFormatterWrapper.hxx>
+#include <svl/numformat.hxx>
#include <svl/numuno.hxx>
-#include <svl/zforlist.hxx>
#include <tools/color.hxx>
#include <com/sun/star/util/Date.hpp>
#include <osl/diagnose.h>
@@ -56,7 +56,7 @@ NumberFormatterWrapper::NumberFormatterWrapper( const uno::Reference< util::XNum
OUString sNullDate( "NullDate" );
if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sNullDate) )
m_aNullDate = xProp->getPropertyValue(sNullDate);
- SvNumberFormatsSupplierObj* pSupplierObj = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xSupplier );
+ SvNumberFormatsSupplierObj* pSupplierObj = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier );
if( pSupplierObj )
m_pNumberFormatter = pSupplierObj->GetNumberFormatter();
SAL_WARN_IF(!m_pNumberFormatter,"chart2.tools","need a numberformatter");
@@ -66,12 +66,31 @@ NumberFormatterWrapper::~NumberFormatterWrapper()
{
}
+namespace
+{
+ bool getDate(const css::uno::Any& rAny, util::Date& rDate)
+ {
+ if (rAny >>= rDate)
+ return true;
+ util::DateTime aUtilDateTime;
+ if (rAny >>= aUtilDateTime)
+ {
+ rDate.Day = aUtilDateTime.Day;
+ rDate.Month = aUtilDateTime.Month;
+ rDate.Year = aUtilDateTime.Year;
+ return true;
+ }
+ SAL_WARN("chart2.tools", "neither a util::Date nor a util::DateTime");
+ return false;
+ }
+}
+
Date NumberFormatterWrapper::getNullDate() const
{
Date aRet(30,12,1899);
util::Date aUtilDate;
- if( m_aNullDate.hasValue() && (m_aNullDate >>= aUtilDate) )
+ if (m_aNullDate.hasValue() && getDate(m_aNullDate, aUtilDate))
{
aRet = Date(aUtilDate.Day,aUtilDate.Month,aUtilDate.Year);
}
@@ -86,7 +105,7 @@ OUString NumberFormatterWrapper::getFormattedString( sal_Int32 nNumberFormatKey,
Color& rLabelColor, bool& rbColorChanged ) const
{
OUString aText;
- Color* pTextColor = nullptr;
+ const Color* pTextColor = nullptr;
if( !m_pNumberFormatter )
{
OSL_FAIL("Need a NumberFormatter");
@@ -102,8 +121,8 @@ OUString NumberFormatterWrapper::getFormattedString( sal_Int32 nNumberFormatKey,
nMonth = rDate.GetMonth();
nDay = rDate.GetDay();
util::Date aNewNullDate;
- m_aNullDate >>= aNewNullDate;
- m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year);
+ if (getDate(m_aNullDate, aNewNullDate))
+ m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year);
}
// tdf#130969: use UNLIMITED_PRECISION in case of GENERAL Number Format
if( m_pNumberFormatter->GetStandardPrec() != SvNumberFormatter::UNLIMITED_PRECISION )
diff --git a/chart2/source/tools/OPropertySet.cxx b/chart2/source/tools/OPropertySet.cxx
index 252cfb605be1..29e7298974da 100644
--- a/chart2/source/tools/OPropertySet.cxx
+++ b/chart2/source/tools/OPropertySet.cxx
@@ -18,10 +18,12 @@
*/
#include <OPropertySet.hxx>
-#include "ImplOPropertySet.hxx"
+#include <CloneHelper.hxx>
#include <cppuhelper/queryinterface.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/style/XStyle.hpp>
-#include <vector>
+#include <algorithm>
#include <memory>
using namespace ::com::sun::star;
@@ -38,26 +40,41 @@ using ::cppu::OPropertySetHelper;
namespace property
{
-OPropertySet::OPropertySet( ::osl::Mutex & par_rMutex ) :
- OBroadcastHelper( par_rMutex ),
+OPropertySet::OPropertySet( ) :
+ OBroadcastHelper( m_aMutex ),
// the following causes a warning; there seems to be no way to avoid it
OPropertySetHelper( static_cast< OBroadcastHelper & >( *this )),
- m_rMutex( par_rMutex ),
- m_pImplProperties( new impl::ImplOPropertySet() ),
m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
{
}
-OPropertySet::OPropertySet( const OPropertySet & rOther, ::osl::Mutex & par_rMutex ) :
- OBroadcastHelper( par_rMutex ),
+OPropertySet::OPropertySet( const OPropertySet & rOther ) :
+ OBroadcastHelper( m_aMutex ),
// the following causes a warning; there seems to be no way to avoid it
OPropertySetHelper( static_cast< OBroadcastHelper & >( *this )),
- m_rMutex( par_rMutex ),
+ css::lang::XTypeProvider(),
+ css::beans::XPropertyState(),
+ css::beans::XMultiPropertyStates(),
+ css::style::XStyleSupplier(),
m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
{
- MutexGuard aGuard( m_rMutex );
- if (rOther.m_pImplProperties)
- m_pImplProperties.reset(new impl::ImplOPropertySet(*rOther.m_pImplProperties));
+ MutexGuard aGuard( m_aMutex );
+
+ m_aProperties = rOther.m_aProperties;
+
+ // clone interface properties
+ for(auto& rProp : m_aProperties)
+ {
+ if( rProp.second.hasValue() &&
+ rProp.second.getValueType().getTypeClass() == uno::TypeClass_INTERFACE )
+ {
+ Reference< util::XCloneable > xCloneable;
+ if( rProp.second >>= xCloneable )
+ rProp.second <<= xCloneable->createClone();
+ }
+ }
+
+ m_xStyle.set( ::chart::CloneHelper::CreateRefClone< style::XStyle >()( rOther.m_xStyle ));
}
void OPropertySet::SetNewValuesExplicitlyEvenIfTheyEqualDefault()
@@ -109,7 +126,7 @@ beans::PropertyState SAL_CALL
{
cppu::IPropertyArrayHelper & rPH = getInfoHelper();
- return m_pImplProperties->GetPropertyStateByHandle(
+ return GetPropertyStateByHandle(
rPH.getHandleByName( PropertyName ));
}
@@ -124,7 +141,7 @@ Sequence< beans::PropertyState > SAL_CALL
std::vector< sal_Int32 > aHandles( pHandles.get(), pHandles.get() + aPropertyName.getLength());
pHandles.reset();
- return m_pImplProperties->GetPropertyStatesByHandle( aHandles );
+ return GetPropertyStatesByHandle( aHandles );
}
void SAL_CALL
@@ -132,7 +149,7 @@ void SAL_CALL
{
cppu::IPropertyArrayHelper & rPH = getInfoHelper();
- m_pImplProperties->SetPropertyToDefault( rPH.getHandleByName( PropertyName ));
+ SetPropertyToDefault( rPH.getHandleByName( PropertyName ));
firePropertyChangeEvent();
}
@@ -141,7 +158,9 @@ Any SAL_CALL
{
cppu::IPropertyArrayHelper & rPH = getInfoHelper();
- return GetDefaultValue( rPH.getHandleByName( aPropertyName ) );
+ Any any;
+ GetDefaultValue( rPH.getHandleByName( aPropertyName ), any );
+ return any;
}
// ____ XMultiPropertyStates ____
@@ -152,7 +171,7 @@ Any SAL_CALL
void SAL_CALL
OPropertySet::setAllPropertiesToDefault()
{
- m_pImplProperties->SetAllPropertiesToDefault();
+ SetAllPropertiesToDefault();
firePropertyChangeEvent();
}
@@ -167,7 +186,7 @@ void SAL_CALL
std::vector< sal_Int32 > aHandles( pHandles.get(), pHandles.get() + aPropertyNames.getLength());
pHandles.reset();
- m_pImplProperties->SetPropertiesToDefault( aHandles );
+ SetPropertiesToDefault( aHandles );
}
Sequence< Any > SAL_CALL
@@ -182,8 +201,9 @@ Sequence< Any > SAL_CALL
for( ; nI < nElements; ++nI )
{
- pResultArray[ nI ] = GetDefaultValue(
- rPH.getHandleByName( aPropertyNames[ nI ] ));
+ GetDefaultValue(
+ rPH.getHandleByName( aPropertyNames[ nI ] ),
+ pResultArray[ nI ]);
}
return aResult;
@@ -240,28 +260,27 @@ void SAL_CALL OPropertySet::setFastPropertyValue_NoBroadcast
Any aDefault;
try
{
- aDefault = GetDefaultValue( nHandle );
+ GetDefaultValue( nHandle, aDefault );
}
catch( const beans::UnknownPropertyException& )
{
aDefault.clear();
}
- m_pImplProperties->SetPropertyValueByHandle( nHandle, rValue );
if( !m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault && aDefault.hasValue() && aDefault == rValue ) //#i98893# don't export defaults to file
- m_pImplProperties->SetPropertyToDefault( nHandle );
+ SetPropertyToDefault( nHandle );
else
- m_pImplProperties->SetPropertyValueByHandle( nHandle, rValue );
+ SetPropertyValueByHandle( nHandle, rValue );
}
void SAL_CALL OPropertySet::getFastPropertyValue
( Any& rValue,
sal_Int32 nHandle ) const
{
- if( m_pImplProperties->GetPropertyValueByHandle( rValue, nHandle ))
+ if( GetPropertyValueByHandle( rValue, nHandle ))
return;
// property was not set -> try style
- uno::Reference< beans::XFastPropertySet > xStylePropSet( m_pImplProperties->GetStyle(), uno::UNO_QUERY );
+ uno::Reference< beans::XFastPropertySet > xStylePropSet( m_xStyle, uno::UNO_QUERY );
if( xStylePropSet.is() )
{
#ifdef DBG_UTIL
@@ -321,7 +340,7 @@ void SAL_CALL OPropertySet::getFastPropertyValue
// => take the default value
try
{
- rValue = GetDefaultValue( nHandle );
+ GetDefaultValue( nHandle, rValue );
}
catch( const beans::UnknownPropertyException& )
{
@@ -338,12 +357,12 @@ void OPropertySet::firePropertyChangeEvent()
// ____ XStyleSupplier ____
Reference< style::XStyle > SAL_CALL OPropertySet::getStyle()
{
- return m_pImplProperties->GetStyle();
+ return m_xStyle;
}
void SAL_CALL OPropertySet::setStyle( const Reference< style::XStyle >& xStyle )
{
- if( ! m_pImplProperties->SetStyle( xStyle ))
+ if( ! SetStyle( xStyle ))
throw lang::IllegalArgumentException(
"Empty Style",
static_cast< beans::XPropertySet * >( this ),
@@ -367,6 +386,80 @@ void SAL_CALL OPropertySet::setFastPropertyValue( sal_Int32 nHandle, const Any&
firePropertyChangeEvent();
}
+beans::PropertyState OPropertySet::GetPropertyStateByHandle( sal_Int32 nHandle ) const
+{
+ if( m_aProperties.end() == m_aProperties.find( nHandle ))
+ return beans::PropertyState_DEFAULT_VALUE;
+ return beans::PropertyState_DIRECT_VALUE;
+}
+
+Sequence< beans::PropertyState > OPropertySet::GetPropertyStatesByHandle(
+ const std::vector< sal_Int32 > & aHandles ) const
+{
+ Sequence< beans::PropertyState > aResult( aHandles.size());
+
+ std::transform( aHandles.begin(), aHandles.end(),
+ aResult.getArray(),
+ [this](sal_Int32 nHandle) { return GetPropertyStateByHandle(nHandle); });
+
+ return aResult;
+}
+
+void OPropertySet::SetPropertyToDefault( sal_Int32 nHandle )
+{
+ auto aFoundIter( m_aProperties.find( nHandle ) );
+
+ if( m_aProperties.end() != aFoundIter )
+ {
+ m_aProperties.erase( aFoundIter );
+ }
+}
+
+void OPropertySet::SetPropertiesToDefault(
+ const std::vector< sal_Int32 > & aHandles )
+{
+ for(auto nHandle : aHandles)
+ m_aProperties.erase(nHandle);
+}
+
+void OPropertySet::SetAllPropertiesToDefault()
+{
+ m_aProperties.clear();
+}
+
+bool OPropertySet::GetPropertyValueByHandle(
+ Any & rValue,
+ sal_Int32 nHandle ) const
+{
+ bool bResult = false;
+
+ auto aFoundIter( m_aProperties.find( nHandle ) );
+
+ if( m_aProperties.end() != aFoundIter )
+ {
+ rValue = (*aFoundIter).second;
+ bResult = true;
+ }
+
+ return bResult;
+}
+
+void OPropertySet::SetPropertyValueByHandle(
+ sal_Int32 nHandle, const Any & rValue )
+{
+ m_aProperties[ nHandle ] = rValue;
+}
+
+bool OPropertySet::SetStyle( const Reference< style::XStyle > & xStyle )
+{
+ if( ! xStyle.is())
+ return false;
+
+ m_xStyle = xStyle;
+ return true;
+}
+
+
} // namespace property
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index 2b7628f7a0ab..d5b2f068c8a0 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -19,28 +19,31 @@
#include <sal/config.h>
+#include <cstddef>
#include <map>
#include <ObjectIdentifier.hxx>
#include <TitleHelper.hxx>
#include <ChartModel.hxx>
-#include <ChartModelHelper.hxx>
+#include <ChartType.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <servicenames_charttypes.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <DataSeries.hxx>
+#include <RegressionCurveModel.hxx>
-#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/XAxis.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
+#include <utility>
namespace com::sun::star::drawing { class XShape; }
@@ -52,18 +55,18 @@ using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
-const char m_aMultiClick[] = "MultiClick";
-const char m_aDragMethodEquals[] = "DragMethod=";
-const char m_aDragParameterEquals[] = "DragParameter=";
-const char m_aProtocol[] = "CID/";
-const OUString m_aPieSegmentDragMethodServiceName("PieSegmentDragging");
+constexpr OUString m_aMultiClick = u"MultiClick"_ustr;
+constexpr OUString m_aDragMethodEquals = u"DragMethod="_ustr;
+constexpr OUString m_aDragParameterEquals = u"DragParameter="_ustr;
+constexpr OUString m_aProtocol = u"CID/"_ustr;
+constexpr OUString m_aPieSegmentDragMethodServiceName(u"PieSegmentDragging"_ustr);
namespace
{
OUString lcl_createClassificationStringForType( ObjectType eObjectType
- , const OUString& rDragMethodServiceName
- , const OUString& rDragParameterString
+ , std::u16string_view rDragMethodServiceName
+ , std::u16string_view rDragParameterString
)
{
OUStringBuffer aRet;
@@ -81,19 +84,17 @@ OUString lcl_createClassificationStringForType( ObjectType eObjectType
default:
break;//empty string
}
- if( !rDragMethodServiceName.isEmpty() )
+ if( !rDragMethodServiceName.empty() )
{
if( !aRet.isEmpty() )
aRet.append(":");
- aRet.append( m_aDragMethodEquals );
- aRet.append( rDragMethodServiceName );
+ aRet.append( OUString::Concat(m_aDragMethodEquals) + rDragMethodServiceName );
- if( !rDragParameterString.isEmpty() )
+ if( !rDragParameterString.empty() )
{
if( !aRet.isEmpty() )
aRet.append(":");
- aRet.append( m_aDragParameterEquals );
- aRet.append( rDragParameterString );
+ aRet.append( OUString::Concat(m_aDragParameterEquals) + rDragParameterString );
}
}
return aRet.makeStringAndClear();
@@ -126,30 +127,20 @@ OUString lcl_getTitleParentParticle( TitleHelper::eTitleType aTitleType )
return aRet;
}
-Reference<XChartType> lcl_getFirstStockChartType( const Reference< frame::XModel >& xChartModel )
+rtl::Reference<ChartType> lcl_getFirstStockChartType( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
if(!xDiagram.is())
return nullptr;
//iterate through all coordinate systems
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( !xCooSysContainer.is())
- return nullptr;
- const uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( Reference< XCoordinateSystem > const & coords : aCooSysList )
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysList( xDiagram->getBaseCoordinateSystems() );
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysList )
{
//iterate through all chart types in the current coordinate system
- Reference< XChartTypeContainer > xChartTypeContainer( coords, uno::UNO_QUERY );
- if( !xChartTypeContainer.is() )
- continue;
-
- const uno::Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- for( Reference< XChartType > const & xChartType : aChartTypeList )
+ for( rtl::Reference< ChartType > const & xChartType : coords->getChartTypes2() )
{
- if(!xChartType.is())
- continue;
OUString aChartType = xChartType->getChartType();
if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
return xChartType;
@@ -158,107 +149,95 @@ Reference<XChartType> lcl_getFirstStockChartType( const Reference< frame::XModel
return nullptr;
}
-OUString lcl_getIndexStringAfterString( const OUString& rString, const OUString& rSearchString )
+std::u16string_view lcl_getIndexStringAfterString( std::u16string_view rString, std::u16string_view rSearchString )
{
- OUStringBuffer aRet;
-
- sal_Int32 nIndexStart = rString.lastIndexOf( rSearchString );
- if( nIndexStart != -1 )
- {
- nIndexStart += rSearchString.getLength();
- sal_Int32 nIndexEnd = rString.getLength();
- sal_Int32 nNextColon = rString.indexOf( ':', nIndexStart );
- if( nNextColon != -1 )
- nIndexEnd = nNextColon;
- aRet = rString.copy(nIndexStart,nIndexEnd-nIndexStart);
- }
-
- return aRet.makeStringAndClear();
+ size_t nIndexStart = rString.rfind( rSearchString );
+ if( nIndexStart == std::u16string_view::npos )
+ return std::u16string_view();
+ nIndexStart += rSearchString.size();
+ size_t nIndexEnd = rString.size();
+ size_t nNextColon = rString.find( ':', nIndexStart );
+ if( nNextColon != std::u16string_view::npos )
+ nIndexEnd = nNextColon;
+ return rString.substr(nIndexStart,nIndexEnd-nIndexStart);
}
-sal_Int32 lcl_StringToIndex( const OUString& rIndexString )
+sal_Int32 lcl_StringToIndex( std::u16string_view rIndexString )
{
sal_Int32 nRet = -1;
- if( !rIndexString.isEmpty() )
+ if( !rIndexString.empty() )
{
- nRet = rIndexString.toInt32();
+ nRet = o3tl::toInt32(rIndexString);
if( nRet < -1 )
nRet = -1;
}
return nRet;
}
-void lcl_parseCooSysIndices( sal_Int32& rnDiagram, sal_Int32& rnCooSys, const OUString& rString )
+void lcl_parseCooSysIndices( sal_Int32& rnDiagram, sal_Int32& rnCooSys, std::u16string_view rString )
{
- rnDiagram = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "D=" ) );
- rnCooSys = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "CS=" ) );
+ rnDiagram = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, u"D=" ) );
+ rnCooSys = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, u"CS=" ) );
}
-void lcl_parseAxisIndices( sal_Int32& rnDimensionIndex, sal_Int32& rnAxisIndex, const OUString& rString )
+void lcl_parseAxisIndices( sal_Int32& rnDimensionIndex, sal_Int32& rnAxisIndex, std::u16string_view rString )
{
- OUString aAxisIndexString = lcl_getIndexStringAfterString( rString, ":Axis=" );
+ std::u16string_view aAxisIndexString = lcl_getIndexStringAfterString( rString, u":Axis=" );
sal_Int32 nCharacterIndex=0;
- rnDimensionIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) );
- rnAxisIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) );
+ rnDimensionIndex = lcl_StringToIndex( o3tl::getToken(aAxisIndexString, 0, ',', nCharacterIndex ) );
+ rnAxisIndex = lcl_StringToIndex( o3tl::getToken(aAxisIndexString, 0, ',', nCharacterIndex ) );
}
-void lcl_parseGridIndices( sal_Int32& rnSubGridIndex, const OUString& rString )
+void lcl_parseGridIndices( sal_Int32& rnSubGridIndex, std::u16string_view rString )
{
rnSubGridIndex = -1;
- rnSubGridIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, ":SubGrid=" ) );
+ rnSubGridIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, u":SubGrid=" ) );
}
-void lcl_parseSeriesIndices( sal_Int32& rnChartTypeIndex, sal_Int32& rnSeriesIndex, sal_Int32& rnPointIndex, const OUString& rString )
+void lcl_parseSeriesIndices( sal_Int32& rnChartTypeIndex, sal_Int32& rnSeriesIndex, sal_Int32& rnPointIndex, std::u16string_view rString )
{
- rnChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "CT=" ) );
- rnSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "Series=" ) );
- rnPointIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "Point=" ) );
+ rnChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, u"CT=" ) );
+ rnSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, u"Series=" ) );
+ rnPointIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, u"Point=" ) );
}
-void lcl_getDiagramAndCooSys( const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel
- , Reference< XDiagram >& xDiagram
- , Reference< XCoordinateSystem >& xCooSys )
+void lcl_getDiagramAndCooSys( std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
+ , rtl::Reference< Diagram >& xDiagram
+ , rtl::Reference< BaseCoordinateSystem >& xCooSys )
{
sal_Int32 nDiagramIndex = -1;
sal_Int32 nCooSysIndex = -1;
lcl_parseCooSysIndices( nDiagramIndex, nCooSysIndex, rObjectCID );
- xDiagram = ChartModelHelper::findDiagram( xChartModel );//todo use nDiagramIndex when more than one diagram is possible in future
+ xDiagram = xChartModel->getFirstChartDiagram();//todo use nDiagramIndex when more than one diagram is possible in future
if( !xDiagram.is() )
return;
if( nCooSysIndex > -1 )
{
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( xCooSysContainer.is() )
- {
- uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- if( nCooSysIndex < aCooSysList.getLength() )
- xCooSys = aCooSysList[nCooSysIndex];
- }
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysList( xDiagram->getBaseCoordinateSystems() );
+ if( o3tl::make_unsigned(nCooSysIndex) < aCooSysList.size() )
+ xCooSys = aCooSysList[nCooSysIndex];
}
}
} //anonymous namespace
ObjectIdentifier::ObjectIdentifier()
- :m_aObjectCID( OUString() )
{
}
-ObjectIdentifier::ObjectIdentifier( const OUString& rObjectCID )
- :m_aObjectCID( rObjectCID )
+ObjectIdentifier::ObjectIdentifier( OUString aObjectCID )
+ :m_aObjectCID(std::move( aObjectCID ))
{
}
ObjectIdentifier::ObjectIdentifier( const Reference< drawing::XShape >& rxShape )
- :m_aObjectCID( OUString() )
- ,m_xAdditionalShape( rxShape )
+ : m_xAdditionalShape( rxShape )
{
}
ObjectIdentifier::ObjectIdentifier( const Any& rAny )
- :m_aObjectCID( OUString() )
{
const uno::Type& rType = rAny.getValueType();
if ( rType == cppu::UnoType<OUString>::get() )
@@ -277,11 +256,6 @@ bool ObjectIdentifier::operator==( const ObjectIdentifier& rOID ) const
( m_xAdditionalShape == rOID.m_xAdditionalShape );
}
-bool ObjectIdentifier::operator!=( const ObjectIdentifier& rOID ) const
-{
- return !operator==( rOID );
-}
-
bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
{
bool bReturn = false;
@@ -305,41 +279,55 @@ bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
}
OUString ObjectIdentifier::createClassifiedIdentifierForObject(
+ const rtl::Reference< ::chart::Title >& xTitle
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
+{
+ TitleHelper::eTitleType aTitleType;
+ OUString aRet;
+ const std::u16string_view aObjectID;
+ const std::u16string_view aDragMethodServiceName;
+ const std::u16string_view aDragParameterString;
+ if( TitleHelper::getTitleType( aTitleType, xTitle, xChartModel ) )
+ {
+ enum ObjectType eObjectType = OBJECTTYPE_TITLE;
+ OUString aParentParticle = lcl_getTitleParentParticle( aTitleType );
+ aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
+ }
+ return aRet;
+}
+
+OUString ObjectIdentifier::createClassifiedIdentifierForObject(
const Reference< uno::XInterface >& xObject
- , ChartModel& rModel)
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
OUString aRet;
enum ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
- OUString aObjectID;
+ const std::u16string_view aObjectID;
OUString aParentParticle;
- OUString aDragMethodServiceName;
- OUString aDragParameterString;
+ const std::u16string_view aDragMethodServiceName;
+ const std::u16string_view aDragParameterString;
try
{
//title
- Reference< XTitle > xTitle( xObject, uno::UNO_QUERY );
- if( xTitle.is() )
- {
- TitleHelper::eTitleType aTitleType;
- if( TitleHelper::getTitleType( aTitleType, xTitle, rModel ) )
- {
- eObjectType = OBJECTTYPE_TITLE;
- aParentParticle = lcl_getTitleParentParticle( aTitleType );
- aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
- eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
- }
- return aRet;
+ if( ::chart::Title* pTitle = dynamic_cast<::chart::Title*>(xObject.get()) )
+ return createClassifiedIdentifierForObject(rtl::Reference<Title>(pTitle), xChartModel);
+ uno::Reference<chart2::XDataTable> xDataTable(xObject, uno::UNO_QUERY);
+ if (xDataTable.is())
+ {
+ return createClassifiedIdentifierForParticle(createParticleForDataTable(xChartModel));
}
//axis
- Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
+ rtl::Reference< Axis > xAxis = dynamic_cast<Axis*>( xObject.get() );
if( xAxis.is() )
{
- Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, rModel.getFirstDiagram() ) );
- OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, rModel ) );
+ rtl::Reference<Diagram> xDiagram = xChartModel->getFirstChartDiagram();
+ rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
+ OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, xChartModel ) );
sal_Int32 nDimensionIndex=-1;
sal_Int32 nAxisIndex=-1;
AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
@@ -351,7 +339,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject(
Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
if( xLegend.is() )
{
- return createClassifiedIdentifierForParticle( createParticleForLegend( rModel ) );
+ return createClassifiedIdentifierForParticle( createParticleForLegend( xChartModel ) );
}
//diagram
@@ -387,40 +375,37 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject(
}
OUString ObjectIdentifier::createClassifiedIdentifierForObject(
- const Reference< uno::XInterface >& xObject
- , const Reference< frame::XModel >& xChartModel )
+ const rtl::Reference< Legend >& xLegend
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- OUString aRet;
-
- enum ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
- OUString aObjectID;
- OUString aParentParticle;
- OUString aDragMethodServiceName;
- OUString aDragParameterString;
-
try
{
- //title
- Reference< XTitle > xTitle( xObject, uno::UNO_QUERY );
- if( xTitle.is() )
+ if( xLegend.is() )
{
- TitleHelper::eTitleType aTitleType;
- if( TitleHelper::getTitleType( aTitleType, xTitle, xChartModel ) )
- {
- eObjectType = OBJECTTYPE_TITLE;
- aParentParticle = lcl_getTitleParentParticle( aTitleType );
- aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
- eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
- }
- return aRet;
-
+ return createClassifiedIdentifierForParticle( createParticleForLegend( xChartModel ) );
}
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ OSL_FAIL("give object could not be identified in createClassifiedIdentifierForObject");
+ return OUString();
+}
+
+OUString ObjectIdentifier::createClassifiedIdentifierForObject(
+ const rtl::Reference<::chart::Axis>& xAxis
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
+{
+ try
+ {
//axis
- Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
if( xAxis.is() )
{
- Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ) ) );
+ rtl::Reference<Diagram> xDiagram = xChartModel->getFirstChartDiagram();
+ rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, xChartModel ) );
sal_Int32 nDimensionIndex=-1;
sal_Int32 nAxisIndex=-1;
@@ -428,71 +413,42 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject(
OUString aAxisParticle( createParticleForAxis( nDimensionIndex, nAxisIndex ) );
return createClassifiedIdentifierForParticles( aCooSysParticle, aAxisParticle );
}
-
- //legend
- Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
- if( xLegend.is() )
- {
- return createClassifiedIdentifierForParticle( createParticleForLegend( xChartModel ) );
- }
-
- //diagram
- Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
- if( xDiagram.is() )
- {
- return createClassifiedIdentifierForParticle( createParticleForDiagram() );
- }
-
- //todo
- //XDataSeries
- //CooSys
- //charttype
- //datapoint?
- //Gridproperties
}
catch(const uno::Exception&)
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
- if( eObjectType != OBJECTTYPE_UNKNOWN )
- {
- aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
- eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
- }
- else
- {
- OSL_FAIL("give object could not be identified in createClassifiedIdentifierForObject");
- }
+ OSL_FAIL("give object could not be identified in createClassifiedIdentifierForObject");
- return aRet;
+ return OUString();
}
OUString ObjectIdentifier::createClassifiedIdentifierForParticle(
- const OUString& rParticle )
+ std::u16string_view rParticle )
{
- return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle, OUString() );
+ return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle, u"" );
}
OUString ObjectIdentifier::createClassifiedIdentifierForParticles(
- const OUString& rParentParticle
- , const OUString& rChildParticle
- , const OUString& rDragMethodServiceName
- , const OUString& rDragParameterString )
+ std::u16string_view rParentParticle
+ , std::u16string_view rChildParticle
+ , std::u16string_view rDragMethodServiceName
+ , std::u16string_view rDragParameterString )
{
ObjectType eObjectType( ObjectIdentifier::getObjectType( rChildParticle ) );
if( eObjectType == OBJECTTYPE_UNKNOWN )
eObjectType = ObjectIdentifier::getObjectType( rParentParticle );
- OUStringBuffer aRet( m_aProtocol );
- aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString ));
- if(aRet.getLength() > static_cast<sal_Int32>(strlen(m_aProtocol)))
+ OUStringBuffer aRet( m_aProtocol +
+ lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString ));
+ if(aRet.getLength() > m_aProtocol.getLength())
aRet.append("/");
- if(!rParentParticle.isEmpty())
+ if(!rParentParticle.empty())
{
aRet.append(rParentParticle);
- if( !rChildParticle.isEmpty() )
+ if( !rChildParticle.empty() )
aRet.append(":");
}
aRet.append(rChildParticle);
@@ -507,59 +463,27 @@ OUString ObjectIdentifier::createParticleForDiagram()
}
OUString ObjectIdentifier::createParticleForCoordinateSystem(
- const Reference< XCoordinateSystem >& xCooSys
- , ChartModel& rModel )
-{
- OUStringBuffer aRet;
-
- Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( xCooSysContainer.is() )
- {
- sal_Int32 nCooSysIndex = 0;
- uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( ; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
- {
- Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
- if( xCooSys == xCurrentCooSys )
- {
- aRet = ObjectIdentifier::createParticleForDiagram();
- aRet.append(":CS=");
- aRet.append( OUString::number( nCooSysIndex ) );
- break;
- }
- }
- }
-
- return aRet.makeStringAndClear();
-}
-
-OUString ObjectIdentifier::createParticleForCoordinateSystem(
- const Reference< XCoordinateSystem >& xCooSys
- , const Reference< frame::XModel >& xChartModel )
+ const rtl::Reference< BaseCoordinateSystem >& xCooSys
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- OUStringBuffer aRet;
+ OUString aRet;
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( xCooSysContainer.is() )
+ rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() );
+ if( xDiagram.is() )
{
- sal_Int32 nCooSysIndex = 0;
- uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- for( ; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
+ std::size_t nCooSysIndex = 0;
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysList( xDiagram->getBaseCoordinateSystems() );
+ for( ; nCooSysIndex < aCooSysList.size(); ++nCooSysIndex )
{
- Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
- if( xCooSys == xCurrentCooSys )
+ if( xCooSys == aCooSysList[nCooSysIndex] )
{
- aRet = ObjectIdentifier::createParticleForDiagram();
- aRet.append(":CS=");
- aRet.append( OUString::number( nCooSysIndex ) );
+ aRet = ObjectIdentifier::createParticleForDiagram() + ":CS=" + OUString::number( nCooSysIndex );
break;
}
}
}
- return aRet.makeStringAndClear();
+ return aRet;
}
OUString ObjectIdentifier::createParticleForAxis(
@@ -584,7 +508,7 @@ OUString ObjectIdentifier::createParticleForGrid(
OUString ObjectIdentifier::createClassifiedIdentifierForGrid(
const Reference< XAxis >& xAxis
- , const Reference< frame::XModel >& xChartModel
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, sal_Int32 nSubGridIndex )
{
//-1: main grid, 0: first subgrid etc
@@ -604,81 +528,56 @@ OUString ObjectIdentifier::createParticleForSeries(
sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
, sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex )
{
- OUStringBuffer aRet;
-
- aRet.append("D=");
- aRet.append( OUString::number( nDiagramIndex ) );
- aRet.append(":CS=");
- aRet.append( OUString::number( nCooSysIndex ) );
- aRet.append(":CT=");
- aRet.append( OUString::number( nChartTypeIndex ) );
- aRet.append(":");
- aRet.append(getStringForType( OBJECTTYPE_DATA_SERIES ));
- aRet.append("=");
- aRet.append( OUString::number( nSeriesIndex ) );
-
- return aRet.makeStringAndClear();
+ return
+ "D=" + OUString::number( nDiagramIndex ) +
+ ":CS=" + OUString::number( nCooSysIndex ) +
+ ":CT=" + OUString::number( nChartTypeIndex ) +
+ ":" + getStringForType( OBJECTTYPE_DATA_SERIES ) + "=" +
+ OUString::number( nSeriesIndex );
}
-OUString ObjectIdentifier::createParticleForLegend( ChartModel& )
-{
- OUStringBuffer aRet;
-
- //todo: if more than one diagram is implemented, find the correct diagram which is owner of the given legend
-
- aRet.append( ObjectIdentifier::createParticleForDiagram() );
- aRet.append(":");
- aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
- aRet.append("=");
-
- return aRet.makeStringAndClear();
-}
OUString ObjectIdentifier::createParticleForLegend(
- const Reference< frame::XModel >& )
+ const rtl::Reference<::chart::ChartModel>& )
{
- OUStringBuffer aRet;
-
//todo: if more than one diagram is implemented, find the correct diagram which is owner of the given legend
- aRet.append( ObjectIdentifier::createParticleForDiagram() );
- aRet.append(":");
- aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
- aRet.append("=");
+ return ObjectIdentifier::createParticleForDiagram() + ":" + getStringForType( OBJECTTYPE_LEGEND ) + "=";
+}
- return aRet.makeStringAndClear();
+OUString ObjectIdentifier::createParticleForDataTable(const rtl::Reference<::chart::ChartModel>& /* xChartModel */)
+{
+ return ObjectIdentifier::createParticleForDiagram() + ":" + getStringForType(OBJECTTYPE_DATA_TABLE) + "=";
}
OUString ObjectIdentifier::createClassifiedIdentifier(
enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
- , const OUString& rParticleID )//e.g. SeriesID
+ , std::u16string_view rParticleID )//e.g. SeriesID
{
return createClassifiedIdentifierWithParent(
- eObjectType, rParticleID, OUString() );
+ eObjectType, rParticleID, u"" );
}
OUString ObjectIdentifier::createClassifiedIdentifierWithParent(
enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
- , const OUString& rParticleID //e.g. Point Index or SubGrid Index
- , const OUString& rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
- , const OUString& rDragMethodServiceName
- , const OUString& rDragParameterString
+ , std::u16string_view rParticleID //e.g. Point Index or SubGrid Index
+ , std::u16string_view rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
+ , std::u16string_view rDragMethodServiceName
+ , std::u16string_view rDragParameterString
)
//, bool bIsMultiClickObject ) //e.g. true
{
//e.g. "MultiClick/Series=2:Point=34"
- OUStringBuffer aRet( m_aProtocol );
- aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString ));
- if(aRet.getLength() > static_cast<sal_Int32>(strlen(m_aProtocol)))
+ OUStringBuffer aRet( m_aProtocol +
+ lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString ));
+ if(aRet.getLength() > m_aProtocol.getLength())
aRet.append("/");
aRet.append(rParentPartical);
- if(!rParentPartical.isEmpty())
+ if(!rParentPartical.empty())
aRet.append(":");
- aRet.append(getStringForType( eObjectType ));
- aRet.append("=");
- aRet.append(rParticleID);
+ aRet.append(getStringForType( eObjectType ) + "=" + rParticleID);
return aRet.makeStringAndClear();
}
@@ -702,89 +601,89 @@ OUString ObjectIdentifier::createPieSegmentDragParameterString(
}
bool ObjectIdentifier::parsePieSegmentDragParameterString(
- const OUString& rDragParameterString
+ std::u16string_view rDragParameterString
, sal_Int32& rOffsetPercent
, awt::Point& rMinimumPosition
, awt::Point& rMaximumPosition )
{
sal_Int32 nCharacterIndex = 0;
- OUString aValueString( rDragParameterString.getToken( 0, ',', nCharacterIndex ) );
- rOffsetPercent = aValueString.toInt32();
+ std::u16string_view aValueString( o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ) );
+ rOffsetPercent = o3tl::toInt32(aValueString);
if( nCharacterIndex < 0 )
return false;
- aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
- rMinimumPosition.X = aValueString.toInt32();
+ aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex );
+ rMinimumPosition.X = o3tl::toInt32(aValueString);
if( nCharacterIndex < 0 )
return false;
- aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
- rMinimumPosition.Y = aValueString.toInt32();
+ aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex );
+ rMinimumPosition.Y = o3tl::toInt32(aValueString);
if( nCharacterIndex < 0 )
return false;
- aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
- rMaximumPosition.X = aValueString.toInt32();
+ aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex );
+ rMaximumPosition.X = o3tl::toInt32(aValueString);
if( nCharacterIndex < 0 )
return false;
- aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
- rMaximumPosition.Y = aValueString.toInt32();
+ aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex );
+ rMaximumPosition.Y = o3tl::toInt32(aValueString);
return nCharacterIndex >= 0;
}
-OUString ObjectIdentifier::getDragMethodServiceName( const OUString& rCID )
+std::u16string_view ObjectIdentifier::getDragMethodServiceName( std::u16string_view rCID )
{
- OUString aRet;
+ std::u16string_view aRet;
- sal_Int32 nIndexStart = rCID.indexOf( m_aDragMethodEquals );
- if( nIndexStart != -1 )
+ size_t nIndexStart = rCID.find( m_aDragMethodEquals );
+ if( nIndexStart != std::u16string_view::npos )
{
- nIndexStart = rCID.indexOf( '=', nIndexStart );
- if( nIndexStart != -1 )
+ nIndexStart = rCID.find( '=', nIndexStart );
+ if( nIndexStart != std::u16string_view::npos )
{
nIndexStart++;
- sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
- if( nNextSlash != -1 )
+ size_t nNextSlash = rCID.find( '/', nIndexStart );
+ if( nNextSlash != std::u16string_view::npos )
{
sal_Int32 nIndexEnd = nNextSlash;
- sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
- if( nNextColon < nNextSlash )
+ size_t nNextColon = rCID.find( ':', nIndexStart );
+ if( nNextColon == std::u16string_view::npos || nNextColon < nNextSlash )
nIndexEnd = nNextColon;
- aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
+ aRet = rCID.substr(nIndexStart,nIndexEnd-nIndexStart);
}
}
}
return aRet;
}
-OUString ObjectIdentifier::getDragParameterString( const OUString& rCID )
+std::u16string_view ObjectIdentifier::getDragParameterString( std::u16string_view rCID )
{
- OUString aRet;
+ std::u16string_view aRet;
- sal_Int32 nIndexStart = rCID.indexOf( m_aDragParameterEquals );
- if( nIndexStart != -1 )
+ size_t nIndexStart = rCID.find( m_aDragParameterEquals );
+ if( nIndexStart != std::u16string_view::npos )
{
- nIndexStart = rCID.indexOf( '=', nIndexStart );
- if( nIndexStart != -1 )
+ nIndexStart = rCID.find( '=', nIndexStart );
+ if( nIndexStart != std::u16string_view::npos )
{
nIndexStart++;
- sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
- if( nNextSlash != -1 )
+ size_t nNextSlash = rCID.find( '/', nIndexStart );
+ if( nNextSlash != std::u16string_view::npos )
{
sal_Int32 nIndexEnd = nNextSlash;
- sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
- if( nNextColon < nNextSlash )
+ size_t nNextColon = rCID.find( ':', nIndexStart );
+ if( nNextColon == std::u16string_view::npos || nNextColon < nNextSlash )
nIndexEnd = nNextColon;
- aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
+ aRet = rCID.substr(nIndexStart,nIndexEnd-nIndexStart);
}
}
}
return aRet;
}
-bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier )
+bool ObjectIdentifier::isDragableObject( std::u16string_view rClassifiedIdentifier )
{
bool bReturn = false;
ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier );
@@ -799,8 +698,8 @@ bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier )
bReturn = true;
break;
default:
- OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( rClassifiedIdentifier ) );
- bReturn = !aDragMethodServiceName.isEmpty();
+ std::u16string_view aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( rClassifiedIdentifier ) );
+ bReturn = !aDragMethodServiceName.empty();
break;
}
return bReturn;
@@ -820,7 +719,7 @@ bool ObjectIdentifier::isDragableObject() const
return bReturn;
}
-bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier )
+bool ObjectIdentifier::isRotateableObject( std::u16string_view rClassifiedIdentifier )
{
bool bReturn = false;
ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier );
@@ -837,7 +736,7 @@ bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier
return bReturn;
}
-bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier )
+bool ObjectIdentifier::isMultiClickObject( std::u16string_view rClassifiedIdentifier )
{
//the name of a shape is it's ClassifiedIdentifier
@@ -846,27 +745,27 @@ bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier
//was selected before;
//!!!!! by definition the name of a MultiClickObject starts with "CID/MultiClick:"
- bool bRet = rClassifiedIdentifier.match( m_aMultiClick, strlen(m_aProtocol) );
+ bool bRet = o3tl::starts_with(rClassifiedIdentifier.substr( m_aProtocol.getLength() ), m_aMultiClick);
return bRet;
}
-bool ObjectIdentifier::areSiblings( const OUString& rCID1, const OUString& rCID2 )
+bool ObjectIdentifier::areSiblings( std::u16string_view rCID1, std::u16string_view rCID2 )
{
bool bRet=false;
- sal_Int32 nLastSign1 = rCID1.lastIndexOf( '=' );
- sal_Int32 nLastSign2 = rCID2.lastIndexOf( '=' );
- if( nLastSign1 == rCID1.indexOf( '=' ) )//CID cannot be sibling if only one "=" occurs
+ size_t nLastSign1 = rCID1.rfind( '=' );
+ size_t nLastSign2 = rCID2.rfind( '=' );
+ if( nLastSign1 == rCID1.find( '=' ) )//CID cannot be sibling if only one "=" occurs
bRet=false;
- else if( nLastSign2 == rCID2.indexOf( '=' ) )//CID cannot be sibling if only one "=" occurs
+ else if( nLastSign2 == rCID2.find( '=' ) )//CID cannot be sibling if only one "=" occurs
bRet=false;
else if( ObjectIdentifier::areIdenticalObjects( rCID1, rCID2 ) )
bRet=false;
else
{
- OUString aParent1( ObjectIdentifier::getFullParentParticle( rCID1 ) );
- if( !aParent1.isEmpty() )
+ std::u16string_view aParent1( ObjectIdentifier::getFullParentParticle( rCID1 ) );
+ if( !aParent1.empty() )
{
- OUString aParent2( ObjectIdentifier::getFullParentParticle( rCID2 ) );
+ std::u16string_view aParent2( ObjectIdentifier::getFullParentParticle( rCID2 ) );
bRet=aParent1 == aParent2;
}
//legend entries are special:
@@ -880,14 +779,14 @@ bool ObjectIdentifier::areSiblings( const OUString& rCID1, const OUString& rCID2
return bRet;
}
-bool ObjectIdentifier::areIdenticalObjects( const OUString& rCID1, const OUString& rCID2 )
+bool ObjectIdentifier::areIdenticalObjects( std::u16string_view rCID1, std::u16string_view rCID2 )
{
if( rCID1 == rCID2 )
return true;
//draggable pie or donut segments need special treatment, as their CIDs do change with offset
{
- if( rCID1.indexOf( m_aPieSegmentDragMethodServiceName ) < 0
- || rCID2.indexOf( m_aPieSegmentDragMethodServiceName ) < 0 )
+ if( rCID1.find( m_aPieSegmentDragMethodServiceName ) == std::u16string_view::npos
+ || rCID2.find( m_aPieSegmentDragMethodServiceName ) == std::u16string_view::npos )
return false;
OUString aID1( ObjectIdentifier::getObjectID( rCID1 ) );
@@ -975,76 +874,82 @@ OUString ObjectIdentifier::getStringForType( ObjectType eObjectType )
case OBJECTTYPE_DATA_STOCK_GAIN:
aRet="StockGain";
break;
+ case OBJECTTYPE_DATA_TABLE:
+ aRet="DataTable";
+ break;
default: //OBJECTTYPE_UNKNOWN
;
}
return aRet;
}
-ObjectType ObjectIdentifier::getObjectType( const OUString& rCID )
+ObjectType ObjectIdentifier::getObjectType( std::u16string_view aCID )
{
ObjectType eRet;
- sal_Int32 nLastSign = rCID.lastIndexOf( ':' );//last sign before the type string
- if(nLastSign==-1)
- nLastSign = rCID.lastIndexOf( '/' );
- if(nLastSign==-1)
+ size_t nLastSign = aCID.rfind( ':' );//last sign before the type string
+ if(nLastSign == std::u16string_view::npos)
+ nLastSign = aCID.rfind( '/' );
+ if(nLastSign == std::u16string_view::npos)
{
- sal_Int32 nEndIndex = rCID.lastIndexOf( '=' );
- if(nEndIndex==-1)
+ size_t nEndIndex = aCID.rfind( '=' );
+ if(nEndIndex == std::u16string_view::npos)
return OBJECTTYPE_UNKNOWN;
nLastSign = 0;
}
if( nLastSign>0 )
nLastSign++;
- if( rCID.match("Page",nLastSign) )
+ aCID = aCID.substr(nLastSign);
+ if( o3tl::starts_with(aCID, u"Page") )
eRet = OBJECTTYPE_PAGE;
- else if( rCID.match("Title",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Title") )
eRet = OBJECTTYPE_TITLE;
- else if( rCID.match("LegendEntry",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"LegendEntry") )
eRet = OBJECTTYPE_LEGEND_ENTRY;
- else if( rCID.match("Legend",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Legend") )
eRet = OBJECTTYPE_LEGEND;
- else if( rCID.match("DiagramWall",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"DiagramWall") )
eRet = OBJECTTYPE_DIAGRAM_WALL;
- else if( rCID.match("DiagramFloor",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"DiagramFloor") )
eRet = OBJECTTYPE_DIAGRAM_FLOOR;
- else if( rCID.match("D=",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"D=") )
eRet = OBJECTTYPE_DIAGRAM;
- else if( rCID.match("AxisUnitLabel",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"AxisUnitLabel") )
eRet = OBJECTTYPE_AXIS_UNITLABEL;
- else if( rCID.match("Axis",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Axis") )
eRet = OBJECTTYPE_AXIS;
- else if( rCID.match("Grid",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Grid") )
eRet = OBJECTTYPE_GRID;
- else if( rCID.match("SubGrid",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"SubGrid") )
eRet = OBJECTTYPE_SUBGRID;
- else if( rCID.match("Series",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Series") )
eRet = OBJECTTYPE_DATA_SERIES;
- else if( rCID.match("Point",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Point") )
eRet = OBJECTTYPE_DATA_POINT;
- else if( rCID.match("DataLabels",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"DataLabels") )
eRet = OBJECTTYPE_DATA_LABELS;
- else if( rCID.match("DataLabel",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"DataLabel") )
eRet = OBJECTTYPE_DATA_LABEL;
- else if( rCID.match("ErrorsX",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"ErrorsX") )
eRet = OBJECTTYPE_DATA_ERRORS_X;
- else if( rCID.match("ErrorsY",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"ErrorsY") )
eRet = OBJECTTYPE_DATA_ERRORS_Y;
- else if( rCID.match("ErrorsZ",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"ErrorsZ") )
eRet = OBJECTTYPE_DATA_ERRORS_Z;
- else if( rCID.match("Curve",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Curve") )
eRet = OBJECTTYPE_DATA_CURVE;
- else if( rCID.match("Equation",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Equation") )
eRet = OBJECTTYPE_DATA_CURVE_EQUATION;
- else if( rCID.match("Average",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"Average") )
eRet = OBJECTTYPE_DATA_AVERAGE_LINE;
- else if( rCID.match("StockRange",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"StockRange") )
eRet = OBJECTTYPE_DATA_STOCK_RANGE;
- else if( rCID.match("StockLoss",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"StockLoss") )
eRet = OBJECTTYPE_DATA_STOCK_LOSS;
- else if( rCID.match("StockGain",nLastSign) )
+ else if( o3tl::starts_with(aCID, u"StockGain") )
eRet = OBJECTTYPE_DATA_STOCK_GAIN;
+ else if( o3tl::starts_with(aCID, u"DataTable") )
+ eRet = OBJECTTYPE_DATA_TABLE;
else
eRet = OBJECTTYPE_UNKNOWN;
@@ -1066,7 +971,7 @@ ObjectType ObjectIdentifier::getObjectType() const
}
OUString ObjectIdentifier::createDataCurveCID(
- const OUString& rSeriesParticle
+ std::u16string_view rSeriesParticle
, sal_Int32 nCurveIndex
, bool bAverageLine )
{
@@ -1076,20 +981,20 @@ OUString ObjectIdentifier::createDataCurveCID(
}
OUString ObjectIdentifier::createDataCurveEquationCID(
- const OUString& rSeriesParticle
+ std::u16string_view rSeriesParticle
, sal_Int32 nCurveIndex )
{
OUString aParticleID( OUString::number( nCurveIndex ) );
return createClassifiedIdentifierWithParent( OBJECTTYPE_DATA_CURVE_EQUATION, aParticleID, rSeriesParticle );
}
-OUString ObjectIdentifier::addChildParticle( const OUString& rParticle, const OUString& rChildParticle )
+OUString ObjectIdentifier::addChildParticle( std::u16string_view rParticle, std::u16string_view rChildParticle )
{
OUStringBuffer aRet(rParticle);
- if( !aRet.isEmpty() && !rChildParticle.isEmpty() )
+ if( !aRet.isEmpty() && !rChildParticle.empty() )
aRet.append(":");
- if( !rChildParticle.isEmpty() )
+ if( !rChildParticle.empty() )
aRet.append(rChildParticle);
return aRet.makeStringAndClear();
@@ -1100,22 +1005,21 @@ OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType,
OUStringBuffer aRet( getStringForType( eObjectType ) );
if( !aRet.isEmpty() )
{
- aRet.append("=");
- aRet.append(OUString::number(nIndex));
+ aRet.append("=" + OUString::number(nIndex));
}
return aRet.makeStringAndClear();
}
-sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const OUString& rParticleOrCID )
+sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( std::u16string_view rParticleOrCID )
{
- const OUString aIndexString = lcl_getIndexStringAfterString( rParticleOrCID, "=" );
- return lcl_StringToIndex( aIndexString.getToken( 0, ',' ) );
+ const std::u16string_view aIndexString = lcl_getIndexStringAfterString( rParticleOrCID, u"=" );
+ return lcl_StringToIndex( o3tl::getToken(aIndexString, 0, ',' ) );
}
OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType
- , const OUString& rSeriesParticle
- , const OUString& rDragMethodServiceName
- , const OUString& rDragParameterString )
+ , std::u16string_view rSeriesParticle
+ , std::u16string_view rDragMethodServiceName
+ , std::u16string_view rDragParameterString )
{
OUString aChildParticle = getStringForType( eSubObjectType ) + "=";
@@ -1124,72 +1028,64 @@ OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType
, rDragMethodServiceName, rDragParameterString );
}
-OUString ObjectIdentifier::createPointCID( const OUString& rPointCID_Stub, sal_Int32 nIndex )
+OUString ObjectIdentifier::createPointCID( std::u16string_view rPointCID_Stub, sal_Int32 nIndex )
{
return rPointCID_Stub + OUString::number( nIndex );
}
-OUString ObjectIdentifier::getParticleID( const OUString& rCID )
+std::u16string_view ObjectIdentifier::getParticleID( std::u16string_view rCID )
{
- OUString aRet;
- sal_Int32 nLast = rCID.lastIndexOf('=');
- if(nLast>=0)
- aRet = rCID.copy(++nLast);
+ std::u16string_view aRet;
+ size_t nLast = rCID.rfind('=');
+ if(nLast != std::u16string_view::npos)
+ aRet = rCID.substr(++nLast);
return aRet;
}
-OUString ObjectIdentifier::getFullParentParticle( const OUString& rCID )
+std::u16string_view ObjectIdentifier::getFullParentParticle( std::u16string_view rCID )
{
- OUString aRet;
+ std::u16string_view aRet;
- sal_Int32 nStartPos = rCID.lastIndexOf('/');
- if( nStartPos>=0 )
+ size_t nStartPos = rCID.rfind('/');
+ if( nStartPos != std::u16string_view::npos )
{
nStartPos++;
- sal_Int32 nEndPos = rCID.lastIndexOf(':');
- if( nEndPos>=0 && nStartPos < nEndPos )
+ size_t nEndPos = rCID.rfind(':');
+ if( nEndPos != std::u16string_view::npos && nStartPos < nEndPos )
{
- aRet = rCID.copy(nStartPos,nEndPos-nStartPos);
+ aRet = rCID.substr(nStartPos,nEndPos-nStartPos);
}
}
return aRet;
}
-OUString ObjectIdentifier::getObjectID( const OUString& rCID )
+OUString ObjectIdentifier::getObjectID( std::u16string_view rCID )
{
OUString aRet;
- sal_Int32 nStartPos = rCID.lastIndexOf('/');
- if( nStartPos>=0 )
+ size_t nStartPos = rCID.rfind('/');
+ if( nStartPos != std::u16string_view::npos )
{
nStartPos++;
- sal_Int32 nEndPos = rCID.getLength();
- aRet = rCID.copy(nStartPos,nEndPos-nStartPos);
+ size_t nEndPos = rCID.size();
+ aRet = rCID.substr(nStartPos,nEndPos-nStartPos);
}
return aRet;
}
-bool ObjectIdentifier::isCID( const OUString& rName )
+bool ObjectIdentifier::isCID( std::u16string_view rName )
{
- return !rName.isEmpty() && rName.match( m_aProtocol );
+ return !rName.empty() && o3tl::starts_with( rName, m_aProtocol );
}
Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
- const OUString& rObjectCID,
- const Reference< chart2::XChartDocument >& xChartDocument )
-{
- return ObjectIdentifier::getObjectPropertySet(
- rObjectCID, Reference< frame::XModel >( xChartDocument ));
-}
-
-Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
- const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel )
+ std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
//return the model object that is indicated by rObjectCID
- if(rObjectCID.isEmpty())
+ if(rObjectCID.empty())
return nullptr;
if(!xChartModel.is())
return nullptr;
@@ -1198,26 +1094,24 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
try
{
ObjectType eObjectType = ObjectIdentifier::getObjectType( rObjectCID );
- OUString aParticleID = ObjectIdentifier::getParticleID( rObjectCID );
+ std::u16string_view aParticleID = ObjectIdentifier::getParticleID( rObjectCID );
- Reference< XDiagram > xDiagram;
- Reference< XCoordinateSystem > xCooSys;
+ rtl::Reference< Diagram > xDiagram;
+ rtl::Reference< BaseCoordinateSystem > xCooSys;
lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
switch(eObjectType)
{
case OBJECTTYPE_PAGE:
{
- Reference< XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
- if( xChartDocument.is())
- xObjectProperties.set( xChartDocument->getPageBackground() );
+ xObjectProperties.set( xChartModel->getPageBackground() );
}
break;
case OBJECTTYPE_TITLE:
{
TitleHelper::eTitleType aTitleType = getTitleTypeForCID( rObjectCID );
- Reference< XTitle > xTitle( TitleHelper::getTitle( aTitleType, xChartModel ) );
- xObjectProperties.set( xTitle, uno::UNO_QUERY );
+ rtl::Reference< Title > xTitle( TitleHelper::getTitle( aTitleType, xChartModel ) );
+ xObjectProperties = xTitle;
}
break;
case OBJECTTYPE_LEGEND:
@@ -1230,7 +1124,7 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
break;
case OBJECTTYPE_DIAGRAM:
{
- xObjectProperties.set( xDiagram, uno::UNO_QUERY );
+ xObjectProperties = xDiagram;
}
break;
case OBJECTTYPE_DIAGRAM_WALL:
@@ -1251,10 +1145,10 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
sal_Int32 nAxisIndex = -1;
lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
- Reference< chart2::XAxis > xAxis(
- AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ) );
+ rtl::Reference< Axis > xAxis =
+ AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys );
if( xAxis.is() )
- xObjectProperties.set( xAxis, uno::UNO_QUERY );
+ xObjectProperties = xAxis;
}
break;
case OBJECTTYPE_AXIS_UNITLABEL:
@@ -1269,27 +1163,27 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
sal_Int32 nSubGridIndex = -1;
lcl_parseGridIndices( nSubGridIndex, rObjectCID );
- xObjectProperties.set( AxisHelper::getGridProperties( xCooSys , nDimensionIndex, nAxisIndex, nSubGridIndex ) );
+ xObjectProperties = AxisHelper::getGridProperties( xCooSys , nDimensionIndex, nAxisIndex, nSubGridIndex );
}
break;
case OBJECTTYPE_DATA_LABELS:
case OBJECTTYPE_DATA_SERIES:
{
- Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
+ rtl::Reference< DataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
rObjectCID, xChartModel ) );
if( xSeries.is() )
- xObjectProperties.set( xSeries, uno::UNO_QUERY );
+ xObjectProperties = xSeries;
break;
}
case OBJECTTYPE_DATA_LABEL:
case OBJECTTYPE_DATA_POINT:
{
- Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
- rObjectCID, xChartModel ) );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID(
+ rObjectCID, xChartModel );
if(xSeries.is())
{
- sal_Int32 nIndex = aParticleID.toInt32();
+ sal_Int32 nIndex = o3tl::toInt32(aParticleID);
xObjectProperties = xSeries->getDataPointByIndex( nIndex );
}
break;
@@ -1298,26 +1192,22 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
case OBJECTTYPE_DATA_ERRORS_Y:
case OBJECTTYPE_DATA_ERRORS_Z:
{
- Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
- rObjectCID, xChartModel ) );
+ rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID(
+ rObjectCID, xChartModel );
if(xSeries.is())
{
- Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
Reference< beans::XPropertySet > xErrorBarProp;
- if( xSeriesProp.is() )
- {
- OUString errorBar;
+ OUString errorBar;
- if ( eObjectType == OBJECTTYPE_DATA_ERRORS_X)
- errorBar = CHART_UNONAME_ERRORBAR_X;
- else if (eObjectType == OBJECTTYPE_DATA_ERRORS_Y)
- errorBar = CHART_UNONAME_ERRORBAR_Y;
- else
- errorBar = "ErrorBarZ";
+ if ( eObjectType == OBJECTTYPE_DATA_ERRORS_X)
+ errorBar = CHART_UNONAME_ERRORBAR_X;
+ else if (eObjectType == OBJECTTYPE_DATA_ERRORS_Y)
+ errorBar = CHART_UNONAME_ERRORBAR_Y;
+ else
+ errorBar = "ErrorBarZ";
- xSeriesProp->getPropertyValue( errorBar ) >>= xErrorBarProp;
- xObjectProperties = xErrorBarProp;
- }
+ xSeries->getPropertyValue( errorBar ) >>= xErrorBarProp;
+ xObjectProperties = xErrorBarProp;
}
break;
}
@@ -1325,19 +1215,19 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
case OBJECTTYPE_DATA_CURVE:
case OBJECTTYPE_DATA_CURVE_EQUATION:
{
- Reference< XRegressionCurveContainer > xRegressionContainer( ObjectIdentifier::getDataSeriesForCID(
- rObjectCID, xChartModel ), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegressionContainer = ObjectIdentifier::getDataSeriesForCID(
+ rObjectCID, xChartModel );
if(xRegressionContainer.is())
{
- sal_Int32 nIndex = aParticleID.toInt32();
- uno::Sequence< Reference< XRegressionCurve > > aCurveList =
- xRegressionContainer->getRegressionCurves();
- if( nIndex >= 0 && nIndex <aCurveList.getLength() )
+ sal_Int32 nIndex = o3tl::toInt32(aParticleID);
+ const std::vector< rtl::Reference< RegressionCurveModel > > & aCurveList =
+ xRegressionContainer->getRegressionCurves2();
+ if( nIndex >= 0 && o3tl::make_unsigned(nIndex) < aCurveList.size() )
{
if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
- xObjectProperties.set( aCurveList[nIndex]->getEquationProperties());
+ xObjectProperties = aCurveList[nIndex]->getEquationProperties();
else
- xObjectProperties.set( aCurveList[nIndex], uno::UNO_QUERY );
+ xObjectProperties = aCurveList[nIndex];
}
}
break;
@@ -1346,20 +1236,25 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
break;
case OBJECTTYPE_DATA_STOCK_LOSS:
{
- Reference<XChartType> xChartType( lcl_getFirstStockChartType( xChartModel ) );
- Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY );
- if(xChartTypeProps.is())
- xChartTypeProps->getPropertyValue( "BlackDay" ) >>= xObjectProperties;
+ rtl::Reference<ChartType> xChartType( lcl_getFirstStockChartType( xChartModel ) );
+ if(xChartType.is())
+ xChartType->getPropertyValue( "BlackDay" ) >>= xObjectProperties;
}
break;
case OBJECTTYPE_DATA_STOCK_GAIN:
{
- Reference<XChartType> xChartType( lcl_getFirstStockChartType( xChartModel ) );
- Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY );
- if(xChartTypeProps.is())
- xChartTypeProps->getPropertyValue( "WhiteDay" ) >>= xObjectProperties;
+ rtl::Reference<ChartType> xChartType( lcl_getFirstStockChartType( xChartModel ) );
+ if(xChartType.is())
+ xChartType->getPropertyValue( "WhiteDay" ) >>= xObjectProperties;
}
break;
+ case OBJECTTYPE_DATA_TABLE:
+ {
+ if (xDiagram.is())
+ xObjectProperties.set(xDiagram->getDataTable(), uno::UNO_QUERY);
+ }
+ break;
+ break;
default: //OBJECTTYPE_UNKNOWN
break;
}
@@ -1371,12 +1266,12 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
return xObjectProperties;
}
-Reference< XAxis > ObjectIdentifier::getAxisForCID(
- const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel )
+rtl::Reference< Axis > ObjectIdentifier::getAxisForCID(
+ std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- Reference< XDiagram > xDiagram;
- Reference< XCoordinateSystem > xCooSys;
+ rtl::Reference< Diagram > xDiagram;
+ rtl::Reference< BaseCoordinateSystem > xCooSys;
lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
sal_Int32 nDimensionIndex = -1;
@@ -1386,14 +1281,12 @@ Reference< XAxis > ObjectIdentifier::getAxisForCID(
return AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys );
}
-Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID(
- const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel )
+rtl::Reference< DataSeries > ObjectIdentifier::getDataSeriesForCID(
+ std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- Reference< XDataSeries > xSeries;
-
- Reference< XDiagram > xDiagram;
- Reference< XCoordinateSystem > xCooSys;
+ rtl::Reference< Diagram > xDiagram;
+ rtl::Reference< BaseCoordinateSystem > xCooSys;
lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
sal_Int32 nChartTypeIndex = -1;
@@ -1401,34 +1294,36 @@ Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID(
sal_Int32 nPointIndex = -1;
lcl_parseSeriesIndices( nChartTypeIndex, nSeriesIndex, nPointIndex, rObjectCID );
- Reference< XDataSeriesContainer > xDataSeriesContainer( DiagramHelper::getChartTypeByIndex( xDiagram, nChartTypeIndex ), uno::UNO_QUERY );
- if( xDataSeriesContainer.is() )
+ rtl::Reference< DataSeries > xSeries;
+ if (xDiagram)
{
- uno::Sequence< uno::Reference< XDataSeries > > aDataSeriesSeq( xDataSeriesContainer->getDataSeries() );
- if( nSeriesIndex >= 0 && nSeriesIndex < aDataSeriesSeq.getLength() )
- xSeries.set( aDataSeriesSeq[nSeriesIndex] );
+ rtl::Reference< ChartType > xDataSeriesContainer( xDiagram->getChartTypeByIndex( nChartTypeIndex ) );
+ if( xDataSeriesContainer.is() )
+ {
+ const std::vector< rtl::Reference< DataSeries > > & aDataSeriesSeq( xDataSeriesContainer->getDataSeries2() );
+ if( nSeriesIndex >= 0 && o3tl::make_unsigned(nSeriesIndex) < aDataSeriesSeq.size() )
+ xSeries = aDataSeriesSeq[nSeriesIndex];
+ }
}
-
return xSeries;
}
-Reference< XDiagram > ObjectIdentifier::getDiagramForCID(
- const OUString& rObjectCID
- , const uno::Reference< frame::XModel >& xChartModel )
+rtl::Reference< Diagram > ObjectIdentifier::getDiagramForCID(
+ std::u16string_view rObjectCID
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- Reference< XDiagram > xDiagram;
-
- Reference< XCoordinateSystem > xCooSys;
+ rtl::Reference< Diagram > xDiagram;
+ rtl::Reference< BaseCoordinateSystem > xCooSys;
lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
return xDiagram;
}
-TitleHelper::eTitleType ObjectIdentifier::getTitleTypeForCID( const OUString& rCID )
+TitleHelper::eTitleType ObjectIdentifier::getTitleTypeForCID( std::u16string_view rCID )
{
TitleHelper::eTitleType eRet( TitleHelper::MAIN_TITLE );
- OUString aParentParticle = ObjectIdentifier::getFullParentParticle( rCID );
+ std::u16string_view aParentParticle = ObjectIdentifier::getFullParentParticle( rCID );
const tTitleMap& rMap = lcl_getTitleMap();
tTitleMap::const_iterator aIt = std::find_if(rMap.begin(), rMap.end(),
[&aParentParticle](tTitleMap::const_reference rEntry) { return aParentParticle == rEntry.second; });
@@ -1438,7 +1333,7 @@ TitleHelper::eTitleType ObjectIdentifier::getTitleTypeForCID( const OUString& rC
return eRet;
}
-OUString ObjectIdentifier::getSeriesParticleFromCID( const OUString& rCID )
+OUString ObjectIdentifier::getSeriesParticleFromCID( std::u16string_view rCID )
{
sal_Int32 nDiagramIndex = -1;
sal_Int32 nCooSysIndex = -1;
@@ -1452,12 +1347,12 @@ OUString ObjectIdentifier::getSeriesParticleFromCID( const OUString& rCID )
return ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex );
}
-OUString ObjectIdentifier::getMovedSeriesCID( const OUString& rObjectCID, bool bForward )
+OUString ObjectIdentifier::getMovedSeriesCID( std::u16string_view rObjectCID, bool bForward )
{
- sal_Int32 nDiagramIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, "CID/D=" ) );
- sal_Int32 nCooSysIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, "CS=" ) );
- sal_Int32 nChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, "CT=" ) );
- sal_Int32 nSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, "Series=" ) );
+ sal_Int32 nDiagramIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, u"CID/D=" ) );
+ sal_Int32 nCooSysIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, u"CS=" ) );
+ sal_Int32 nChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, u"CT=" ) );
+ sal_Int32 nSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, u"Series=" ) );
if( bForward )
nSeriesIndex--;
diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index b3585b71f5e3..f8921d73c266 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -21,6 +21,7 @@
#include <RegressionCalculationHelper.hxx>
#include <cmath>
+#include <limits>
#include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
@@ -90,7 +91,7 @@ void SAL_CALL PolynomialRegressionCurveCalculator::recalculateRegression(
const uno::Sequence< double >& aXValues,
const uno::Sequence< double >& aYValues )
{
- rtl::math::setNan(&m_fCorrelationCoefficient);
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();
RegressionCalculationHelper::tDoubleVectorPair aValues(
RegressionCalculationHelper::cleanup( aXValues, aYValues, RegressionCalculationHelper::isValid()));
@@ -269,18 +270,13 @@ void SAL_CALL PolynomialRegressionCurveCalculator::recalculateRegression(
double SAL_CALL PolynomialRegressionCurveCalculator::getCurveValue( double x )
{
- double fResult;
- rtl::math::setNan(&fResult);
-
if (mCoefficients.empty())
- {
- return fResult;
- }
+ return std::numeric_limits<double>::quiet_NaN();
sal_Int32 aNoCoefficients = static_cast<sal_Int32>(mCoefficients.size());
// Horner's method
- fResult = 0.0;
+ double fResult = 0.0;
for (sal_Int32 i = aNoCoefficients - 1; i >= 0; i--)
{
fResult = mCoefficients[i] + (x * fResult);
@@ -345,7 +341,7 @@ OUString PolynomialRegressionCurveCalculator::ImplGetRepresentation(
{
if ( bFindValue ) // if it is not the first aValue
aTmpBuf.append( " " );
- aTmpBuf.append( OUStringChar(aMinusSign) ).append(" ");
+ aTmpBuf.append( OUStringChar(aMinusSign) + " ");
aValue = - aValue;
}
else
@@ -385,7 +381,7 @@ OUString PolynomialRegressionCurveCalculator::ImplGetRepresentation(
}
addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
}
- if ( aBuf.toString() == ( mYName + " = ") )
+ if ( std::u16string_view(aBuf) == Concat2View( mYName + " = ") )
aBuf.append( "0" );
return aBuf.makeStringAndClear();
diff --git a/chart2/source/tools/PopupRequest.cxx b/chart2/source/tools/PopupRequest.cxx
index 1d3a36d5c43a..70dd65b78393 100644
--- a/chart2/source/tools/PopupRequest.cxx
+++ b/chart2/source/tools/PopupRequest.cxx
@@ -14,14 +14,9 @@ using namespace css;
namespace chart
{
+PopupRequest::PopupRequest() {}
-PopupRequest::PopupRequest()
- : impl::PopupRequest_Base(m_aMutex)
-{
-}
-
-PopupRequest::~PopupRequest()
-{}
+PopupRequest::~PopupRequest() {}
// ____ XRequestCallback ____
@@ -31,12 +26,6 @@ void SAL_CALL PopupRequest::addCallback(const uno::Reference<awt::XCallback>& xC
m_xCallback = xCallback;
}
-// ____ WeakComponentImplHelperBase ____
-// is called when dispose() is called at this component
-void SAL_CALL PopupRequest::disposing()
-{
-}
-
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
index eb054bd8db66..504048641b59 100644
--- a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
@@ -21,6 +21,7 @@
#include <RegressionCalculationHelper.hxx>
#include <SpecialCharacters.hxx>
+#include <limits>
#include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
@@ -30,12 +31,10 @@ namespace chart
{
PotentialRegressionCurveCalculator::PotentialRegressionCurveCalculator()
- : m_fSlope(0.0)
- , m_fIntercept(0.0)
+ : m_fSlope(std::numeric_limits<double>::quiet_NaN())
+ , m_fIntercept(std::numeric_limits<double>::quiet_NaN())
, m_fSign(1.0)
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
}
PotentialRegressionCurveCalculator::~PotentialRegressionCurveCalculator()
@@ -61,9 +60,9 @@ void SAL_CALL PotentialRegressionCurveCalculator::recalculateRegression(
nMax = aValues.first.size();
if( nMax <= 1 )
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
- ::rtl::math::setNan( & m_fCorrelationCoefficient );
+ m_fSlope = std::numeric_limits<double>::quiet_NaN();
+ m_fIntercept = std::numeric_limits<double>::quiet_NaN();
+ m_fCorrelationCoefficient = std::numeric_limits<double>::quiet_NaN();
return;
}
m_fSign = -1.0;
@@ -101,16 +100,13 @@ void SAL_CALL PotentialRegressionCurveCalculator::recalculateRegression(
double SAL_CALL PotentialRegressionCurveCalculator::getCurveValue( double x )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
-
if( ! ( std::isnan( m_fSlope ) ||
std::isnan( m_fIntercept )))
{
- fResult = m_fIntercept * pow( x, m_fSlope );
+ return m_fIntercept * pow( x, m_fSlope );
}
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
}
uno::Sequence< geometry::RealPoint2D > SAL_CALL PotentialRegressionCurveCalculator::getCurveValues(
@@ -124,11 +120,8 @@ uno::Sequence< geometry::RealPoint2D > SAL_CALL PotentialRegressionCurveCalculat
isLogarithmicScaling( xScalingY ))
{
// optimize result
- uno::Sequence< geometry::RealPoint2D > aResult( 2 );
- aResult[0].X = min;
- aResult[0].Y = getCurveValue( min );
- aResult[1].X = max;
- aResult[1].Y = getCurveValue( max );
+ uno::Sequence< geometry::RealPoint2D > aResult{ { min, getCurveValue( min ) },
+ { max, getCurveValue( max ) } };
return aResult;
}
@@ -170,19 +163,19 @@ OUString PotentialRegressionCurveCalculator::ImplGetRepresentation(
// if nValueLength not calculated then nullptr
sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr;
if ( m_fIntercept < 0.0 ) // add intercept value
- aTmpBuf.append( OUStringChar(aMinusSign) ).append( " " );
+ aTmpBuf.append( OUStringChar(aMinusSign) + " " );
if( bHasIntercept )
{
OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength );
if ( aValueString != "1" ) // aValueString may be rounded to 1 if nValueLength is small
{
- aTmpBuf.append( aValueString ).append( " " );
+ aTmpBuf.append( aValueString + " " );
}
}
if( m_fSlope != 0.0 ) // add slope value
{
- aTmpBuf.append( mXName ).append( "^" );
- aTmpBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope, pValueLength ));
+ aTmpBuf.append( mXName + "^" +
+ getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope, pValueLength ));
}
addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
}
diff --git a/chart2/source/tools/PropertyHelper.cxx b/chart2/source/tools/PropertyHelper.cxx
index cb3e860c0350..48e21eccaf25 100644
--- a/chart2/source/tools/PropertyHelper.cxx
+++ b/chart2/source/tools/PropertyHelper.cxx
@@ -20,10 +20,13 @@
#include <PropertyHelper.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <docmodel/uno/UnoGradientTools.hxx>
#include <comphelper/sequence.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/string_view.hxx>
+#include <utility>
#include <vector>
#include <algorithm>
#include <iterator>
@@ -37,8 +40,8 @@ namespace
{
struct lcl_EqualsElement
{
- explicit lcl_EqualsElement( const Any & rValue, const Reference< container::XNameAccess > & xAccess )
- : m_aValue( rValue ), m_xAccess( xAccess )
+ explicit lcl_EqualsElement( Any rValue, const Reference< container::XNameAccess > & xAccess )
+ : m_aValue(std::move( rValue )), m_xAccess( xAccess )
{
OSL_ASSERT( m_xAccess.is());
}
@@ -63,13 +66,13 @@ private:
struct lcl_StringMatches
{
- explicit lcl_StringMatches( const OUString & rCmpStr ) :
- m_aCmpStr( rCmpStr )
+ explicit lcl_StringMatches( OUString aCmpStr ) :
+ m_aCmpStr(std::move( aCmpStr ))
{}
- bool operator() ( const OUString & rStr )
+ bool operator() ( std::u16string_view rStr )
{
- return rStr.match( m_aCmpStr );
+ return o3tl::starts_with( rStr, m_aCmpStr );
}
private:
@@ -81,11 +84,11 @@ struct lcl_OUStringRestToInt32
explicit lcl_OUStringRestToInt32( sal_Int32 nPrefixLength ) :
m_nPrefixLength( nPrefixLength )
{}
- sal_Int32 operator() ( const OUString & rStr )
+ sal_Int32 operator() ( std::u16string_view rStr )
{
- if( m_nPrefixLength > rStr.getLength() )
+ if( m_nPrefixLength > static_cast<sal_Int32>(rStr.size()) )
return 0;
- return rStr.copy( m_nPrefixLength ).toInt32();
+ return o3tl::toInt32(rStr.substr( m_nPrefixLength ));
}
private:
sal_Int32 m_nPrefixLength;
@@ -111,56 +114,68 @@ OUString lcl_addNamedPropertyUniqueNameToTable(
const OUString & rPreferredName )
{
if( ! xNameContainer.is() ||
- ! rValue.hasValue() ||
- ( rValue.getValueType() != xNameContainer->getElementType()))
+ ! rValue.hasValue() )
+ return rPreferredName;
+
+ Any aValue(rValue);
+
+ if ( rValue.has<css::awt::Gradient>())
+ {
+ // tdf#158421 the lists for Gradients needs awt::Gradient2
+ // as type, convert input data if needed (and warn about it,
+ // the caller should be changed to offer the needed type)
+ SAL_WARN("chart2","input value needs to be awt::Gradient2");
+ const basegfx::BGradient aTemp(model::gradient::getFromAny(rValue));
+ aValue <<= model::gradient::createUnoGradient2(aTemp);
+ }
+
+ if ( aValue.getValueType() != xNameContainer->getElementType())
return rPreferredName;
try
{
Reference< container::XNameAccess > xNameAccess( xNameContainer, uno::UNO_QUERY_THROW );
- auto aNames( comphelper::sequenceToContainer<std::vector< OUString >>( xNameAccess->getElementNames()));
- std::vector< OUString >::const_iterator aIt(
- std::find_if( aNames.begin(), aNames.end(), lcl_EqualsElement( rValue, xNameAccess )));
+ const uno::Sequence<OUString> aElementNames = xNameAccess->getElementNames();
+ auto it = std::find_if( aElementNames.begin(), aElementNames.end(), lcl_EqualsElement( aValue, xNameAccess ));
+
+ // element found => return name
+ if( it != aElementNames.end())
+ return *it;
// element not found in container
- if( aIt == aNames.end())
+ OUString aUniqueName;
+
+ // check if preferred name is already used
+ if( !rPreferredName.isEmpty())
+ {
+ auto aIt = std::find( aElementNames.begin(), aElementNames.end(), rPreferredName );
+ if( aIt == aElementNames.end())
+ aUniqueName = rPreferredName;
+ }
+
+ if( aUniqueName.isEmpty())
{
- OUString aUniqueName;
-
- // check if preferred name is already used
- if( !rPreferredName.isEmpty())
- {
- aIt = std::find( aNames.begin(), aNames.end(), rPreferredName );
- if( aIt == aNames.end())
- aUniqueName = rPreferredName;
- }
-
- if( aUniqueName.isEmpty())
- {
- // create a unique id using the prefix plus a number
- std::vector< sal_Int32 > aNumbers;
- std::vector< OUString >::iterator aNonConstIt(
- std::partition( aNames.begin(), aNames.end(), lcl_StringMatches( rPrefix )));
- std::transform( aNames.begin(), aNonConstIt,
- back_inserter( aNumbers ),
- lcl_OUStringRestToInt32( rPrefix.getLength() ));
- std::vector< sal_Int32 >::const_iterator aMaxIt(
- std::max_element( aNumbers.begin(), aNumbers.end()));
-
- sal_Int32 nIndex = 1;
- if( aMaxIt != aNumbers.end())
- nIndex = (*aMaxIt) + 1;
-
- aUniqueName = rPrefix + OUString::number( nIndex );
- }
-
- OSL_ASSERT( !aUniqueName.isEmpty());
- xNameContainer->insertByName( aUniqueName, rValue );
- return aUniqueName;
+ auto aNames( comphelper::sequenceToContainer<std::vector< OUString >>( aElementNames ));
+ // create a unique id using the prefix plus a number
+ std::vector< sal_Int32 > aNumbers;
+ std::vector< OUString >::iterator aNonConstIt(
+ std::partition( aNames.begin(), aNames.end(), lcl_StringMatches( rPrefix )));
+ std::transform( aNames.begin(), aNonConstIt,
+ back_inserter( aNumbers ),
+ lcl_OUStringRestToInt32( rPrefix.getLength() ));
+ std::vector< sal_Int32 >::const_iterator aMaxIt(
+ std::max_element( aNumbers.begin(), aNumbers.end()));
+
+ sal_Int32 nIndex = 1;
+ if( aMaxIt != aNumbers.end())
+ nIndex = (*aMaxIt) + 1;
+
+ aUniqueName = rPrefix + OUString::number( nIndex );
}
- else
- // element found => return name
- return *aIt;
+
+ OSL_ASSERT( !aUniqueName.isEmpty());
+ xNameContainer->insertByName( aUniqueName, aValue );
+ return aUniqueName;
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx
index b326d0bacce9..1b2ae9153fcd 100644
--- a/chart2/source/tools/RangeHighlighter.cxx
+++ b/chart2/source/tools/RangeHighlighter.cxx
@@ -19,20 +19,22 @@
#include <RangeHighlighter.hxx>
#include <WeakListenerAdapter.hxx>
+#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
#include <DataSourceHelper.hxx>
#include <ObjectIdentifier.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
+#include <Diagram.hxx>
#include <com/sun/star/chart2/ScaleData.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <comphelper/sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/color.hxx>
using namespace ::com::sun::star;
@@ -52,12 +54,13 @@ void lcl_fillRanges(
sal_Int32 nIndex = -1 )
{
rOutRanges.realloc( aRangeStrings.getLength());
+ auto pOutRanges = rOutRanges.getArray();
for( sal_Int32 i=0; i<aRangeStrings.getLength(); ++i )
{
- rOutRanges[i].RangeRepresentation = aRangeStrings[i];
- rOutRanges[i].PreferredColor = sal_Int32(nPreferredColor);
- rOutRanges[i].AllowMerginigWithOtherRanges = false;
- rOutRanges[i].Index = nIndex;
+ pOutRanges[i].RangeRepresentation = aRangeStrings[i];
+ pOutRanges[i].PreferredColor = sal_Int32(nPreferredColor);
+ pOutRanges[i].AllowMerginigWithOtherRanges = false;
+ pOutRanges[i].Index = nIndex;
}
}
@@ -67,9 +70,9 @@ namespace chart
{
RangeHighlighter::RangeHighlighter(
- const Reference< view::XSelectionSupplier > & xSelectionSupplier ) :
- impl::RangeHighlighter_Base( m_aMutex ),
- m_xSelectionSupplier( xSelectionSupplier ),
+ const rtl::Reference< ChartModel > & xChartModel ) :
+ m_xSelectionSupplier(xChartModel->getCurrentController(), uno::UNO_QUERY),
+ m_xChartModel( xChartModel ),
m_nAddedListenerCount( 0 ),
m_bIncludeHiddenCells(true)
{
@@ -87,17 +90,14 @@ Sequence< chart2::data::HighlightedRange > SAL_CALL RangeHighlighter::getSelecte
void RangeHighlighter::determineRanges()
{
m_aSelectedRanges.realloc( 0 );
+ if( !m_xChartModel.is())
+ return;
if( !m_xSelectionSupplier.is())
return;
try
{
- Reference< frame::XController > xController( m_xSelectionSupplier, uno::UNO_QUERY );
- Reference< frame::XModel > xChartModel;
- if( xController.is())
- xChartModel.set( xController->getModel());
-
- m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( xChartModel );
+ m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( m_xChartModel );
uno::Any aSelection( m_xSelectionSupplier->getSelection());
const uno::Type& rType = aSelection.getValueType();
@@ -112,7 +112,7 @@ void RangeHighlighter::determineRanges()
{
ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID );
sal_Int32 nIndex = ObjectIdentifier::getIndexFromParticleOrCID( aCID );
- Reference< chart2::XDataSeries > xDataSeries( ObjectIdentifier::getDataSeriesForCID( aCID, xChartModel ) );
+ rtl::Reference< DataSeries > xDataSeries( ObjectIdentifier::getDataSeriesForCID( aCID, m_xChartModel ) );
if( eObjectType == OBJECTTYPE_LEGEND_ENTRY )
{
OUString aParentParticel( ObjectIdentifier::getFullParentParticle( aCID ) );
@@ -134,7 +134,7 @@ void RangeHighlighter::determineRanges()
{
// select error bar ranges, or data series, if the style is
// not set to FROM_DATA
- fillRangesForErrorBars( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), xDataSeries );
+ fillRangesForErrorBars( ObjectIdentifier::getObjectPropertySet( aCID, m_xChartModel ), xDataSeries );
return;
}
else if( xDataSeries.is() )
@@ -146,7 +146,7 @@ void RangeHighlighter::determineRanges()
else if( eObjectType == OBJECTTYPE_AXIS )
{
// Axis (Categories)
- Reference< chart2::XAxis > xAxis( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), uno::UNO_QUERY );
+ Reference< chart2::XAxis > xAxis( ObjectIdentifier::getObjectPropertySet( aCID, m_xChartModel ), uno::UNO_QUERY );
if( xAxis.is())
{
fillRangesForCategories( xAxis );
@@ -160,7 +160,7 @@ void RangeHighlighter::determineRanges()
)
{
// Diagram
- Reference< chart2::XDiagram > xDia( ObjectIdentifier::getDiagramForCID( aCID, xChartModel ) );
+ rtl::Reference< ::chart::Diagram > xDia( ObjectIdentifier::getDiagramForCID( aCID, m_xChartModel ) );
if( xDia.is())
{
fillRangesForDiagram( xDia );
@@ -182,8 +182,7 @@ void RangeHighlighter::determineRanges()
else
{
//if nothing is selected select all ranges
- Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY_THROW );
- fillRangesForDiagram( xChartDoc->getFirstDiagram() );
+ fillRangesForDiagram( m_xChartModel->getFirstChartDiagram() );
return;
}
}
@@ -193,17 +192,18 @@ void RangeHighlighter::determineRanges()
}
}
-void RangeHighlighter::fillRangesForDiagram( const Reference< chart2::XDiagram > & xDiagram )
+void RangeHighlighter::fillRangesForDiagram( const rtl::Reference< Diagram > & xDiagram )
{
Sequence< OUString > aSelectedRanges( DataSourceHelper::getUsedDataRanges( xDiagram ));
m_aSelectedRanges.realloc( aSelectedRanges.getLength());
+ auto pSelectedRanges = m_aSelectedRanges.getArray();
// @todo: merge ranges
for( sal_Int32 i=0; i<aSelectedRanges.getLength(); ++i )
{
- m_aSelectedRanges[i].RangeRepresentation = aSelectedRanges[i];
- m_aSelectedRanges[i].Index = -1;
- m_aSelectedRanges[i].PreferredColor = sal_Int32(defaultPreferredColor);
- m_aSelectedRanges[i].AllowMerginigWithOtherRanges = true;
+ pSelectedRanges[i].RangeRepresentation = aSelectedRanges[i];
+ pSelectedRanges[i].Index = -1;
+ pSelectedRanges[i].PreferredColor = sal_Int32(defaultPreferredColor);
+ pSelectedRanges[i].AllowMerginigWithOtherRanges = true;
}
}
@@ -263,19 +263,15 @@ void RangeHighlighter::fillRangesForCategories( const Reference< chart2::XAxis >
defaultPreferredColor );
}
-void RangeHighlighter::fillRangesForDataPoint( const Reference< uno::XInterface > & xDataSeries, sal_Int32 nIndex )
+void RangeHighlighter::fillRangesForDataPoint( const rtl::Reference< DataSeries > & xDataSeries, sal_Int32 nIndex )
{
if( !xDataSeries.is())
return;
- Reference< chart2::data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY );
- if( !xSource.is() )
- return;
-
Color nPreferredColor = defaultPreferredColor;
std::vector< chart2::data::HighlightedRange > aHilightedRanges;
- const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences());
- for( Reference< chart2::data::XLabeledDataSequence > const & labelDataSeq : aLSeqSeq )
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aLSeqSeq( xDataSeries->getDataSequences2());
+ for( uno::Reference< chart2::data::XLabeledDataSequence > const & labelDataSeq : aLSeqSeq )
{
Reference< chart2::data::XDataSequence > xLabel( labelDataSeq->getLabel());
Reference< chart2::data::XDataSequence > xValues( labelDataSeq->getValues());
@@ -305,7 +301,8 @@ void SAL_CALL RangeHighlighter::addSelectionChangeListener( const Reference< vie
if( m_nAddedListenerCount == 0 )
startListening();
- rBHelper.addListener( cppu::UnoType<decltype(xListener)>::get(), xListener);
+ std::unique_lock g(m_aMutex);
+ maSelectionChangeListeners.addInterface( g, xListener);
++m_nAddedListenerCount;
//bring the new listener up to the current state
@@ -315,7 +312,8 @@ void SAL_CALL RangeHighlighter::addSelectionChangeListener( const Reference< vie
void SAL_CALL RangeHighlighter::removeSelectionChangeListener( const Reference< view::XSelectionChangeListener >& xListener )
{
- rBHelper.removeListener( cppu::UnoType<decltype(xListener)>::get(), xListener );
+ std::unique_lock g(m_aMutex);
+ maSelectionChangeListeners.removeInterface( g, xListener );
--m_nAddedListenerCount;
if( m_nAddedListenerCount == 0 )
stopListening();
@@ -333,18 +331,16 @@ void SAL_CALL RangeHighlighter::selectionChanged( const lang::EventObject& /*aEv
void RangeHighlighter::fireSelectionEvent()
{
- ::cppu::OInterfaceContainerHelper* pIC = rBHelper.getContainer(
- cppu::UnoType< view::XSelectionChangeListener >::get() );
- if( pIC )
+ std::unique_lock g(m_aMutex);
+ if( maSelectionChangeListeners.getLength(g) )
{
lang::EventObject aEvent( static_cast< lang::XComponent* >( this ) );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- uno::Reference< view::XSelectionChangeListener > xListener( aIt.next(), uno::UNO_QUERY );
- if( xListener.is() )
- xListener->selectionChanged( aEvent );
- }
+ maSelectionChangeListeners.forEach(g,
+ [&aEvent](const css::uno::Reference<view::XSelectionChangeListener>& xListener)
+ {
+ xListener->selectionChanged(aEvent);
+ }
+ );
}
}
@@ -382,7 +378,7 @@ void RangeHighlighter::stopListening()
// ____ WeakComponentImplHelperBase ____
// is called when dispose() is called at this component
-void SAL_CALL RangeHighlighter::disposing()
+void RangeHighlighter::disposing(std::unique_lock<std::mutex>&)
{
// @todo: remove listener. Currently the controller shows an assertion
// because it is already disposed
diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx
index 44109500552a..714fa83b425c 100644
--- a/chart2/source/tools/ReferenceSizeProvider.cxx
+++ b/chart2/source/tools/ReferenceSizeProvider.cxx
@@ -19,19 +19,20 @@
#include <ReferenceSizeProvider.hxx>
#include <RelativeSizeHelper.hxx>
-#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <ChartModel.hxx>
+#include <DataSeries.hxx>
+#include <DataSeriesProperties.hxx>
+#include <Diagram.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XTitled.hpp>
-#include <com/sun/star/chart2/XTitle.hpp>
-#include <com/sun/star/chart2/XDataSeries.hpp>
-#include <tools/diagnose_ex.h>
+#include <Legend.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <vector>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -41,7 +42,7 @@ namespace chart
ReferenceSizeProvider::ReferenceSizeProvider(
awt::Size aPageSize,
- const Reference< XChartDocument > & xChartDoc ) :
+ const rtl::Reference<::chart::ChartModel> & xChartDoc ) :
m_aPageSize( aPageSize ),
m_xChartDoc( xChartDoc ),
m_bUseAutoScale( getAutoResizeState( xChartDoc ) == AUTO_RESIZE_YES )
@@ -91,36 +92,35 @@ void ReferenceSizeProvider::setValuesAtTitle(
void ReferenceSizeProvider::setValuesAtAllDataSeries()
{
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDoc ));
+ rtl::Reference< Diagram > xDiagram( m_xChartDoc->getFirstChartDiagram());
+ if (!xDiagram)
+ return;
// DataSeries/Points
- std::vector< Reference< XDataSeries > > aSeries(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeries =
+ xDiagram->getDataSeries();
for (auto const& elem : aSeries)
{
- Reference< beans::XPropertySet > xSeriesProp(elem, uno::UNO_QUERY );
- if( xSeriesProp.is())
+ // data points
+ Sequence< sal_Int32 > aPointIndexes;
+ try
{
- // data points
- Sequence< sal_Int32 > aPointIndexes;
- try
- {
- if( xSeriesProp->getPropertyValue( "AttributedDataPoints") >>= aPointIndexes )
- {
- for( sal_Int32 idx : aPointIndexes )
- setValuesAtPropertySet(
- elem->getDataPointByIndex( idx ) );
- }
- }
- catch (const uno::Exception&)
+ // "AttributedDataPoints"
+ if( elem->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS) >>= aPointIndexes )
{
- DBG_UNHANDLED_EXCEPTION("chart2");
+ for (sal_Int32 idx : aPointIndexes)
+ setValuesAtPropertySet(
+ elem->getDataPointByIndex( idx ) );
}
-
- //it is important to correct the datapoint properties first as they do reference the series properties
- setValuesAtPropertySet( xSeriesProp );
}
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ //it is important to correct the datapoint properties first as they do reference the series properties
+ setValuesAtPropertySet( elem );
}
}
@@ -131,7 +131,7 @@ void ReferenceSizeProvider::setValuesAtPropertySet(
if( ! xProp.is())
return;
- static const char aRefSizeName[] = "ReferencePageSize";
+ static constexpr OUString aRefSizeName = u"ReferencePageSize"_ustr;
try
{
@@ -217,84 +217,73 @@ void ReferenceSizeProvider::impl_getAutoResizeFromTitled(
with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
*/
ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState(
- const Reference< XChartDocument > & xChartDoc )
+ const rtl::Reference<::chart::ChartModel> & xChartDoc )
{
AutoResizeState eResult = AUTO_RESIZE_UNKNOWN;
// Main Title
- Reference< XTitled > xDocTitled( xChartDoc, uno::UNO_QUERY );
- if( xDocTitled.is())
- impl_getAutoResizeFromTitled( xDocTitled, eResult );
+ if( xChartDoc.is())
+ impl_getAutoResizeFromTitled( xChartDoc, eResult );
if( eResult == AUTO_RESIZE_AMBIGUOUS )
return eResult;
// diagram is needed by the rest of the objects
- Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartDoc );
+ rtl::Reference< Diagram > xDiagram = xChartDoc->getFirstChartDiagram();
if( ! xDiagram.is())
return eResult;
// Sub Title
- Reference< XTitled > xDiaTitled( xDiagram, uno::UNO_QUERY );
- if( xDiaTitled.is())
- impl_getAutoResizeFromTitled( xDiaTitled, eResult );
+ if( xDiagram.is())
+ impl_getAutoResizeFromTitled( xDiagram, eResult );
if( eResult == AUTO_RESIZE_AMBIGUOUS )
return eResult;
// Legend
- Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
- if( xLegendProp.is())
- getAutoResizeFromPropSet( xLegendProp, eResult );
+ rtl::Reference< Legend > xLegend( xDiagram->getLegend2() );
+ if( xLegend.is())
+ getAutoResizeFromPropSet( xLegend, eResult );
if( eResult == AUTO_RESIZE_AMBIGUOUS )
return eResult;
// Axes (incl. Axis Titles)
- const Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
- for( Reference< XAxis > const & axis : aAxes )
+ const std::vector< rtl::Reference< Axis > > aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
+ for( rtl::Reference< Axis > const & axis : aAxes )
{
- Reference< beans::XPropertySet > xProp( axis, uno::UNO_QUERY );
- if( xProp.is())
- getAutoResizeFromPropSet( xProp, eResult );
- Reference< XTitled > xTitled( axis, uno::UNO_QUERY );
- if( xTitled.is())
- {
- impl_getAutoResizeFromTitled( xTitled, eResult );
- if( eResult == AUTO_RESIZE_AMBIGUOUS )
- return eResult;
- }
+ getAutoResizeFromPropSet( axis, eResult );
+ impl_getAutoResizeFromTitled( axis, eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
}
// DataSeries/Points
- std::vector< Reference< XDataSeries > > aSeries(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeries =
+ xDiagram->getDataSeries();
for (auto const& elem : aSeries)
{
- Reference< beans::XPropertySet > xSeriesProp(elem, uno::UNO_QUERY);
- if( xSeriesProp.is())
- {
- getAutoResizeFromPropSet( xSeriesProp, eResult );
- if( eResult == AUTO_RESIZE_AMBIGUOUS )
- return eResult;
+ getAutoResizeFromPropSet( elem, eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
- // data points
- Sequence< sal_Int32 > aPointIndexes;
- try
+ // data points
+ Sequence< sal_Int32 > aPointIndexes;
+ try
+ {
+ // "AttributedDataPoints"
+ if( elem->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS) >>= aPointIndexes )
{
- if( xSeriesProp->getPropertyValue( "AttributedDataPoints") >>= aPointIndexes )
+ for (sal_Int32 idx : aPointIndexes)
{
- for( sal_Int32 idx : aPointIndexes )
- {
- getAutoResizeFromPropSet(
- elem->getDataPointByIndex( idx ), eResult );
- if( eResult == AUTO_RESIZE_AMBIGUOUS )
- return eResult;
- }
+ getAutoResizeFromPropSet(
+ elem->getDataPointByIndex( idx ), eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
}
}
- catch (const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ }
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
}
}
@@ -314,29 +303,27 @@ void ReferenceSizeProvider::setAutoResizeState( ReferenceSizeProvider::AutoResiz
m_bUseAutoScale = (eNewState == AUTO_RESIZE_YES);
// Main Title
- impl_setValuesAtTitled( Reference< XTitled >( m_xChartDoc, uno::UNO_QUERY ));
+ impl_setValuesAtTitled( m_xChartDoc );
// diagram is needed by the rest of the objects
- Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_xChartDoc );
+ rtl::Reference< Diagram > xDiagram = m_xChartDoc->getFirstChartDiagram();
if( ! xDiagram.is())
return;
// Sub Title
- impl_setValuesAtTitled( Reference< XTitled >( xDiagram, uno::UNO_QUERY ));
+ impl_setValuesAtTitled( xDiagram );
// Legend
- Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
- if( xLegendProp.is())
- setValuesAtPropertySet( xLegendProp );
+ rtl::Reference< Legend > xLegend( xDiagram->getLegend2() );
+ if( xLegend.is())
+ setValuesAtPropertySet( xLegend );
// Axes (incl. Axis Titles)
- const Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
- for( Reference< XAxis > const & axis : aAxes )
+ const std::vector< rtl::Reference< Axis > > aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
+ for( rtl::Reference< Axis > const & axis : aAxes )
{
- Reference< beans::XPropertySet > xProp( axis, uno::UNO_QUERY );
- if( xProp.is())
- setValuesAtPropertySet( xProp );
- impl_setValuesAtTitled( Reference< XTitled >( axis, uno::UNO_QUERY ));
+ setValuesAtPropertySet( axis );
+ impl_setValuesAtTitled( axis );
}
// DataSeries/Points
diff --git a/chart2/source/tools/RegressionCurveCalculator.cxx b/chart2/source/tools/RegressionCurveCalculator.cxx
index 5b65375b0376..8f22f9834bdc 100644
--- a/chart2/source/tools/RegressionCurveCalculator.cxx
+++ b/chart2/source/tools/RegressionCurveCalculator.cxx
@@ -36,16 +36,16 @@ using ::com::sun::star::uno::Sequence;
namespace chart
{
-RegressionCurveCalculator::RegressionCurveCalculator() :
- m_fCorrelationCoefficient(0.0),
- mDegree(2),
- mForceIntercept(false),
- mInterceptValue(0.0),
- mPeriod(2),
- mXName("x"), mYName("f(x)")
+RegressionCurveCalculator::RegressionCurveCalculator()
+ : m_fCorrelationCoefficient(std::numeric_limits<double>::quiet_NaN())
+ , mDegree(2)
+ , mForceIntercept(false)
+ , mInterceptValue(std::numeric_limits<double>::quiet_NaN())
+ , mPeriod(2)
+ , mXName("x")
+ , mYName("f(x)")
+ , mnMovingType(0)
{
- rtl::math::setNan( &m_fCorrelationCoefficient );
- rtl::math::setNan( &mInterceptValue );
}
RegressionCurveCalculator::~RegressionCurveCalculator()
@@ -72,12 +72,16 @@ void RegressionCurveCalculator::setRegressionProperties(
sal_Int32 aDegree,
sal_Bool aForceIntercept,
double aInterceptValue,
- sal_Int32 aPeriod )
+ sal_Int32 aPeriod,
+ sal_Int32 nMovingType )
{
+ if( aPeriod < 0 )
+ throw lang::IllegalArgumentException("aPeriod may not be < 0", static_cast<cppu::OWeakObject*>(this), 3);
mDegree = aDegree;
mForceIntercept = aForceIntercept;
mInterceptValue = aInterceptValue;
mPeriod = aPeriod;
+ mnMovingType = nMovingType;
}
OUString RegressionCurveCalculator::getFormattedString(
@@ -96,9 +100,7 @@ OUString RegressionCurveCalculator::getFormattedString(
{ // round fNumber to *pStringLength characters
const sal_Int32 nMinDigit = 6; // minimum significant digits for General format
sal_Int32 nSignificantDigit = ( *pStringLength <= nMinDigit ? nMinDigit : *pStringLength );
- aResult = OStringToOUString(
- ::rtl::math::doubleToString( fNumber, rtl_math_StringFormat_G1, nSignificantDigit, '.', true ),
- RTL_TEXTENCODING_ASCII_US );
+ aResult = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_G1, nSignificantDigit, '.', true );
// count characters different from significant digits (decimal separator, scientific notation)
sal_Int32 nExtraChar = aResult.getLength() - *pStringLength;
if ( nExtraChar > 0 && *pStringLength > nMinDigit )
@@ -106,9 +108,7 @@ OUString RegressionCurveCalculator::getFormattedString(
nSignificantDigit = *pStringLength - nExtraChar;
if ( nSignificantDigit < nMinDigit )
nSignificantDigit = nMinDigit;
- aResult = OStringToOUString(
- ::rtl::math::doubleToString( fNumber, rtl_math_StringFormat_G1, nSignificantDigit, '.', true ),
- RTL_TEXTENCODING_ASCII_US );
+ aResult = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_G1, nSignificantDigit, '.', true );
}
fNumber = ::rtl::math::stringToDouble( aResult, '.', ',' );
}
@@ -119,9 +119,7 @@ OUString RegressionCurveCalculator::getFormattedString(
sal_Int32 nStringLength = 4; // default length
if ( pStringLength )
nStringLength = *pStringLength;
- aResult = OStringToOUString(
- ::rtl::math::doubleToString( fNumber, rtl_math_StringFormat_G1, nStringLength, '.', true ),
- RTL_TEXTENCODING_ASCII_US );
+ aResult = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_G1, nStringLength, '.', true );
}
return aResult;
}
@@ -133,7 +131,7 @@ Sequence< geometry::RealPoint2D > SAL_CALL RegressionCurveCalculator::getCurveVa
sal_Bool /* bMaySkipPointsInCalculation */ )
{
if( nPointCount < 2 )
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException("too few points", static_cast<cppu::OWeakObject*>(this), 2);
// determine if scaling and inverse scaling for x-values work
bool bDoXScaling( xScalingX.is());
@@ -143,6 +141,7 @@ Sequence< geometry::RealPoint2D > SAL_CALL RegressionCurveCalculator::getCurveVa
bDoXScaling = bDoXScaling && xInverseScaling.is();
Sequence< geometry::RealPoint2D > aResult( nPointCount );
+ auto pResult = aResult.getArray();
double fMin( min );
double fFact = (max - min) / double(nPointCount-1);
@@ -158,8 +157,8 @@ Sequence< geometry::RealPoint2D > SAL_CALL RegressionCurveCalculator::getCurveVa
double x = fMin + nP * fFact;
if( bDoXScaling )
x = xInverseScaling->doScaling( x );
- aResult[nP].X = x;
- aResult[nP].Y = getCurveValue( x );
+ pResult[nP].X = x;
+ pResult[nP].Y = getCurveValue( x );
}
return aResult;
diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx
index 47f6a4b0ebfe..efb6bea5c3aa 100644
--- a/chart2/source/tools/RegressionCurveHelper.cxx
+++ b/chart2/source/tools/RegressionCurveHelper.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstddef>
+
#include <RegressionCurveHelper.hxx>
#include <MeanValueRegressionCurveCalculator.hxx>
#include <LinearRegressionCurveCalculator.hxx>
@@ -26,16 +30,20 @@
#include <ExponentialRegressionCurveCalculator.hxx>
#include <PotentialRegressionCurveCalculator.hxx>
#include <CommonConverters.hxx>
-#include "RegressionCurveModel.hxx"
+#include <RegressionCurveModel.hxx>
#include <ChartTypeHelper.hxx>
+#include <ChartType.hxx>
+#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
+#include <DataSeries.hxx>
#include <ResId.hxx>
#include <strings.hrc>
-#include <DiagramHelper.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/XRegressionCurveCalculator.hpp>
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
-#include <tools/diagnose_ex.h>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <o3tl/safeint.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/property.hxx>
using namespace ::com::sun::star;
@@ -85,38 +93,38 @@ OUString lcl_getServiceNameForType(SvxChartRegress eType)
namespace chart
{
-Reference< XRegressionCurve > RegressionCurveHelper::createMeanValueLine()
+rtl::Reference< RegressionCurveModel > RegressionCurveHelper::createMeanValueLine()
{
- return Reference< XRegressionCurve >( new MeanValueRegressionCurve );
+ return new MeanValueRegressionCurve;
}
-Reference< XRegressionCurve > RegressionCurveHelper::createRegressionCurveByServiceName(
- const OUString& aServiceName )
+rtl::Reference< RegressionCurveModel > RegressionCurveHelper::createRegressionCurveByServiceName(
+ std::u16string_view aServiceName )
{
- Reference< XRegressionCurve > xResult;
+ rtl::Reference< RegressionCurveModel > xResult;
// todo: use factory methods with service name
- if( aServiceName == "com.sun.star.chart2.LinearRegressionCurve" )
+ if( aServiceName == u"com.sun.star.chart2.LinearRegressionCurve" )
{
xResult.set( new LinearRegressionCurve );
}
- else if( aServiceName == "com.sun.star.chart2.LogarithmicRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.LogarithmicRegressionCurve" )
{
xResult.set( new LogarithmicRegressionCurve );
}
- else if( aServiceName == "com.sun.star.chart2.ExponentialRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.ExponentialRegressionCurve" )
{
xResult.set( new ExponentialRegressionCurve );
}
- else if( aServiceName == "com.sun.star.chart2.PotentialRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.PotentialRegressionCurve" )
{
xResult.set( new PotentialRegressionCurve );
}
- else if( aServiceName == "com.sun.star.chart2.PolynomialRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.PolynomialRegressionCurve" )
{
xResult.set( new PolynomialRegressionCurve );
}
- else if( aServiceName == "com.sun.star.chart2.MovingAverageRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.MovingAverageRegressionCurve" )
{
xResult.set( new MovingAverageRegressionCurve );
}
@@ -124,37 +132,37 @@ Reference< XRegressionCurve > RegressionCurveHelper::createRegressionCurveByServ
return xResult;
}
-Reference< XRegressionCurveCalculator > RegressionCurveHelper::createRegressionCurveCalculatorByServiceName(
- const OUString& aServiceName )
+rtl::Reference< RegressionCurveCalculator > RegressionCurveHelper::createRegressionCurveCalculatorByServiceName(
+ std::u16string_view aServiceName )
{
- Reference< XRegressionCurveCalculator > xResult;
+ rtl::Reference< RegressionCurveCalculator > xResult;
// todo: use factory methods with service name
- if( aServiceName == "com.sun.star.chart2.MeanValueRegressionCurve" )
+ if( aServiceName == u"com.sun.star.chart2.MeanValueRegressionCurve" )
{
xResult.set( new MeanValueRegressionCurveCalculator() );
}
- if( aServiceName == "com.sun.star.chart2.LinearRegressionCurve" )
+ if( aServiceName == u"com.sun.star.chart2.LinearRegressionCurve" )
{
xResult.set( new LinearRegressionCurveCalculator() );
}
- else if( aServiceName == "com.sun.star.chart2.LogarithmicRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.LogarithmicRegressionCurve" )
{
xResult.set( new LogarithmicRegressionCurveCalculator() );
}
- else if( aServiceName == "com.sun.star.chart2.ExponentialRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.ExponentialRegressionCurve" )
{
xResult.set( new ExponentialRegressionCurveCalculator() );
}
- else if( aServiceName == "com.sun.star.chart2.PotentialRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.PotentialRegressionCurve" )
{
xResult.set( new PotentialRegressionCurveCalculator() );
}
- else if( aServiceName == "com.sun.star.chart2.PolynomialRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.PolynomialRegressionCurve" )
{
xResult.set( new PolynomialRegressionCurveCalculator() );
}
- else if( aServiceName == "com.sun.star.chart2.MovingAverageRegressionCurve" )
+ else if( aServiceName == u"com.sun.star.chart2.MovingAverageRegressionCurve" )
{
xResult.set( new MovingAverageRegressionCurveCalculator() );
}
@@ -211,8 +219,9 @@ void RegressionCurveHelper::initializeCurveCalculator(
// initialize with 1, 2, ...
//first category (index 0) matches with real number 1.0
aXValues.realloc( aYValues.getLength());
+ auto pXValues = aXValues.getArray();
for( i=0; i<aXValues.getLength(); ++i )
- aXValues[i] = i+1;
+ pXValues[i] = i+1;
bXValuesFound = true;
}
@@ -224,14 +233,14 @@ void RegressionCurveHelper::initializeCurveCalculator(
void RegressionCurveHelper::initializeCurveCalculator(
const Reference< XRegressionCurveCalculator > & xOutCurveCalculator,
- const Reference< XDataSeries > & xSeries,
- const Reference< frame::XModel > & xModel )
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
+ const rtl::Reference<::chart::ChartModel> & xModel )
{
sal_Int32 nAxisType = ChartTypeHelper::getAxisType(
ChartModelHelper::getChartTypeOfSeries( xModel, xSeries ), 0 ); // x-axis
initializeCurveCalculator( xOutCurveCalculator,
- uno::Reference< data::XDataSource >( xSeries, uno::UNO_QUERY ),
+ xSeries,
(nAxisType == AxisType::REALNUMBER) );
}
@@ -259,6 +268,28 @@ bool RegressionCurveHelper::hasMeanValueLine(
return false;
}
+bool RegressionCurveHelper::hasMeanValueLine(
+ const rtl::Reference< DataSeries > & xRegCnt )
+{
+ if( !xRegCnt.is())
+ return false;
+
+ try
+ {
+ for( rtl::Reference< RegressionCurveModel > const & curve : xRegCnt->getRegressionCurves2() )
+ {
+ if( isMeanValueLine( curve ))
+ return true;
+ }
+ }
+ catch( const Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ return false;
+}
+
bool RegressionCurveHelper::isMeanValueLine(
const uno::Reference< chart2::XRegressionCurve > & xRegCurve )
{
@@ -268,7 +299,15 @@ bool RegressionCurveHelper::isMeanValueLine(
"com.sun.star.chart2.MeanValueRegressionCurve";
}
-uno::Reference< chart2::XRegressionCurve >
+bool RegressionCurveHelper::isMeanValueLine(
+ const rtl::Reference< RegressionCurveModel > & xRegCurve )
+{
+ return xRegCurve.is() &&
+ xRegCurve->getServiceName() ==
+ "com.sun.star.chart2.MeanValueRegressionCurve";
+}
+
+rtl::Reference< RegressionCurveModel >
RegressionCurveHelper::getMeanValueLine(
const uno::Reference< chart2::XRegressionCurveContainer > & xRegCnt )
{
@@ -281,6 +320,29 @@ uno::Reference< chart2::XRegressionCurve >
for( uno::Reference< XRegressionCurve > const & curve : aCurves )
{
if( isMeanValueLine( curve ))
+ return dynamic_cast<RegressionCurveModel*>(curve.get());
+ }
+ }
+ catch( const Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+
+ return nullptr;
+}
+
+rtl::Reference< RegressionCurveModel >
+ RegressionCurveHelper::getMeanValueLine(
+ const rtl::Reference< DataSeries > & xRegCnt )
+{
+ if( xRegCnt.is())
+ {
+ try
+ {
+ for( rtl::Reference< RegressionCurveModel > const & curve : xRegCnt->getRegressionCurves2() )
+ {
+ if( isMeanValueLine( curve ))
return curve;
}
}
@@ -290,7 +352,7 @@ uno::Reference< chart2::XRegressionCurve >
}
}
- return uno::Reference< chart2::XRegressionCurve >();
+ return nullptr;
}
void RegressionCurveHelper::addMeanValueLine(
@@ -316,6 +378,25 @@ void RegressionCurveHelper::addMeanValueLine(
}
}
+void RegressionCurveHelper::addMeanValueLine(
+ rtl::Reference< DataSeries > const & xRegCnt,
+ const uno::Reference< XPropertySet > & xSeriesProp )
+{
+ if( !xRegCnt.is() ||
+ ::chart::RegressionCurveHelper::hasMeanValueLine( xRegCnt ) )
+ return;
+
+ // todo: use a valid context
+ rtl::Reference< RegressionCurveModel > xCurve( createMeanValueLine() );
+ xRegCnt->addRegressionCurve( xCurve );
+
+ if( xSeriesProp.is())
+ {
+ xCurve->setPropertyValue( "LineColor",
+ xSeriesProp->getPropertyValue( "Color"));
+ }
+}
+
void RegressionCurveHelper::removeMeanValueLine(
Reference< XRegressionCurveContainer > const & xRegCnt )
{
@@ -345,13 +426,40 @@ void RegressionCurveHelper::removeMeanValueLine(
}
}
-uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::addRegressionCurve(
+void RegressionCurveHelper::removeMeanValueLine(
+ rtl::Reference< DataSeries > const & xRegCnt )
+{
+ if( !xRegCnt.is())
+ return;
+
+ try
+ {
+ for( rtl::Reference< RegressionCurveModel > const & curve : xRegCnt->getRegressionCurves2() )
+ {
+ if( isMeanValueLine( curve ))
+ {
+ xRegCnt->removeRegressionCurve( curve );
+ // attention: the iterator i has become invalid now
+
+ // note: assume that there is only one mean-value curve
+ // to remove multiple mean-value curves remove the break
+ break;
+ }
+ }
+ }
+ catch( const Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+}
+
+rtl::Reference< RegressionCurveModel > RegressionCurveHelper::addRegressionCurve(
SvxChartRegress eType,
uno::Reference< XRegressionCurveContainer > const & xRegressionCurveContainer,
const uno::Reference< beans::XPropertySet >& xPropertySource,
const uno::Reference< beans::XPropertySet >& xEquationProperties )
{
- uno::Reference< chart2::XRegressionCurve > xCurve;
+ rtl::Reference< RegressionCurveModel > xCurve;
if( !xRegressionCurveContainer.is() )
return xCurve;
@@ -366,24 +474,20 @@ uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::addRegressionC
if( !aServiceName.isEmpty())
{
// todo: use a valid context
- xCurve.set( createRegressionCurveByServiceName( aServiceName ) );
+ xCurve = createRegressionCurveByServiceName( aServiceName );
if( xEquationProperties.is())
xCurve->setEquationProperties( xEquationProperties );
- uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
- if( xProperties.is())
+ if( xPropertySource.is())
+ comphelper::copyProperties( xPropertySource, xCurve );
+ else
{
- if( xPropertySource.is())
- comphelper::copyProperties( xPropertySource, xProperties );
- else
+ uno::Reference< XPropertySet > xSeriesProp( xRegressionCurveContainer, uno::UNO_QUERY );
+ if( xSeriesProp.is())
{
- uno::Reference< XPropertySet > xSeriesProp( xRegressionCurveContainer, uno::UNO_QUERY );
- if( xSeriesProp.is())
- {
- xProperties->setPropertyValue( "LineColor",
- xSeriesProp->getPropertyValue( "Color"));
- }
+ xCurve->setPropertyValue( "LineColor",
+ xSeriesProp->getPropertyValue( "Color"));
}
}
}
@@ -392,67 +496,98 @@ uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::addRegressionC
return xCurve;
}
+rtl::Reference< RegressionCurveModel > RegressionCurveHelper::addRegressionCurve(
+ SvxChartRegress eType,
+ rtl::Reference< DataSeries > const & xRegressionCurveContainer,
+ const uno::Reference< beans::XPropertySet >& xPropertySource,
+ const uno::Reference< beans::XPropertySet >& xEquationProperties )
+{
+ rtl::Reference< RegressionCurveModel > xCurve;
+
+ if( !xRegressionCurveContainer.is() )
+ return xCurve;
+
+ if( eType == SvxChartRegress::NONE )
+ {
+ OSL_FAIL("don't create a regression curve of type none");
+ return xCurve;
+ }
+
+ OUString aServiceName( lcl_getServiceNameForType( eType ));
+ if( !aServiceName.isEmpty())
+ {
+ // todo: use a valid context
+ xCurve = createRegressionCurveByServiceName( aServiceName );
+
+ if( xEquationProperties.is())
+ xCurve->setEquationProperties( xEquationProperties );
+
+ if( xPropertySource.is())
+ comphelper::copyProperties( xPropertySource, xCurve );
+ else
+ {
+ xCurve->setPropertyValue( "LineColor",
+ xRegressionCurveContainer->getPropertyValue( "Color"));
+ }
+ }
+ xRegressionCurveContainer->addRegressionCurve( xCurve );
+
+ return xCurve;
+}
+
/** removes all regression curves that are not of type mean value
and returns true, if anything was removed
*/
bool RegressionCurveHelper::removeAllExceptMeanValueLine(
- uno::Reference< chart2::XRegressionCurveContainer > const & xRegCnt )
+ rtl::Reference< DataSeries > const & xRegCnt )
{
+ if( !xRegCnt.is())
+ return false;
+
bool bRemovedSomething = false;
- if( xRegCnt.is())
+ try
{
- try
+ std::vector< rtl::Reference< RegressionCurveModel > > aCurvesToDelete;
+ for( rtl::Reference< RegressionCurveModel > const & curve : xRegCnt->getRegressionCurves2() )
{
- const uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(
- xRegCnt->getRegressionCurves());
- std::vector< uno::Reference< chart2::XRegressionCurve > > aCurvesToDelete;
- for( uno::Reference< chart2::XRegressionCurve > const & curve : aCurves )
- {
- if( ! isMeanValueLine( curve ))
- {
- aCurvesToDelete.push_back( curve );
- }
- }
-
- for (auto const& curveToDelete : aCurvesToDelete)
+ if( ! isMeanValueLine( curve ))
{
- xRegCnt->removeRegressionCurve(curveToDelete);
- bRemovedSomething = true;
+ aCurvesToDelete.push_back( curve );
}
}
- catch( const uno::Exception & )
+
+ for (auto const& curveToDelete : aCurvesToDelete)
{
- DBG_UNHANDLED_EXCEPTION("chart2");
+ xRegCnt->removeRegressionCurve(curveToDelete);
+ bRemovedSomething = true;
}
}
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
return bRemovedSomething;
}
void RegressionCurveHelper::removeEquations(
- uno::Reference< chart2::XRegressionCurveContainer > const & xRegCnt )
+ rtl::Reference< DataSeries > const & xRegCnt )
{
if( !xRegCnt.is())
return;
try
{
- const uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(
- xRegCnt->getRegressionCurves());
- for( uno::Reference< chart2::XRegressionCurve > const & curve : aCurves )
+ for( rtl::Reference< RegressionCurveModel > const & curve : xRegCnt->getRegressionCurves2() )
{
if( !isMeanValueLine( curve ) )
{
- uno::Reference< chart2::XRegressionCurve > xRegCurve( curve );
- if( xRegCurve.is() )
+ uno::Reference< beans::XPropertySet > xEqProp( curve->getEquationProperties() ) ;
+ if( xEqProp.is())
{
- uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties() ) ;
- if( xEqProp.is())
- {
- xEqProp->setPropertyValue( "ShowEquation", uno::Any( false ));
- xEqProp->setPropertyValue( "XName", uno::Any( OUString("x") ));
- xEqProp->setPropertyValue( "YName", uno::Any( OUString("f(x) ") ));
- xEqProp->setPropertyValue( "ShowCorrelationCoefficient", uno::Any( false ));
- }
+ xEqProp->setPropertyValue( "ShowEquation", uno::Any( false ));
+ xEqProp->setPropertyValue( "XName", uno::Any( OUString("x") ));
+ xEqProp->setPropertyValue( "YName", uno::Any( OUString("f(x) ") ));
+ xEqProp->setPropertyValue( "ShowCorrelationCoefficient", uno::Any( false ));
}
}
}
@@ -463,7 +598,7 @@ void RegressionCurveHelper::removeEquations(
}
}
-uno::Reference< XRegressionCurve > RegressionCurveHelper::changeRegressionCurveType(
+rtl::Reference< RegressionCurveModel > RegressionCurveHelper::changeRegressionCurveType(
SvxChartRegress eType,
uno::Reference< XRegressionCurveContainer > const & xRegressionCurveContainer,
uno::Reference< XRegressionCurve > const & xRegressionCurve )
@@ -476,7 +611,7 @@ uno::Reference< XRegressionCurve > RegressionCurveHelper::changeRegressionCurveT
xRegressionCurve->getEquationProperties());
}
-uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getFirstCurveNotMeanValueLine(
+rtl::Reference< RegressionCurveModel > RegressionCurveHelper::getFirstCurveNotMeanValueLine(
const Reference< XRegressionCurveContainer > & xRegCnt )
{
if( !xRegCnt.is())
@@ -490,6 +625,30 @@ uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getFirstCurveN
{
if( ! isMeanValueLine( curve ))
{
+ return dynamic_cast<RegressionCurveModel*>(curve.get());
+ }
+ }
+ }
+ catch( const Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ return nullptr;
+}
+
+rtl::Reference< RegressionCurveModel > RegressionCurveHelper::getFirstCurveNotMeanValueLine(
+ const rtl::Reference< DataSeries > & xRegCnt )
+{
+ if( !xRegCnt.is())
+ return nullptr;
+
+ try
+ {
+ for( rtl::Reference< RegressionCurveModel > const & curve : xRegCnt->getRegressionCurves2() )
+ {
+ if( ! isMeanValueLine( curve ))
+ {
return curve;
}
}
@@ -502,8 +661,8 @@ uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getFirstCurveN
return nullptr;
}
-uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getRegressionCurveAtIndex(
- const Reference< XRegressionCurveContainer >& xCurveContainer,
+rtl::Reference< RegressionCurveModel > RegressionCurveHelper::getRegressionCurveAtIndex(
+ const rtl::Reference< DataSeries >& xCurveContainer,
sal_Int32 aIndex )
{
if( !xCurveContainer.is())
@@ -511,8 +670,8 @@ uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getRegressionC
try
{
- uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(xCurveContainer->getRegressionCurves());
- if(0 <= aIndex && aIndex < aCurves.getLength())
+ const std::vector< rtl::Reference< RegressionCurveModel > > aCurves(xCurveContainer->getRegressionCurves2());
+ if(0 <= aIndex && o3tl::make_unsigned(aIndex) < aCurves.size())
{
if(!isMeanValueLine(aCurves[aIndex]))
return aCurves[aIndex];
@@ -681,29 +840,6 @@ OUString RegressionCurveHelper::getRegressionCurveName( const Reference< XRegres
return aResult;
}
-std::vector< Reference< chart2::XRegressionCurve > >
- RegressionCurveHelper::getAllRegressionCurvesNotMeanValueLine(
- const Reference< chart2::XDiagram > & xDiagram )
-{
- std::vector< Reference< chart2::XRegressionCurve > > aResult;
- std::vector< Reference< chart2::XDataSeries > > aSeries( DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- for (auto const& elem : aSeries)
- {
- Reference< chart2::XRegressionCurveContainer > xContainer(elem, uno::UNO_QUERY);
- if(xContainer.is())
- {
- const uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(xContainer->getRegressionCurves());
- for( Reference< XRegressionCurve > const & curve : aCurves )
- {
- if( ! isMeanValueLine( curve ))
- aResult.push_back( curve );
- }
- }
- }
-
- return aResult;
-}
-
void RegressionCurveHelper::resetEquationPosition(
const Reference< chart2::XRegressionCurve > & xCurve )
{
@@ -712,7 +848,7 @@ void RegressionCurveHelper::resetEquationPosition(
try
{
- const OUString aPosPropertyName( "RelativePosition" );
+ static constexpr OUString aPosPropertyName( u"RelativePosition"_ustr );
Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties()); // since m233: , uno::UNO_SET_THROW );
if( xEqProp->getPropertyValue( aPosPropertyName ).hasValue())
xEqProp->setPropertyValue( aPosPropertyName, uno::Any());
@@ -724,15 +860,15 @@ void RegressionCurveHelper::resetEquationPosition(
}
sal_Int32 RegressionCurveHelper::getRegressionCurveIndex(
- const Reference< chart2::XRegressionCurveContainer >& xContainer,
- const Reference< chart2::XRegressionCurve >& xCurve )
+ const rtl::Reference< DataSeries >& xContainer,
+ const rtl::Reference< RegressionCurveModel >& xCurve )
{
if( xContainer.is())
{
- uno::Sequence< uno::Reference< XRegressionCurve > > aCurves(
- xContainer->getRegressionCurves());
+ const std::vector< rtl::Reference< RegressionCurveModel > > & aCurves(
+ xContainer->getRegressionCurves2());
- for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ for( std::size_t i = 0; i < aCurves.size(); ++i )
{
if( xCurve == aCurves[i] )
return i;
@@ -759,6 +895,20 @@ bool RegressionCurveHelper::hasEquation( const Reference< chart2::XRegressionCur
return bHasEquation;
}
+bool RegressionCurveHelper::MayHaveCorrelationCoefficient( const Reference< chart2::XRegressionCurve > & xCurve )
+{
+ bool bMayHaveCorrelationCoefficient = true;
+ if( xCurve.is())
+ {
+ uno::Reference< beans::XPropertySet > xEquationProp( xCurve->getEquationProperties() );
+ if( xEquationProp.is() )
+ {
+ xEquationProp->getPropertyValue( "MayHaveCorrelationCoefficient") >>= bMayHaveCorrelationCoefficient;
+ }
+ }
+ return bMayHaveCorrelationCoefficient;
+}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/RegressionCurveModel.cxx b/chart2/source/tools/RegressionCurveModel.cxx
index 649e93e2702f..06be003ef106 100644
--- a/chart2/source/tools/RegressionCurveModel.cxx
+++ b/chart2/source/tools/RegressionCurveModel.cxx
@@ -17,8 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "RegressionCurveModel.hxx"
+#include <RegressionCurveModel.hxx>
#include <LinePropertiesHelper.hxx>
+#include <RegressionCurveCalculator.hxx>
#include <RegressionCurveHelper.hxx>
#include "RegressionEquation.hxx"
#include <CloneHelper.hxx>
@@ -26,7 +27,6 @@
#include <ModifyListenerHelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <tools/diagnose_ex.h>
namespace com::sun::star::uno { class XComponentContext; }
@@ -44,7 +44,8 @@ enum
PROPERTY_EXTRAPOLATE_BACKWARD,
PROPERTY_FORCE_INTERCEPT,
PROPERTY_INTERCEPT_VALUE,
- PROPERTY_CURVE_NAME
+ PROPERTY_CURVE_NAME,
+ PROPERTY_MOVING_AVERAGE_TYPE
};
void lcl_AddPropertiesToVector(
@@ -62,6 +63,12 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::BOUND |
beans::PropertyAttribute::MAYBEDEFAULT );
+ rOutProperties.emplace_back( "MovingAverageType",
+ PROPERTY_MOVING_AVERAGE_TYPE,
+ cppu::UnoType<sal_Int32>::get(),
+ beans::PropertyAttribute::BOUND |
+ beans::PropertyAttribute::MAYBEDEFAULT );
+
rOutProperties.emplace_back( "ExtrapolateForward",
PROPERTY_EXTRAPOLATE_FORWARD,
cppu::UnoType<double>::get(),
@@ -92,31 +99,21 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::BOUND );
}
-struct StaticXXXDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- ::chart::LinePropertiesHelper::AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-};
-
-struct StaticXXXDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticXXXDefaults_Initializer >
+const ::chart::tPropertyValueMap & GetStaticXXXDefaults()
{
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ [](){
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
-struct StaticRegressionCurveInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& GetStaticRegressionCurveInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
+ static ::cppu::OPropertyArrayHelper aPropHelper =
+ [](){
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
@@ -125,25 +122,15 @@ private:
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticRegressionCurveInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionCurveInfoHelper_Initializer >
-{
+ }();
+ return aPropHelper;
};
-struct StaticRegressionCurveInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticRegressionCurveInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticRegressionCurveInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticRegressionCurveInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& GetStaticRegressionCurveInfo()
{
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(GetStaticRegressionCurveInfoHelper() ) );
+ return xPropertySetInfo;
};
} // anonymous namespace
@@ -152,9 +139,8 @@ namespace chart
{
RegressionCurveModel::RegressionCurveModel( tCurveType eCurveType ) :
- ::property::OPropertySet( m_aMutex ),
m_eRegressionCurveType( eCurveType ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_xModifyEventForwarder( new ModifyEventForwarder() ),
m_xEquationProperties( new RegressionEquation )
{
// set 0 line width (default) hard, so that it is always written to XML,
@@ -166,9 +152,9 @@ RegressionCurveModel::RegressionCurveModel( tCurveType eCurveType ) :
RegressionCurveModel::RegressionCurveModel( const RegressionCurveModel & rOther ) :
impl::RegressionCurveModel_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
+ ::property::OPropertySet( rOther ),
m_eRegressionCurveType( rOther.m_eRegressionCurveType ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
m_xEquationProperties.set( CloneHelper::CreateRefClone< beans::XPropertySet >()( rOther.m_xEquationProperties ));
ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
@@ -197,11 +183,20 @@ void SAL_CALL RegressionCurveModel::setEquationProperties( const uno::Reference<
ModifyListenerHelper::removeListener( m_xEquationProperties, m_xModifyEventForwarder );
m_xEquationProperties.set( xEquationProperties );
+ setPropertyMayHaveR2();
ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
fireModifyEvent();
}
}
+void RegressionCurveModel::setPropertyMayHaveR2()
+{
+ if( m_xEquationProperties.is()) {
+ bool bMayHaveR2 = m_eRegressionCurveType != CURVE_TYPE_MOVING_AVERAGE;
+ m_xEquationProperties->setPropertyValue( "MayHaveCorrelationCoefficient", uno::Any( bMayHaveR2 ) );
+ }
+}
+
// ____ XServiceName ____
OUString SAL_CALL RegressionCurveModel::getServiceName()
{
@@ -229,28 +224,12 @@ OUString SAL_CALL RegressionCurveModel::getServiceName()
// ____ XModifyBroadcaster ____
void SAL_CALL RegressionCurveModel::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL RegressionCurveModel::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
@@ -268,6 +247,7 @@ void SAL_CALL RegressionCurveModel::disposing( const lang::EventObject& /* Sourc
// ____ OPropertySet ____
void RegressionCurveModel::firePropertyChangeEvent()
{
+ setPropertyMayHaveR2();
fireModifyEvent();
}
@@ -277,24 +257,25 @@ void RegressionCurveModel::fireModifyEvent()
}
// ____ OPropertySet ____
-uno::Any RegressionCurveModel::GetDefaultValue( sal_Int32 nHandle ) const
+void RegressionCurveModel::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticXXXDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = GetStaticXXXDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL RegressionCurveModel::getInfoHelper()
{
- return *StaticRegressionCurveInfoHelper::get();
+ return GetStaticRegressionCurveInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL RegressionCurveModel::getPropertySetInfo()
{
- return *StaticRegressionCurveInfo::get();
+ return GetStaticRegressionCurveInfo();
}
// needed by MSC compiler
diff --git a/chart2/source/tools/RegressionEquation.cxx b/chart2/source/tools/RegressionEquation.cxx
index 1c46dc69f054..34bbd6b491d9 100644
--- a/chart2/source/tools/RegressionEquation.cxx
+++ b/chart2/source/tools/RegressionEquation.cxx
@@ -33,7 +33,6 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/awt/Size.hpp>
-#include <tools/diagnose_ex.h>
#include <algorithm>
@@ -54,6 +53,7 @@ enum
PROP_EQUATION_XNAME,
PROP_EQUATION_YNAME,
PROP_EQUATION_SHOW_CORRELATION_COEFF,
+ PROP_EQUATION_MAY_HAVE_CORRELATION_COEFF,
PROP_EQUATION_REF_PAGE_SIZE,
PROP_EQUATION_REL_POS,
PROP_EQUATION_NUMBER_FORMAT
@@ -86,6 +86,12 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT );
+ rOutProperties.emplace_back( "MayHaveCorrelationCoefficient",
+ PROP_EQUATION_MAY_HAVE_CORRELATION_COEFF,
+ cppu::UnoType<bool>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
+
rOutProperties.emplace_back( "ReferencePageSize",
PROP_EQUATION_REF_PAGE_SIZE,
cppu::UnoType<awt::Size>::get(),
@@ -105,84 +111,59 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
-struct StaticRegressionEquationDefaults_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 );
- ::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
-
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_XNAME, OUString("x") );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_YNAME, OUString("f(x)") );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW_CORRELATION_COEFF, false );
- //::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SEPARATOR, OUString( '\n' ));
-
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
-
- float fDefaultCharHeight = 10.0;
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
- }
-};
-
-struct StaticRegressionEquationDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticRegressionEquationDefaults_Initializer >
-{
-};
-
-struct StaticRegressionEquationInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-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::CharacterProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticRegressionEquationInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionEquationInfoHelper_Initializer >
+::chart::tPropertyValueMap& GetStaticRegressionEquationDefaults()
{
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ [](){
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( aOutMap );
+ ::chart::CharacterProperties::AddDefaultsToMap( aOutMap );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_SHOW, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_XNAME, OUString("x") );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_YNAME, OUString("f(x)") );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_SHOW_CORRELATION_COEFF, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_MAY_HAVE_CORRELATION_COEFF, true );
+ //::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_SEPARATOR, OUString( '\n' ));
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
};
-struct StaticRegressionEquationInfo_Initializer
+::cppu::OPropertyArrayHelper& GetStaticRegressionEquationInfoHelper()
{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticRegressionEquationInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
+ static ::cppu::OPropertyArrayHelper aPropHelper =
+ [](){
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
-struct StaticRegressionEquationInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticRegressionEquationInfo_Initializer >
+const uno::Reference< beans::XPropertySetInfo > & GetStaticRegressionEquationInfo()
{
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(GetStaticRegressionEquationInfoHelper()) );
+ return xPropertySetInfo;
};
} // anonymous namespace
@@ -191,14 +172,13 @@ namespace chart
{
RegressionEquation::RegressionEquation() :
- ::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder())
{}
RegressionEquation::RegressionEquation( const RegressionEquation & rOther ) :
impl::RegressionEquation_Base(rOther),
- ::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ ::property::OPropertySet( rOther ),
+ m_xModifyEventForwarder( new ModifyEventForwarder())
{}
RegressionEquation::~RegressionEquation()
@@ -211,51 +191,36 @@ uno::Reference< util::XCloneable > SAL_CALL RegressionEquation::createClone()
}
// ____ OPropertySet ____
-uno::Any RegressionEquation::GetDefaultValue( sal_Int32 nHandle ) const
+void RegressionEquation::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticRegressionEquationDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = GetStaticRegressionEquationDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ rAny.clear();
+ else
+ rAny = (*aFound).second;
}
::cppu::IPropertyArrayHelper & SAL_CALL RegressionEquation::getInfoHelper()
{
- return *StaticRegressionEquationInfoHelper::get();
+ return GetStaticRegressionEquationInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL RegressionEquation::getPropertySetInfo()
{
- return *StaticRegressionEquationInfo::get();
+ return GetStaticRegressionEquationInfo();
}
// ____ XModifyBroadcaster ____
void SAL_CALL RegressionEquation::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL RegressionEquation::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
{
- try
- {
- uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
// ____ XModifyListener ____
diff --git a/chart2/source/tools/RegressionEquation.hxx b/chart2/source/tools/RegressionEquation.hxx
index 605dd115ade6..8a500cd1d73c 100644
--- a/chart2/source/tools/RegressionEquation.hxx
+++ b/chart2/source/tools/RegressionEquation.hxx
@@ -16,20 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_TOOLS_REGRESSIONEQUATION_HXX
-#define INCLUDED_CHART2_SOURCE_TOOLS_REGRESSIONEQUATION_HXX
+#pragma once
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/chart2/XTitle.hpp>
-#include <MutexContainer.hxx>
#include <OPropertySet.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
+#include <ModifyListenerHelper.hxx>
namespace chart
{
@@ -46,7 +43,6 @@ typedef ::cppu::WeakImplHelper<
}
class RegressionEquation final :
- public MutexContainer,
public impl::RegressionEquation_Base,
public ::property::OPropertySet
{
@@ -71,7 +67,7 @@ private:
explicit RegressionEquation( const RegressionEquation & rOther );
// ____ OPropertySet ____
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
+ virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
@@ -112,12 +108,9 @@ private:
css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > > m_aStrings;
- css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder;
+ rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
};
} // namespace chart
-// INCLUDED_CHART2_SOURCE_TOOLS_REGRESSIONEQUATION_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/RelativePositionHelper.cxx b/chart2/source/tools/RelativePositionHelper.cxx
index deb3e5ca5a2c..260888e907dd 100644
--- a/chart2/source/tools/RelativePositionHelper.cxx
+++ b/chart2/source/tools/RelativePositionHelper.cxx
@@ -237,9 +237,9 @@ awt::Point RelativePositionHelper::getCenterOfAnchoredObject(
//take rotation into account:
aResult.X += static_cast< sal_Int32 >(
- ::rtl::math::round( fXDelta * rtl::math::cos( fAnglePi ) + fYDelta * rtl::math::sin( fAnglePi ) ) );
+ ::rtl::math::round( fXDelta * std::cos( fAnglePi ) + fYDelta * std::sin( fAnglePi ) ) );
aResult.Y += static_cast< sal_Int32 >(
- ::rtl::math::round( - fXDelta * rtl::math::sin( fAnglePi ) + fYDelta * rtl::math::cos( fAnglePi ) ) );
+ ::rtl::math::round( - fXDelta * std::sin( fAnglePi ) + fYDelta * std::cos( fAnglePi ) ) );
return aResult;
}
diff --git a/chart2/source/tools/RelativeSizeHelper.cxx b/chart2/source/tools/RelativeSizeHelper.cxx
index a142d5b293e8..4a3cd84cfb88 100644
--- a/chart2/source/tools/RelativeSizeHelper.cxx
+++ b/chart2/source/tools/RelativeSizeHelper.cxx
@@ -20,14 +20,13 @@
#include <RelativeSizeHelper.hxx>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/diagnose_ex.h>
-
+#include <comphelper/diagnose_ex.hxx>
+#include <svx/unoshape.hxx>
#include <vector>
#include <algorithm>
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
-using namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
@@ -45,13 +44,44 @@ double RelativeSizeHelper::calculate(
rOldReferenceSize.Height <= 0 )
return fValue;
- return min(
+ return std::min(
static_cast< double >( rNewReferenceSize.Width ) / static_cast< double >( rOldReferenceSize.Width ),
static_cast< double >( rNewReferenceSize.Height ) / static_cast< double >( rOldReferenceSize.Height ))
* fValue;
}
void RelativeSizeHelper::adaptFontSizes(
+ SvxShapeText& xTargetProperties,
+ const awt::Size & rOldReferenceSize,
+ const awt::Size & rNewReferenceSize )
+{
+ float fFontHeight = 0;
+
+ std::vector< OUString > aProperties;
+ aProperties.emplace_back("CharHeight" );
+ aProperties.emplace_back("CharHeightAsian" );
+ aProperties.emplace_back("CharHeightComplex" );
+
+ for (auto const& property : aProperties)
+ {
+ try
+ {
+ if( xTargetProperties.SvxShape::getPropertyValue(property) >>= fFontHeight )
+ {
+ xTargetProperties.SvxShape::setPropertyValue(
+ property,
+ Any( static_cast< float >(
+ calculate( fFontHeight, rOldReferenceSize, rNewReferenceSize ))));
+ }
+ }
+ catch( const Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+}
+
+void RelativeSizeHelper::adaptFontSizes(
const Reference< XPropertySet > & xTargetProperties,
const awt::Size & rOldReferenceSize,
const awt::Size & rNewReferenceSize )
@@ -61,7 +91,7 @@ void RelativeSizeHelper::adaptFontSizes(
float fFontHeight = 0;
- vector< OUString > aProperties;
+ std::vector< OUString > aProperties;
aProperties.emplace_back("CharHeight" );
aProperties.emplace_back("CharHeightAsian" );
aProperties.emplace_back("CharHeightComplex" );
diff --git a/chart2/source/tools/ResId.cxx b/chart2/source/tools/ResId.cxx
index 850eb9b84dd7..aaa1d840c95c 100644
--- a/chart2/source/tools/ResId.cxx
+++ b/chart2/source/tools/ResId.cxx
@@ -18,13 +18,12 @@
*/
#include <ResId.hxx>
-#include <unotools/resmgr.hxx>
namespace chart
{
- OUString SchResId(const char *pId)
+ OUString SchResId(TranslateId aId)
{
- return Translate::get(pId, Translate::Create("chart"));
+ return Translate::get(aId, Translate::Create("chart"));
}
} // namespace chart
diff --git a/chart2/source/tools/Scaling.cxx b/chart2/source/tools/Scaling.cxx
index 27a9c51a7a44..b7179537c43b 100644
--- a/chart2/source/tools/Scaling.cxx
+++ b/chart2/source/tools/Scaling.cxx
@@ -18,19 +18,21 @@
*/
#include <Scaling.hxx>
-#include <rtl/math.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <cppuhelper/supportsservice.hxx>
+#include <cmath>
+#include <limits>
+
namespace com::sun::star::uno { class XComponentContext; }
namespace
{
-const char lcl_aServiceName_Logarithmic[] = "com.sun.star.chart2.LogarithmicScaling";
-const char lcl_aServiceName_Exponential[] = "com.sun.star.chart2.ExponentialScaling";
-const char lcl_aServiceName_Linear[] = "com.sun.star.chart2.LinearScaling";
-const char lcl_aServiceName_Power[] = "com.sun.star.chart2.PowerScaling";
+constexpr OUString lcl_aServiceName_Logarithmic = u"com.sun.star.chart2.LogarithmicScaling"_ustr;
+constexpr OUString lcl_aServiceName_Exponential = u"com.sun.star.chart2.ExponentialScaling"_ustr;
+constexpr OUString lcl_aServiceName_Linear = u"com.sun.star.chart2.LinearScaling"_ustr;
+constexpr OUString lcl_aServiceName_Power = u"com.sun.star.chart2.PowerScaling"_ustr;
}
@@ -57,12 +59,9 @@ LogarithmicScaling::~LogarithmicScaling()
double SAL_CALL LogarithmicScaling::doScaling( double value )
{
- double fResult;
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
- fResult = log( value ) / m_fLogOfBase;
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
+ return std::log( value ) / m_fLogOfBase;
}
uno::Reference< XScaling > SAL_CALL LogarithmicScaling::getInverseScaling()
@@ -106,12 +105,9 @@ ExponentialScaling::~ExponentialScaling()
double SAL_CALL ExponentialScaling::doScaling( double value )
{
- double fResult;
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
- fResult = pow( m_fBase, value );
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
+ return std::pow( m_fBase, value );
}
uno::Reference< XScaling > SAL_CALL ExponentialScaling::getInverseScaling()
@@ -154,12 +150,9 @@ LinearScaling::~LinearScaling()
double SAL_CALL LinearScaling::doScaling( double value )
{
- double fResult;
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
- fResult = m_fOffset + m_fSlope * value;
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
+ return m_fOffset + m_fSlope * value;
}
uno::Reference< XScaling > SAL_CALL
@@ -167,7 +160,7 @@ uno::Reference< XScaling > SAL_CALL
{
// ToDo: ApproxEqual ?
if( m_fSlope == 0 )
- throw uno::RuntimeException();
+ throw uno::RuntimeException("Divide by zero exception");
return new LinearScaling( 1.0 / m_fSlope, m_fOffset / m_fSlope );
}
@@ -205,12 +198,9 @@ PowerScaling::~PowerScaling()
double SAL_CALL PowerScaling::doScaling( double value )
{
- double fResult;
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
- fResult = pow( value, m_fExponent );
- return fResult;
+ return std::numeric_limits<double>::quiet_NaN();
+ return std::pow( value, m_fExponent );
}
uno::Reference< XScaling > SAL_CALL
@@ -218,7 +208,7 @@ uno::Reference< XScaling > SAL_CALL
{
// ToDo: ApproxEqual ?
if( m_fExponent == 0 )
- throw uno::RuntimeException();
+ throw uno::RuntimeException("Divide by zero exception");
return new PowerScaling( 1.0 / m_fExponent );
}
diff --git a/chart2/source/tools/SceneProperties.cxx b/chart2/source/tools/SceneProperties.cxx
index 9d5746ef649d..eb65d81c94db 100644
--- a/chart2/source/tools/SceneProperties.cxx
+++ b/chart2/source/tools/SceneProperties.cxx
@@ -18,6 +18,7 @@
*/
#include <SceneProperties.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/drawing/HomogenMatrix.hpp>
@@ -276,13 +277,13 @@ void SceneProperties::AddDefaultsToMap(
aMtx.Line4.Column1 = aMtx.Line4.Column2 = aMtx.Line4.Column3 = 0.0;
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_TRANSF_MATRIX, aMtx );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCENE_DISTANCE, 4200 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCENE_FOCAL_LENGTH, 8000 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_DISTANCE, sal_Int32(4200) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_FOCAL_LENGTH, sal_Int32(8000) );
// PROP_SCENE_SHADOW_SLANT;
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_SHADE_MODE, drawing::ShadeMode_SMOOTH );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >(
+ ::chart::PropertyHelper::setPropertyValueDefault(
rOutMap, PROP_SCENE_AMBIENT_COLOR, ChartTypeHelper::getDefaultAmbientLightColor(false,nullptr));
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_TWO_SIDED_LIGHTING, true );
diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx
index 02dab3b9bd89..5f3bbdf802d6 100644
--- a/chart2/source/tools/StatisticsHelper.cxx
+++ b/chart2/source/tools/StatisticsHelper.cxx
@@ -18,20 +18,22 @@
*/
#include <StatisticsHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <ErrorBar.hxx>
#include <unonames.hxx>
-#include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/data/LabeledDataSequence.hpp>
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
#include <com/sun/star/chart2/data/XDataSink.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+
+#include <cmath>
+#include <limits>
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Reference;
@@ -60,19 +62,14 @@ double lcl_getVariance( const Sequence< double > & rData, sal_Int32 & rOutValidC
}
}
- double fResult;
if( rOutValidCount == 0 )
- ::rtl::math::setNan( & fResult );
- else
- {
- const double fN = static_cast< double >( rOutValidCount );
- fResult = (fQuadSum - fSum*fSum/fN) / fN;
- }
+ return std::numeric_limits<double>::quiet_NaN();
- return fResult;
+ const double fN = static_cast< double >( rOutValidCount );
+ return (fQuadSum - fSum*fSum/fN) / fN;
}
-Reference< chart2::data::XLabeledDataSequence > lcl_getErrorBarLabeledSequence(
+uno::Reference< chart2::data::XLabeledDataSequence > lcl_getErrorBarLabeledSequence(
const Reference< chart2::data::XDataSource > & xDataSource,
bool bPositiveValue, bool bYError,
OUString & rOutRoleNameUsed )
@@ -84,8 +81,7 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getErrorBarLabeledSequence(
aRole.append( 'x');
OUString aPlainRole = aRole.makeStringAndClear();
- aRole.append( aPlainRole );
- aRole.append( '-' );
+ aRole.append( aPlainRole + "-" );
if( bPositiveValue )
aRole.append( "positive" );
@@ -93,14 +89,14 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getErrorBarLabeledSequence(
aRole.append( "negative" );
OUString aLongRole = aRole.makeStringAndClear();
- Reference< chart2::data::XLabeledDataSequence > xLSeq(
- ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aLongRole ));
+ uno::Reference< chart2::data::XLabeledDataSequence > xLSeq =
+ ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aLongRole );
// try role without "-negative" or "-positive" postfix
if( xLSeq.is())
rOutRoleNameUsed = aLongRole;
else
{
- xLSeq.set( ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aPlainRole ));
+ xLSeq = ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aPlainRole );
if( xLSeq.is())
rOutRoleNameUsed = aPlainRole;
else
@@ -136,7 +132,8 @@ void lcl_addSequenceToDataSource(
Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
xDataSource->getDataSequences());
aSequences.realloc( aSequences.getLength() + 1 );
- aSequences[ aSequences.getLength() - 1 ] = xLSeq;
+ auto pSequences = aSequences.getArray();
+ pSequences[ aSequences.getLength() - 1 ] = xLSeq;
xSink->setData( aSequences );
}
@@ -146,7 +143,7 @@ void lcl_setXMLRangePropertyAtDataSequence(
{
try
{
- const OUString aXMLRangePropName( "CachedXMLRange");
+ static constexpr OUString aXMLRangePropName( u"CachedXMLRange"_ustr);
Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY_THROW );
Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo());
if( xInfo.is() && xInfo->hasPropertyByName( aXMLRangePropName ))
@@ -183,36 +180,27 @@ double StatisticsHelper::getStandardError( const Sequence< double > & rData )
{
sal_Int32 nValCount;
double fVar = lcl_getVariance( rData, nValCount );
- double fResult;
-
- if( nValCount == 0 ||
- std::isnan( fVar ))
- {
- ::rtl::math::setNan( & fResult );
- }
- else
- {
- // standard-deviation / sqrt(n)
- fResult = sqrt( fVar ) / sqrt( double(nValCount) );
- }
- return fResult;
+ if( nValCount == 0 || std::isnan( fVar ))
+ return std::numeric_limits<double>::quiet_NaN();
+ // standard-deviation / sqrt(n)
+ return sqrt( fVar ) / sqrt( double(nValCount) );
}
-Reference< chart2::data::XLabeledDataSequence > StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+uno::Reference< chart2::data::XLabeledDataSequence > StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
const Reference< chart2::data::XDataSource > & xDataSource,
bool bPositiveValue,
bool bYError /* = true */ )
{
- Reference< chart2::data::XLabeledDataSequence > xResult;
+ uno::Reference< chart2::data::XLabeledDataSequence > xResult;
if( !xDataSource.is())
return xResult;
OUString aRole;
- Reference< chart2::data::XLabeledDataSequence > xLSeq(
- lcl_getErrorBarLabeledSequence( xDataSource, bPositiveValue, bYError, aRole ));
+ uno::Reference< chart2::data::XLabeledDataSequence > xLSeq =
+ lcl_getErrorBarLabeledSequence( xDataSource, bPositiveValue, bYError, aRole );
if( xLSeq.is())
- xResult.set( xLSeq );
+ xResult = xLSeq;
return xResult;
}
@@ -222,10 +210,10 @@ Reference< chart2::data::XDataSequence > StatisticsHelper::getErrorDataSequenceF
bool bPositiveValue,
bool bYError /* = true */ )
{
- Reference< chart2::data::XLabeledDataSequence > xLSeq(
+ uno::Reference< chart2::data::XLabeledDataSequence > xLSeq =
StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
xDataSource, bPositiveValue,
- bYError ));
+ bYError );
if( !xLSeq.is())
return Reference< chart2::data::XDataSequence >();
@@ -238,8 +226,7 @@ double StatisticsHelper::getErrorFromDataSource(
bool bPositiveValue,
bool bYError /* = true */ )
{
- double fResult = 0.0;
- ::rtl::math::setNan( & fResult );
+ double fResult = std::numeric_limits<double>::quiet_NaN();
Reference< chart2::data::XDataSequence > xValues(
StatisticsHelper::getErrorDataSequenceFromDataSource( xDataSource, bPositiveValue, bYError ));
@@ -293,18 +280,17 @@ void StatisticsHelper::setErrorDataSequence(
}
Reference< beans::XPropertySet > StatisticsHelper::addErrorBars(
- const Reference< chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference< DataSeries > & xDataSeries,
sal_Int32 nStyle,
bool bYError /* = true */ )
{
Reference< beans::XPropertySet > xErrorBar;
- Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY );
- if( !xSeriesProp.is())
+ if( !xDataSeries.is())
return xErrorBar;
const OUString aPropName(
- bYError ? OUString(CHART_UNONAME_ERRORBAR_Y) : OUString(CHART_UNONAME_ERRORBAR_X));
- if( !( xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar ) ||
+ bYError ? CHART_UNONAME_ERRORBAR_Y : CHART_UNONAME_ERRORBAR_X);
+ if( !( xDataSeries->getPropertyValue( aPropName ) >>= xErrorBar ) ||
!xErrorBar.is())
{
xErrorBar.set( new ErrorBar );
@@ -316,28 +302,27 @@ Reference< beans::XPropertySet > StatisticsHelper::addErrorBars(
xErrorBar->setPropertyValue( "ErrorBarStyle", uno::Any( nStyle ));
}
- xSeriesProp->setPropertyValue( aPropName, uno::Any( xErrorBar ));
+ xDataSeries->setPropertyValue( aPropName, uno::Any( xErrorBar ));
return xErrorBar;
}
Reference< beans::XPropertySet > StatisticsHelper::getErrorBars(
- const Reference< chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference< DataSeries > & xDataSeries,
bool bYError /* = true */ )
{
- Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY );
Reference< beans::XPropertySet > xErrorBar;
const OUString aPropName(
- bYError ? OUString(CHART_UNONAME_ERRORBAR_Y) : OUString(CHART_UNONAME_ERRORBAR_X));
+ bYError ? CHART_UNONAME_ERRORBAR_Y : CHART_UNONAME_ERRORBAR_X);
- if ( xSeriesProp.is())
- xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar;
+ if ( xDataSeries.is())
+ xDataSeries->getPropertyValue( aPropName ) >>= xErrorBar;
return xErrorBar;
}
bool StatisticsHelper::hasErrorBars(
- const Reference< chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference< DataSeries > & xDataSeries,
bool bYError /* = true */ )
{
Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, bYError ));
@@ -349,7 +334,7 @@ bool StatisticsHelper::hasErrorBars(
}
void StatisticsHelper::removeErrorBars(
- const Reference< chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference< DataSeries > & xDataSeries,
bool bYError /* = true */ )
{
Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, bYError ));
@@ -359,7 +344,7 @@ void StatisticsHelper::removeErrorBars(
}
bool StatisticsHelper::usesErrorBarRanges(
- const Reference< chart2::XDataSeries > & xDataSeries,
+ const rtl::Reference< DataSeries > & xDataSeries,
bool bYError /* = true */ )
{
Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, bYError ));
diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx
index fe788397d40d..47fa8bb49317 100644
--- a/chart2/source/tools/ThreeDHelper.cxx
+++ b/chart2/source/tools/ThreeDHelper.cxx
@@ -17,19 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <basegfx/numeric/ftools.hxx>
#include <ThreeDHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <ChartTypeHelper.hxx>
-#include <BaseGFXHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <defines.hxx>
-#include <editeng/unoprnms.hxx>
-#include <com/sun/star/beans/XPropertyState.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/drawing/ShadeMode.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/helpers.hxx>
#include <rtl/math.hxx>
@@ -46,17 +43,16 @@ using ::rtl::math::tan;
namespace
{
-bool lcl_isRightAngledAxesSetAndSupported( const Reference< beans::XPropertySet >& xSceneProperties )
+bool lcl_isRightAngledAxesSetAndSupported( const rtl::Reference< Diagram >& xDiagram )
{
- if( xSceneProperties.is() )
+ if( xDiagram.is() )
{
bool bRightAngledAxes = false;
- xSceneProperties->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes;
+ xDiagram->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes;
if(bRightAngledAxes)
{
- uno::Reference< chart2::XDiagram > xDiagram( xSceneProperties, uno::UNO_QUERY );
if( ChartTypeHelper::isSupportingRightAngledAxes(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
+ xDiagram->getChartTypeByIndex( 0 ) ) )
{
return true;
}
@@ -65,233 +61,6 @@ bool lcl_isRightAngledAxesSetAndSupported( const Reference< beans::XPropertySet
return false;
}
-void lcl_RotateLightSource( const Reference< beans::XPropertySet >& xSceneProperties
- , const OUString& rLightSourceDirection
- , const OUString& rLightSourceOn
- , const ::basegfx::B3DHomMatrix& rRotationMatrix )
-{
- if( !xSceneProperties.is() )
- return;
-
- bool bLightOn = false;
- if( !(xSceneProperties->getPropertyValue( rLightSourceOn ) >>= bLightOn) )
- return;
-
- if( bLightOn )
- {
- drawing::Direction3D aLight;
- if( xSceneProperties->getPropertyValue( rLightSourceDirection ) >>= aLight )
- {
- ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aLight ) );
- aLightVector = rRotationMatrix*aLightVector;
-
- xSceneProperties->setPropertyValue( rLightSourceDirection
- , uno::Any( BaseGFXHelper::B3DVectorToDirection3D( aLightVector ) ) );
- }
- }
-}
-
-void lcl_rotateLights( const ::basegfx::B3DHomMatrix& rLightRottion, const Reference< beans::XPropertySet >& xSceneProperties )
-{
- if(!xSceneProperties.is())
- return;
-
- ::basegfx::B3DHomMatrix aLightRottion( rLightRottion );
- BaseGFXHelper::ReduceToRotationMatrix( aLightRottion );
-
- lcl_RotateLightSource( xSceneProperties, "D3DSceneLightDirection1", "D3DSceneLightOn1", aLightRottion );
- lcl_RotateLightSource( xSceneProperties, "D3DSceneLightDirection2", "D3DSceneLightOn2", aLightRottion );
- lcl_RotateLightSource( xSceneProperties, "D3DSceneLightDirection3", "D3DSceneLightOn3", aLightRottion );
- lcl_RotateLightSource( xSceneProperties, "D3DSceneLightDirection4", "D3DSceneLightOn4", aLightRottion );
- lcl_RotateLightSource( xSceneProperties, "D3DSceneLightDirection5", "D3DSceneLightOn5", aLightRottion );
- lcl_RotateLightSource( xSceneProperties, "D3DSceneLightDirection6", "D3DSceneLightOn6", aLightRottion );
- lcl_RotateLightSource( xSceneProperties, "D3DSceneLightDirection7", "D3DSceneLightOn7", aLightRottion );
- lcl_RotateLightSource( xSceneProperties, "D3DSceneLightDirection8", "D3DSceneLightOn8", aLightRottion );
-}
-
-::basegfx::B3DHomMatrix lcl_getInverseRotationMatrix( const Reference< beans::XPropertySet >& xSceneProperties )
-{
- ::basegfx::B3DHomMatrix aInverseRotation;
- double fXAngleRad=0.0;
- double fYAngleRad=0.0;
- double fZAngleRad=0.0;
- ThreeDHelper::getRotationAngleFromDiagram(
- xSceneProperties, fXAngleRad, fYAngleRad, fZAngleRad );
- aInverseRotation.rotate( 0.0, 0.0, -fZAngleRad );
- aInverseRotation.rotate( 0.0, -fYAngleRad, 0.0 );
- aInverseRotation.rotate( -fXAngleRad, 0.0, 0.0 );
- return aInverseRotation;
-}
-
-::basegfx::B3DHomMatrix lcl_getCompleteRotationMatrix( const Reference< beans::XPropertySet >& xSceneProperties )
-{
- ::basegfx::B3DHomMatrix aCompleteRotation;
- double fXAngleRad=0.0;
- double fYAngleRad=0.0;
- double fZAngleRad=0.0;
- ThreeDHelper::getRotationAngleFromDiagram(
- xSceneProperties, fXAngleRad, fYAngleRad, fZAngleRad );
- aCompleteRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
- return aCompleteRotation;
-}
-
-bool lcl_isEqual( const drawing::Direction3D& rA, const drawing::Direction3D& rB )
-{
- return ::rtl::math::approxEqual(rA.DirectionX, rB.DirectionX)
- && ::rtl::math::approxEqual(rA.DirectionY, rB.DirectionY)
- && ::rtl::math::approxEqual(rA.DirectionZ, rB.DirectionZ);
-}
-
-bool lcl_isLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramProps, bool bRealistic )
-{
- if(!xDiagramProps.is())
- return false;
-
- bool bIsOn = false;
- xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_2 ) >>= bIsOn;
- if(!bIsOn)
- return false;
-
- uno::Reference< chart2::XDiagram > xDiagram( xDiagramProps, uno::UNO_QUERY );
- uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
-
- sal_Int32 nColor = 0;
- xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTCOLOR_2 ) >>= nColor;
- if( nColor != ::chart::ChartTypeHelper::getDefaultDirectLightColor( !bRealistic, xChartType ) )
- return false;
-
- sal_Int32 nAmbientColor = 0;
- xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR ) >>= nAmbientColor;
- if( nAmbientColor != ::chart::ChartTypeHelper::getDefaultAmbientLightColor( !bRealistic, xChartType ) )
- return false;
-
- drawing::Direction3D aDirection(0,0,0);
- xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 ) >>= aDirection;
-
- drawing::Direction3D aDefaultDirection( bRealistic
- ? ChartTypeHelper::getDefaultRealisticLightDirection(xChartType)
- : ChartTypeHelper::getDefaultSimpleLightDirection(xChartType) );
-
- //rotate default light direction when right angled axes are off but supported
- {
- bool bRightAngledAxes = false;
- xDiagramProps->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes;
- if(!bRightAngledAxes)
- {
- if( ChartTypeHelper::isSupportingRightAngledAxes(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
- {
- ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( xDiagramProps ) );
- BaseGFXHelper::ReduceToRotationMatrix( aRotation );
- ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aDefaultDirection ) );
- aLightVector = aRotation*aLightVector;
- aDefaultDirection = BaseGFXHelper::B3DVectorToDirection3D( aLightVector );
- }
- }
- }
-
- return lcl_isEqual( aDirection, aDefaultDirection );
-}
-
-bool lcl_isRealisticLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramProps )
-{
- return lcl_isLightScheme( xDiagramProps, true /*bRealistic*/ );
-}
-bool lcl_isSimpleLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramProps )
-{
- return lcl_isLightScheme( xDiagramProps, false /*bRealistic*/ );
-}
-void lcl_setLightsForScheme( const uno::Reference< beans::XPropertySet >& xDiagramProps, const ThreeDLookScheme& rScheme )
-{
- if(!xDiagramProps.is())
- return;
- if( rScheme == ThreeDLookScheme_Unknown)
- return;
-
- xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_2, uno::Any( true ) );
-
- uno::Reference< chart2::XDiagram > xDiagram( xDiagramProps, uno::UNO_QUERY );
- uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
- uno::Any aADirection( rScheme == ThreeDLookScheme_Simple
- ? ChartTypeHelper::getDefaultSimpleLightDirection(xChartType)
- : ChartTypeHelper::getDefaultRealisticLightDirection(xChartType) );
-
- xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2, aADirection );
- //rotate light direction when right angled axes are off but supported
- {
- bool bRightAngledAxes = false;
- xDiagramProps->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes;
- if(!bRightAngledAxes)
- {
- if( ChartTypeHelper::isSupportingRightAngledAxes( xChartType ) )
- {
- ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( xDiagramProps ) );
- BaseGFXHelper::ReduceToRotationMatrix( aRotation );
- lcl_RotateLightSource( xDiagramProps, "D3DSceneLightDirection2", "D3DSceneLightOn2", aRotation );
- }
- }
- }
-
- sal_Int32 nColor = ::chart::ChartTypeHelper::getDefaultDirectLightColor( rScheme==ThreeDLookScheme_Simple, xChartType );
- xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTCOLOR_2, uno::Any( nColor ) );
-
- sal_Int32 nAmbientColor = ::chart::ChartTypeHelper::getDefaultAmbientLightColor( rScheme==ThreeDLookScheme_Simple, xChartType );
- xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR, uno::Any( nAmbientColor ) );
-}
-
-bool lcl_isRealisticScheme( drawing::ShadeMode aShadeMode
- , sal_Int32 nRoundedEdges
- , sal_Int32 nObjectLines )
-{
- if(aShadeMode!=drawing::ShadeMode_SMOOTH)
- return false;
- if(nRoundedEdges!=5)
- return false;
- if(nObjectLines!=0)
- return false;
- return true;
-}
-
-bool lcl_isSimpleScheme( drawing::ShadeMode aShadeMode
- , sal_Int32 nRoundedEdges
- , sal_Int32 nObjectLines
- , const uno::Reference< XDiagram >& xDiagram )
-{
- if(aShadeMode!=drawing::ShadeMode_FLAT)
- return false;
- if(nRoundedEdges!=0)
- return false;
- if(nObjectLines==0)
- {
- uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
- return ChartTypeHelper::noBordersForSimpleScheme( xChartType );
- }
- if(nObjectLines!=1)
- return false;
- return true;
-}
-
-void lcl_setRealisticScheme( drawing::ShadeMode& rShadeMode
- , sal_Int32& rnRoundedEdges
- , sal_Int32& rnObjectLines )
-{
- rShadeMode = drawing::ShadeMode_SMOOTH;
- rnRoundedEdges = 5;
- rnObjectLines = 0;
-}
-
-void lcl_setSimpleScheme( drawing::ShadeMode& rShadeMode
- , sal_Int32& rnRoundedEdges
- , sal_Int32& rnObjectLines
- , const uno::Reference< XDiagram >& xDiagram )
-{
- rShadeMode = drawing::ShadeMode_FLAT;
- rnRoundedEdges = 0;
-
- uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
- rnObjectLines = ChartTypeHelper::noBordersForSimpleScheme( xChartType ) ? 0 : 1;
-}
-
} //end anonymous namespace
drawing::CameraGeometry ThreeDHelper::getDefaultCameraGeometry( bool bPie )
@@ -316,60 +85,6 @@ drawing::CameraGeometry ThreeDHelper::getDefaultCameraGeometry( bool bPie )
namespace
{
-::basegfx::B3DHomMatrix lcl_getCameraMatrix( const uno::Reference< beans::XPropertySet >& xSceneProperties )
-{
- drawing::HomogenMatrix aCameraMatrix;
-
- drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
- if( xSceneProperties.is() )
- xSceneProperties->getPropertyValue( "D3DCameraGeometry" ) >>= aCG;
-
- ::basegfx::B3DVector aVPN( BaseGFXHelper::Direction3DToB3DVector( aCG.vpn ) );
- ::basegfx::B3DVector aVUP( BaseGFXHelper::Direction3DToB3DVector( aCG.vup ) );
-
- //normalize vectors:
- aVPN.normalize();
- aVUP.normalize();
-
- ::basegfx::B3DVector aCross = ::basegfx::cross( aVUP, aVPN );
-
- //first line is VUP x VPN
- aCameraMatrix.Line1.Column1 = aCross[0];
- aCameraMatrix.Line1.Column2 = aCross[1];
- aCameraMatrix.Line1.Column3 = aCross[2];
- aCameraMatrix.Line1.Column4 = 0.0;
-
- //second line is VUP
- aCameraMatrix.Line2.Column1 = aVUP[0];
- aCameraMatrix.Line2.Column2 = aVUP[1];
- aCameraMatrix.Line2.Column3 = aVUP[2];
- aCameraMatrix.Line2.Column4 = 0.0;
-
- //third line is VPN
- aCameraMatrix.Line3.Column1 = aVPN[0];
- aCameraMatrix.Line3.Column2 = aVPN[1];
- aCameraMatrix.Line3.Column3 = aVPN[2];
- aCameraMatrix.Line3.Column4 = 0.0;
-
- //fourth line is 0 0 0 1
- aCameraMatrix.Line4.Column1 = 0.0;
- aCameraMatrix.Line4.Column2 = 0.0;
- aCameraMatrix.Line4.Column3 = 0.0;
- aCameraMatrix.Line4.Column4 = 1.0;
-
- return BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aCameraMatrix );
-}
-
-double lcl_shiftAngleToIntervalMinusPiToPi( double fAngleRad )
-{
- //valid range: ]-Pi,Pi]
- while( fAngleRad<=-F_PI )
- fAngleRad+=(2*F_PI);
- while( fAngleRad>F_PI )
- fAngleRad-=(2*F_PI);
- return fAngleRad;
-}
-
void lcl_ensureIntervalMinus1To1( double& rSinOrCos )
{
if (rSinOrCos < -1.0)
@@ -415,25 +130,25 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
//element 23
double f23 = cos(R)*sin(E);
if(f23>0)
- x = F_PI2;
+ x = M_PI_2;
else
- x = -F_PI2;
+ x = -M_PI_2;
y = R;
}
else if( ( nRotationDeg == 90 || nRotationDeg == 270 )
&& ( nElevationDeg == 90 || nElevationDeg == 270 ) )
{
//cR==0 && cE==0
- z = F_PI2;
+ z = M_PI_2;
if( sin(R)>0 )
- x = F_PI2;
+ x = M_PI_2;
else
- x = -F_PI2;
+ x = -M_PI_2;
if( (sin(R)*sin(E))>0 )
y = 0.0;
else
- y = F_PI;
+ y = M_PI;
}
else if( (nRotationDeg == 0 || nRotationDeg == 180 )
&& ( nElevationDeg == 0 || nElevationDeg == 180 ) )
@@ -450,14 +165,14 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
z = 0.0;
if( (sin(R)/cos(E))>0 )
- y = F_PI2;
+ y = M_PI_2;
else
- y = -F_PI2;
+ y = -M_PI_2;
if( (cos(E))>0 )
x = 0;
else
- x = F_PI;
+ x = M_PI;
}
else if ( nElevationDeg == 0 || nElevationDeg == 180 )
{
@@ -472,19 +187,19 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
else if ( nElevationDeg == 90 || nElevationDeg == 270 )
{
//sR!=0 cR!=0 cE==0
- //element 12 + 22 --> y=0 or F_PI and x=+-F_PI/2
+ //element 12 + 22 --> y=0 or M_PI and x=+-M_PI/2
//-->element 13/23:
z = atan(sin(R)/(cos(R)*sin(E)));
//use element 13 for sign for x
if( (sin(R)*sin(z))>0.0 )
- x = F_PI2;
+ x = M_PI_2;
else
- x = -F_PI2;
+ x = -M_PI_2;
//use element 21 for y
if( (sin(R)*sin(E)*sin(z))>0.0)
y = 0.0;
else
- y = F_PI;
+ y = M_PI;
}
else if ( nRotationDeg == 0 || nRotationDeg == 180 )
{
@@ -499,10 +214,10 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
else if (nRotationDeg == 90 || nRotationDeg == 270)
{
//sE!=0 cE!=0 cR==0
- //z = +- F_PI/2;
- //x = +- F_PI/2;
- z = F_PI2;
- x = F_PI2;
+ //z = +- M_PI/2;
+ //x = +- M_PI/2;
+ z = M_PI_2;
+ x = M_PI_2;
double sR = sin(R);
if( sR<0.0 )
x *= -1.0; //different signs for x and z
@@ -553,7 +268,7 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
if( (f22a*f22b)<0.0 )
{
y *= -1;
- x=(F_PI-x);
+ x=(M_PI-x);
}
}
else
@@ -565,7 +280,7 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
if( (f22a*f22b)<0.0 )
{
y *= -1;
- x=(F_PI-x);
+ x=(M_PI-x);
}
}
}
@@ -605,14 +320,14 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
if( f11 > 0 )
R = 0.0;
else
- R = F_PI;
+ R = M_PI;
//element 23
double f23 = cos(z)*sin(x) / cos(R);
if( f23 > 0 )
- E = F_PI2;
+ E = M_PI_2;
else
- E = -F_PI2;
+ E = -M_PI_2;
}
else if( lcl_isCosZero(z) )
{
@@ -622,16 +337,16 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
double f13 = sin(x)*sin(z);
//element 13+11
if( f13 > 0 )
- R = F_PI2;
+ R = M_PI_2;
else
- R = -F_PI2;
+ R = -M_PI_2;
//element 21
double f21 = cos(y)*sin(z) / sin(R);
if( f21 > 0 )
- E = F_PI2;
+ E = M_PI_2;
else
- E = -F_PI2;
+ E = -M_PI_2;
}
else
{
@@ -641,14 +356,14 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
R = atan( f13/f11 );
if(f11<0)
- R+=F_PI;
+ R+=M_PI;
//element 23
double f23 = cos(z)*sin(x);
if( f23/cos(R) > 0 )
- E = F_PI2;
+ E = M_PI_2;
else
- E = -F_PI2;
+ E = -M_PI_2;
}
}
else if( lcl_isSinZero(x) )
@@ -658,13 +373,13 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
if( f11 > 0 )
R = 0.0;
else
- R = F_PI;
+ R = M_PI;
double f22 = cos(x)*cos(z);
if( f22 > 0 )
E = 0.0;
else
- E = F_PI;
+ E = M_PI;
}
else if( lcl_isSinZero(z) )
{
@@ -673,14 +388,14 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
if( f11 > 0 )
R = 0.0;
else
- R = F_PI;
+ R = M_PI;
//element 22 && 23
double f22 = cos(x)*cos(z);
double f23 = cos(z)*sin(x);
E = atan( f23/(f22*cos(R)) );
if( (f22*cos(E))<0 )
- E+=F_PI;
+ E+=M_PI;
}
else if( lcl_isCosZero(z) )
{
@@ -688,16 +403,16 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
double f13 = sin(x)*sin(z);
//element 13+11
if( f13 > 0 )
- R = F_PI2;
+ R = M_PI_2;
else
- R = -F_PI2;
+ R = -M_PI_2;
//element 21+22
double f21 = cos(y)*sin(z);
if( f21/sin(R) > 0 )
- E = F_PI2;
+ E = M_PI_2;
else
- E = -F_PI2;
+ E = -M_PI_2;
}
else
{
@@ -705,7 +420,7 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
double f13 = sin(x)*sin(z);
R = atan( f13/f11 );
if( (f11*cos(R))<0.0 )
- R+=F_PI;
+ R+=M_PI;
double f22 = cos(x)*cos(z);
if( !lcl_isCosZero(R) )
@@ -713,7 +428,7 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
else
E = atan( cos(y)*sin(z) /( f22*sin(R) ) );
if( (f22*cos(E))<0 )
- E+=F_PI;
+ E+=M_PI;
}
}
else if( lcl_isCosZero(y) )
@@ -722,15 +437,15 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
double f13 = sin(x)*sin(z)+cos(x)*cos(z)*sin(y);
if( f13 >= 0 )
- R = F_PI2;
+ R = M_PI_2;
else
- R = -F_PI2;
+ R = -M_PI_2;
double f22 = cos(x)*cos(z)+sin(x)*sin(y)*sin(z);
if( f22 >= 0 )
E = 0.0;
else
- E = F_PI;
+ E = M_PI;
}
else if( lcl_isSinZero(x) )
{
@@ -742,13 +457,13 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
R = atan( f13/f11 );
//R = asin(f13);
if( f11<0 )
- R+=F_PI;
+ R+=M_PI;
double f22 = cos(x)*cos(z);
if( f22>0 )
E = 0.0;
else
- E = F_PI;
+ E = M_PI;
}
else if( lcl_isCosZero(z) )
{
@@ -770,14 +485,14 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
R = atan( f13/f11 );
if( f11<0 )
- R+=F_PI;
+ R+=M_PI;
double f21 = cos(y)*sin(z);
double f22 = cos(x)*cos(z);
E = atan(f21/(f22*sin(R)) );
if( (f22*cos(E))<0.0 )
- E+=F_PI;
+ E+=M_PI;
}
}
else if( lcl_isCosZero(x) )
@@ -787,23 +502,23 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
if( lcl_isSinZero(z) )
{
//cosY!=0 sinY!=0 cosX=0 sinZ=0
- R=0;//13 -> R=0 or F_PI
+ R=0;//13 -> R=0 or M_PI
if( f11<0.0 )
- R=F_PI;
- E=F_PI2;//22 -> E=+-F_PI/2
+ R=M_PI;
+ E=M_PI_2;//22 -> E=+-M_PI/2
//use element 11 and 23 for sign
double f23 = cos(z)*sin(x);
if( (f11*f23*sin(E))<0.0 )
- E=-F_PI2;
+ E=-M_PI_2;
}
else if( lcl_isCosZero(z) )
{
//cosY!=0 sinY!=0 cosX=0 cosZ=0
//element 11 & 13:
if( (sin(x)*sin(z))>0.0 )
- R=F_PI2;
+ R=M_PI_2;
else
- R=-F_PI2;
+ R=-M_PI_2;
//element 22:
E=acos( sin(x)*sin(y)*sin(z));
//use element 21 for sign:
@@ -817,7 +532,7 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
R = atan( sin(x)*sin(z)/(cos(y)*cos(z)) );
//use 13 for 'sign'
if( (sin(x)*sin(z))<0.0 )
- R += F_PI;
+ R += M_PI;
//element 22
E = acos(sin(x)*sin(y)*sin(z) );
//use 21 for sign
@@ -846,12 +561,12 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
R=atan(-cos(y)/(cos(x)*sin(y)));
//use element 13 for 'sign'
if( (sin(x)*sin(z)*sin(R))<0.0 )
- R+=F_PI;
+ R+=M_PI;
//element 21/22
E=atan( cos(y)*sin(z)/(sin(R)*sin(x)*sin(y)*sin(z)) );
//use element 23 for 'sign'
if( (-cos(x)*sin(y)*sin(z)*cos(R)*sin(E))<0.0 )
- E+=F_PI;
+ E+=M_PI;
}
else
{
@@ -860,13 +575,13 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
double f13 = sin(x)*sin(z)+cos(x)*cos(z)*sin(y);
R = atan( f13/ f11 );
if(f11<0.0)
- R+=F_PI;
+ R+=M_PI;
double f22 = cos(x)*cos(z)+sin(x)*sin(y)*sin(z);
double f23 = cos(x)*sin(y)*sin(z)-cos(z)*sin(x);
//23/22:
E = atan( -1.0*f23/(f22*cos(R)) );
if(f22<0.0)
- E+=F_PI;
+ E+=M_PI;
}
rnElevationDeg = basegfx::fround(basegfx::rad2deg(E));
@@ -888,172 +603,6 @@ void ThreeDHelper::adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double
rfYAngleRad = ThreeDHelper::getValueClippedToRange(rfYAngleRad, basegfx::deg2rad(ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes()) );
}
-void ThreeDHelper::getRotationAngleFromDiagram(
- const Reference< beans::XPropertySet >& xSceneProperties, double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad )
-{
- //takes the camera and the transformation matrix into account
-
- rfXAngleRad = rfYAngleRad = rfZAngleRad = 0.0;
-
- if( !xSceneProperties.is() )
- return;
-
- //get camera rotation
- ::basegfx::B3DHomMatrix aFixCameraRotationMatrix( lcl_getCameraMatrix( xSceneProperties ) );
- BaseGFXHelper::ReduceToRotationMatrix( aFixCameraRotationMatrix );
-
- //get scene rotation
- ::basegfx::B3DHomMatrix aSceneRotation;
- {
- drawing::HomogenMatrix aHomMatrix;
- if( xSceneProperties->getPropertyValue( "D3DTransformMatrix") >>= aHomMatrix )
- {
- aSceneRotation = BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHomMatrix );
- BaseGFXHelper::ReduceToRotationMatrix( aSceneRotation );
- }
- }
-
- ::basegfx::B3DHomMatrix aResultRotation = aFixCameraRotationMatrix * aSceneRotation;
- ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix( aResultRotation ) );
-
- rfXAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getX());
- rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getY());
- rfZAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getZ());
-
- if(rfZAngleRad<-F_PI2 || rfZAngleRad>F_PI2)
- {
- rfZAngleRad-=F_PI;
- rfXAngleRad-=F_PI;
- rfYAngleRad=(F_PI-rfYAngleRad);
-
- rfXAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfXAngleRad);
- rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfYAngleRad);
- rfZAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfZAngleRad);
- }
-}
-
-void ThreeDHelper::switchRightAngledAxes( const Reference< beans::XPropertySet >& xSceneProperties, bool bRightAngledAxes )
-{
- try
- {
- if( xSceneProperties.is() )
- {
- bool bOldRightAngledAxes = false;
- xSceneProperties->getPropertyValue( "RightAngledAxes") >>= bOldRightAngledAxes;
- if( bOldRightAngledAxes!=bRightAngledAxes)
- {
- xSceneProperties->setPropertyValue( "RightAngledAxes", uno::Any( bRightAngledAxes ));
- if(bRightAngledAxes)
- {
- ::basegfx::B3DHomMatrix aInverseRotation( lcl_getInverseRotationMatrix( xSceneProperties ) );
- lcl_rotateLights( aInverseRotation, xSceneProperties );
- }
- else
- {
- ::basegfx::B3DHomMatrix aCompleteRotation( lcl_getCompleteRotationMatrix( xSceneProperties ) );
- lcl_rotateLights( aCompleteRotation, xSceneProperties );
- }
- }
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
-void ThreeDHelper::setRotationAngleToDiagram(
- const Reference< beans::XPropertySet >& xSceneProperties
- , double fXAngleRad, double fYAngleRad, double fZAngleRad )
-{
- //the rotation of the camera is not touched but taken into account
- //the rotation difference is applied to the transformation matrix
-
- //the light sources will be adapted also
-
- if( !xSceneProperties.is() )
- return;
-
- try
- {
- //remind old rotation for adaptation of light directions
- ::basegfx::B3DHomMatrix aInverseOldRotation( lcl_getInverseRotationMatrix( xSceneProperties ) );
-
- ::basegfx::B3DHomMatrix aInverseCameraRotation;
- {
- ::basegfx::B3DTuple aR( BaseGFXHelper::GetRotationFromMatrix(
- lcl_getCameraMatrix( xSceneProperties ) ) );
- aInverseCameraRotation.rotate( 0.0, 0.0, -aR.getZ() );
- aInverseCameraRotation.rotate( 0.0, -aR.getY(), 0.0 );
- aInverseCameraRotation.rotate( -aR.getX(), 0.0, 0.0 );
- }
-
- ::basegfx::B3DHomMatrix aCumulatedRotation;
- aCumulatedRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
-
- //calculate new scene matrix
- ::basegfx::B3DHomMatrix aSceneRotation = aInverseCameraRotation*aCumulatedRotation;
- BaseGFXHelper::ReduceToRotationMatrix( aSceneRotation );
-
- //set new rotation to transformation matrix
- xSceneProperties->setPropertyValue(
- "D3DTransformMatrix", uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation )));
-
- //rotate lights if RightAngledAxes are not set or not supported
- bool bRightAngledAxes = false;
- xSceneProperties->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes;
- uno::Reference< chart2::XDiagram > xDiagram( xSceneProperties, uno::UNO_QUERY );
- if(!bRightAngledAxes || !ChartTypeHelper::isSupportingRightAngledAxes(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
- {
- ::basegfx::B3DHomMatrix aNewRotation;
- aNewRotation.rotate( fXAngleRad, fYAngleRad, fZAngleRad );
- lcl_rotateLights( aNewRotation*aInverseOldRotation, xSceneProperties );
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
-void ThreeDHelper::getRotationFromDiagram( const uno::Reference< beans::XPropertySet >& xSceneProperties
- , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree )
-{
- double fXAngle, fYAngle, fZAngle;
- ThreeDHelper::getRotationAngleFromDiagram( xSceneProperties, fXAngle, fYAngle, fZAngle );
-
- if( !lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) )
- {
- ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
- rnHorizontalAngleDegree, rnVerticalAngleDegree, fXAngle, fYAngle, fZAngle);
- rnVerticalAngleDegree*=-1;
- }
- else
- {
- rnHorizontalAngleDegree = basegfx::fround(basegfx::rad2deg(fXAngle));
- rnVerticalAngleDegree = basegfx::fround(-1.0 * basegfx::rad2deg(fYAngle));
- // nZRotation = basegfx::fround(-1.0 * basegfx::rad2deg(fZAngle));
- }
-
- rnHorizontalAngleDegree = NormAngle180(rnHorizontalAngleDegree);
- rnVerticalAngleDegree = NormAngle180(rnVerticalAngleDegree);
-}
-
-void ThreeDHelper::setRotationToDiagram( const uno::Reference< beans::XPropertySet >& xSceneProperties
- , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree )
-{
- //todo: x and y is not equal to horz and vert in case of RightAngledAxes==false
- double fXAngle = basegfx::deg2rad(nHorizontalAngleDegree);
- double fYAngle = basegfx::deg2rad(-1 * nVerticalYAngleDegree);
- double fZAngle = 0.0;
-
- if( !lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) )
- ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
- nHorizontalAngleDegree, -1*nVerticalYAngleDegree, fXAngle, fYAngle, fZAngle );
-
- ThreeDHelper::setRotationAngleToDiagram( xSceneProperties, fXAngle, fYAngle, fZAngle );
-}
void ThreeDHelper::getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance )
{
@@ -1071,57 +620,6 @@ void ThreeDHelper::ensureCameraDistanceRange( double& rfCameraDistance )
rfCameraDistance = fMax;
}
-double ThreeDHelper::getCameraDistance(
- const Reference< beans::XPropertySet >& xSceneProperties )
-{
- double fCameraDistance = FIXED_SIZE_FOR_3D_CHART_VOLUME;
-
- if( !xSceneProperties.is() )
- return fCameraDistance;
-
- try
- {
- drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
- xSceneProperties->getPropertyValue( "D3DCameraGeometry" ) >>= aCG;
- ::basegfx::B3DVector aVRP( BaseGFXHelper::Position3DToB3DVector( aCG.vrp ) );
- fCameraDistance = aVRP.getLength();
-
- ensureCameraDistanceRange( fCameraDistance );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
- return fCameraDistance;
-}
-
-void ThreeDHelper::setCameraDistance(
- const Reference< beans::XPropertySet >& xSceneProperties, double fCameraDistance )
-{
- if( !xSceneProperties.is() )
- return;
-
- try
- {
- if( fCameraDistance <= 0 )
- fCameraDistance = FIXED_SIZE_FOR_3D_CHART_VOLUME;
-
- drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
- xSceneProperties->getPropertyValue( "D3DCameraGeometry" ) >>= aCG;
- ::basegfx::B3DVector aVRP( BaseGFXHelper::Position3DToB3DVector( aCG.vrp ) );
- if( ::basegfx::fTools::equalZero( aVRP.getLength() ) )
- aVRP = ::basegfx::B3DVector(0,0,1);
- aVRP.setLength(fCameraDistance);
- aCG.vrp = BaseGFXHelper::B3DVectorToPosition3D( aVRP );
-
- xSceneProperties->setPropertyValue( "D3DCameraGeometry", uno::Any( aCG ));
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-}
-
double ThreeDHelper::CameraDistanceToPerspective( double fCameraDistance )
{
double fMin, fMax;
@@ -1150,140 +648,8 @@ double ThreeDHelper::PerspectiveToCameraDistance( double fPerspective )
return fRet;
}
-ThreeDLookScheme ThreeDHelper::detectScheme( const uno::Reference< XDiagram >& xDiagram )
-{
- ThreeDLookScheme aScheme = ThreeDLookScheme_Unknown;
-
- sal_Int32 nRoundedEdges;
- sal_Int32 nObjectLines;
- ThreeDHelper::getRoundedEdgesAndObjectLines( xDiagram, nRoundedEdges, nObjectLines );
-
- //get shade mode and light settings:
- drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH );
- uno::Reference< beans::XPropertySet > xDiagramProps( xDiagram, uno::UNO_QUERY );
- try
- {
- if( xDiagramProps.is() )
- xDiagramProps->getPropertyValue( "D3DSceneShadeMode" )>>= aShadeMode;
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- if( lcl_isSimpleScheme( aShadeMode, nRoundedEdges, nObjectLines, xDiagram ) )
- {
- if( lcl_isSimpleLightScheme(xDiagramProps) )
- aScheme = ThreeDLookScheme_Simple;
- }
- else if( lcl_isRealisticScheme( aShadeMode, nRoundedEdges, nObjectLines ) )
- {
- if( lcl_isRealisticLightScheme(xDiagramProps) )
- aScheme = ThreeDLookScheme_Realistic;
- }
-
- return aScheme;
-}
-
-void ThreeDHelper::setScheme( const uno::Reference< XDiagram >& xDiagram, ThreeDLookScheme aScheme )
-{
- if( aScheme == ThreeDLookScheme_Unknown )
- return;
-
- drawing::ShadeMode aShadeMode;
- sal_Int32 nRoundedEdges;
- sal_Int32 nObjectLines;
-
- if( aScheme == ThreeDLookScheme_Simple )
- lcl_setSimpleScheme(aShadeMode,nRoundedEdges,nObjectLines,xDiagram);
- else
- lcl_setRealisticScheme(aShadeMode,nRoundedEdges,nObjectLines);
-
- try
- {
- ThreeDHelper::setRoundedEdgesAndObjectLines( xDiagram, nRoundedEdges, nObjectLines );
-
- uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY );
- if( xProp.is() )
- {
- drawing::ShadeMode aOldShadeMode;
- if( ! ( (xProp->getPropertyValue( "D3DSceneShadeMode" )>>=aOldShadeMode) &&
- aOldShadeMode == aShadeMode ))
- {
- xProp->setPropertyValue( "D3DSceneShadeMode", uno::Any( aShadeMode ));
- }
- }
-
- lcl_setLightsForScheme( xProp, aScheme );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
-}
-
-void ThreeDHelper::set3DSettingsToDefault( const uno::Reference< beans::XPropertySet >& xSceneProperties )
-{
- Reference< beans::XPropertyState > xState( xSceneProperties, uno::UNO_QUERY );
- if(xState.is())
- {
- xState->setPropertyToDefault( "D3DSceneDistance");
- xState->setPropertyToDefault( "D3DSceneFocalLength");
- }
- ThreeDHelper::setDefaultRotation( xSceneProperties );
- ThreeDHelper::setDefaultIllumination( xSceneProperties );
-}
-
-void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet >& xSceneProperties, bool bPieOrDonut )
-{
- if( !xSceneProperties.is() )
- return;
-
- drawing::CameraGeometry aCameraGeo( ThreeDHelper::getDefaultCameraGeometry( bPieOrDonut ) );
- xSceneProperties->setPropertyValue( "D3DCameraGeometry", uno::Any( aCameraGeo ));
-
- ::basegfx::B3DHomMatrix aSceneRotation;
- if( bPieOrDonut )
- aSceneRotation.rotate( -F_PI/3.0, 0, 0 );
- xSceneProperties->setPropertyValue( "D3DTransformMatrix",
- uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation )));
-}
-
-void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet >& xSceneProperties )
-{
- bool bPieOrDonut( DiagramHelper::isPieOrDonutChart( uno::Reference< XDiagram >(xSceneProperties, uno::UNO_QUERY) ) );
- ThreeDHelper::setDefaultRotation( xSceneProperties, bPieOrDonut );
-}
-
-void ThreeDHelper::setDefaultIllumination( const uno::Reference< beans::XPropertySet >& xSceneProperties )
-{
- if( !xSceneProperties.is() )
- return;
-
- drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH );
- try
- {
- xSceneProperties->getPropertyValue( "D3DSceneShadeMode" )>>= aShadeMode;
- xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_1, uno::Any( false ) );
- xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_3, uno::Any( false ) );
- xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_4, uno::Any( false ) );
- xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_5, uno::Any( false ) );
- xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_6, uno::Any( false ) );
- xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_7, uno::Any( false ) );
- xSceneProperties->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_8, uno::Any( false ) );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- ThreeDLookScheme aScheme = (aShadeMode==drawing::ShadeMode_FLAT) ? ThreeDLookScheme_Simple : ThreeDLookScheme_Realistic;
- lcl_setLightsForScheme( xSceneProperties, aScheme );
-}
-
void ThreeDHelper::getRoundedEdgesAndObjectLines(
- const uno::Reference< XDiagram > & xDiagram
+ const rtl::Reference< Diagram > & xDiagram
, sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines )
{
rnRoundedEdges = -1;
@@ -1295,8 +661,8 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines(
drawing::LineStyle aLineStyle( drawing::LineStyle_SOLID );
- std::vector< uno::Reference< XDataSeries > > aSeriesList(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ std::vector< rtl::Reference< DataSeries > > aSeriesList =
+ xDiagram->getDataSeries();
sal_Int32 nSeriesCount = static_cast<sal_Int32>( aSeriesList.size() );
OUString aPercentDiagonalPropertyName( "PercentDiagonal" );
@@ -1304,8 +670,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines(
for( sal_Int32 nS = 0; nS < nSeriesCount; ++nS )
{
- uno::Reference< XDataSeries > xSeries( aSeriesList[nS] );
- uno::Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xSeries( aSeriesList[nS] );
if(!nS)
{
rnRoundedEdges = 0;
@@ -1313,7 +678,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines(
{
sal_Int16 nPercentDiagonal = 0;
- xProp->getPropertyValue( aPercentDiagonalPropertyName ) >>= nPercentDiagonal;
+ xSeries->getPropertyValue( aPercentDiagonalPropertyName ) >>= nPercentDiagonal;
rnRoundedEdges = static_cast< sal_Int32 >( nPercentDiagonal );
if( DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
@@ -1327,7 +692,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines(
}
try
{
- xProp->getPropertyValue( aBorderStylePropertyName ) >>= aLineStyle;
+ xSeries->getPropertyValue( aBorderStylePropertyName ) >>= aLineStyle;
if( DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, aBorderStylePropertyName, uno::Any(aLineStyle) ) )
@@ -1344,7 +709,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines(
if( !bDifferentRoundedEdges )
{
sal_Int16 nPercentDiagonal = 0;
- xProp->getPropertyValue( aPercentDiagonalPropertyName ) >>= nPercentDiagonal;
+ xSeries->getPropertyValue( aPercentDiagonalPropertyName ) >>= nPercentDiagonal;
sal_Int32 nCurrentRoundedEdges = static_cast< sal_Int32 >( nPercentDiagonal );
if(nCurrentRoundedEdges!=rnRoundedEdges
|| DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
@@ -1357,7 +722,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines(
if( !bDifferentObjectLines )
{
drawing::LineStyle aCurrentLineStyle;
- xProp->getPropertyValue( aBorderStylePropertyName ) >>= aCurrentLineStyle;
+ xSeries->getPropertyValue( aBorderStylePropertyName ) >>= aCurrentLineStyle;
if(aCurrentLineStyle!=aLineStyle
|| DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
, aBorderStylePropertyName, uno::Any(aLineStyle) ) )
@@ -1382,7 +747,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines(
}
void ThreeDHelper::setRoundedEdgesAndObjectLines(
- const uno::Reference< XDiagram > & xDiagram
+ const rtl::Reference< Diagram > & xDiagram
, sal_Int32 nRoundedEdges, sal_Int32 nObjectLines )
{
if( (nRoundedEdges<0||nRoundedEdges>100) && nObjectLines!=0 && nObjectLines!=1 )
@@ -1395,13 +760,10 @@ void ThreeDHelper::setRoundedEdgesAndObjectLines(
uno::Any aALineStyle( aLineStyle);
uno::Any aARoundedEdges( static_cast< sal_Int16 >( nRoundedEdges ));
- std::vector< uno::Reference< XDataSeries > > aSeriesList(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
- sal_Int32 nSeriesCount = static_cast<sal_Int32>( aSeriesList.size() );
- for( sal_Int32 nS = 0; nS < nSeriesCount; ++nS )
+ std::vector< rtl::Reference< DataSeries > > aSeriesList =
+ xDiagram->getDataSeries();
+ for( auto const& xSeries : aSeriesList)
{
- uno::Reference< XDataSeries > xSeries( aSeriesList[nS] );
-
if( nRoundedEdges>=0 && nRoundedEdges<=100 )
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "PercentDiagonal", aARoundedEdges );
@@ -1410,13 +772,13 @@ void ThreeDHelper::setRoundedEdgesAndObjectLines(
}
}
-CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( const Reference< beans::XPropertySet >& xSceneProperties )
+CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
CuboidPlanePosition eRet(CuboidPlanePosition_Left);
double fXAngleRad=0.0; double fYAngleRad=0.0; double fZAngleRad=0.0;
- ThreeDHelper::getRotationAngleFromDiagram( xSceneProperties, fXAngleRad, fYAngleRad, fZAngleRad );
- if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) )
+ xDiagram->getRotationAngle( fXAngleRad, fYAngleRad, fZAngleRad );
+ if( lcl_isRightAngledAxesSetAndSupported( xDiagram ) )
{
ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad );
}
@@ -1425,13 +787,13 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeft
return eRet;
}
-CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( const Reference< beans::XPropertySet >& xSceneProperties )
+CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( const rtl::Reference< Diagram >& xDiagram )
{
CuboidPlanePosition eRet(CuboidPlanePosition_Back);
double fXAngleRad=0.0; double fYAngleRad=0.0; double fZAngleRad=0.0;
- ThreeDHelper::getRotationAngleFromDiagram( xSceneProperties, fXAngleRad, fYAngleRad, fZAngleRad );
- if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) )
+ xDiagram->getRotationAngle( fXAngleRad, fYAngleRad, fZAngleRad );
+ if( lcl_isRightAngledAxesSetAndSupported( xDiagram ) )
{
ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad );
}
@@ -1440,13 +802,13 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBack
return eRet;
}
-CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( const Reference< beans::XPropertySet >& xSceneProperties )
+CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( const rtl::Reference< Diagram >& xDiagram )
{
CuboidPlanePosition eRet(CuboidPlanePosition_Bottom);
double fXAngleRad=0.0; double fYAngleRad=0.0; double fZAngleRad=0.0;
- ThreeDHelper::getRotationAngleFromDiagram( xSceneProperties, fXAngleRad, fYAngleRad, fZAngleRad );
- if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) )
+ xDiagram->getRotationAngle( fXAngleRad, fYAngleRad, fZAngleRad );
+ if( lcl_isRightAngledAxesSetAndSupported( xDiagram ) )
{
ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad );
}
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
index 3cdddbbeeb44..e9f76c619985 100644
--- a/chart2/source/tools/TitleHelper.cxx
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -18,15 +18,15 @@
*/
#include <TitleHelper.hxx>
+#include <Title.hxx>
#include <ChartModel.hxx>
-#include <ChartModelHelper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
-#include <DiagramHelper.hxx>
+#include <Diagram.hxx>
#include <ReferenceSizeProvider.hxx>
#include <com/sun/star/chart2/FormattedString.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
namespace chart
@@ -40,7 +40,7 @@ namespace {
uno::Reference< XTitled > lcl_getTitleParentFromDiagram(
TitleHelper::eTitleType nTitleIndex
- , const uno::Reference< XDiagram >& xDiagram )
+ , const rtl::Reference< Diagram >& xDiagram )
{
uno::Reference< XTitled > xResult;
@@ -48,7 +48,7 @@ uno::Reference< XTitled > lcl_getTitleParentFromDiagram(
nTitleIndex == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION )
{
bool bDummy = false;
- bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy );
+ bool bIsVertical = xDiagram && xDiagram->getVertical( bDummy, bDummy );
if( nTitleIndex == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION )
nTitleIndex = bIsVertical ? TitleHelper::X_AXIS_TITLE : TitleHelper::Y_AXIS_TITLE;
@@ -60,27 +60,27 @@ uno::Reference< XTitled > lcl_getTitleParentFromDiagram(
{
case TitleHelper::SUB_TITLE:
if( xDiagram.is())
- xResult.set( xDiagram, uno::UNO_QUERY );
+ xResult = xDiagram;
break;
case TitleHelper::X_AXIS_TITLE:
if( xDiagram.is())
- xResult.set( AxisHelper::getAxis( 0, true, xDiagram ), uno::UNO_QUERY );
+ xResult = AxisHelper::getAxis( 0, true, xDiagram );
break;
case TitleHelper::Y_AXIS_TITLE:
if( xDiagram.is())
- xResult.set( AxisHelper::getAxis( 1, true, xDiagram ), uno::UNO_QUERY );
+ xResult = AxisHelper::getAxis( 1, true, xDiagram );
break;
case TitleHelper::Z_AXIS_TITLE:
if( xDiagram.is())
- xResult.set( AxisHelper::getAxis( 2, true, xDiagram ), uno::UNO_QUERY );
+ xResult = AxisHelper::getAxis( 2, true, xDiagram );
break;
case TitleHelper::SECONDARY_X_AXIS_TITLE:
if( xDiagram.is())
- xResult.set( AxisHelper::getAxis( 0, false, xDiagram ), uno::UNO_QUERY );
+ xResult = AxisHelper::getAxis( 0, false, xDiagram );
break;
case TitleHelper::SECONDARY_Y_AXIS_TITLE:
if( xDiagram.is())
- xResult.set( AxisHelper::getAxis( 1, false, xDiagram ), uno::UNO_QUERY );
+ xResult = AxisHelper::getAxis( 1, false, xDiagram );
break;
case TitleHelper::MAIN_TITLE:
@@ -93,7 +93,7 @@ uno::Reference< XTitled > lcl_getTitleParentFromDiagram(
}
uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex
- , const uno::Reference< XDiagram >& xDiagram )
+ , const rtl::Reference< Diagram >& xDiagram )
{
uno::Reference< XTitled > xResult;
switch( nTitleIndex )
@@ -120,70 +120,72 @@ uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleInde
}
uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex
- , const uno::Reference< frame::XModel >& xModel )
+ , const rtl::Reference<::chart::ChartModel>& xModel )
{
if(nTitleIndex == TitleHelper::MAIN_TITLE)
{
- uno::Reference< XTitled > xTitled( xModel, uno::UNO_QUERY );
- return xTitled;
+ return xModel;
}
- uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- uno::Reference< XDiagram > xDiagram;
+ rtl::Reference< Diagram > xDiagram;
- if( xChartDoc.is())
- xDiagram.set( xChartDoc->getFirstDiagram());
+ if( xModel.is())
+ xDiagram = xModel->getFirstChartDiagram();
return lcl_getTitleParent( nTitleIndex, xDiagram );
}
}
-uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
+rtl::Reference< Title > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
, ChartModel& rModel )
{
if(nTitleIndex == TitleHelper::MAIN_TITLE)
- return rModel.getTitleObject();
+ return rModel.getTitleObject2();
- uno::Reference< XDiagram > xDiagram = rModel.getFirstDiagram();
+ rtl::Reference< Diagram > xDiagram = rModel.getFirstChartDiagram();
uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xDiagram ) );
- if( xTitled.is())
- return xTitled->getTitleObject();
- return nullptr;
+ if( !xTitled )
+ return nullptr;
+ uno::Reference<XTitle> xTitle = xTitled->getTitleObject();
+ auto pTitle = dynamic_cast<Title*>(xTitle.get());
+ assert(!xTitle || pTitle);
+ return pTitle;
}
-uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
- , const uno::Reference< frame::XModel >& xModel )
+rtl::Reference< Title > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
+ , const rtl::Reference<ChartModel>& xModel )
{
uno::Reference< XTitled > xTitled;
if(nTitleIndex == TitleHelper::MAIN_TITLE)
{
- xTitled.set( xModel, uno::UNO_QUERY );
+ xTitled = xModel;
}
else
{
- uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- uno::Reference< XDiagram > xDiagram;
- if( xChartDoc.is())
- xDiagram.set( xChartDoc->getFirstDiagram());
+ rtl::Reference< Diagram > xDiagram;
+ if( xModel.is())
+ xDiagram = xModel->getFirstChartDiagram();
xTitled = lcl_getTitleParent( nTitleIndex, xDiagram );
}
- if( xTitled.is())
- return xTitled->getTitleObject();
- return nullptr;
+ if( !xTitled )
+ return nullptr;
+ uno::Reference<XTitle> xTitle = xTitled->getTitleObject();
+ Title* pTitle = dynamic_cast<Title*>(xTitle.get());
+ assert(!xTitle || pTitle);
+ return pTitle;
}
-uno::Reference< XTitle > TitleHelper::createOrShowTitle(
+rtl::Reference< Title > TitleHelper::createOrShowTitle(
TitleHelper::eTitleType eTitleType
, const OUString& rTitleText
- , const uno::Reference< frame::XModel >& xModel
+ , const rtl::Reference<ChartModel>& xModel
, const uno::Reference< uno::XComponentContext > & xContext )
{
- uno::Reference< chart2::XTitle > xTitled( TitleHelper::getTitle( eTitleType, xModel ) );
+ rtl::Reference< Title > xTitled( TitleHelper::getTitle( eTitleType, xModel ) );
if( xTitled.is())
{
- css::uno::Reference<css::beans::XPropertySet> xProps(xTitled, css::uno::UNO_QUERY_THROW);
- xProps->setPropertyValue("Visible",css::uno::Any(true));
+ xTitled->setPropertyValue("Visible",css::uno::Any(true));
return xTitled;
}
else
@@ -192,20 +194,20 @@ uno::Reference< XTitle > TitleHelper::createOrShowTitle(
}
}
-uno::Reference< XTitle > TitleHelper::createTitle(
+rtl::Reference< Title > TitleHelper::createTitle(
TitleHelper::eTitleType eTitleType
, const OUString& rTitleText
- , const uno::Reference< frame::XModel >& xModel
+ , const rtl::Reference<ChartModel>& xModel
, const uno::Reference< uno::XComponentContext > & xContext
, ReferenceSizeProvider * pRefSizeProvider )
{
- uno::Reference< XTitle > xTitle;
+ rtl::Reference< ::chart::Title > xTitle;
uno::Reference< XTitled > xTitled( lcl_getTitleParent( eTitleType, xModel ) );
if( !xTitled.is() )
{
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) );
- uno::Reference< chart2::XAxis > xAxis;
+ rtl::Reference< Diagram > xDiagram( xModel->getFirstChartDiagram() );
+ rtl::Reference< Axis > xAxis;
switch( eTitleType )
{
case TitleHelper::SECONDARY_X_AXIS_TITLE:
@@ -217,90 +219,80 @@ uno::Reference< XTitle > TitleHelper::createTitle(
default:
break;
}
- uno::Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY );
- if( xProps.is() )
+ if( xAxis.is() )
{
- xProps->setPropertyValue( "Show", uno::Any( false ) );
+ xAxis->setPropertyValue( "Show", uno::Any( false ) );
xTitled = lcl_getTitleParent( eTitleType, xModel );
}
}
if(xTitled.is())
{
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) );
+ rtl::Reference< Diagram > xDiagram( xModel->getFirstChartDiagram() );
- xTitle.set( xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.Title",
- xContext ), uno::UNO_QUERY );
+ xTitle = new ::chart::Title();
- if(xTitle.is())
+ // default char height (main: 13.0 == default)
+ float fDefaultCharHeightSub = 11.0;
+ float fDefaultCharHeightAxis = 9.0;
+ switch( eTitleType )
{
- // default char height (main: 13.0 == default)
- float fDefaultCharHeightSub = 11.0;
- float fDefaultCharHeightAxis = 9.0;
- switch( eTitleType )
- {
- case TitleHelper::SUB_TITLE:
- TitleHelper::setCompleteString(
- rTitleText, xTitle, xContext, & fDefaultCharHeightSub );
- break;
- case TitleHelper::X_AXIS_TITLE:
- case TitleHelper::Y_AXIS_TITLE:
- case TitleHelper::Z_AXIS_TITLE:
- case TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION:
- case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION:
- case TitleHelper::SECONDARY_X_AXIS_TITLE:
- case TitleHelper::SECONDARY_Y_AXIS_TITLE:
- TitleHelper::setCompleteString(
- rTitleText, xTitle, xContext, & fDefaultCharHeightAxis );
- break;
- default:
- TitleHelper::setCompleteString( rTitleText, xTitle, xContext );
- break;
- }
+ case TitleHelper::SUB_TITLE:
+ TitleHelper::setCompleteString(
+ rTitleText, xTitle, xContext, & fDefaultCharHeightSub );
+ break;
+ case TitleHelper::X_AXIS_TITLE:
+ case TitleHelper::Y_AXIS_TITLE:
+ case TitleHelper::Z_AXIS_TITLE:
+ case TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION:
+ case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION:
+ case TitleHelper::SECONDARY_X_AXIS_TITLE:
+ case TitleHelper::SECONDARY_Y_AXIS_TITLE:
+ TitleHelper::setCompleteString(
+ rTitleText, xTitle, xContext, & fDefaultCharHeightAxis );
+ break;
+ default:
+ TitleHelper::setCompleteString( rTitleText, xTitle, xContext );
+ break;
+ }
- // set/clear autoscale
- if( pRefSizeProvider )
- pRefSizeProvider->setValuesAtTitle( xTitle );
+ // set/clear autoscale
+ if( pRefSizeProvider )
+ pRefSizeProvider->setValuesAtTitle( xTitle );
- xTitled->setTitleObject( xTitle );
+ xTitled->setTitleObject( xTitle );
- //default rotation 90 degree for y axis title in normal coordinatesystems or for x axis title for swapped coordinatesystems
- if( eTitleType == TitleHelper::X_AXIS_TITLE ||
- eTitleType == TitleHelper::Y_AXIS_TITLE ||
- eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE ||
- eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE )
+ //default rotation 90 degree for y axis title in normal coordinatesystems or for x axis title for swapped coordinatesystems
+ if( eTitleType == TitleHelper::X_AXIS_TITLE ||
+ eTitleType == TitleHelper::Y_AXIS_TITLE ||
+ eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE ||
+ eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE )
+ {
+ try
{
- try
- {
- bool bDummy = false;
- bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy );
-
- Reference< beans::XPropertySet > xTitleProps( xTitle, uno::UNO_QUERY );
- if( xTitleProps.is() )
- {
- if( (!bIsVertical && eTitleType == TitleHelper::Y_AXIS_TITLE)
- || (bIsVertical && eTitleType == TitleHelper::X_AXIS_TITLE)
- || (!bIsVertical && eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE)
- || (bIsVertical && eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE) )
- {
- xTitleProps->setPropertyValue( "TextRotation", uno::Any( 90.0 ));
- }
- }
- }
- catch( const uno::Exception & )
+ bool bDummy = false;
+ bool bIsVertical = xDiagram->getVertical( bDummy, bDummy );
+
+ if( (!bIsVertical && eTitleType == TitleHelper::Y_AXIS_TITLE)
+ || (bIsVertical && eTitleType == TitleHelper::X_AXIS_TITLE)
+ || (!bIsVertical && eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE)
+ || (bIsVertical && eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE) )
{
- DBG_UNHANDLED_EXCEPTION("chart2");
+ xTitle->setPropertyValue( "TextRotation", uno::Any( 90.0 ));
}
}
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
}
}
return xTitle;
}
-OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle )
+OUString TitleHelper::getCompleteString( const rtl::Reference< Title >& xTitle )
{
if(!xTitle.is())
return OUString();
@@ -311,53 +303,89 @@ OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle
return aRet.makeStringAndClear();
}
-void TitleHelper::setCompleteString( const OUString& rNewText
- , const uno::Reference< XTitle >& xTitle
- , const uno::Reference< uno::XComponentContext > & xContext
- , const float * pDefaultCharHeight /* = 0 */ )
+OUString TitleHelper::getUnstackedStr(const OUString& rNewText)
{
- //the format of the first old text portion will be maintained if there is any
- if(!xTitle.is())
- return;
+ //#i99841# remove linebreaks that were added for vertical stacking
+ OUStringBuffer aUnstackedStr;
+ OUStringBuffer aSource(rNewText);
- OUString aNewText = rNewText;
+ bool bBreakIgnored = false;
+ sal_Int32 nLen = rNewText.getLength();
+ for (sal_Int32 nPos = 0; nPos < nLen; ++nPos)
+ {
+ sal_Unicode aChar = aSource[nPos];
+ if (aChar != '\n')
+ {
+ aUnstackedStr.append(aChar);
+ bBreakIgnored = false;
+ }
+ else if (aChar == '\n' && bBreakIgnored)
+ aUnstackedStr.append(aChar);
+ else
+ bBreakIgnored = true;
+ }
+ return aUnstackedStr.makeStringAndClear();
+}
+
+void TitleHelper::setFormattedString( const rtl::Reference< Title >& xTitle,
+ const css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& aNewFormattedTitle )
+{
+ if (!xTitle.is() || !aNewFormattedTitle.hasElements())
+ return;
bool bStacked = false;
- uno::Reference< beans::XPropertySet > xTitleProperties( xTitle, uno::UNO_QUERY );
- if( xTitleProperties.is() )
- xTitleProperties->getPropertyValue( "StackCharacters" ) >>= bStacked;
+ xTitle->getPropertyValue("StackCharacters") >>= bStacked;
- if( bStacked )
+ if (bStacked)
{
- //#i99841# remove linebreaks that were added for vertical stacking
- OUStringBuffer aUnstackedStr;
- OUStringBuffer aSource(rNewText);
-
- bool bBreakIgnored = false;
- sal_Int32 nLen = rNewText.getLength();
- for( sal_Int32 nPos = 0; nPos < nLen; ++nPos )
+ for (uno::Reference< chart2::XFormattedString >const& formattedStr : aNewFormattedTitle)
{
- sal_Unicode aChar = aSource[nPos];
- if( aChar != '\n' )
- {
- aUnstackedStr.append( aChar );
- bBreakIgnored = false;
- }
- else if( aChar == '\n' && bBreakIgnored )
- aUnstackedStr.append( aChar );
- else
- bBreakIgnored = true;
+ formattedStr->setString(TitleHelper::getUnstackedStr(formattedStr->getString()));
}
- aNewText = aUnstackedStr.makeStringAndClear();
}
- uno::Sequence< uno::Reference< XFormattedString > > aNewStringList(1);
+ xTitle->setText(aNewFormattedTitle);
+}
- uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText();
- if( aOldStringList.hasElements() )
+void TitleHelper::setCompleteString( const OUString& rNewText
+ , const rtl::Reference< Title >& xTitle
+ , const uno::Reference< uno::XComponentContext > & xContext
+ , const float * pDefaultCharHeight /* = 0 */
+ , bool bDialogTitle /*= false*/ )
+{
+ if (!xTitle.is())
+ return;
+
+ bool bStacked = false;
+ if( xTitle.is() )
+ xTitle->getPropertyValue( "StackCharacters" ) >>= bStacked;
+
+ OUString aNewText = rNewText;
+ if( bStacked )
{
- aNewStringList[0].set( aOldStringList[0] );
- aNewStringList[0]->setString( aNewText );
+ aNewText = getUnstackedStr(rNewText);
+ }
+
+ uno::Sequence< uno::Reference< XFormattedString > > aNewStringList;
+ uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText();
+ if( aOldStringList.hasElements())
+ {
+ const OUString aFullString = getCompleteString(xTitle);
+ if (bDialogTitle && aNewText.equals(getUnstackedStr(aFullString)))
+ {
+ // If the new title setted from a dialog window to a new string
+ // the first old text portion will be maintained if it's a new string,
+ // otherwise we use the original one.
+ aNewStringList = aOldStringList;
+ }
+ else
+ {
+ // If the new title setted from a dialog to a new string the first
+ // old text portion will be maintained if there was any. Also in case of ODF
+ // import which still not support non-uniform formatted titles
+ aNewStringList = { aOldStringList[0] };
+ aNewStringList[0]->setString(aNewText);
+ }
}
else
{
@@ -365,7 +393,7 @@ void TitleHelper::setCompleteString( const OUString& rNewText
chart2::FormattedString::create( xContext );
xFormattedString->setString( aNewText );
- aNewStringList[0].set( xFormattedString );
+ aNewStringList = { xFormattedString };
if( pDefaultCharHeight != nullptr )
{
try
@@ -385,7 +413,7 @@ void TitleHelper::setCompleteString( const OUString& rNewText
}
void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex
- , const css::uno::Reference< css::frame::XModel >& xModel )
+ , const rtl::Reference<ChartModel>& xModel )
{
uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) );
if( xTitled.is())
@@ -394,28 +422,17 @@ void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex
}
}
-void TitleHelper::hideTitle( TitleHelper::eTitleType nTitleIndex
- , const css::uno::Reference< css::frame::XModel >& xModel )
-{
- uno::Reference< chart2::XTitle > xTitled( TitleHelper::getTitle( nTitleIndex, xModel ) );
- if( xTitled.is())
- {
- css::uno::Reference<css::beans::XPropertySet> xProps(xTitled, css::uno::UNO_QUERY_THROW);
- xProps->setPropertyValue("Visible",css::uno::Any(false));
- }
-}
-
bool TitleHelper::getTitleType( eTitleType& rType
- , const css::uno::Reference< css::chart2::XTitle >& xTitle
- , ChartModel& rModel )
+ , const rtl::Reference< Title >& xTitle
+ , const rtl::Reference<ChartModel>& xModel )
{
- if( !xTitle.is() )
+ if( !xTitle.is() || !xModel.is() )
return false;
- Reference< chart2::XTitle > xCurrentTitle;
+ rtl::Reference< Title > xCurrentTitle;
for( sal_Int32 nTitleType = TITLE_BEGIN; nTitleType < NORMAL_TITLE_END; nTitleType++ )
{
- xCurrentTitle = TitleHelper::getTitle( static_cast<eTitleType>(nTitleType), rModel );
+ xCurrentTitle = TitleHelper::getTitle( static_cast<eTitleType>(nTitleType), xModel );
if( xCurrentTitle == xTitle )
{
rType = static_cast<eTitleType>(nTitleType);
@@ -426,25 +443,15 @@ bool TitleHelper::getTitleType( eTitleType& rType
return false;
}
-bool TitleHelper::getTitleType( eTitleType& rType
- , const css::uno::Reference< css::chart2::XTitle >& xTitle
- , const css::uno::Reference< css::frame::XModel >& xModel )
+void TitleHelper::hideTitle( TitleHelper::eTitleType nTitleIndex
+ , const rtl::Reference<ChartModel>& xModel)
{
- if( !xTitle.is() || !xModel.is() )
- return false;
-
- Reference< chart2::XTitle > xCurrentTitle;
- for( sal_Int32 nTitleType = TITLE_BEGIN; nTitleType < NORMAL_TITLE_END; nTitleType++ )
+ uno::Reference< chart2::XTitle > xTitled( TitleHelper::getTitle( nTitleIndex, xModel ) );
+ if( xTitled.is())
{
- xCurrentTitle = TitleHelper::getTitle( static_cast<eTitleType>(nTitleType), xModel );
- if( xCurrentTitle == xTitle )
- {
- rType = static_cast<eTitleType>(nTitleType);
- return true;
- }
+ css::uno::Reference<css::beans::XPropertySet> xProps(xTitled, css::uno::UNO_QUERY_THROW);
+ xProps->setPropertyValue("Visible",css::uno::Any(false));
}
-
- return false;
}
} //namespace chart
diff --git a/chart2/source/tools/TrueGuard.cxx b/chart2/source/tools/TrueGuard.cxx
deleted file mode 100644
index f4acf35742d4..000000000000
--- a/chart2/source/tools/TrueGuard.cxx
+++ /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 .
- */
-
-#include <TrueGuard.hxx>
-
-namespace chart
-{
-
-TrueGuard::TrueGuard( bool& rbTrueDuringGuardedTime )
- : m_rbTrueDuringGuardedTime( rbTrueDuringGuardedTime )
-{
- m_rbTrueDuringGuardedTime = true;
-}
-
-TrueGuard::~TrueGuard()
-{
- m_rbTrueDuringGuardedTime = false;
-}
-
-} // namespace chart
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx
index 8851988b6d85..b7929719df02 100644
--- a/chart2/source/tools/UncachedDataSequence.cxx
+++ b/chart2/source/tools/UncachedDataSequence.cxx
@@ -20,13 +20,13 @@
#include <UncachedDataSequence.hxx>
#include <CommonFunctors.hxx>
#include <ModifyListenerHelper.hxx>
+#include <InternalDataProvider.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <algorithm>
#include <strings.hrc>
#include <ResId.hxx>
-#include <com/sun/star/chart2/XInternalDataProvider.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
using namespace ::com::sun::star;
@@ -36,12 +36,11 @@ using ::com::sun::star::uno::Any;
using ::osl::MutexGuard;
// necessary for MS compiler
-using ::comphelper::OPropertyContainer;
using ::chart::impl::UncachedDataSequence_Base;
namespace
{
-const char lcl_aServiceName[] = "com.sun.star.comp.chart.UncachedDataSequence";
+constexpr OUString lcl_aServiceName = u"com.sun.star.comp.chart.UncachedDataSequence"_ustr;
enum
{
@@ -55,43 +54,36 @@ namespace chart
{
UncachedDataSequence::UncachedDataSequence(
- const Reference< chart2::XInternalDataProvider > & xIntDataProv,
- const OUString & rRangeRepresentation )
- : OPropertyContainer( GetBroadcastHelper()),
- UncachedDataSequence_Base( GetMutex()),
- m_nNumberFormatKey(0),
- m_xDataProvider( xIntDataProv ),
- m_aSourceRepresentation( rRangeRepresentation ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ rtl::Reference< InternalDataProvider > xIntDataProv,
+ OUString aRangeRepresentation )
+ : m_nNumberFormatKey(0),
+ m_xDataProvider(std::move( xIntDataProv )),
+ m_aSourceRepresentation(std::move( aRangeRepresentation )),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
registerProperties();
}
UncachedDataSequence::UncachedDataSequence(
- const Reference< chart2::XInternalDataProvider > & xIntDataProv,
- const OUString & rRangeRepresentation,
+ rtl::Reference< InternalDataProvider > xIntDataProv,
+ OUString aRangeRepresentation,
const OUString & rRole )
- : OPropertyContainer( GetBroadcastHelper()),
- UncachedDataSequence_Base( GetMutex()),
- m_nNumberFormatKey(0),
- m_xDataProvider( xIntDataProv ),
- m_aSourceRepresentation( rRangeRepresentation ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ : m_nNumberFormatKey(0),
+ m_xDataProvider(std::move( xIntDataProv )),
+ m_aSourceRepresentation(std::move( aRangeRepresentation )),
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
registerProperties();
- setFastPropertyValue_NoBroadcast( PROP_PROPOSED_ROLE, uno::Any( rRole ));
+ std::unique_lock<std::mutex> aGuard;
+ setFastPropertyValue_NoBroadcast( aGuard, PROP_PROPOSED_ROLE, uno::Any( rRole ));
}
UncachedDataSequence::UncachedDataSequence( const UncachedDataSequence & rSource )
- : ::comphelper::OMutexAndBroadcastHelper(),
- OPropertyContainer( GetBroadcastHelper()),
- ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >(),
- UncachedDataSequence_Base( GetMutex()),
- m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
+ : m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
m_sRole( rSource.m_sRole ),
m_xDataProvider( rSource.m_xDataProvider ),
m_aSourceRepresentation( rSource.m_aSourceRepresentation ),
- m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+ m_xModifyEventForwarder( new ModifyEventForwarder() )
{
registerProperties();
}
@@ -120,8 +112,8 @@ void UncachedDataSequence::registerProperties()
cppu::UnoType<decltype(m_aXMLRange)>::get() );
}
-IMPLEMENT_FORWARD_XINTERFACE2( UncachedDataSequence, UncachedDataSequence_Base, OPropertyContainer )
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( UncachedDataSequence, UncachedDataSequence_Base, OPropertyContainer )
+IMPLEMENT_FORWARD_XINTERFACE2( UncachedDataSequence, UncachedDataSequence_Base, comphelper::OPropertyContainer2 )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( UncachedDataSequence, UncachedDataSequence_Base, comphelper::OPropertyContainer2 )
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL UncachedDataSequence::getPropertySetInfo()
@@ -168,37 +160,31 @@ css::uno::Sequence< OUString > SAL_CALL UncachedDataSequence::getSupportedServic
// ________ XNumericalDataSequence ________
Sequence< double > SAL_CALL UncachedDataSequence::getNumericalData()
{
- Sequence< double > aResult;
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock<std::mutex> aGuard;
if( m_xDataProvider.is())
{
- Sequence< uno::Any > aValues( m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation ));
- aResult.realloc( aValues.getLength());
- std::transform( aValues.begin(), aValues.end(),
- aResult.getArray(), CommonFunctors::AnyToDouble());
+ const Sequence< uno::Any > aValues( m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation ));
+ return CommonFunctors::convertToSequence(aValues, CommonFunctors::ToDouble());
}
- return aResult;
+ return {};
}
// ________ XTextualDataSequence ________
Sequence< OUString > SAL_CALL UncachedDataSequence::getTextualData()
{
- Sequence< OUString > aResult;
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock<std::mutex> aGuard;
if( m_xDataProvider.is())
{
- Sequence< uno::Any > aValues( m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation ));
- aResult.realloc( aValues.getLength());
- std::transform( aValues.begin(), aValues.end(),
- aResult.getArray(), CommonFunctors::AnyToString());
+ const Sequence< uno::Any > aValues( m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation ));
+ return CommonFunctors::convertToSequence(aValues, CommonFunctors::ToString());
}
- return aResult;
+ return {};
}
// ________ XDataSequence ________
Sequence< Any > SAL_CALL UncachedDataSequence::getData()
{
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock<std::mutex> aGuard;
if( m_xDataProvider.is())
return m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation );
return Sequence< Any >();
@@ -214,7 +200,7 @@ Sequence< OUString > SAL_CALL UncachedDataSequence::generateLabel( chart2::data:
// auto-generated label
sal_Int32 nSeries = m_aSourceRepresentation.toInt32() + 1;
OUString aResString(::chart::SchResId(STR_DATA_UNNAMED_SERIES_WITH_INDEX));
- const OUString aReplacementStr("%NUMBER");
+ static constexpr OUString aReplacementStr(u"%NUMBER"_ustr);
sal_Int32 nIndex = aResString.indexOf(aReplacementStr);
OUString aName;
if( nIndex != -1 )
@@ -230,12 +216,12 @@ Sequence< OUString > SAL_CALL UncachedDataSequence::generateLabel( chart2::data:
// ____ XIndexReplace ____
void SAL_CALL UncachedDataSequence::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
{
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock<std::mutex> aGuard;
Sequence< Any > aData( getData());
if( Index < aData.getLength() &&
m_xDataProvider.is() )
{
- aData[Index] = Element;
+ aData.getArray()[Index] = Element;
m_xDataProvider->setDataByRangeRepresentation( m_aSourceRepresentation, aData );
fireModifyEvent();
}
@@ -281,8 +267,7 @@ void SAL_CALL UncachedDataSequence::setName( const OUString& aName )
Reference< util::XCloneable > SAL_CALL UncachedDataSequence::createClone()
{
- UncachedDataSequence * pNewSeq = new UncachedDataSequence( *this );
- return Reference< util::XCloneable >( pNewSeq );
+ return new UncachedDataSequence( *this );
}
// ____ XModifiable ____
@@ -300,28 +285,12 @@ void SAL_CALL UncachedDataSequence::setModified( sal_Bool bModified )
// ____ XModifyBroadcaster (base of XModifiable) ____
void SAL_CALL UncachedDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->addModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->addModifyListener( aListener );
}
void SAL_CALL UncachedDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener )
{
- try
- {
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
- xBroadcaster->removeModifyListener( aListener );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xModifyEventForwarder->removeModifyListener( aListener );
}
void UncachedDataSequence::fireModifyEvent()
diff --git a/chart2/source/tools/WeakListenerAdapter.cxx b/chart2/source/tools/WeakListenerAdapter.cxx
index 85b2f3b39a36..16b3d815031c 100644
--- a/chart2/source/tools/WeakListenerAdapter.cxx
+++ b/chart2/source/tools/WeakListenerAdapter.cxx
@@ -26,21 +26,6 @@ using ::com::sun::star::uno::Reference;
namespace chart
{
-WeakModifyListenerAdapter::WeakModifyListenerAdapter(
- const uno::WeakReference< util::XModifyListener > & xListener ) :
- WeakListenerAdapter< css::util::XModifyListener >( xListener )
-{}
-
-WeakModifyListenerAdapter::~WeakModifyListenerAdapter()
-{}
-
-void SAL_CALL WeakModifyListenerAdapter::modified( const lang::EventObject& aEvent )
-{
- Reference< util::XModifyListener > xModListener( getListener() );
- if( xModListener.is())
- xModListener->modified( aEvent );
-}
-
WeakSelectionChangeListenerAdapter::WeakSelectionChangeListenerAdapter(
const Reference< view::XSelectionChangeListener > & xListener ) :
WeakListenerAdapter< css::view::XSelectionChangeListener >( xListener )
diff --git a/chart2/source/tools/WrappedDefaultProperty.cxx b/chart2/source/tools/WrappedDefaultProperty.cxx
index 74d2b4b0aae0..00a94493eafc 100644
--- a/chart2/source/tools/WrappedDefaultProperty.cxx
+++ b/chart2/source/tools/WrappedDefaultProperty.cxx
@@ -18,10 +18,11 @@
*/
#include <WrappedDefaultProperty.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
+#include <utility>
using namespace ::com::sun::star;
@@ -32,9 +33,9 @@ namespace chart
WrappedDefaultProperty::WrappedDefaultProperty(
const OUString& rOuterName, const OUString& rInnerName,
- const uno::Any& rNewOuterDefault ) :
+ uno::Any aNewOuterDefault ) :
WrappedProperty( rOuterName, rInnerName ),
- m_aOuterDefaultValue( rNewOuterDefault )
+ m_aOuterDefaultValue(std::move( aNewOuterDefault ))
{}
WrappedDefaultProperty::~WrappedDefaultProperty()
diff --git a/chart2/source/tools/WrappedProperty.cxx b/chart2/source/tools/WrappedProperty.cxx
index ee28aba86e68..8b0891c770f5 100644
--- a/chart2/source/tools/WrappedProperty.cxx
+++ b/chart2/source/tools/WrappedProperty.cxx
@@ -20,7 +20,8 @@
#include <WrappedProperty.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Any;
@@ -29,9 +30,9 @@ using ::com::sun::star::uno::Reference;
namespace chart
{
-WrappedProperty::WrappedProperty( const OUString& rOuterName, const OUString& rInnerName)
- : m_aOuterName( rOuterName )
- , m_aInnerName( rInnerName )
+WrappedProperty::WrappedProperty( OUString aOuterName, OUString aInnerName)
+ : m_aOuterName(std::move( aOuterName ))
+ , m_aInnerName(std::move( aInnerName ))
{
}
WrappedProperty::~WrappedProperty()
diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx
index 26344a578adc..9eee3f8632e8 100644
--- a/chart2/source/tools/WrappedPropertySet.cxx
+++ b/chart2/source/tools/WrappedPropertySet.cxx
@@ -20,7 +20,7 @@
#include <WrappedPropertySet.hxx>
#include <cppuhelper/propshlp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
namespace chart
@@ -115,7 +115,7 @@ void SAL_CALL WrappedPropertySet::setPropertyValue( const OUString& rPropertyNam
catch( const uno::Exception& ex )
{
css::uno::Any anyEx = cppu::getCaughtException();
- OSL_FAIL("invalid exception caught in WrappedPropertySet::setPropertyValue");
+ TOOLS_WARN_EXCEPTION( "chart2", "invalid exception caught in WrappedPropertySet::setPropertyValue");
throw lang::WrappedTargetException( ex.Message, nullptr, anyEx );
}
}
@@ -152,7 +152,7 @@ Any SAL_CALL WrappedPropertySet::getPropertyValue( const OUString& rPropertyName
catch( const uno::Exception& ex )
{
css::uno::Any anyEx = cppu::getCaughtException();
- OSL_FAIL("invalid exception caught in WrappedPropertySet::setPropertyValue");
+ TOOLS_WARN_EXCEPTION( "chart2", "invalid exception caught in WrappedPropertySet::setPropertyValue");
throw lang::WrappedTargetException( ex.Message, nullptr, anyEx );
}
@@ -237,12 +237,13 @@ Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyValues( const Sequence<
if( rNameSeq.hasElements() )
{
aRetSeq.realloc( rNameSeq.getLength() );
+ auto pRetSeq = aRetSeq.getArray();
for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
{
try
{
OUString aPropertyName( rNameSeq[nN] );
- aRetSeq[nN] = getPropertyValue( aPropertyName );
+ pRetSeq[nN] = getPropertyValue( aPropertyName );
}
catch( const beans::UnknownPropertyException& )
{
@@ -309,10 +310,11 @@ Sequence< beans::PropertyState > SAL_CALL WrappedPropertySet::getPropertyStates(
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;
@@ -367,10 +369,11 @@ Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyDefaults( const Sequence
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/tools/XMLRangeHelper.cxx b/chart2/source/tools/XMLRangeHelper.cxx
index cc4749deee1f..196a0396542a 100644
--- a/chart2/source/tools/XMLRangeHelper.cxx
+++ b/chart2/source/tools/XMLRangeHelper.cxx
@@ -21,6 +21,7 @@
#include <rtl/character.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
#include <algorithm>
@@ -103,7 +104,7 @@ void lcl_getXMLStringForCell( const ::chart::XMLRangeHelper::Cell & rCell, OUStr
}
void lcl_getSingleCellAddressFromXMLString(
- const OUString& rXMLString,
+ std::u16string_view rXMLString,
sal_Int32 nStartPos, sal_Int32 nEndPos,
::chart::XMLRangeHelper::Cell & rOutCell )
{
@@ -111,7 +112,7 @@ void lcl_getSingleCellAddressFromXMLString(
static const sal_Unicode aDollar( '$' );
static const sal_Unicode aLetterA( 'A' );
- OUString aCellStr = rXMLString.copy( nStartPos, nEndPos - nStartPos + 1 ).toAsciiUpperCase();
+ OUString aCellStr = OUString(rXMLString.substr( nStartPos, nEndPos - nStartPos + 1 )).toAsciiUpperCase();
const sal_Unicode* pStrArray = aCellStr.getStr();
sal_Int32 nLength = aCellStr.getLength();
sal_Int32 i = nLength - 1, nColumn = 0;
@@ -119,7 +120,7 @@ void lcl_getSingleCellAddressFromXMLString(
// parse number for row
while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 )
i--;
- rOutCell.nRow = (aCellStr.copy( i + 1 )).toInt32() - 1;
+ rOutCell.nRow = (o3tl::toInt32(aCellStr.subView( i + 1 ))) - 1;
// a dollar in XML means absolute (whereas in UI it means relative)
if( pStrArray[ i ] == aDollar )
{
diff --git a/chart2/source/view/axes/DateHelper.cxx b/chart2/source/view/axes/DateHelper.cxx
index f705a7346091..4c4a96dce2f8 100644
--- a/chart2/source/view/axes/DateHelper.cxx
+++ b/chart2/source/view/axes/DateHelper.cxx
@@ -66,7 +66,7 @@ bool DateHelper::IsLessThanOneYearAway( const Date& rD1, const Date& rD2 )
return rD2 > aDMin && rD2 < aDMax;
}
-double DateHelper::RasterizeDateValue( double fValue, const Date& rNullDate, long TimeResolution )
+double DateHelper::RasterizeDateValue( double fValue, const Date& rNullDate, tools::Long TimeResolution )
{
if (std::isnan(fValue))
return fValue;
diff --git a/chart2/source/view/axes/DateScaling.cxx b/chart2/source/view/axes/DateScaling.cxx
index 60ffc14bbfae..f24f46a8e457 100644
--- a/chart2/source/view/axes/DateScaling.cxx
+++ b/chart2/source/view/axes/DateScaling.cxx
@@ -22,11 +22,14 @@
#include <rtl/math.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <limits>
+
namespace
{
-const char lcl_aServiceName_DateScaling[] = "com.sun.star.chart2.DateScaling";
-const char lcl_aServiceName_InverseDateScaling[] = "com.sun.star.chart2.InverseDateScaling";
+constexpr OUString lcl_aServiceName_DateScaling = u"com.sun.star.chart2.DateScaling"_ustr;
+constexpr OUString lcl_aServiceName_InverseDateScaling
+ = u"com.sun.star.chart2.InverseDateScaling"_ustr;
const double lcl_fNumberOfMonths = 12.0;//todo: this needs to be offered by basic tools Date class if it should be more generic
}
@@ -54,37 +57,36 @@ double SAL_CALL DateScaling::doScaling( double value )
{
double fResult(value);
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
- else
+ return std::numeric_limits<double>::quiet_NaN();
+ switch( m_nTimeUnit )
{
- Date aDate(m_aNullDate);
- aDate.AddDays(::rtl::math::approxFloor(value));
- switch( m_nTimeUnit )
+ case DAY:
+ fResult = value;
+ if(m_bShifted)
+ fResult+=0.5;
+ break;
+ case YEAR:
+ case MONTH:
+ default:
{
- case DAY:
- fResult = value;
- if(m_bShifted)
- fResult+=0.5;
- break;
- case YEAR:
- case MONTH:
- default:
- fResult = aDate.GetYear();
- fResult *= lcl_fNumberOfMonths;//assuming equal count of months in each year
- fResult += aDate.GetMonth();
-
- double fDayOfMonth = aDate.GetDay();
- fDayOfMonth -= 1.0;
- double fDaysInMonth = aDate.GetDaysInMonth();
- fResult += fDayOfMonth/fDaysInMonth;
- if(m_bShifted)
- {
- if( m_nTimeUnit==YEAR )
- fResult += 0.5*lcl_fNumberOfMonths;
- else
- fResult += 0.5;
- }
- break;
+ Date aDate(m_aNullDate);
+ aDate.AddDays(::rtl::math::approxFloor(value));
+ fResult = aDate.GetYear();
+ fResult *= lcl_fNumberOfMonths;//assuming equal count of months in each year
+ fResult += aDate.GetMonth();
+
+ double fDayOfMonth = aDate.GetDay();
+ fDayOfMonth -= 1.0;
+ double fDaysInMonth = aDate.GetDaysInMonth();
+ fResult += fDayOfMonth/fDaysInMonth;
+ if(m_bShifted)
+ {
+ if( m_nTimeUnit==YEAR )
+ fResult += 0.5*lcl_fNumberOfMonths;
+ else
+ fResult += 0.5;
+ }
+ break;
}
}
return fResult;
@@ -130,7 +132,7 @@ double SAL_CALL InverseDateScaling::doScaling( double value )
{
double fResult(value);
if( std::isnan( value ) || std::isinf( value ) )
- ::rtl::math::setNan( & fResult );
+ return std::numeric_limits<double>::quiet_NaN();
else
{
switch( m_nTimeUnit )
diff --git a/chart2/source/view/axes/DateScaling.hxx b/chart2/source/view/axes/DateScaling.hxx
index 2c2f34dd6330..29b7a139ae32 100644
--- a/chart2/source/view/axes/DateScaling.hxx
+++ b/chart2/source/view/axes/DateScaling.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_DATESCALING_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_DATESCALING_HXX
+#pragma once
#include <com/sun/star/chart2/XScaling.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -92,6 +91,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
index 2bb936567469..eaf5c4347379 100644
--- a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
+++ b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
@@ -21,7 +21,8 @@
#include <com/sun/star/chart/TimeUnit.hpp>
-#include <rtl/math.hxx>
+#include <cmath>
+#include <limits>
namespace chart
{
@@ -47,8 +48,7 @@ bool MergedMinimumAndMaximumSupplier::hasMinimumAndMaximumSupplier( MinimumAndMa
double MergedMinimumAndMaximumSupplier::getMinimumX()
{
- double fGlobalExtremum;
- ::rtl::math::setInf(&fGlobalExtremum, false);
+ double fGlobalExtremum = std::numeric_limits<double>::infinity();
for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
double fLocalExtremum = elem->getMinimumX();
@@ -56,14 +56,13 @@ double MergedMinimumAndMaximumSupplier::getMinimumX()
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
double MergedMinimumAndMaximumSupplier::getMaximumX()
{
- double fGlobalExtremum;
- ::rtl::math::setInf(&fGlobalExtremum, true);
+ double fGlobalExtremum = -std::numeric_limits<double>::infinity();
for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
double fLocalExtremum = elem->getMaximumX();
@@ -71,14 +70,13 @@ double MergedMinimumAndMaximumSupplier::getMaximumX()
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
double MergedMinimumAndMaximumSupplier::getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
{
- double fGlobalExtremum;
- ::rtl::math::setInf(&fGlobalExtremum, false);
+ double fGlobalExtremum = std::numeric_limits<double>::infinity();
for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
double fLocalExtremum = elem->getMinimumYInRange( fMinimumX, fMaximumX, nAxisIndex );
@@ -86,14 +84,13 @@ double MergedMinimumAndMaximumSupplier::getMinimumYInRange( double fMinimumX, do
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
double MergedMinimumAndMaximumSupplier::getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
{
- double fGlobalExtremum;
- ::rtl::math::setInf(&fGlobalExtremum, true);
+ double fGlobalExtremum = -std::numeric_limits<double>::infinity();
for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
double fLocalExtremum = elem->getMaximumYInRange( fMinimumX, fMaximumX, nAxisIndex );
@@ -101,14 +98,13 @@ double MergedMinimumAndMaximumSupplier::getMaximumYInRange( double fMinimumX, do
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
double MergedMinimumAndMaximumSupplier::getMinimumZ()
{
- double fGlobalExtremum;
- ::rtl::math::setInf(&fGlobalExtremum, false);
+ double fGlobalExtremum = std::numeric_limits<double>::infinity();
for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
double fLocalExtremum = elem->getMinimumZ();
@@ -116,14 +112,13 @@ double MergedMinimumAndMaximumSupplier::getMinimumZ()
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
double MergedMinimumAndMaximumSupplier::getMaximumZ()
{
- double fGlobalExtremum;
- ::rtl::math::setInf(&fGlobalExtremum, true);
+ double fGlobalExtremum = -std::numeric_limits<double>::infinity();
for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
double fLocalExtremum = elem->getMaximumZ();
@@ -131,7 +126,7 @@ double MergedMinimumAndMaximumSupplier::getMaximumZ()
fGlobalExtremum=fLocalExtremum;
}
if(std::isinf(fGlobalExtremum))
- ::rtl::math::setNan(&fGlobalExtremum);
+ return std::numeric_limits<double>::quiet_NaN();
return fGlobalExtremum;
}
@@ -185,19 +180,19 @@ void MergedMinimumAndMaximumSupplier::clearMinimumAndMaximumSupplierList()
m_aMinimumAndMaximumSupplierList.clear();
}
-long MergedMinimumAndMaximumSupplier::calculateTimeResolutionOnXAxis()
+tools::Long MergedMinimumAndMaximumSupplier::calculateTimeResolutionOnXAxis()
{
- long nRet = css::chart::TimeUnit::YEAR;
+ tools::Long nRet = css::chart::TimeUnit::YEAR;
for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
- long nCurrent = elem->calculateTimeResolutionOnXAxis();
+ tools::Long nCurrent = elem->calculateTimeResolutionOnXAxis();
if(nRet>nCurrent)
nRet=nCurrent;
}
return nRet;
}
-void MergedMinimumAndMaximumSupplier::setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate )
+void MergedMinimumAndMaximumSupplier::setTimeResolutionOnXAxis( tools::Long nTimeResolution, const Date& rNullDate )
{
for (auto const& elem : m_aMinimumAndMaximumSupplierList)
elem->setTimeResolutionOnXAxis( nTimeResolution, rNullDate );
diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx
index 10fc3ccd4f56..24195c8fdc93 100644
--- a/chart2/source/view/axes/ScaleAutomatism.cxx
+++ b/chart2/source/view/axes/ScaleAutomatism.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/chart2/AxisType.hpp>
#include <rtl/math.hxx>
+#include <tools/long.hxx>
#include <limits>
namespace chart
@@ -63,9 +64,8 @@ ExplicitScaleData::ExplicitScaleData()
, Maximum(10.0)
, Origin(0.0)
, Orientation(css::chart2::AxisOrientation_MATHEMATICAL)
- , Scaling()
, AxisType(css::chart2::AxisType::REALNUMBER)
- , ShiftedCategoryPosition(false)
+ , m_bShiftedCategoryPosition(false)
, TimeResolution(css::chart::TimeUnit::DAY)
, NullDate(30,12,1899)
{
@@ -83,7 +83,6 @@ ExplicitIncrementData::ExplicitIncrementData()
, Distance(1.0)
, PostEquidistant(true)
, BaseValue(0.0)
- , SubIncrements()
{
}
@@ -108,8 +107,8 @@ ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale, const Date& rNu
void ScaleAutomatism::resetValueRange( )
{
- ::rtl::math::setNan( &m_fValueMinimum );
- ::rtl::math::setNan( &m_fValueMaximum );
+ m_fValueMinimum = std::numeric_limits<double>::quiet_NaN();
+ m_fValueMaximum = std::numeric_limits<double>::quiet_NaN();
}
void ScaleAutomatism::expandValueRange( double fMinimum, double fMaximum )
@@ -203,7 +202,7 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
//fill explicit increment
- rExplicitScale.ShiftedCategoryPosition = m_aSourceScale.ShiftedCategoryPosition;
+ rExplicitScale.m_bShiftedCategoryPosition = m_aSourceScale.ShiftedCategoryPosition;
bool bIsLogarithm = false;
//minimum and maximum of the ExplicitScaleData may be changed if allowed
@@ -243,7 +242,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForCategory(
// no scaling for categories
rExplicitScale.Scaling.clear();
- if( rExplicitScale.ShiftedCategoryPosition )
+ if( rExplicitScale.m_bShiftedCategoryPosition )
rExplicitScale.Maximum += 1.0;
// ensure that at least one category is visible
@@ -566,13 +565,13 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis(
switch( rExplicitScale.TimeResolution )
{
case DAY:
- if( rExplicitScale.ShiftedCategoryPosition )
+ if( rExplicitScale.m_bShiftedCategoryPosition )
++aMaxDate; //for explicit scales we need one interval more (maximum excluded)
break;
case MONTH:
aMinDate.SetDay(1);
aMaxDate.SetDay(1);
- if( rExplicitScale.ShiftedCategoryPosition )
+ if( rExplicitScale.m_bShiftedCategoryPosition )
aMaxDate = DateHelper::GetDateSomeMonthsAway(aMaxDate,1);//for explicit scales we need one interval more (maximum excluded)
if( DateHelper::IsLessThanOneMonthAway( aMinDate, aMaxDate ) )
{
@@ -587,7 +586,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis(
aMinDate.SetMonth(1);
aMaxDate.SetDay(1);
aMaxDate.SetMonth(1);
- if( rExplicitScale.ShiftedCategoryPosition )
+ if( rExplicitScale.m_bShiftedCategoryPosition )
aMaxDate = DateHelper::GetDateSomeYearsAway(aMaxDate,1);//for explicit scales we need one interval more (maximum excluded)
if( DateHelper::IsLessThanOneYearAway( aMinDate, aMaxDate ) )
{
@@ -612,11 +611,11 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis(
nMaxMainIncrementCount--;
//choose major time interval:
- long nDayCount = aMaxDate - aMinDate;
- long nMainIncrementCount = 1;
+ tools::Long nDayCount = aMaxDate - aMinDate;
+ tools::Long nMainIncrementCount = 1;
if( !bAutoMajor )
{
- long nIntervalDayCount = rExplicitIncrement.MajorTimeInterval.Number;
+ tools::Long nIntervalDayCount = rExplicitIncrement.MajorTimeInterval.Number;
if( rExplicitIncrement.MajorTimeInterval.TimeUnit < rExplicitScale.TimeResolution )
rExplicitIncrement.MajorTimeInterval.TimeUnit = rExplicitScale.TimeResolution;
switch( rExplicitIncrement.MajorTimeInterval.TimeUnit )
@@ -636,8 +635,8 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis(
}
if( bAutoMajor )
{
- long nNumer = 1;
- long nIntervalDays = nDayCount / nMaxMainIncrementCount;
+ tools::Long nNumer = 1;
+ tools::Long nIntervalDays = nDayCount / nMaxMainIncrementCount;
double nDaysPerInterval = 1.0;
if( nIntervalDays>365 || rExplicitScale.TimeResolution==YEAR )
{
@@ -655,7 +654,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis(
nDaysPerInterval = 1.0;
}
- nNumer = static_cast<sal_Int32>( rtl::math::approxCeil( nIntervalDays/nDaysPerInterval ) );
+ nNumer = static_cast<sal_Int32>( rtl::math::approxFloor( nIntervalDays/nDaysPerInterval ) );
if(nNumer<=0)
nNumer=1;
if( rExplicitIncrement.MajorTimeInterval.TimeUnit == DAY )
@@ -666,13 +665,13 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis(
{
rExplicitIncrement.MajorTimeInterval.TimeUnit = MONTH;
nDaysPerInterval = 31.0;
- nNumer = static_cast<sal_Int32>( rtl::math::approxCeil( nIntervalDays/nDaysPerInterval ) );
+ nNumer = static_cast<sal_Int32>( rtl::math::approxFloor( nIntervalDays/nDaysPerInterval ) );
if(nNumer<=0)
nNumer=1;
}
}
rExplicitIncrement.MajorTimeInterval.Number = nNumer;
- nMainIncrementCount = static_cast<long>(nDayCount/(nNumer*nDaysPerInterval));
+ nMainIncrementCount = static_cast<tools::Long>(nDayCount/(nNumer*nDaysPerInterval));
}
//choose minor time interval:
@@ -680,7 +679,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis(
{
if( rExplicitIncrement.MinorTimeInterval.TimeUnit > rExplicitIncrement.MajorTimeInterval.TimeUnit )
rExplicitIncrement.MinorTimeInterval.TimeUnit = rExplicitIncrement.MajorTimeInterval.TimeUnit;
- long nIntervalDayCount = rExplicitIncrement.MinorTimeInterval.Number;
+ tools::Long nIntervalDayCount = rExplicitIncrement.MinorTimeInterval.Number;
switch( rExplicitIncrement.MinorTimeInterval.TimeUnit )
{
case DAY:
diff --git a/chart2/source/view/axes/TickmarkProperties.hxx b/chart2/source/view/axes/TickmarkProperties.hxx
index 07dc623995e5..cbb0398b6a19 100644
--- a/chart2/source/view/axes/TickmarkProperties.hxx
+++ b/chart2/source/view/axes/TickmarkProperties.hxx
@@ -17,23 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKPROPERTIES_HXX
+#pragma once
#include <VLineProperties.hxx>
namespace chart
{
-
struct TickmarkProperties
{
- sal_Int32 RelativePos;//Position in screen values relative to the axis where the tickmark line starts
- sal_Int32 Length;//Length of the tickmark line in screen values
+ sal_Int32
+ RelativePos; //Position in screen values relative to the axis where the tickmark line starts
+ sal_Int32 Length; //Length of the tickmark line in screen values
VLineProperties aLineProperties;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx
index 8332f01ff9a2..c30f2f25d5e5 100644
--- a/chart2/source/view/axes/Tickmarks.cxx
+++ b/chart2/source/view/axes/Tickmarks.cxx
@@ -24,18 +24,19 @@
#include "VAxisProperties.hxx"
#include <osl/diagnose.h>
#include <com/sun/star/chart2/AxisType.hpp>
+#include <utility>
using namespace ::com::sun::star;
using ::basegfx::B2DVector;
namespace chart {
-TickInfo::TickInfo( const uno::Reference<chart2::XScaling>& xInverse )
+TickInfo::TickInfo( uno::Reference<chart2::XScaling> xInverse )
: fScaledTickValue( 0.0 )
-, xInverseScaling( xInverse )
+, xInverseScaling(std::move( xInverse ))
, aTickScreenPosition(0.0,0.0)
-, bPaintIt( true )
, nFactorForLimitedTextWidth(1)
+, bPaintIt( true )
{
}
@@ -85,9 +86,9 @@ TickInfo* PureTickIter::nextInfo()
}
TickFactory::TickFactory(
- const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement )
- : m_rScale( rScale )
- , m_rIncrement( rIncrement )
+ ExplicitScaleData aScale, ExplicitIncrementData aIncrement )
+ : m_rScale(std::move( aScale ))
+ , m_rIncrement(std::move( aIncrement ))
{
//@todo: make sure that the scale is valid for the scaling
@@ -175,7 +176,7 @@ bool TickFactory2D::isHorizontalAxis() const
// for skew axes compare angle with horizontal vector
double fInclination = std::abs(B2DVector(m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D).angle(B2DVector(1.0, 0.0)));
- return fInclination < F_PI4 || fInclination > (F_PI-F_PI4);
+ return fInclination < M_PI_4 || fInclination > (M_PI-M_PI_4);
}
bool TickFactory2D::isVerticalAxis() const
{
@@ -187,7 +188,7 @@ bool TickFactory2D::isVerticalAxis() const
// for skew axes compare angle with vertical vector
double fInclination = std::abs(B2DVector(m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D).angle(B2DVector(0.0, -1.0)));
- return fInclination < F_PI4 || fInclination > (F_PI-F_PI4);
+ return fInclination < M_PI_4 || fInclination > (M_PI-M_PI_4);
}
//static
sal_Int32 TickFactory2D::getTickScreenDistance( TickIter& rIter )
@@ -203,11 +204,6 @@ sal_Int32 TickFactory2D::getTickScreenDistance( TickIter& rIter )
return pFirstTickInfo->getScreenDistanceBetweenTicks( *pSecondTickInfo );
}
-B2DVector TickFactory2D::getXaxisStartPos() const
-{
- return m_aAxisStartScreenPosition2D;
-}
-
B2DVector TickFactory2D::getTickScreenPosition2D( double fScaledLogicTickValue ) const
{
B2DVector aRet(m_aAxisStartScreenPosition2D);
@@ -238,11 +234,9 @@ void TickFactory2D::addPointSequenceForTickLine( drawing::PointSequenceSequence&
B2DVector aStart = aTickScreenPosition + aOrthoDirection*rTickmarkProperties.RelativePos;
B2DVector aEnd = aStart - aOrthoDirection*rTickmarkProperties.Length;
- rPoints[nSequenceIndex].realloc(2);
- rPoints[nSequenceIndex][0].X = static_cast<sal_Int32>(aStart.getX());
- rPoints[nSequenceIndex][0].Y = static_cast<sal_Int32>(aStart.getY());
- rPoints[nSequenceIndex][1].X = static_cast<sal_Int32>(aEnd.getX());
- rPoints[nSequenceIndex][1].Y = static_cast<sal_Int32>(aEnd.getY());
+ rPoints.getArray()[nSequenceIndex]
+ = { { static_cast<sal_Int32>(aStart.getX()), static_cast<sal_Int32>(aStart.getY()) },
+ { static_cast<sal_Int32>(aEnd.getX()), static_cast<sal_Int32>(aEnd.getY()) } };
}
B2DVector TickFactory2D::getDistanceAxisTickToText( const AxisProperties& rAxisProperties, bool bIncludeFarAwayDistanceIfSo, bool bIncludeSpaceBetweenTickAndText ) const
@@ -300,11 +294,10 @@ B2DVector TickFactory2D::getDistanceAxisTickToText( const AxisProperties& rAxisP
void TickFactory2D::createPointSequenceForAxisMainLine( drawing::PointSequenceSequence& rPoints ) const
{
- rPoints[0].realloc(2);
- rPoints[0][0].X = static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getX());
- rPoints[0][0].Y = static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getY());
- rPoints[0][1].X = static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getX());
- rPoints[0][1].Y = static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getY());
+ rPoints.getArray()[0] = { { static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getX()),
+ static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getY()) },
+ { static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getX()),
+ static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getY()) } };
}
void TickFactory2D::updateScreenValues( TickInfoArraysType& rAllTickInfos ) const
diff --git a/chart2/source/view/axes/Tickmarks.hxx b/chart2/source/view/axes/Tickmarks.hxx
index cab62aaa4477..2266c03c91d2 100644
--- a/chart2/source/view/axes/Tickmarks.hxx
+++ b/chart2/source/view/axes/Tickmarks.hxx
@@ -16,13 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_HXX
+#pragma once
#include <chartview/ExplicitScaleValues.hxx>
#include <basegfx/vector/b2dvector.hxx>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
-
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
#include <vector>
namespace chart { struct AxisProperties; }
@@ -36,18 +36,15 @@ struct TickInfo
{
double fScaledTickValue;
css::uno::Reference<css::chart2::XScaling> xInverseScaling;
-
- ::basegfx::B2DVector aTickScreenPosition;
- bool bPaintIt;
-
- css::uno::Reference<css::drawing::XShape> xTextShape;
-
+ rtl::Reference<SvxShapeText> xTextShape;
OUString aText;//used only for complex categories so far
+ ::basegfx::B2DVector aTickScreenPosition;
sal_Int32 nFactorForLimitedTextWidth;//categories in higher levels of complex categories can have more place than a single simple category
+ bool bPaintIt;
//methods:
TickInfo() = delete;
- explicit TickInfo( const css::uno::Reference<css::chart2::XScaling>& xInverse );
+ explicit TickInfo( css::uno::Reference<css::chart2::XScaling> xInverse );
/**
* Return a value associated with the tick mark. It's normally an original
@@ -86,8 +83,8 @@ class TickFactory
{
public:
TickFactory(
- const ExplicitScaleData& rScale
- , const ExplicitIncrementData& rIncrement );
+ ExplicitScaleData aScale
+ , ExplicitIncrementData aIncrement );
virtual ~TickFactory();
void getAllTicks( TickInfoArraysType& rAllTickInfos ) const;
@@ -135,7 +132,16 @@ public:
bool isHorizontalAxis() const;
bool isVerticalAxis() const;
- ::basegfx::B2DVector getXaxisStartPos() const;
+
+ const ::basegfx::B2DVector & getXaxisStartPos() const
+ {
+ return m_aAxisStartScreenPosition2D;
+ }
+
+ const ::basegfx::B2DVector & getXaxisEndPos() const
+ {
+ return m_aAxisEndScreenPosition2D;
+ }
private:
::basegfx::B2DVector getTickScreenPosition2D( double fScaledLogicTickValue ) const;
@@ -153,6 +159,4 @@ private:
} //namespace chart
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/Tickmarks_Dates.cxx b/chart2/source/view/axes/Tickmarks_Dates.cxx
index 854e661f67b4..869d46603fb7 100644
--- a/chart2/source/view/axes/Tickmarks_Dates.cxx
+++ b/chart2/source/view/axes/Tickmarks_Dates.cxx
@@ -23,6 +23,7 @@
#include <osl/diagnose.h>
#include <DateHelper.hxx>
#include <com/sun/star/chart/TimeUnit.hpp>
+#include <utility>
namespace chart
{
@@ -34,9 +35,9 @@ using ::com::sun::star::chart::TimeUnit::MONTH;
using ::com::sun::star::chart::TimeUnit::YEAR;
DateTickFactory::DateTickFactory(
- const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement )
- : m_aScale( rScale )
- , m_aIncrement( rIncrement )
+ ExplicitScaleData aScale, ExplicitIncrementData aIncrement )
+ : m_aScale(std::move( aScale ))
+ , m_aIncrement(std::move( aIncrement ))
{
//@todo: make sure that the scale is valid for the scaling
diff --git a/chart2/source/view/axes/Tickmarks_Dates.hxx b/chart2/source/view/axes/Tickmarks_Dates.hxx
index 2e4e3b35b58a..bc75bad4e04b 100644
--- a/chart2/source/view/axes/Tickmarks_Dates.hxx
+++ b/chart2/source/view/axes/Tickmarks_Dates.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_DATES_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_DATES_HXX
+#pragma once
#include "Tickmarks.hxx"
@@ -28,8 +27,8 @@ class DateTickFactory
{
public:
DateTickFactory(
- const ExplicitScaleData& rScale
- , const ExplicitIncrementData& rIncrement );
+ ExplicitScaleData aScale
+ , ExplicitIncrementData aIncrement );
~DateTickFactory();
void getAllTicks( TickInfoArraysType& rAllTickInfos ) const;
@@ -46,6 +45,5 @@ private: //member
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/Tickmarks_Equidistant.cxx b/chart2/source/view/axes/Tickmarks_Equidistant.cxx
index 60f6e63311ad..c1991fb3ba6e 100644
--- a/chart2/source/view/axes/Tickmarks_Equidistant.cxx
+++ b/chart2/source/view/axes/Tickmarks_Equidistant.cxx
@@ -23,6 +23,7 @@
#include <float.h>
#include <limits>
+#include <utility>
namespace chart
{
@@ -70,9 +71,9 @@ double EquidistantTickFactory::getMaximumAtIncrement( double fMax, const Explici
}
EquidistantTickFactory::EquidistantTickFactory(
- const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement )
- : m_rScale( rScale )
- , m_rIncrement( rIncrement )
+ ExplicitScaleData aScale, ExplicitIncrementData aIncrement )
+ : m_rScale(std::move( aScale ))
+ , m_rIncrement(std::move( aIncrement ))
{
//@todo: make sure that the scale is valid for the scaling
@@ -105,7 +106,7 @@ EquidistantTickFactory::EquidistantTickFactory(
m_fOuterMajorTickBorderMin_Scaled = m_fOuterMajorTickBorderMin;
m_fOuterMajorTickBorderMax_Scaled = m_fOuterMajorTickBorderMax;
- if(!(!m_rIncrement.PostEquidistant && m_xInverseScaling.is()) )
+ if(m_rIncrement.PostEquidistant || !m_xInverseScaling.is())
return;
m_fOuterMajorTickBorderMin_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMin);
@@ -150,6 +151,7 @@ void EquidistantTickFactory::addSubTicks( sal_Int32 nDepth, uno::Sequence< uno::
return;
uno::Sequence< double > aSubTicks(nMaxSubTickCount);
+ auto pSubTicks = aSubTicks.getArray();
sal_Int32 nRealSubTickCount = 0;
sal_Int32 nIntervalCount = m_rIncrement.SubIncrements[nDepth-1].IntervalCount;
@@ -163,13 +165,13 @@ void EquidistantTickFactory::addSubTicks( sal_Int32 nDepth, uno::Sequence< uno::
if(!pValue)
continue;
- aSubTicks[nRealSubTickCount] = *pValue;
+ pSubTicks[nRealSubTickCount] = *pValue;
nRealSubTickCount++;
}
}
aSubTicks.realloc(nRealSubTickCount);
- rParentTicks[nDepth] = aSubTicks;
+ rParentTicks.getArray()[nDepth] = aSubTicks;
if(static_cast<sal_Int32>(m_rIncrement.SubIncrements.size())>nDepth)
addSubTicks( nDepth+1, rParentTicks );
}
@@ -317,7 +319,9 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co
return;
uno::Sequence< uno::Sequence< double > > aAllTicks(nDepthCount);
- aAllTicks[0].realloc(nMaxMajorTickCount);
+ auto pAllTicks = aAllTicks.getArray();
+ pAllTicks[0].realloc(nMaxMajorTickCount);
+ auto pAllTicks0 = pAllTicks[0].getArray();
sal_Int32 nRealMajorTickCount = 0;
for( sal_Int32 nMajorTick=0; nMajorTick<nMaxMajorTickCount; nMajorTick++ )
@@ -325,12 +329,12 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co
double* pValue = getMajorTick( nMajorTick );
if(!pValue)
continue;
- aAllTicks[0][nRealMajorTickCount] = *pValue;
+ pAllTicks0[nRealMajorTickCount] = *pValue;
nRealMajorTickCount++;
}
if(!nRealMajorTickCount)
return;
- aAllTicks[0].realloc(nRealMajorTickCount);
+ pAllTicks[0].realloc(nRealMajorTickCount);
addSubTicks(1, aAllTicks);
@@ -350,7 +354,7 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co
if( m_rIncrement.SubIncrements[nN].IntervalCount>1 )
nCheckCount *= m_rIncrement.SubIncrements[nN].IntervalCount;
}
- uno::Sequence< double >& rTicks = aAllTicks[nDepth];
+ uno::Sequence< double >& rTicks = pAllTicks[nDepth];
sal_Int32 nCount = rTicks.getLength();
//check lower border
for( nTick=0; nTick<nCheckCount && nTick<nCount; nTick++)
@@ -377,8 +381,9 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co
uno::Sequence< double > aOldTicks(rTicks);
rTicks.realloc(nNewCount);
+ auto pTicks = rTicks.getArray();
for(nTick = 0; nTick<nNewCount; nTick++)
- rTicks[nTick] = aOldTicks[nInvisibleAtLowerBorder+nTick];
+ pTicks[nTick] = aOldTicks[nInvisibleAtLowerBorder+nTick];
}
}
diff --git a/chart2/source/view/axes/Tickmarks_Equidistant.hxx b/chart2/source/view/axes/Tickmarks_Equidistant.hxx
index 55263c05ba28..6068903cb6e7 100644
--- a/chart2/source/view/axes/Tickmarks_Equidistant.hxx
+++ b/chart2/source/view/axes/Tickmarks_Equidistant.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_EQUIDISTANT_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_EQUIDISTANT_HXX
+#pragma once
#include "Tickmarks.hxx"
#include <memory>
@@ -102,8 +101,8 @@ class EquidistantTickFactory
{
public:
EquidistantTickFactory(
- const ExplicitScaleData& rScale
- , const ExplicitIncrementData& rIncrement );
+ ExplicitScaleData aScale
+ , ExplicitIncrementData aIncrement );
~EquidistantTickFactory();
void getAllTicks( TickInfoArraysType& rAllTickInfos ) const;
@@ -143,6 +142,5 @@ private: //member
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx
index 6e6f40b65684..30aead187dcb 100644
--- a/chart2/source/view/axes/VAxisBase.cxx
+++ b/chart2/source/view/axes/VAxisBase.cxx
@@ -21,11 +21,10 @@
#include <ShapeFactory.hxx>
#include <ExplicitCategoriesProvider.hxx>
#include "Tickmarks.hxx"
-#include <com/sun/star/drawing/XShapes.hpp>
+#include <Axis.hxx>
+#include <VSeriesPlotter.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <osl/diagnose.h>
@@ -85,10 +84,10 @@ void VAxisBase::initAxisLabelProperties( const css::awt::Size& rFontReferenceSiz
m_bUseTextLabels = true;
}
- m_aAxisLabelProperties.nNumberFormatKey = m_aAxisProperties.m_nNumberFormatKey;
+ m_aAxisLabelProperties.m_nNumberFormatKey = m_aAxisProperties.m_nNumberFormatKey;
m_aAxisLabelProperties.init(m_aAxisProperties.m_xAxisModel);
if( m_aAxisProperties.m_bComplexCategories && m_aAxisProperties.m_nAxisType == AxisType::CATEGORY )
- m_aAxisLabelProperties.eStaggering = AxisLabelStaggering::SideBySide;
+ m_aAxisLabelProperties.m_eStaggering = AxisLabelStaggering::SideBySide;
}
bool VAxisBase::isDateAxis() const
@@ -100,9 +99,9 @@ bool VAxisBase::isComplexCategoryAxis() const
return m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels;
}
-void VAxisBase::recordMaximumTextSize( const Reference< drawing::XShape >& xShape, double fRotationAngleDegree )
+void VAxisBase::recordMaximumTextSize( SvxShape& xShape, double fRotationAngleDegree )
{
- if( m_bRecordMaximumTextSize && xShape.is() )
+ if( m_bRecordMaximumTextSize )
{
awt::Size aSize( ShapeFactory::getSizeAfterRotation(
xShape, fRotationAngleDegree ) );
@@ -132,15 +131,14 @@ bool VAxisBase::isAnythingToDraw()
if( !m_aAxisProperties.m_xAxisModel.is() )
return false;
- OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
- if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ OSL_ENSURE(m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
+ if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
return false;
- uno::Reference< beans::XPropertySet > xProps( m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
- if( xProps.is() )
+ if( m_aAxisProperties.m_xAxisModel.is() )
{
bool bShow = false;
- xProps->getPropertyValue( "Show" ) >>= bShow;
+ m_aAxisProperties.m_xAxisModel->getPropertyValue( "Show" ) >>= bShow;
if( !bShow )
return false;
}
@@ -159,7 +157,7 @@ void VAxisBase::setExplicitScaleAndIncrement(
void VAxisBase::createAllTickInfos( TickInfoArraysType& rAllTickInfos )
{
std::unique_ptr< TickFactory > apTickFactory( createTickFactory() );
- if( m_aScale.ShiftedCategoryPosition )
+ if( m_aScale.m_bShiftedCategoryPosition )
apTickFactory->getAllTicksShifted( rAllTickInfos );
else
apTickFactory->getAllTicks( rAllTickInfos );
@@ -186,8 +184,10 @@ bool VAxisBase::prepareShapeCreation()
//create named group shape
m_xGroupShape_Shapes = createGroupShape( m_xLogicTarget, m_nDimension==2 ? m_aCID : "");
- if( m_aAxisProperties.m_bDisplayLabels )
- m_xTextTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget, m_aCID );
+ if (m_aAxisProperties.m_bDisplayLabels)
+ m_xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget, m_aCID );
+ if (m_aAxisProperties.m_bDisplayDataTable)
+ m_xDataTableTarget = ShapeFactory::createGroup2D(m_xFinalTarget);
return true;
}
@@ -242,6 +242,13 @@ void VAxisBase::updateUnscaledValuesAtTicks( TickIter& rIter )
}
}
+void VAxisBase::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& /*rSeriesPlotterList*/,
+ uno::Reference<util::XNumberFormatsSupplier> const& /*xNumberFormatsSupplier*/,
+ rtl::Reference<::chart::ChartModel> const& /*xChartDoc*/,
+ css::uno::Reference<css::uno::XComponentContext> const& /*rComponentContext*/)
+{
+}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VAxisBase.hxx b/chart2/source/view/axes/VAxisBase.hxx
index bddba67f9e5c..4ee4f5e288ae 100644
--- a/chart2/source/view/axes/VAxisBase.hxx
+++ b/chart2/source/view/axes/VAxisBase.hxx
@@ -16,18 +16,23 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISBASE_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISBASE_HXX
+#pragma once
#include "VAxisOrGridBase.hxx"
#include "VAxisProperties.hxx"
#include "Tickmarks.hxx"
namespace com::sun::star::util { class XNumberFormatsSupplier; }
+namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class VSeriesPlotter;
+class DataTableView;
+class ChartModel;
+class LegendEntryProvider;
+
class VAxisBase : public VAxisOrGridBase
{
public:
@@ -60,14 +65,20 @@ public:
void setExtraLinePositionAtOtherAxis( double fCrossingAt );
+ virtual void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+ css::uno::Reference<css::util::XNumberFormatsSupplier> const& xNumberFormatsSupplier,
+ rtl::Reference<::chart::ChartModel> const& xChartDoc,
+ css::uno::Reference<css::uno::XComponentContext> const& rComponentContext);
+
+ std::shared_ptr<DataTableView> getDataTableView() { return m_pDataTableView; }
+
protected: //methods
static size_t getIndexOfLongestLabel( const css::uno::Sequence<OUString>& rLabels );
void removeTextShapesFromTicks();
void updateUnscaledValuesAtTicks( TickIter& rIter );
virtual bool prepareShapeCreation();
- void recordMaximumTextSize( const css::uno::Reference< css::drawing::XShape >& xShape
- , double fRotationAngleDegree );
+ void recordMaximumTextSize( SvxShape& xShape, double fRotationAngleDegree );
bool isDateAxis() const;
bool isComplexCategoryAxis() const;
@@ -79,8 +90,11 @@ protected: //member
css::uno::Sequence< OUString > m_aTextLabels;
bool m_bUseTextLabels;
- css::uno::Reference< css::drawing::XShapes > m_xGroupShape_Shapes;
- css::uno::Reference< css::drawing::XShapes > m_xTextTarget;
+ rtl::Reference< SvxShapeGroupAnyD > m_xGroupShape_Shapes;
+ rtl::Reference< SvxShapeGroupAnyD > m_xTextTarget;
+ rtl::Reference< SvxShapeGroupAnyD > m_xDataTableTarget;
+
+ std::shared_ptr<DataTableView> m_pDataTableView;
/**
* This typically consists of 2 TickInfo vectors (i.e. the outer vector
@@ -100,6 +114,5 @@ protected: //member
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VAxisOrGridBase.hxx b/chart2/source/view/axes/VAxisOrGridBase.hxx
index 8bcaf898c3eb..1defc154a809 100644
--- a/chart2/source/view/axes/VAxisOrGridBase.hxx
+++ b/chart2/source/view/axes/VAxisOrGridBase.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISORGRIDBASE_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISORGRIDBASE_HXX
+#pragma once
#include <PlotterBase.hxx>
#include <ThreeDHelper.hxx>
@@ -60,6 +59,5 @@ protected: //member
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx
index 27a4950a886b..a69508cec77a 100644
--- a/chart2/source/view/axes/VAxisProperties.cxx
+++ b/chart2/source/view/axes/VAxisProperties.cxx
@@ -19,17 +19,17 @@
#include "VAxisProperties.hxx"
#include <ViewDefines.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <ChartModelHelper.hxx>
#include <ExplicitCategoriesProvider.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/chart2/XAxis.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <rtl/math.hxx>
+#include <utility>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -152,9 +152,10 @@ TickmarkProperties AxisProperties::getBiggestTickmarkProperties()
return aTickmarkProperties;
}
-AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel
- , ExplicitCategoriesProvider* pExplicitCategoriesProvider )
- : m_xAxisModel(xAxisModel)
+AxisProperties::AxisProperties(rtl::Reference<::chart::Axis> xAxisModel,
+ ExplicitCategoriesProvider* pExplicitCategoriesProvider,
+ rtl::Reference<::chart::DataTable> const& xDataTableModel)
+ : m_xAxisModel(std::move(xAxisModel))
, m_nDimensionIndex(0)
, m_bIsMainAxis(true)
, m_bSwapXAndY(false)
@@ -163,18 +164,18 @@ AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel
, m_eTickmarkPos( css::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS )
, m_bCrossingAxisHasReverseDirection(false)
, m_bCrossingAxisIsCategoryAxes(false)
+ , m_bDisplayDataTable(false)
+ , m_bDataTableAlignAxisValuesWithColumns(false)
, m_bDisplayLabels( true )
, m_bTryStaggeringFirst( false )
, m_nNumberFormatKey(0)
, m_nMajorTickmarks(1)
, m_nMinorTickmarks(1)
- , m_aTickmarkPropertiesList()
- , m_aLineProperties()
- //for category axes
, m_nAxisType(AxisType::REALNUMBER)
, m_bComplexCategories(false)
, m_pExplicitCategoriesProvider(pExplicitCategoriesProvider)
, m_bLimitSpaceForLabels(false)
+ , m_xDataTableModel(xDataTableModel)
{
}
@@ -243,13 +244,11 @@ void AxisProperties::initAxisPositioning( const uno::Reference< beans::XProperty
void AxisProperties::init( bool bCartesian )
{
- uno::Reference< beans::XPropertySet > xProp =
- uno::Reference<beans::XPropertySet>::query( m_xAxisModel );
- if( !xProp.is() )
+ if( !m_xAxisModel.is() )
return;
if( m_nDimensionIndex<2 )
- initAxisPositioning( xProp );
+ initAxisPositioning( m_xAxisModel );
ScaleData aScaleData = m_xAxisModel->getScaleData();
if( m_nDimensionIndex==0 )
@@ -258,6 +257,11 @@ void AxisProperties::init( bool bCartesian )
if( bCartesian )
{
+ if ((!m_bSwapXAndY && m_nDimensionIndex == 0) || (m_bSwapXAndY && m_nDimensionIndex == 1))
+ {
+ m_bDisplayDataTable = m_xDataTableModel.is();
+ }
+
if( m_nDimensionIndex == 0 && m_nAxisType == AxisType::CATEGORY
&& m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() )
m_bComplexCategories = true;
@@ -286,10 +290,9 @@ void AxisProperties::init( bool bCartesian )
{
maLabelAlignment.mfLabelDirection *= -1.0;
maLabelAlignment.mfInnerTickDirection *= -1.0;
- }
- if( bIsYAxisPosition )
maLabelAlignment.meAlignment = lcl_getLabelAlignmentForYAxis(*this);
+ }
else
maLabelAlignment.meAlignment = lcl_getLabelAlignmentForXAxis(*this);
}
@@ -298,19 +301,19 @@ void AxisProperties::init( bool bCartesian )
try
{
//init LineProperties
- m_aLineProperties.initFromPropertySet( xProp );
+ m_aLineProperties.initFromPropertySet( m_xAxisModel );
//init display labels
- xProp->getPropertyValue( "DisplayLabels" ) >>= m_bDisplayLabels;
+ m_xAxisModel->getPropertyValue( "DisplayLabels" ) >>= m_bDisplayLabels;
// Init layout strategy hint for axis labels.
// Compatibility option: starting from LibreOffice 5.1 the rotated
// layout is preferred to staggering for axis labels.
- xProp->getPropertyValue( "TryStaggeringFirst" ) >>= m_bTryStaggeringFirst;
+ m_xAxisModel->getPropertyValue( "TryStaggeringFirst" ) >>= m_bTryStaggeringFirst;
//init TickmarkProperties
- xProp->getPropertyValue( "MajorTickmarks" ) >>= m_nMajorTickmarks;
- xProp->getPropertyValue( "MinorTickmarks" ) >>= m_nMinorTickmarks;
+ m_xAxisModel->getPropertyValue( "MajorTickmarks" ) >>= m_nMajorTickmarks;
+ m_xAxisModel->getPropertyValue( "MinorTickmarks" ) >>= m_nMinorTickmarks;
sal_Int32 nMaxDepth = 0;
if(m_nMinorTickmarks!=0)
@@ -329,51 +332,60 @@ void AxisProperties::init( bool bCartesian )
{
TOOLS_WARN_EXCEPTION("chart2", "" );
}
+
+ if (m_bDisplayDataTable)
+ {
+ m_bDataTableAlignAxisValuesWithColumns = (m_nDimensionIndex == 0);
+
+ if (m_nDimensionIndex == 0)
+ {
+ m_bDisplayLabels = false;
+ }
+
+ }
}
AxisLabelProperties::AxisLabelProperties()
: m_aFontReferenceSize( ChartModelHelper::getDefaultPageSize() )
, m_aMaximumSpaceForLabels( 0 , 0, m_aFontReferenceSize.Width, m_aFontReferenceSize.Height )
- , nNumberFormatKey(0)
- , eStaggering( AxisLabelStaggering::SideBySide )
- , bLineBreakAllowed( false )
- , bOverlapAllowed( false )
- , bStackCharacters( false )
- , fRotationAngleDegree( 0.0 )
- , nRhythm( 1 )
+ , m_nNumberFormatKey(0)
+ , m_eStaggering( AxisLabelStaggering::SideBySide )
+ , m_bLineBreakAllowed( false )
+ , m_bOverlapAllowed( false )
+ , m_bStackCharacters( false )
+ , m_fRotationAngleDegree( 0.0 )
+ , m_nRhythm( 1 )
{
}
-void AxisLabelProperties::init( const uno::Reference< XAxis >& xAxisModel )
+void AxisLabelProperties::init( const rtl::Reference< Axis >& xAxisModel )
{
- uno::Reference< beans::XPropertySet > xProp =
- uno::Reference<beans::XPropertySet>::query( xAxisModel );
- if(!xProp.is())
+ if(!xAxisModel.is())
return;
try
{
- xProp->getPropertyValue( "TextBreak" ) >>= bLineBreakAllowed;
- xProp->getPropertyValue( "TextOverlap" ) >>= bOverlapAllowed;
- xProp->getPropertyValue( "StackCharacters" ) >>= bStackCharacters;
- xProp->getPropertyValue( "TextRotation" ) >>= fRotationAngleDegree;
+ xAxisModel->getPropertyValue( "TextBreak" ) >>= m_bLineBreakAllowed;
+ xAxisModel->getPropertyValue( "TextOverlap" ) >>= m_bOverlapAllowed;
+ xAxisModel->getPropertyValue( "StackCharacters" ) >>= m_bStackCharacters;
+ xAxisModel->getPropertyValue( "TextRotation" ) >>= m_fRotationAngleDegree;
css::chart::ChartAxisArrangeOrderType eArrangeOrder;
- xProp->getPropertyValue( "ArrangeOrder" ) >>= eArrangeOrder;
+ xAxisModel->getPropertyValue( "ArrangeOrder" ) >>= eArrangeOrder;
switch(eArrangeOrder)
{
case css::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE:
- eStaggering = AxisLabelStaggering::SideBySide;
+ m_eStaggering = AxisLabelStaggering::SideBySide;
break;
case css::chart::ChartAxisArrangeOrderType_STAGGER_EVEN:
- eStaggering = AxisLabelStaggering::StaggerEven;
+ m_eStaggering = AxisLabelStaggering::StaggerEven;
break;
case css::chart::ChartAxisArrangeOrderType_STAGGER_ODD:
- eStaggering = AxisLabelStaggering::StaggerOdd;
+ m_eStaggering = AxisLabelStaggering::StaggerOdd;
break;
default:
- eStaggering = AxisLabelStaggering::StaggerAuto;
+ m_eStaggering = AxisLabelStaggering::StaggerAuto;
break;
}
}
@@ -385,14 +397,14 @@ void AxisLabelProperties::init( const uno::Reference< XAxis >& xAxisModel )
bool AxisLabelProperties::isStaggered() const
{
- return ( eStaggering == AxisLabelStaggering::StaggerOdd || eStaggering == AxisLabelStaggering::StaggerEven );
+ return ( m_eStaggering == AxisLabelStaggering::StaggerOdd || m_eStaggering == AxisLabelStaggering::StaggerEven );
}
void AxisLabelProperties::autoRotate45()
{
- fRotationAngleDegree = 45;
- bLineBreakAllowed = false;
- eStaggering = AxisLabelStaggering::SideBySide;
+ m_fRotationAngleDegree = 45;
+ m_bLineBreakAllowed = false;
+ m_eStaggering = AxisLabelStaggering::SideBySide;
}
} //namespace chart
diff --git a/chart2/source/view/axes/VAxisProperties.hxx b/chart2/source/view/axes/VAxisProperties.hxx
index d087e5064e37..0cc23602b541 100644
--- a/chart2/source/view/axes/VAxisProperties.hxx
+++ b/chart2/source/view/axes/VAxisProperties.hxx
@@ -16,11 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISPROPERTIES_HXX
+#pragma once
#include "TickmarkProperties.hxx"
+#include <Axis.hxx>
#include <LabelAlignment.hxx>
+#include <DataTable.hxx>
#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
@@ -28,6 +29,7 @@
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ref.hxx>
#include <vector>
#include <optional>
@@ -59,20 +61,20 @@ struct AxisLabelProperties final
css::awt::Size m_aFontReferenceSize;//reference size to calculate the font height
css::awt::Rectangle m_aMaximumSpaceForLabels;//Labels need to be clipped in order to fit into this rectangle
- sal_Int32 nNumberFormatKey;
+ sal_Int32 m_nNumberFormatKey;
- AxisLabelStaggering eStaggering;
+ AxisLabelStaggering m_eStaggering;
- bool bLineBreakAllowed;
- bool bOverlapAllowed;
+ bool m_bLineBreakAllowed;
+ bool m_bOverlapAllowed;
- bool bStackCharacters;
- double fRotationAngleDegree;
+ bool m_bStackCharacters;
+ double m_fRotationAngleDegree;
- sal_Int32 nRhythm; //show only each nth label with n==nRhythm
+ sal_Int32 m_nRhythm; //show only each nth label with n==nRhythm
//methods:
- void init( const css::uno::Reference< css::chart2::XAxis >& xAxisModel );
+ void init( const rtl::Reference< ::chart::Axis >& xAxisModel );
bool isStaggered() const;
@@ -91,7 +93,7 @@ struct AxisLabelAlignment
struct AxisProperties final
{
- css::uno::Reference<css::chart2::XAxis> m_xAxisModel;
+ rtl::Reference<::chart::Axis> m_xAxisModel;
sal_Int32 m_nDimensionIndex;
bool m_bIsMainAxis;//not secondary axis
@@ -109,7 +111,11 @@ struct AxisProperties final
AxisLabelAlignment maLabelAlignment;
- bool m_bDisplayLabels;
+ // Data table
+ bool m_bDisplayDataTable;
+ bool m_bDataTableAlignAxisValuesWithColumns;
+
+ bool m_bDisplayLabels;
// Compatibility option: starting from LibreOffice 5.1 the rotated
// layout is preferred to staggering for axis labels.
@@ -137,10 +143,13 @@ struct AxisProperties final
bool m_bLimitSpaceForLabels;
+ rtl::Reference<::chart::DataTable> m_xDataTableModel;
+
//methods:
- AxisProperties( const css::uno::Reference< css::chart2::XAxis >& xAxisModel
- , ExplicitCategoriesProvider* pExplicitCategoriesProvider );
+ AxisProperties(rtl::Reference<::chart::Axis> xAxisModel,
+ ExplicitCategoriesProvider* pExplicitCategoriesProvider,
+ rtl::Reference<::chart::DataTable> const& xDataTableModel);
void init(bool bCartesian=false);//init from model data (m_xAxisModel)
@@ -159,6 +168,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 1c62bfb93903..3b40602660f1 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -23,18 +23,23 @@
#include <PropertyMapper.hxx>
#include <NumberFormatterWrapper.hxx>
#include <LabelPositionHelper.hxx>
-#include <TrueGuard.hxx>
#include <BaseGFXHelper.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include "Tickmarks_Equidistant.hxx"
#include <ExplicitCategoriesProvider.hxx>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/chart2/XAxis.hpp>
+#include <o3tl/safeint.hxx>
#include <rtl/math.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/color.hxx>
#include <svx/unoshape.hxx>
#include <svx/unoshtxt.hxx>
+#include <VSeriesPlotter.hxx>
+#include <DataTableView.hxx>
+#include <ChartModel.hxx>
+
+#include <comphelper/scopeguard.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
@@ -44,6 +49,7 @@
#include <basegfx/numeric/ftools.hxx>
#include <algorithm>
+#include <limits>
#include <memory>
using namespace ::com::sun::star;
@@ -72,57 +78,52 @@ VCartesianAxis::~VCartesianAxis()
m_pPosHelper = nullptr;
}
-static void lcl_ResizeTextShapeToFitAvailableSpace( Reference< drawing::XShape > const & xShape2DText,
+static void lcl_ResizeTextShapeToFitAvailableSpace( SvxShapeText& rShape2DText,
const AxisLabelProperties& rAxisLabelProperties,
- const OUString& rLabel,
+ std::u16string_view rLabel,
const tNameSequence& rPropNames,
const tAnySequence& rPropValues,
const bool bIsHorizontalAxis )
{
- uno::Reference< text::XTextRange > xTextRange( xShape2DText, uno::UNO_QUERY );
+ bool bTextHorizontal = rAxisLabelProperties.m_fRotationAngleDegree != 0.0;
+ bool bIsDirectionVertical = bIsHorizontalAxis && bTextHorizontal;
+ const sal_Int32 nFullSize = bIsDirectionVertical ? rAxisLabelProperties.m_aFontReferenceSize.Height : rAxisLabelProperties.m_aFontReferenceSize.Width;
- if( !xTextRange.is() )
+ if( !nFullSize || rLabel.empty() )
return;
- const sal_Int32 nFullSize = bIsHorizontalAxis ? rAxisLabelProperties.m_aFontReferenceSize.Height : rAxisLabelProperties.m_aFontReferenceSize.Width;
+ const sal_Int32 nAvgCharWidth = rShape2DText.getSize().Width / rLabel.size();
- if( !nFullSize || !rLabel.getLength() )
- return;
+ sal_Int32 nMaxLabelsSize = bIsDirectionVertical ? rAxisLabelProperties.m_aMaximumSpaceForLabels.Height : rAxisLabelProperties.m_aMaximumSpaceForLabels.Width;
- sal_Int32 nMaxLabelsSize = bIsHorizontalAxis ? rAxisLabelProperties.m_aMaximumSpaceForLabels.Height : rAxisLabelProperties.m_aMaximumSpaceForLabels.Width;
- const sal_Int32 nAvgCharWidth = xShape2DText->getSize().Width / rLabel.getLength();
- const sal_Int32 nTextSize = bIsHorizontalAxis ? ShapeFactory::getSizeAfterRotation(xShape2DText, rAxisLabelProperties.fRotationAngleDegree).Height :
- ShapeFactory::getSizeAfterRotation(xShape2DText, rAxisLabelProperties.fRotationAngleDegree).Width;
+ awt::Size aSizeAfterRotation = ShapeFactory::getSizeAfterRotation(rShape2DText, rAxisLabelProperties.m_fRotationAngleDegree);
+
+ const sal_Int32 nTextSize = bIsDirectionVertical ? aSizeAfterRotation.Height : aSizeAfterRotation.Width;
if( !nAvgCharWidth )
return;
- const OUString sDots = "...";
+ static constexpr OUString sDots = u"..."_ustr;
const sal_Int32 nCharsToRemove = ( nTextSize - nMaxLabelsSize ) / nAvgCharWidth + 1;
- sal_Int32 nNewLen = rLabel.getLength() - nCharsToRemove - sDots.getLength();
+ sal_Int32 nNewLen = rLabel.size() - nCharsToRemove - sDots.getLength();
// Prevent from showing only dots
if (nNewLen < 0)
- nNewLen = ( rLabel.getLength() >= sDots.getLength() ) ? sDots.getLength() : rLabel.getLength();
+ nNewLen = ( sal_Int32(rLabel.size()) >= sDots.getLength() ) ? sDots.getLength() : rLabel.size();
bool bCrop = nCharsToRemove > 0;
if( !bCrop )
return;
- OUString aNewLabel = rLabel.copy( 0, nNewLen );
+ OUString aNewLabel( rLabel.substr( 0, nNewLen ) );
if( nNewLen > sDots.getLength() )
aNewLabel += sDots;
- xTextRange->setString( aNewLabel );
+ rShape2DText.setString( aNewLabel );
- uno::Reference< beans::XPropertySet > xProp( xTextRange, uno::UNO_QUERY );
- if( xProp.is() )
- {
- PropertyMapper::setMultiProperties( rPropNames, rPropValues, xProp );
- }
+ PropertyMapper::setMultiProperties( rPropNames, rPropValues, rShape2DText );
}
-static Reference< drawing::XShape > createSingleLabel(
- const Reference< lang::XMultiServiceFactory>& xShapeFactory
- , const Reference< drawing::XShapes >& xTarget
+static rtl::Reference<SvxShapeText> createSingleLabel(
+ const rtl::Reference< SvxShapeGroupAnyD >& xTarget
, const awt::Point& rAnchorScreenPosition2D
, const OUString& rLabel
, const AxisLabelProperties& rAxisLabelProperties
@@ -136,30 +137,27 @@ static Reference< drawing::XShape > createSingleLabel(
return nullptr;
// #i78696# use mathematically correct rotation now
- const double fRotationAnglePi(-basegfx::deg2rad(rAxisLabelProperties.fRotationAngleDegree));
+ const double fRotationAnglePi(-basegfx::deg2rad(rAxisLabelProperties.m_fRotationAngleDegree));
uno::Any aATransformation = ShapeFactory::makeTransformation( rAnchorScreenPosition2D, fRotationAnglePi );
- OUString aLabel = ShapeFactory::getStackedString( rLabel, rAxisLabelProperties.bStackCharacters );
+ OUString aLabel = ShapeFactory::getStackedString( rLabel, rAxisLabelProperties.m_bStackCharacters );
- Reference< drawing::XShape > xShape2DText = ShapeFactory::getOrCreateShapeFactory(xShapeFactory)
- ->createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation );
+ rtl::Reference<SvxShapeText> xShape2DText =
+ ShapeFactory::createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation );
if( rAxisProperties.m_bLimitSpaceForLabels )
- lcl_ResizeTextShapeToFitAvailableSpace(xShape2DText, rAxisLabelProperties, aLabel, rPropNames, rPropValues, bIsHorizontalAxis);
+ lcl_ResizeTextShapeToFitAvailableSpace(*xShape2DText, rAxisLabelProperties, aLabel, rPropNames, rPropValues, bIsHorizontalAxis);
LabelPositionHelper::correctPositionForRotation( xShape2DText
- , rAxisProperties.maLabelAlignment.meAlignment, rAxisLabelProperties.fRotationAngleDegree, rAxisProperties.m_bComplexCategories );
+ , rAxisProperties.maLabelAlignment.meAlignment, rAxisLabelProperties.m_fRotationAngleDegree, rAxisProperties.m_bComplexCategories );
return xShape2DText;
}
-static bool lcl_doesShapeOverlapWithTickmark( const Reference< drawing::XShape >& xShape
+static bool lcl_doesShapeOverlapWithTickmark( SvxShape& rShape
, double fRotationAngleDegree
, const basegfx::B2DVector& rTickScreenPosition )
{
- if(!xShape.is())
- return false;
-
- ::basegfx::B2IRectangle aShapeRect = BaseGFXHelper::makeRectangle(xShape->getPosition(), ShapeFactory::getSizeAfterRotation( xShape, fRotationAngleDegree ));
+ ::basegfx::B2IRectangle aShapeRect = BaseGFXHelper::makeRectangle(rShape.getPosition(), ShapeFactory::getSizeAfterRotation( rShape, fRotationAngleDegree ));
basegfx::B2IVector aPosition(
static_cast<sal_Int32>( rTickScreenPosition.getX() )
@@ -187,8 +185,8 @@ static void lcl_getRotatedPolygon( B2DPolygon &aPoly, const ::basegfx::B2DRectan
aPoly.transform( aMatrix );
}
-static bool doesOverlap( const Reference< drawing::XShape >& xShape1
- , const Reference< drawing::XShape >& xShape2
+static bool doesOverlap( const rtl::Reference<SvxShapeText>& xShape1
+ , const rtl::Reference<SvxShapeText>& xShape2
, double fRotationAngleDegree )
{
if( !xShape1.is() || !xShape2.is() )
@@ -213,7 +211,7 @@ static bool doesOverlap( const Reference< drawing::XShape >& xShape1
static void removeShapesAtWrongRhythm( TickIter& rIter
, sal_Int32 nCorrectRhythm
, sal_Int32 nMaxTickToCheck
- , const Reference< drawing::XShapes >& xTarget )
+ , const rtl::Reference< SvxShapeGroupAnyD >& xTarget )
{
sal_Int32 nTick = 0;
for( TickInfo* pTickInfo = rIter.firstInfo()
@@ -326,7 +324,7 @@ static B2DVector lcl_getLabelsDistance( TickIter& rIter, const B2DVector& rDista
aStaggerDirection.normalize();
sal_Int32 nDistance=0;
- Reference< drawing::XShape > xShape2DText;
+ rtl::Reference< SvxShapeText > xShape2DText;
for( TickInfo* pTickInfo = rIter.firstInfo()
; pTickInfo
; pTickInfo = rIter.nextInfo() )
@@ -334,7 +332,7 @@ static B2DVector lcl_getLabelsDistance( TickIter& rIter, const B2DVector& rDista
xShape2DText = pTickInfo->xTextShape;
if( xShape2DText.is() )
{
- awt::Size aSize = ShapeFactory::getSizeAfterRotation( xShape2DText, fRotationAngleDegree );
+ awt::Size aSize = ShapeFactory::getSizeAfterRotation( *xShape2DText, fRotationAngleDegree );
if(fabs(aStaggerDirection.getX())>fabs(aStaggerDirection.getY()))
nDistance = std::max(nDistance,aSize.Width);
else
@@ -355,12 +353,11 @@ static void lcl_shiftLabels( TickIter& rIter, const B2DVector& rStaggerDistance
{
if(rStaggerDistance.getLength()==0.0)
return;
- Reference< drawing::XShape > xShape2DText;
for( TickInfo* pTickInfo = rIter.firstInfo()
; pTickInfo
; pTickInfo = rIter.nextInfo() )
{
- xShape2DText = pTickInfo->xTextShape;
+ const rtl::Reference<SvxShapeText>& xShape2DText = pTickInfo->xTextShape;
if( xShape2DText.is() )
{
awt::Point aPos = xShape2DText->getPosition();
@@ -371,17 +368,12 @@ static void lcl_shiftLabels( TickIter& rIter, const B2DVector& rStaggerDistance
}
}
-static bool lcl_hasWordBreak( const Reference<drawing::XShape>& xShape )
+static bool lcl_hasWordBreak( const rtl::Reference<SvxShapeText>& xShape )
{
if (!xShape.is())
return false;
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
- SvxShapeText* pShapeText = dynamic_cast<SvxShapeText*>(pShape);
- if (!pShapeText)
- return false;
-
- SvxTextEditSource* pTextEditSource = dynamic_cast<SvxTextEditSource*>(pShapeText->GetEditSource());
+ SvxTextEditSource* pTextEditSource = dynamic_cast<SvxTextEditSource*>(xShape->GetEditSource());
if (!pTextEditSource)
return false;
@@ -442,7 +434,7 @@ static void getAxisLabelProperties(
const AxisLabelProperties& rAxisLabelProp,
sal_Int32 nLimitedSpaceForText, bool bLimitedHeight )
{
- Reference<beans::XPropertySet> xProps(rAxisProp.m_xAxisModel, uno::UNO_QUERY);
+ Reference<beans::XPropertySet> xProps(rAxisProp.m_xAxisModel);
PropertyMapper::getTextLabelMultiPropertyLists(
xProps, rPropNames, rPropValues, false, nLimitedSpaceForText, bLimitedHeight, false);
@@ -525,16 +517,16 @@ bool VCartesianAxis::isBreakOfLabelsAllowed(
{
if( m_aTextLabels.getLength() > 100 )
return false;
- if( !rAxisLabelProperties.bLineBreakAllowed )
+ if( !rAxisLabelProperties.m_bLineBreakAllowed )
return false;
- if( rAxisLabelProperties.bStackCharacters )
+ if( rAxisLabelProperties.m_bStackCharacters )
return false;
//no break for value axis
if( !m_bUseTextLabels )
return false;
- if( !( rAxisLabelProperties.fRotationAngleDegree == 0.0 ||
- rAxisLabelProperties.fRotationAngleDegree == 90.0 ||
- rAxisLabelProperties.fRotationAngleDegree == 270.0 ) )
+ if( !( rAxisLabelProperties.m_fRotationAngleDegree == 0.0 ||
+ rAxisLabelProperties.m_fRotationAngleDegree == 90.0 ||
+ rAxisLabelProperties.m_fRotationAngleDegree == 270.0 ) )
return false;
//no break for complex vertical category axis
if( !m_aAxisProperties.m_bSwapXAndY )
@@ -550,26 +542,26 @@ bool canAutoAdjustLabelPlacement(
const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis)
{
// joined prerequisite checks for auto rotate and auto stagger
- if( rAxisLabelProperties.bOverlapAllowed )
+ if( rAxisLabelProperties.m_bOverlapAllowed )
return false;
- if( rAxisLabelProperties.bLineBreakAllowed ) // auto line break may conflict with...
+ if( rAxisLabelProperties.m_bLineBreakAllowed ) // auto line break may conflict with...
return false;
- if( rAxisLabelProperties.fRotationAngleDegree != 0.0 )
+ if( rAxisLabelProperties.m_fRotationAngleDegree != 0.0 )
return false;
// automatic adjusting labels only works for
// horizontal axis with horizontal text
// or vertical axis with vertical text
if( bIsHorizontalAxis )
- return !rAxisLabelProperties.bStackCharacters;
+ return !rAxisLabelProperties.m_bStackCharacters;
if( bIsVerticalAxis )
- return rAxisLabelProperties.bStackCharacters;
+ return rAxisLabelProperties.m_bStackCharacters;
return false;
}
bool isAutoStaggeringOfLabelsAllowed(
const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis )
{
- if( rAxisLabelProperties.eStaggering != AxisLabelStaggering::StaggerAuto )
+ if( rAxisLabelProperties.m_eStaggering != AxisLabelStaggering::StaggerAuto )
return false;
return canAutoAdjustLabelPlacement(rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis);
}
@@ -674,7 +666,7 @@ void VCartesianAxis::createAllTickInfos( TickInfoArraysType& rAllTickInfos )
TickIter* VCartesianAxis::createLabelTickIterator( sal_Int32 nTextLevel )
{
- if( nTextLevel>=0 && nTextLevel < static_cast< sal_Int32 >(m_aAllTickInfos.size()) )
+ if( nTextLevel>=0 && o3tl::make_unsigned(nTextLevel) < m_aAllTickInfos.size() )
return new PureTickIter( m_aAllTickInfos[nTextLevel] );
return nullptr;
}
@@ -711,7 +703,7 @@ sal_Int32 VCartesianAxis::getTextLevelCount() const
}
bool VCartesianAxis::createTextShapes(
- const Reference<drawing::XShapes>& xTarget, TickIter& rTickIter,
+ const rtl::Reference< SvxShapeGroupAnyD >& xTarget, TickIter& rTickIter,
AxisLabelProperties& rAxisLabelProperties, TickFactory2D const * pTickFactory,
sal_Int32 nScreenDistanceBetweenTicks )
{
@@ -733,21 +725,31 @@ bool VCartesianAxis::createTextShapes(
}
}
- if (!isBreakOfLabelsAllowed(rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis) &&
+ bool bIsBreakOfLabelsAllowed = isBreakOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis );
+ if (!bIsBreakOfLabelsAllowed &&
!isAutoStaggeringOfLabelsAllowed(rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis) &&
!rAxisLabelProperties.isStaggered())
+ {
return createTextShapesSimple(xTarget, rTickIter, rAxisLabelProperties, pTickFactory);
+ }
FixedNumberFormatter aFixedNumberFormatter(
- m_xNumberFormatsSupplier, rAxisLabelProperties.nNumberFormatKey );
+ m_xNumberFormatsSupplier, rAxisLabelProperties.m_nNumberFormatKey );
bool bIsStaggered = rAxisLabelProperties.isStaggered();
B2DVector aTextToTickDistance = pTickFactory->getDistanceAxisTickToText(m_aAxisProperties, true);
sal_Int32 nLimitedSpaceForText = -1;
- if( isBreakOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis ) )
+ if (bIsBreakOfLabelsAllowed)
{
- nLimitedSpaceForText = nScreenDistanceBetweenTicks;
+ if (!m_aAxisProperties.m_bLimitSpaceForLabels)
+ {
+ basegfx::B2DVector nDeltaVector = pTickFactory->getXaxisEndPos() - pTickFactory->getXaxisStartPos();
+ nLimitedSpaceForText = nDeltaVector.getX();
+ }
+ if (nScreenDistanceBetweenTicks > 0)
+ nLimitedSpaceForText = nScreenDistanceBetweenTicks;
+
if( bIsStaggered )
nLimitedSpaceForText *= 2;
@@ -760,14 +762,14 @@ bool VCartesianAxis::createTextShapes(
}
// recalculate the nLimitedSpaceForText in case of 90 and 270 degree if the text break is true
- if ( rAxisLabelProperties.fRotationAngleDegree == 90.0 || rAxisLabelProperties.fRotationAngleDegree == 270.0 )
+ if ( rAxisLabelProperties.m_fRotationAngleDegree == 90.0 || rAxisLabelProperties.m_fRotationAngleDegree == 270.0 )
{
nLimitedSpaceForText = rAxisLabelProperties.m_aMaximumSpaceForLabels.Height;
m_aAxisProperties.m_bLimitSpaceForLabels = false;
}
// recalculate the nLimitedSpaceForText in case of vertical category axis if the text break is true
- if ( m_aAxisProperties.m_bSwapXAndY && bIsVerticalAxis && rAxisLabelProperties.fRotationAngleDegree == 0.0 )
+ if ( m_aAxisProperties.m_bSwapXAndY && bIsVerticalAxis && rAxisLabelProperties.m_fRotationAngleDegree == 0.0 )
{
nLimitedSpaceForText = pTickFactory->getXaxisStartPos().getX();
m_aAxisProperties.m_bLimitSpaceForLabels = false;
@@ -790,7 +792,7 @@ bool VCartesianAxis::createTextShapes(
tAnySequence aPropValues;
getAxisLabelProperties(aPropNames, aPropValues, m_aAxisProperties, rAxisLabelProperties, nLimitedSpaceForText, bLimitedHeight);
- uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,"CharColor");
+ uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,u"CharColor");
Color nColor = COL_AUTO;
if(pColorAny)
*pColorAny >>= nColor;
@@ -808,21 +810,21 @@ bool VCartesianAxis::createTextShapes(
pPREPreviousVisibleTickInfo : pPreviousVisibleTickInfo;
//don't create labels which does not fit into the rhythm
- if( nTick%rAxisLabelProperties.nRhythm != 0 )
+ if( nTick%rAxisLabelProperties.m_nRhythm != 0 )
continue;
//don't create labels for invisible ticks
if( !pTickInfo->bPaintIt )
continue;
- if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.m_bOverlapAllowed )
{
// Overlapping is not allowed. If the label overlaps with its
// neighboring label, try increasing the tick interval (or rhythm
// as it's called) and start over.
- if( lcl_doesShapeOverlapWithTickmark( pLastVisibleNeighbourTickInfo->xTextShape
- , rAxisLabelProperties.fRotationAngleDegree
+ if( lcl_doesShapeOverlapWithTickmark( *pLastVisibleNeighbourTickInfo->xTextShape
+ , rAxisLabelProperties.m_fRotationAngleDegree
, pTickInfo->aTickScreenPosition ) )
{
// This tick overlaps with its neighbor. Try to stagger (if
@@ -832,11 +834,11 @@ bool VCartesianAxis::createTextShapes(
if( !bIsStaggered && isAutoStaggeringOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis ) )
{
bIsStaggered = true;
- rAxisLabelProperties.eStaggering = AxisLabelStaggering::StaggerEven;
+ rAxisLabelProperties.m_eStaggering = AxisLabelStaggering::StaggerEven;
pLastVisibleNeighbourTickInfo = pPREPreviousVisibleTickInfo;
if( !pLastVisibleNeighbourTickInfo ||
- !lcl_doesShapeOverlapWithTickmark( pLastVisibleNeighbourTickInfo->xTextShape
- , rAxisLabelProperties.fRotationAngleDegree
+ !lcl_doesShapeOverlapWithTickmark( *pLastVisibleNeighbourTickInfo->xTextShape
+ , rAxisLabelProperties.m_fRotationAngleDegree
, pTickInfo->aTickScreenPosition ) )
bOverlapsAfterAutoStagger = false;
}
@@ -847,8 +849,8 @@ bool VCartesianAxis::createTextShapes(
// Increment the visible tick intervals (if that's
// allowed) and start over.
- rAxisLabelProperties.nRhythm++;
- removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ rAxisLabelProperties.m_nRhythm++;
+ removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.m_nRhythm, nTick, xTarget );
return false;
}
}
@@ -874,37 +876,41 @@ bool VCartesianAxis::createTextShapes(
//create single label
if(!pTickInfo->xTextShape.is())
- pTickInfo->xTextShape = createSingleLabel( m_xShapeFactory, xTarget
+ {
+ pTickInfo->xTextShape = createSingleLabel( xTarget
, aAnchorScreenPosition2D, aLabel
, rAxisLabelProperties, m_aAxisProperties
, aPropNames, aPropValues, bIsHorizontalAxis );
+ }
if(!pTickInfo->xTextShape.is())
continue;
- recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree );
+ recordMaximumTextSize( *pTickInfo->xTextShape, rAxisLabelProperties.m_fRotationAngleDegree );
// Label has multiple lines and the words are broken
- if( nLimitedSpaceForText>0 && !rAxisLabelProperties.bOverlapAllowed
- && rAxisLabelProperties.fRotationAngleDegree == 0.0
- && lcl_hasWordBreak( pTickInfo->xTextShape ) )
+ if (nLimitedSpaceForText > 0
+ && !rAxisLabelProperties.m_bOverlapAllowed
+ && rAxisLabelProperties.m_fRotationAngleDegree == 0.0
+ && nTick > 0
+ && lcl_hasWordBreak(pTickInfo->xTextShape))
{
// Label has multiple lines and belongs to a complex category
// axis. Rotate 90 degrees to try to avoid overlaps.
if ( m_aAxisProperties.m_bComplexCategories )
{
- rAxisLabelProperties.fRotationAngleDegree = 90;
+ rAxisLabelProperties.m_fRotationAngleDegree = 90;
}
- rAxisLabelProperties.bLineBreakAllowed = false;
- m_aAxisLabelProperties.fRotationAngleDegree = rAxisLabelProperties.fRotationAngleDegree;
+ rAxisLabelProperties.m_bLineBreakAllowed = false;
+ m_aAxisLabelProperties.m_fRotationAngleDegree = rAxisLabelProperties.m_fRotationAngleDegree;
removeTextShapesFromTicks();
return false;
}
//if NO OVERLAP -> remove overlapping shapes
- if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.m_bOverlapAllowed )
{
// Check if the label still overlaps with its neighbor.
- if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree ) )
+ if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, rAxisLabelProperties.m_fRotationAngleDegree ) )
{
// It overlaps. Check if staggering helps.
bool bOverlapsAfterAutoStagger = true;
@@ -916,11 +922,11 @@ bool VCartesianAxis::createTextShapes(
|| m_aAxisProperties.m_bTryStaggeringFirst )
{
bIsStaggered = true;
- rAxisLabelProperties.eStaggering = AxisLabelStaggering::StaggerEven;
+ rAxisLabelProperties.m_eStaggering = AxisLabelStaggering::StaggerEven;
pLastVisibleNeighbourTickInfo = pPREPreviousVisibleTickInfo;
if( !pLastVisibleNeighbourTickInfo ||
- !lcl_doesShapeOverlapWithTickmark( pLastVisibleNeighbourTickInfo->xTextShape
- , rAxisLabelProperties.fRotationAngleDegree
+ !lcl_doesShapeOverlapWithTickmark( *pLastVisibleNeighbourTickInfo->xTextShape
+ , rAxisLabelProperties.m_fRotationAngleDegree
, pTickInfo->aTickScreenPosition ) )
bOverlapsAfterAutoStagger = false;
}
@@ -937,15 +943,15 @@ bool VCartesianAxis::createTextShapes(
// The nRhythm parameter is reset to 1 since the layout
// used for text labels is changed.
rAxisLabelProperties.autoRotate45();
- m_aAxisLabelProperties.fRotationAngleDegree = rAxisLabelProperties.fRotationAngleDegree; // Store it for future runs.
+ m_aAxisLabelProperties.m_fRotationAngleDegree = rAxisLabelProperties.m_fRotationAngleDegree; // Store it for future runs.
removeTextShapesFromTicks();
- rAxisLabelProperties.nRhythm = 1;
+ rAxisLabelProperties.m_nRhythm = 1;
return false;
}
// Try incrementing the tick interval and start over.
- rAxisLabelProperties.nRhythm++;
- removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ rAxisLabelProperties.m_nRhythm++;
+ removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.m_nRhythm, nTick, xTarget );
return false;
}
}
@@ -958,11 +964,11 @@ bool VCartesianAxis::createTextShapes(
}
bool VCartesianAxis::createTextShapesSimple(
- const Reference<drawing::XShapes>& xTarget, TickIter& rTickIter,
+ const rtl::Reference< SvxShapeGroupAnyD >& xTarget, TickIter& rTickIter,
AxisLabelProperties& rAxisLabelProperties, TickFactory2D const * pTickFactory )
{
FixedNumberFormatter aFixedNumberFormatter(
- m_xNumberFormatsSupplier, rAxisLabelProperties.nNumberFormatKey );
+ m_xNumberFormatsSupplier, rAxisLabelProperties.m_nNumberFormatKey );
const bool bIsHorizontalAxis = pTickFactory->isHorizontalAxis();
const bool bIsVerticalAxis = pTickFactory->isVerticalAxis();
@@ -981,7 +987,7 @@ bool VCartesianAxis::createTextShapesSimple(
tAnySequence aPropValues;
getAxisLabelProperties(aPropNames, aPropValues, m_aAxisProperties, rAxisLabelProperties, -1, bLimitedHeight);
- uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,"CharColor");
+ uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,u"CharColor");
Color nColor = COL_AUTO;
if(pColorAny)
*pColorAny >>= nColor;
@@ -997,28 +1003,28 @@ bool VCartesianAxis::createTextShapesSimple(
const TickInfo* pLastVisibleNeighbourTickInfo = pPreviousVisibleTickInfo;
//don't create labels which does not fit into the rhythm
- if( nTick%rAxisLabelProperties.nRhythm != 0 )
+ if( nTick%rAxisLabelProperties.m_nRhythm != 0 )
continue;
//don't create labels for invisible ticks
if( !pTickInfo->bPaintIt )
continue;
- if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.m_bOverlapAllowed )
{
// Overlapping is not allowed. If the label overlaps with its
// neighboring label, try increasing the tick interval (or rhythm
// as it's called) and start over.
- if( lcl_doesShapeOverlapWithTickmark( pLastVisibleNeighbourTickInfo->xTextShape
- , rAxisLabelProperties.fRotationAngleDegree
+ if( lcl_doesShapeOverlapWithTickmark( *pLastVisibleNeighbourTickInfo->xTextShape
+ , rAxisLabelProperties.m_fRotationAngleDegree
, pTickInfo->aTickScreenPosition ) )
{
// This tick overlaps with its neighbor. Increment the visible
// tick intervals (if that's allowed) and start over.
- rAxisLabelProperties.nRhythm++;
- removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ rAxisLabelProperties.m_nRhythm++;
+ removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.m_nRhythm, nTick, xTarget );
return false;
}
}
@@ -1043,20 +1049,20 @@ bool VCartesianAxis::createTextShapesSimple(
//create single label
if(!pTickInfo->xTextShape.is())
- pTickInfo->xTextShape = createSingleLabel( m_xShapeFactory, xTarget
+ pTickInfo->xTextShape = createSingleLabel( xTarget
, aAnchorScreenPosition2D, aLabel
, rAxisLabelProperties, m_aAxisProperties
, aPropNames, aPropValues, bIsHorizontalAxis );
if(!pTickInfo->xTextShape.is())
continue;
- recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree );
+ recordMaximumTextSize( *pTickInfo->xTextShape, rAxisLabelProperties.m_fRotationAngleDegree );
//if NO OVERLAP -> remove overlapping shapes
- if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.m_bOverlapAllowed )
{
// Check if the label still overlaps with its neighbor.
- if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree ) )
+ if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, rAxisLabelProperties.m_fRotationAngleDegree ) )
{
// It overlaps.
if( isAutoRotatingOfLabelsAllowed(rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis) )
@@ -1067,15 +1073,15 @@ bool VCartesianAxis::createTextShapesSimple(
// The nRhythm parameter is reset to 1 since the layout
// used for text labels is changed.
rAxisLabelProperties.autoRotate45();
- m_aAxisLabelProperties.fRotationAngleDegree = rAxisLabelProperties.fRotationAngleDegree; // Store it for future runs.
+ m_aAxisLabelProperties.m_fRotationAngleDegree = rAxisLabelProperties.m_fRotationAngleDegree; // Store it for future runs.
removeTextShapesFromTicks();
- rAxisLabelProperties.nRhythm = 1;
+ rAxisLabelProperties.m_nRhythm = 1;
return false;
}
// Try incrementing the tick interval and start over.
- rAxisLabelProperties.nRhythm++;
- removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ rAxisLabelProperties.m_nRhythm++;
+ removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.m_nRhythm, nTick, xTarget );
return false;
}
}
@@ -1109,18 +1115,15 @@ double VCartesianAxis::getLabelLineIntersectionValue() const
double VCartesianAxis::getExtraLineIntersectionValue() const
{
- double fNan;
- rtl::math::setNan(&fNan);
-
if( !m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis )
- return fNan;
+ return std::numeric_limits<double>::quiet_NaN();
double fMin = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMinY();
double fMax = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMaxY();
if( *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis <= fMin
|| *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis >= fMax )
- return fNan;
+ return std::numeric_limits<double>::quiet_NaN();
return *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis;
}
@@ -1134,10 +1137,10 @@ B2DVector VCartesianAxis::getScreenPosition( double fLogicX, double fLogicY, dou
drawing::Position3D aScenePos = m_pPosHelper->transformLogicToScene( fLogicX, fLogicY, fLogicZ, true );
if(m_nDimension==3)
{
- if (m_xLogicTarget.is() && m_pShapeFactory)
+ if (m_xLogicTarget.is())
{
tPropertyNameMap aDummyPropertyNameMap;
- Reference< drawing::XShape > xShape3DAnchor = m_pShapeFactory->createCube( m_xLogicTarget
+ rtl::Reference<Svx3DExtrudeObject> xShape3DAnchor = ShapeFactory::createCube( m_xLogicTarget
, aScenePos,drawing::Direction3D(1,1,1), 0, nullptr, aDummyPropertyNameMap);
awt::Point a2DPos = xShape3DAnchor->getPosition(); //get 2D position from xShape3DAnchor
m_xLogicTarget->remove(xShape3DAnchor);
@@ -1275,9 +1278,7 @@ void VCartesianAxis::get2DAxisMainLine(
double fDeltaY = rEnd.getY() - rStart.getY();
//only those points are candidates which are lying on exactly one wall as these are outer edges
- tScreenPosAndLogicPosList aPosList;
- aPosList.push_back( getScreenPosAndLogicPos( fMinX, fYOnYPlane, fZOther ) );
- aPosList.push_back( getScreenPosAndLogicPos( fMinX, fYOther, fZOnZPlane ) );
+ tScreenPosAndLogicPosList aPosList { getScreenPosAndLogicPos( fMinX, fYOnYPlane, fZOther ), getScreenPosAndLogicPos( fMinX, fYOther, fZOnZPlane ) };
if( fabs(fDeltaY) > fabs(fDeltaX) )
{
@@ -1329,9 +1330,7 @@ void VCartesianAxis::get2DAxisMainLine(
double fDeltaY = rEnd.getY() - rStart.getY();
//only those points are candidates which are lying on exactly one wall as these are outer edges
- tScreenPosAndLogicPosList aPosList;
- aPosList.push_back( getScreenPosAndLogicPos( fXOnXPlane, fMinY, fZOther ) );
- aPosList.push_back( getScreenPosAndLogicPos( fXOther, fMinY, fZOnZPlane ) );
+ tScreenPosAndLogicPosList aPosList { getScreenPosAndLogicPos( fXOnXPlane, fMinY, fZOther ), getScreenPosAndLogicPos( fXOther, fMinY, fZOnZPlane ) };
if( fabs(fDeltaY) > fabs(fDeltaX) )
{
@@ -1408,9 +1407,7 @@ void VCartesianAxis::get2DAxisMainLine(
double fDeltaX = rEnd.getX() - rStart.getX();
//only those points are candidates which are lying on exactly one wall as these are outer edges
- tScreenPosAndLogicPosList aPosList;
- aPosList.push_back( getScreenPosAndLogicPos( fXOther, fYOnYPlane, fMinZ ) );
- aPosList.push_back( getScreenPosAndLogicPos( fXOnXPlane, fYOther, fMinZ ) );
+ tScreenPosAndLogicPosList aPosList { getScreenPosAndLogicPos( fXOther, fYOnYPlane, fMinZ ), getScreenPosAndLogicPos( fXOnXPlane, fYOther, fMinZ ) };
std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() );
ScreenPosAndLogicPos aBestPos( aPosList[0] );
@@ -1583,14 +1580,14 @@ sal_Int32 VCartesianAxis::estimateMaximumAutoMainIncrementCount()
// tdf#48041: do not duplicate the value labels because of rounding
if (m_aAxisProperties.m_nAxisType != css::chart2::AxisType::DATE)
{
- FixedNumberFormatter aFixedNumberFormatterTest(m_xNumberFormatsSupplier, m_aAxisLabelProperties.nNumberFormatKey);
+ FixedNumberFormatter aFixedNumberFormatterTest(m_xNumberFormatsSupplier, m_aAxisLabelProperties.m_nNumberFormatKey);
OUString sPreviousValueLabel;
sal_Int32 nSameLabel = 0;
- for (sal_Int32 nLabel = 0; nLabel < static_cast<sal_Int32>(m_aAllTickInfos[0].size()); ++nLabel)
+ for (auto const & nLabel: m_aAllTickInfos[0])
{
Color nColor = COL_AUTO;
bool bHasColor = false;
- OUString sValueLabel = aFixedNumberFormatterTest.getFormattedString(m_aAllTickInfos[0][nLabel].fScaledTickValue, nColor, bHasColor);
+ OUString sValueLabel = aFixedNumberFormatterTest.getFormattedString(nLabel.fScaledTickValue, nColor, bHasColor);
if (sValueLabel == sPreviousValueLabel)
{
nSameLabel++;
@@ -1631,23 +1628,23 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel
if( isComplexCategoryAxis() )
{
sal_Int32 nTextLevelCount = getTextLevelCount();
- B2DVector aCummulatedLabelsDistance(0,0);
+ B2DVector aCumulatedLabelsDistance(0,0);
for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
{
std::unique_ptr<TickIter> apTickIter(createLabelTickIterator(nTextLevel));
if (apTickIter)
{
- double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
+ double fRotationAngleDegree = m_aAxisLabelProperties.m_fRotationAngleDegree;
if( nTextLevel>0 )
{
- lcl_shiftLabels(*apTickIter, aCummulatedLabelsDistance);
+ lcl_shiftLabels(*apTickIter, aCumulatedLabelsDistance);
//multilevel labels: 0 or 90 by default
if( m_aAxisProperties.m_bSwapXAndY )
fRotationAngleDegree = 90.0;
else
fRotationAngleDegree = 0.0;
}
- aCummulatedLabelsDistance += lcl_getLabelsDistance(
+ aCumulatedLabelsDistance += lcl_getLabelsDistance(
*apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties),
fRotationAngleDegree);
}
@@ -1657,8 +1654,8 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel
{
if( !m_aAllTickInfos.empty() )
{
- LabelIterator aInnerIter( m_aAllTickInfos[0], rAxisLabelProperties.eStaggering, true );
- LabelIterator aOuterIter( m_aAllTickInfos[0], rAxisLabelProperties.eStaggering, false );
+ LabelIterator aInnerIter( m_aAllTickInfos[0], rAxisLabelProperties.m_eStaggering, true );
+ LabelIterator aOuterIter( m_aAllTickInfos[0], rAxisLabelProperties.m_eStaggering, false );
lcl_shiftLabels( aOuterIter
, lcl_getLabelsDistance( aInnerIter
@@ -1667,16 +1664,55 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel
}
}
+void VCartesianAxis::createDataTableShape(std::unique_ptr<TickFactory2D> const& rpTickFactory2D)
+{
+ // Check if we can create the data table shape
+ // Data table view and m_bDisplayDataTable must be true
+ if (!m_pDataTableView || !m_aAxisProperties.m_bDisplayDataTable)
+ return;
+
+ m_pDataTableView->initializeShapes(m_xDataTableTarget);
+ basegfx::B2DVector aStart = rpTickFactory2D->getXaxisStartPos();
+ basegfx::B2DVector aEnd = rpTickFactory2D->getXaxisEndPos();
+
+ rpTickFactory2D->updateScreenValues(m_aAllTickInfos);
+
+ sal_Int32 nDistance = -1;
+
+ std::unique_ptr<TickIter> apTickIter(createLabelTickIterator(0));
+ if (apTickIter)
+ {
+ nDistance = TickFactory2D::getTickScreenDistance(*apTickIter);
+ if (getTextLevelCount() > 1)
+ nDistance *= 2;
+ }
+
+ if (nDistance <= 0)
+ {
+ // we only have one data series so we have no TickMarks, therefore calculate and use the table size
+ auto rDelta = aEnd - aStart;
+ nDistance = basegfx::fround(rDelta.getX());
+ }
+
+ if (nDistance > 0)
+ {
+ m_pDataTableView->createShapes(aStart, aEnd, nDistance);
+ }
+}
+
void VCartesianAxis::createLabels()
{
if( !prepareShapeCreation() )
return;
+ std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
+
+ createDataTableShape(apTickFactory2D);
+
//create labels
if (!m_aAxisProperties.m_bDisplayLabels)
return;
- std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
TickFactory2D* pTickFactory2D = apTickFactory2D.get();
//get the transformed screen values for all tickmarks in aAllTickInfos
@@ -1704,15 +1740,15 @@ void VCartesianAxis::createLabels()
AxisLabelProperties aComplexProps(m_aAxisLabelProperties);
if( m_aAxisProperties.m_bComplexCategories )
{
- aComplexProps.bLineBreakAllowed = true;
- aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0;
+ aComplexProps.m_bLineBreakAllowed = true;
+ aComplexProps.m_bOverlapAllowed = aComplexProps.m_fRotationAngleDegree != 0.0;
if( nTextLevel > 0 )
{
//multilevel labels: 0 or 90 by default
if( m_aAxisProperties.m_bSwapXAndY )
- aComplexProps.fRotationAngleDegree = 90.0;
+ aComplexProps.m_fRotationAngleDegree = 90.0;
else
- aComplexProps.fRotationAngleDegree = 0.0;
+ aComplexProps.m_fRotationAngleDegree = 0.0;
}
}
AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties;
@@ -1723,11 +1759,20 @@ void VCartesianAxis::createLabels()
}
}
doStaggeringOfLabels( m_aAxisLabelProperties, pTickFactory2D );
+
+ if (m_pDataTableView)
+ {
+ sal_Int32 x = m_xTextTarget->getPosition().X;
+ sal_Int32 y = m_xTextTarget->getPosition().Y;
+ sal_Int32 height = m_xTextTarget->getSize().Height;
+ m_pDataTableView->changePosition(x, y + height);
+ }
}
void VCartesianAxis::createMaximumLabels()
{
- TrueGuard aRecordMaximumTextSize(m_bRecordMaximumTextSize);
+ m_bRecordMaximumTextSize = true;
+ const comphelper::ScopeGuard aGuard([this]() { m_bRecordMaximumTextSize = false; });
if( !prepareShapeCreation() )
return;
@@ -1747,10 +1792,10 @@ void VCartesianAxis::createMaximumLabels()
AxisLabelProperties aAxisLabelProperties( m_aAxisLabelProperties );
if( isAutoStaggeringOfLabelsAllowed( aAxisLabelProperties, pTickFactory2D->isHorizontalAxis(), pTickFactory2D->isVerticalAxis() ) )
- aAxisLabelProperties.eStaggering = AxisLabelStaggering::StaggerEven;
+ aAxisLabelProperties.m_eStaggering = AxisLabelStaggering::StaggerEven;
- aAxisLabelProperties.bOverlapAllowed = true;
- aAxisLabelProperties.bLineBreakAllowed = false;
+ aAxisLabelProperties.m_bOverlapAllowed = true;
+ aAxisLabelProperties.m_bLineBreakAllowed = false;
sal_Int32 nTextLevelCount = getTextLevelCount();
for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
{
@@ -1783,7 +1828,7 @@ void VCartesianAxis::updatePositions()
{
for (auto const& tickInfo : tickInfos)
{
- Reference< drawing::XShape > xShape2DText(tickInfo.xTextShape);
+ const rtl::Reference<SvxShapeText> & xShape2DText(tickInfo.xTextShape);
if( xShape2DText.is() )
{
B2DVector aTextToTickDistance( pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties, true ) );
@@ -1793,7 +1838,7 @@ void VCartesianAxis::updatePositions()
static_cast<sal_Int32>(aTickScreenPos2D.getX())
,static_cast<sal_Int32>(aTickScreenPos2D.getY()));
- double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
+ double fRotationAngleDegree = m_aAxisLabelProperties.m_fRotationAngleDegree;
if( nDepth > 0 )
{
//multilevel labels: 0 or 90 by default
@@ -1808,17 +1853,13 @@ void VCartesianAxis::updatePositions()
uno::Any aATransformation = ShapeFactory::makeTransformation(aAnchorScreenPosition2D, fRotationAnglePi);
//set new position
- uno::Reference< beans::XPropertySet > xProp( xShape2DText, uno::UNO_QUERY );
- if( xProp.is() )
+ try
{
- try
- {
- xProp->setPropertyValue( "Transformation", aATransformation );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xShape2DText->SvxShape::setPropertyValue( "Transformation", aATransformation );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
//correctPositionForRotation
@@ -1857,7 +1898,7 @@ void VCartesianAxis::createTickMarkLineShapes( TickInfoArrayType& rTickInfos, co
, m_aAxisProperties.maLabelAlignment.mfInnerTickDirection, rTickmarkProperties, !bTicksAtLabels );
}
aPoints.realloc(nN);
- m_pShapeFactory->createLine2D( m_xGroupShape_Shapes, aPoints
+ ShapeFactory::createLine2D( m_xGroupShape_Shapes, aPoints
, &rTickmarkProperties.aLineProperties );
}
@@ -1866,12 +1907,12 @@ void VCartesianAxis::createShapes()
if( !prepareShapeCreation() )
return;
- std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
- TickFactory2D* pTickFactory2D = apTickFactory2D.get();
-
//create line shapes
if(m_nDimension==2)
{
+ std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
+ TickFactory2D* pTickFactory2D = apTickFactory2D.get();
+
//create extra long ticks to separate complex categories (create them only there where the labels are)
if( isComplexCategoryAxis() )
{
@@ -1889,7 +1930,7 @@ void VCartesianAxis::createShapes()
std::unique_ptr< TickIter > apTickIter(createLabelTickIterator( nTextLevel ));
if( apTickIter )
{
- double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
+ double fRotationAngleDegree = m_aAxisLabelProperties.m_fRotationAngleDegree;
if( nTextLevel > 0 )
{
//Multi-level Labels: default to 0 or 90
@@ -1920,13 +1961,13 @@ void VCartesianAxis::createShapes()
//create normal ticks for major and minor intervals
{
TickInfoArraysType aUnshiftedTickInfos;
- if( m_aScale.ShiftedCategoryPosition )// if ShiftedCategoryPosition==true the tickmarks in m_aAllTickInfos are shifted
+ if( m_aScale.m_bShiftedCategoryPosition )// if m_bShiftedCategoryPosition==true the tickmarks in m_aAllTickInfos are shifted
{
pTickFactory2D->getAllTicks( aUnshiftedTickInfos );
pTickFactory2D->updateScreenValues( aUnshiftedTickInfos );
hideIdenticalScreenValues( aUnshiftedTickInfos );
}
- TickInfoArraysType& rAllTickInfos = m_aScale.ShiftedCategoryPosition ? aUnshiftedTickInfos : m_aAllTickInfos;
+ TickInfoArraysType& rAllTickInfos = m_aScale.m_bShiftedCategoryPosition ? aUnshiftedTickInfos : m_aAllTickInfos;
if (rAllTickInfos.empty())
return;
@@ -1947,7 +1988,7 @@ void VCartesianAxis::createShapes()
{
drawing::PointSequenceSequence aPoints(1);
apTickFactory2D->createPointSequenceForAxisMainLine( aPoints );
- Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
m_xGroupShape_Shapes, aPoints
, &m_aAxisProperties.m_aLineProperties );
//because of this name this line will be used for marking the axis
@@ -1966,7 +2007,7 @@ void VCartesianAxis::createShapes()
drawing::PointSequenceSequence aPoints{{
{static_cast<sal_Int32>(aStart.getX()), static_cast<sal_Int32>(aStart.getY())},
{static_cast<sal_Int32>(aEnd.getX()), static_cast<sal_Int32>(aEnd.getY())} }};
- m_pShapeFactory->createLine2D(
+ ShapeFactory::createLine2D(
m_xGroupShape_Shapes, aPoints, &m_aAxisProperties.m_aLineProperties );
}
}
@@ -1975,6 +2016,20 @@ void VCartesianAxis::createShapes()
createLabels();
}
+void VCartesianAxis::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+ Reference<util::XNumberFormatsSupplier> const& xNumberFormatsSupplier,
+ rtl::Reference<::chart::ChartModel> const& xChartDoc,
+ css::uno::Reference<css::uno::XComponentContext> const& rComponentContext)
+{
+ if (!m_aAxisProperties.m_bDisplayDataTable)
+ return;
+
+ m_pDataTableView.reset(new DataTableView(xChartDoc, m_aAxisProperties.m_xDataTableModel, rComponentContext, m_aAxisProperties.m_bDataTableAlignAxisValuesWithColumns));
+ m_pDataTableView->initializeValues(rSeriesPlotterList);
+ m_xNumberFormatsSupplier = xNumberFormatsSupplier;
+}
+
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx
index 1c020bc4174c..210f36dd4802 100644
--- a/chart2/source/view/axes/VCartesianAxis.hxx
+++ b/chart2/source/view/axes/VCartesianAxis.hxx
@@ -16,15 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANAXIS_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANAXIS_HXX
+#pragma once
#include "VAxisBase.hxx"
#include <basegfx/vector/b2dvector.hxx>
namespace chart
{
-
class VCartesianAxis : public VAxisBase
{
// public methods
@@ -100,6 +98,10 @@ public:
::basegfx::B2DVector aScreenPos;
};
+ void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+ css::uno::Reference<css::util::XNumberFormatsSupplier> const& xNumberFormatsSupplier,
+ rtl::Reference<::chart::ChartModel> const& xChartDoc,
+ css::uno::Reference<css::uno::XComponentContext> const& rComponentContext) override;
private: //methods
/**
* Go through all tick label positions and decide which labels to display
@@ -118,7 +120,7 @@ private: //methods
* method once again to get the text shapes created.
*/
bool createTextShapes(
- const css::uno::Reference<css::drawing::XShapes >& xTarget,
+ const rtl::Reference< SvxShapeGroupAnyD >& xTarget,
TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
TickFactory2D const * pTickFactory, sal_Int32 nScreenDistanceBetweenTicks );
@@ -128,7 +130,7 @@ private: //methods
* are to be resolved only by adjusting the label tick interval.
*/
bool createTextShapesSimple(
- const css::uno::Reference<css::drawing::XShapes >& xTarget,
+ const rtl::Reference< SvxShapeGroupAnyD >& xTarget,
TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
TickFactory2D const * pTickFactory );
@@ -154,9 +156,10 @@ private: //methods
::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const;
ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const;
+
+ void createDataTableShape(std::unique_ptr<TickFactory2D> const& rTickFactory2D);
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
index e7fe42a87124..81fa369c2f60 100644
--- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
@@ -20,11 +20,15 @@
#include "VCartesianCoordinateSystem.hxx"
#include "VCartesianGrid.hxx"
#include "VCartesianAxis.hxx"
+#include <BaseCoordinateSystem.hxx>
#include <AxisIndexDefines.hxx>
+#include <Axis.hxx>
+#include <DataTable.hxx>
+#include <Diagram.hxx>
#include <AxisHelper.hxx>
#include <cppuhelper/implbase.hxx>
#include <ChartModel.hxx>
-#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <GridProperties.hxx>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
@@ -58,7 +62,7 @@ private: //member
}
-VCartesianCoordinateSystem::VCartesianCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys )
+VCartesianCoordinateSystem::VCartesianCoordinateSystem( const rtl::Reference< BaseCoordinateSystem >& xCooSys )
: VCoordinateSystem(xCooSys)
{
}
@@ -78,7 +82,7 @@ void VCartesianCoordinateSystem::createGridShapes()
for( sal_Int32 nDimensionIndex=0; nDimensionIndex<3; nDimensionIndex++)
{
sal_Int32 nAxisIndex = MAIN_AXIS_INDEX;
- Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, m_xCooSysModel ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, nAxisIndex, m_xCooSysModel );
if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
continue;
@@ -87,7 +91,7 @@ void VCartesianCoordinateSystem::createGridShapes()
, getExplicitIncrement(nDimensionIndex,nAxisIndex) );
aGrid.set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, m_eBottomPos );
- aGrid.initPlotter(m_xLogicTargetForGrids,m_xFinalTarget,m_xShapeFactory
+ aGrid.initPlotter(m_xLogicTargetForGrids,m_xFinalTarget
, createCIDForGrid( nDimensionIndex,nAxisIndex ) );
if(nDimensionCount==2)
aGrid.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
@@ -97,16 +101,17 @@ void VCartesianCoordinateSystem::createGridShapes()
}
void VCartesianCoordinateSystem::createVAxisList(
- const uno::Reference<chart2::XChartDocument> & xChartDoc
- , const awt::Size& rFontReferenceSize
- , const awt::Rectangle& rMaximumSpaceForLabels
- , bool bLimitSpaceForLabels
- )
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
+ const awt::Size& rFontReferenceSize,
+ const awt::Rectangle& rMaximumSpaceForLabels,
+ bool bLimitSpaceForLabels,
+ std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+ uno::Reference<uno::XComponentContext> const& rComponentContext)
{
// note: using xChartDoc itself as XNumberFormatsSupplier would cause
// a leak from VCartesianAxis due to cyclic reference
uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier(
- dynamic_cast<ChartModel&>(*xChartDoc).getNumberFormatsSupplier());
+ xChartDoc->getNumberFormatsSupplier());
m_aAxisMap.clear();
@@ -125,16 +130,17 @@ void VCartesianCoordinateSystem::createVAxisList(
sal_Int32 nMaxAxisIndex = m_xCooSysModel->getMaximumAxisIndexByDimension(nDimensionIndex);
for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
{
- Reference< XAxis > xAxis = getAxisByDimension(nDimensionIndex,nAxisIndex);
+ rtl::Reference< Axis > xAxis = getAxisByDimension(nDimensionIndex,nAxisIndex);
if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
continue;
- AxisProperties aAxisProperties(xAxis,getExplicitCategoriesProvider());
+ rtl::Reference<Diagram> xDiagram(xChartDoc->getFirstChartDiagram());
+ AxisProperties aAxisProperties(xAxis, getExplicitCategoriesProvider(), xDiagram->getDataTableRef());
aAxisProperties.m_nDimensionIndex = nDimensionIndex;
aAxisProperties.m_bSwapXAndY = bSwapXAndY;
aAxisProperties.m_bIsMainAxis = (nAxisIndex==0);
aAxisProperties.m_bLimitSpaceForLabels = bLimitSpaceForLabels;
- Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, m_xCooSysModel ) );
+ rtl::Reference< Axis > xCrossingMainAxis = AxisHelper::getCrossingMainAxis( xAxis, m_xCooSysModel );
if( xCrossingMainAxis.is() )
{
ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() );
@@ -149,8 +155,8 @@ void VCartesianCoordinateSystem::createVAxisList(
aAxisProperties.m_xAxisTextProvider = new TextualDataProvider( m_aSeriesNamesForZAxis );
//for the z axis copy the positioning properties from the x axis (or from the y axis for swapped coordinate systems)
- Reference< XAxis > xSisterAxis( AxisHelper::getCrossingMainAxis( xCrossingMainAxis, m_xCooSysModel ) );
- aAxisProperties.initAxisPositioning( Reference< beans::XPropertySet >( xSisterAxis, uno::UNO_QUERY) );
+ rtl::Reference< Axis > xSisterAxis = AxisHelper::getCrossingMainAxis( xCrossingMainAxis, m_xCooSysModel );
+ aAxisProperties.initAxisPositioning( xSisterAxis );
}
aAxisProperties.init(true);
if(aAxisProperties.m_bDisplayLabels)
@@ -162,6 +168,7 @@ void VCartesianCoordinateSystem::createVAxisList(
apVAxis->set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, m_eBottomPos );
apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
+ apVAxis->createDataTableView(rSeriesPlotterList, xNumberFormatsSupplier, xChartDoc, rComponentContext);
}
}
}
@@ -174,16 +181,13 @@ void VCartesianCoordinateSystem::initVAxisInList()
sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
bool bSwapXAndY = getPropertySwapXAndYAxis();
- for (auto const& elem : m_aAxisMap)
+ for (auto const& [nIndexPair, pVAxis] : m_aAxisMap)
{
- VAxisBase* pVAxis = elem.second.get();
- if( pVAxis )
+ if (pVAxis)
{
- sal_Int32 nDimensionIndex = elem.first.first;
- sal_Int32 nAxisIndex = elem.first.second;
+ auto [nDimensionIndex, nAxisIndex] = nIndexPair;
pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
- pVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
- , createCIDForAxis( nDimensionIndex, nAxisIndex ) );
+ pVAxis->initPlotter(m_xLogicTargetForAxes, m_xFinalTarget, createCIDForAxis( nDimensionIndex, nAxisIndex ) );
if(nDimensionCount==2)
pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
pVAxis->setScales( getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
@@ -199,13 +203,12 @@ void VCartesianCoordinateSystem::updateScalesAndIncrementsOnAxes()
sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
bool bSwapXAndY = getPropertySwapXAndYAxis();
- for (auto const& elem : m_aAxisMap)
+ for (auto const& [nIndexPair, pVAxis] : m_aAxisMap)
{
- VAxisBase* pVAxis = elem.second.get();
- if( pVAxis )
+ if (pVAxis)
{
- sal_Int32 nDimensionIndex = elem.first.first;
- sal_Int32 nAxisIndex = elem.first.second;
+ auto [nDimensionIndex, nAxisIndex] = nIndexPair;
+
pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
if(nDimensionCount==2)
pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
index e959dbc5d5ef..968d97a21099 100644
--- a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANCOORDINATESYSTEM_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANCOORDINATESYSTEM_HXX
+#pragma once
#include <VCoordinateSystem.hxx>
@@ -28,14 +27,16 @@ class VCartesianCoordinateSystem : public VCoordinateSystem
{
public:
VCartesianCoordinateSystem() = delete;
- explicit VCartesianCoordinateSystem( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
+ explicit VCartesianCoordinateSystem( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
virtual ~VCartesianCoordinateSystem() override;
virtual void createVAxisList(
- const css::uno::Reference< css::chart2::XChartDocument> &ChartDoc
- , const css::awt::Size& rFontReferenceSize
- , const css::awt::Rectangle& rMaximumSpaceForLabels
- , bool bLimitSpaceForLabels ) override;
+ const rtl::Reference<::chart::ChartModel> &ChartDoc,
+ const css::awt::Size& rFontReferenceSize,
+ const css::awt::Rectangle& rMaximumSpaceForLabels,
+ bool bLimitSpaceForLabels,
+ std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+ css::uno::Reference<css::uno::XComponentContext> const& rComponentContext) override;
virtual void initVAxisInList() override;
virtual void updateScalesAndIncrementsOnAxes() override;
@@ -44,6 +45,5 @@ public:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx
index eda61d9b8e6c..9916ebac0be4 100644
--- a/chart2/source/view/axes/VCartesianGrid.cxx
+++ b/chart2/source/view/axes/VCartesianGrid.cxx
@@ -25,9 +25,9 @@
#include <CommonConverters.hxx>
#include <AxisHelper.hxx>
#include <VLineProperties.hxx>
+#include <GridProperties.hxx>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/chart2/XTransformation.hpp>
#include <memory>
#include <vector>
@@ -62,10 +62,7 @@ GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_In
, CuboidPlanePosition eLeftWallPos
, CuboidPlanePosition eBackWallPos
, CuboidPlanePosition eBottomPos )
- : P0(3)
- , P1(3)
- , P2(3)
- , m_nDimensionIndex(nDimensionIndex)
+ : m_nDimensionIndex(nDimensionIndex)
{
double MinX = pPosHelper->getLogicMinX();
double MinY = pPosHelper->getLogicMinY();
@@ -78,51 +75,40 @@ GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_In
pPosHelper->doLogicScaling( &MaxX,&MaxY,&MaxZ );
if(!pPosHelper->isMathematicalOrientationX())
- {
- double fHelp = MinX;
- MinX = MaxX;
- MaxX = fHelp;
- }
+ std::swap( MinX, MaxX );
if(!pPosHelper->isMathematicalOrientationY())
- {
- double fHelp = MinY;
- MinY = MaxY;
- MaxY = fHelp;
- }
+ std::swap( MinY, MaxY );
if(pPosHelper->isMathematicalOrientationZ())//z axis in draw is reverse to mathematical
- {
- double fHelp = MinZ;
- MinZ = MaxZ;
- MaxZ = fHelp;
- }
+ std::swap( MinZ, MaxZ );
bool bSwapXY = pPosHelper->isSwapXAndY();
//P0: point on 'back' wall, not on 'left' wall
//P1: point on both walls
//P2: point on 'left' wall not on 'back' wall
- P0[0]=P1[0]=P2[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MinX : MaxX;
- P0[1]=P1[1]=P2[1]= (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MinY : MaxY;
- P0[2]=P1[2]=P2[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MinZ : MaxZ;
+ const double v0 = (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MinX : MaxX;
+ const double v1 = (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MinY : MaxY;
+ const double v2 = (eBackWallPos == CuboidPlanePosition_Back) ? MinZ : MaxZ;
+ P0 = P1 = P2 = { v0, v1, v2 };
if(m_nDimensionIndex==0)
{
- P0[1]= (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MaxY : MinY;
- P2[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MaxZ : MinZ;
+ P0.getArray()[1] = (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MaxY : MinY;
+ P2.getArray()[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MaxZ : MinZ;
if( eBottomPos != CuboidPlanePosition_Bottom && !bSwapXY )
P2=P1;
}
else if(m_nDimensionIndex==1)
{
- P0[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MaxX : MinX;
- P2[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MaxZ : MinZ;
+ P0.getArray()[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MaxX : MinX;
+ P2.getArray()[2]= (eBackWallPos == CuboidPlanePosition_Back) ? MaxZ : MinZ;
if( eBottomPos != CuboidPlanePosition_Bottom && bSwapXY )
P2=P1;
}
else if(m_nDimensionIndex==2)
{
- P0[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MaxX : MinX;
- P2[1]= (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MaxY : MinY;
+ P0.getArray()[0]= (eLeftWallPos == CuboidPlanePosition_Left || bSwapXY) ? MaxX : MinX;
+ P2.getArray()[1]= (eLeftWallPos == CuboidPlanePosition_Left || !bSwapXY) ? MaxY : MinY;
if( eBottomPos != CuboidPlanePosition_Bottom )
{
if( !bSwapXY )
@@ -135,40 +121,38 @@ GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_In
void GridLinePoints::update( double fScaledTickValue )
{
- P0[m_nDimensionIndex] = P1[m_nDimensionIndex] = P2[m_nDimensionIndex] = fScaledTickValue;
+ P0.getArray()[m_nDimensionIndex] = P1.getArray()[m_nDimensionIndex] = P2.getArray()[m_nDimensionIndex] = fScaledTickValue;
}
static void addLine2D( drawing::PointSequenceSequence& rPoints, sal_Int32 nIndex
, const GridLinePoints& rScaledLogicPoints
- , const Reference< XTransformation > & xTransformation
+ , const XTransformation2& rTransformation
)
{
- drawing::Position3D aPA = SequenceToPosition3D( xTransformation->transform( rScaledLogicPoints.P0 ) );
- drawing::Position3D aPB = SequenceToPosition3D( xTransformation->transform( rScaledLogicPoints.P1 ) );
-
- rPoints[nIndex].realloc(2);
- rPoints[nIndex][0].X = static_cast<sal_Int32>(aPA.PositionX);
- rPoints[nIndex][0].Y = static_cast<sal_Int32>(aPA.PositionY);
- rPoints[nIndex][1].X = static_cast<sal_Int32>(aPB.PositionX);
- rPoints[nIndex][1].Y = static_cast<sal_Int32>(aPB.PositionY);
+ drawing::Position3D aPA = rTransformation.transform( SequenceToPosition3D(rScaledLogicPoints.P0) );
+ drawing::Position3D aPB = rTransformation.transform( SequenceToPosition3D(rScaledLogicPoints.P1) );
+
+ rPoints.getArray()[nIndex]
+ = { { static_cast<sal_Int32>(aPA.PositionX), static_cast<sal_Int32>(aPA.PositionY) },
+ { static_cast<sal_Int32>(aPB.PositionX), static_cast<sal_Int32>(aPB.PositionY) } };
}
-static void addLine3D( drawing::PolyPolygonShape3D& rPoints, sal_Int32 nIndex
+static void addLine3D( std::vector<std::vector<css::drawing::Position3D>>& rPoints, sal_Int32 nIndex
, const GridLinePoints& rBasePoints
- , const Reference< XTransformation > & xTransformation )
+ , const XTransformation2 & rTransformation )
{
- drawing::Position3D aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P0 ) );
+ drawing::Position3D aPoint =rTransformation.transform( rBasePoints.P0 );
AddPointToPoly( rPoints, aPoint, nIndex );
- aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P1 ) );
+ aPoint = rTransformation.transform( rBasePoints.P1 );
AddPointToPoly( rPoints, aPoint, nIndex );
- aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P2 ) );
+ aPoint = rTransformation.transform( rBasePoints.P2 );
AddPointToPoly( rPoints, aPoint, nIndex );
}
VCartesianGrid::VCartesianGrid( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
- , const Sequence< Reference< beans::XPropertySet > > & rGridPropertiesList )
+ , std::vector< rtl::Reference< ::chart::GridProperties > > aGridPropertiesList )
: VAxisOrGridBase( nDimensionIndex, nDimensionCount )
- , m_aGridPropertiesList( rGridPropertiesList )
+ , m_aGridPropertiesList( std::move(aGridPropertiesList) )
{
m_pPosHelper = new PlottingPositionHelper();
}
@@ -180,10 +164,10 @@ VCartesianGrid::~VCartesianGrid()
}
void VCartesianGrid::fillLinePropertiesFromGridModel( std::vector<VLineProperties>& rLinePropertiesList
- , const Sequence< Reference< beans::XPropertySet > > & rGridPropertiesList )
+ , const std::vector< rtl::Reference< ::chart::GridProperties > > & rGridPropertiesList )
{
rLinePropertiesList.clear();
- if( !rGridPropertiesList.hasElements() )
+ if( rGridPropertiesList.empty() )
return;
VLineProperties aLineProperties;
@@ -199,12 +183,12 @@ void VCartesianGrid::fillLinePropertiesFromGridModel( std::vector<VLinePropertie
void VCartesianGrid::createShapes()
{
- if(!m_aGridPropertiesList.hasElements())
+ if(m_aGridPropertiesList.empty())
return;
//somehow equal to axis tickmarks
//create named group shape
- Reference< drawing::XShapes > xGroupShape_Shapes(
+ rtl::Reference< SvxShapeGroupAnyD > xGroupShape_Shapes(
createGroupShape( m_xLogicTarget, m_aCID ) );
if(!xGroupShape_Shapes.is())
@@ -235,14 +219,14 @@ void VCartesianGrid::createShapes()
if( !aLinePropertiesList[nDepth].isLineVisible() )
continue;
- Reference< drawing::XShapes > xTarget( xGroupShape_Shapes );
+ rtl::Reference< SvxShapeGroupAnyD > xTarget( xGroupShape_Shapes );
if( nDepth > 0 )
{
- xTarget.set( createGroupShape( m_xLogicTarget
+ xTarget = createGroupShape( m_xLogicTarget
, ObjectIdentifier::addChildParticle( m_aCID, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_SUBGRID, nDepth-1 ) )
- ) );
+ );
if(!xTarget.is())
- xTarget.set( xGroupShape_Shapes );
+ xTarget = xGroupShape_Shapes;
}
if(m_nDimension==2)
@@ -259,24 +243,25 @@ void VCartesianGrid::createShapes()
if( !tick.bPaintIt )
continue;
aGridLinePoints.update( tick.fScaledTickValue );
- addLine2D( aPoints, nRealPointCount, aGridLinePoints, m_pPosHelper->getTransformationScaledLogicToScene() );
+ addLine2D( aPoints, nRealPointCount, aGridLinePoints, *m_pPosHelper->getTransformationScaledLogicToScene() );
nRealPointCount++;
}
aPoints.realloc(nRealPointCount);
- m_pShapeFactory->createLine2D( xTarget, aPoints, &aLinePropertiesList[nDepth] );
+ ShapeFactory::createLine2D( xTarget, aPoints, &aLinePropertiesList[nDepth] );
//prepare polygon for handle shape:
drawing::PointSequenceSequence aHandlesPoints(1);
- sal_Int32 nOldHandleCount = aHandlesPoints[0].getLength();
- aHandlesPoints[0].realloc(nOldHandleCount+nRealPointCount);
+ auto pHandlesPoints = aHandlesPoints.getArray();
+ pHandlesPoints[0].realloc(nRealPointCount);
+ auto pHandlesPoints0 = pHandlesPoints[0].getArray();
for( sal_Int32 nN = 0; nN<nRealPointCount; nN++)
- aHandlesPoints[0][nOldHandleCount+nN] = aPoints[nN][1];
+ pHandlesPoints0[nN] = aPoints[nN][1];
//create handle shape:
VLineProperties aHandleLineProperties;
aHandleLineProperties.LineStyle <<= drawing::LineStyle_NONE;
- Reference< drawing::XShape > xHandleShape =
- m_pShapeFactory->createLine2D( xTarget, aHandlesPoints, &aHandleLineProperties );
+ rtl::Reference<SvxShapePolyPolygon> xHandleShape =
+ ShapeFactory::createLine2D( xTarget, aHandlesPoints, &aHandleLineProperties );
::chart::ShapeFactory::setShapeName( xHandleShape, "HandlesOnly" );
}
else //if(2!=m_nDimension)
@@ -284,10 +269,8 @@ void VCartesianGrid::createShapes()
GridLinePoints aGridLinePoints( m_pPosHelper, m_nDimensionIndex, m_eLeftWallPos, m_eBackWallPos, m_eBottomPos );
sal_Int32 nPointCount = (*aDepthIter).size();
- drawing::PolyPolygonShape3D aPoints;
- aPoints.SequenceX.realloc(nPointCount);
- aPoints.SequenceY.realloc(nPointCount);
- aPoints.SequenceZ.realloc(nPointCount);
+ std::vector<std::vector<css::drawing::Position3D>> aPoints;
+ aPoints.resize(nPointCount);
sal_Int32 nRealPointCount = 0;
sal_Int32 nPolyIndex = 0;
@@ -300,14 +283,12 @@ void VCartesianGrid::createShapes()
}
aGridLinePoints.update( tick.fScaledTickValue );
- addLine3D( aPoints, nPolyIndex, aGridLinePoints, m_pPosHelper->getTransformationScaledLogicToScene() );
+ addLine3D( aPoints, nPolyIndex, aGridLinePoints, *m_pPosHelper->getTransformationScaledLogicToScene() );
nRealPointCount+=3;
++nPolyIndex;
}
- aPoints.SequenceX.realloc(nRealPointCount);
- aPoints.SequenceY.realloc(nRealPointCount);
- aPoints.SequenceZ.realloc(nRealPointCount);
- m_pShapeFactory->createLine3D( xTarget, aPoints, aLinePropertiesList[nDepth] );
+ aPoints.resize(nRealPointCount);
+ ShapeFactory::createLine3D( xTarget, aPoints, aLinePropertiesList[nDepth] );
}
}
}
diff --git a/chart2/source/view/axes/VCartesianGrid.hxx b/chart2/source/view/axes/VCartesianGrid.hxx
index d655e0e87142..d41bcc4d466f 100644
--- a/chart2/source/view/axes/VCartesianGrid.hxx
+++ b/chart2/source/view/axes/VCartesianGrid.hxx
@@ -16,39 +16,37 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANGRID_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANGRID_HXX
+#pragma once
#include "VAxisOrGridBase.hxx"
#include <com/sun/star/beans/XPropertySet.hpp>
-namespace chart { struct VLineProperties; }
-
namespace chart
{
+class GridProperties;
+struct VLineProperties;
class VCartesianGrid : public VAxisOrGridBase
{
// public methods
public:
VCartesianGrid( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
- , const css::uno::Sequence<
- css::uno::Reference< css::beans::XPropertySet > >& rGridPropertiesList //main grid, subgrid, subsubgrid etc
+ , std::vector<
+ rtl::Reference< ::chart::GridProperties > > aGridPropertiesList //main grid, subgrid, subsubgrid etc
);
virtual ~VCartesianGrid() override;
virtual void createShapes() override;
static void fillLinePropertiesFromGridModel( std::vector<VLineProperties>& rLinePropertiesList
- , const css::uno::Sequence<
- css::uno::Reference< css::beans::XPropertySet > >& rGridPropertiesList );
+ , const std::vector<
+ rtl::Reference< ::chart::GridProperties > >& rGridPropertiesList );
private:
- css::uno::Sequence<
- css::uno::Reference< css::beans::XPropertySet > > m_aGridPropertiesList; //main grid, subgrid, subsubgrid etc
+ std::vector<
+ rtl::Reference< ::chart::GridProperties > > m_aGridPropertiesList; //main grid, subgrid, subsubgrid etc
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
index 1c900b392233..41ec23d307f3 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -18,24 +18,30 @@
*/
#include <BaseGFXHelper.hxx>
+#include <DateHelper.hxx>
#include <VCoordinateSystem.hxx>
#include "VCartesianCoordinateSystem.hxx"
#include "VPolarCoordinateSystem.hxx"
+#include <BaseCoordinateSystem.hxx>
+#include <GridProperties.hxx>
+#include <ChartModel.hxx>
#include <ScaleAutomatism.hxx>
#include <ShapeFactory.hxx>
#include <servicenames_coosystems.hxx>
#include <ObjectIdentifier.hxx>
#include <ExplicitCategoriesProvider.hxx>
+#include <Axis.hxx>
#include "VAxisBase.hxx"
#include <defines.hxx>
#include <chartview/ExplicitValueProvider.hxx>
#include <com/sun/star/chart/TimeUnit.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/chart2/XCoordinateSystem.hpp>
-#include <comphelper/sequence.hxx>
-#include <tools/diagnose_ex.h>
-#include <algorithm>
#include <rtl/math.hxx>
+#include <comphelper/diagnose_ex.hxx>
+
+#include <algorithm>
+#include <limits>
+#include <utility>
namespace chart
{
@@ -45,7 +51,7 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
std::unique_ptr<VCoordinateSystem> VCoordinateSystem::createCoordinateSystem(
- const Reference< XCoordinateSystem >& xCooSysModel )
+ const rtl::Reference< BaseCoordinateSystem >& xCooSysModel )
{
if( !xCooSysModel.is() )
return nullptr;
@@ -63,13 +69,11 @@ std::unique_ptr<VCoordinateSystem> VCoordinateSystem::createCoordinateSystem(
return pRet;
}
-VCoordinateSystem::VCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys )
- : m_xCooSysModel(xCooSys)
- , m_aMatrixSceneToScreen()
+VCoordinateSystem::VCoordinateSystem( rtl::Reference< BaseCoordinateSystem > xCooSys )
+ : m_xCooSysModel(std::move(xCooSys))
, m_eLeftWallPos(CuboidPlanePosition_Left)
, m_eBackWallPos(CuboidPlanePosition_Back)
, m_eBottomPos(CuboidPlanePosition_Bottom)
- , m_aMergedMinMaxSupplier()
, m_aExplicitScales(3)
, m_aExplicitIncrements(3)
{
@@ -84,33 +88,30 @@ VCoordinateSystem::~VCoordinateSystem()
{
}
-void VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget
- , const Reference< drawing::XShapes >& xFinalTarget
- , const Reference< lang::XMultiServiceFactory >& xShapeFactory
- , Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
+void VCoordinateSystem::initPlottingTargets( const rtl::Reference< SvxShapeGroupAnyD >& xLogicTarget
+ , const rtl::Reference< SvxShapeGroupAnyD >& xFinalTarget
+ , rtl::Reference<SvxShapeGroupAnyD>& xLogicTargetForSeriesBehindAxis )
{
- OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
+ OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is(),"no proper initialization parameters");
//is only allowed to be called once
sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
//create group shape for grids first thus axes are always painted above grids
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
if(nDimensionCount==2)
{
//create and add to target
- m_xLogicTargetForGrids = pShapeFactory->createGroup2D( xLogicTarget );
- xLogicTargetForSeriesBehindAxis = pShapeFactory->createGroup2D( xLogicTarget );
- m_xLogicTargetForAxes = pShapeFactory->createGroup2D( xLogicTarget );
+ m_xLogicTargetForGrids = ShapeFactory::createGroup2D( xLogicTarget );
+ xLogicTargetForSeriesBehindAxis = ShapeFactory::createGroup2D( xLogicTarget );
+ m_xLogicTargetForAxes = ShapeFactory::createGroup2D( xLogicTarget );
}
else
{
//create and added to target
- m_xLogicTargetForGrids = pShapeFactory->createGroup3D( xLogicTarget );
- xLogicTargetForSeriesBehindAxis = pShapeFactory->createGroup3D( xLogicTarget );
- m_xLogicTargetForAxes = pShapeFactory->createGroup3D( xLogicTarget );
+ m_xLogicTargetForGrids = ShapeFactory::createGroup3D( xLogicTarget );
+ xLogicTargetForSeriesBehindAxis = ShapeFactory::createGroup3D( xLogicTarget );
+ m_xLogicTargetForAxes = ShapeFactory::createGroup3D( xLogicTarget );
}
m_xFinalTarget = xFinalTarget;
- m_xShapeFactory = xShapeFactory;
}
void VCoordinateSystem::setParticle( const OUString& rCooSysParticle )
@@ -141,8 +142,8 @@ uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution(
{
uno::Sequence<sal_Int32> aResolution(
std::max<sal_Int32>(m_xCooSysModel->getDimension(), 2));
-
- for( auto& i : aResolution )
+ auto aResolutionRange = asNonConstRange(aResolution);
+ for( auto& i : aResolutionRange )
i = 1000;
::basegfx::B3DTuple aScale( BaseGFXHelper::GetScaleFromMatrix(
@@ -170,48 +171,45 @@ uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution(
//2D
if( aResolution.getLength() == 2 )
{
- aResolution[0]=nXResolution;
- aResolution[1]=nYResolution;
+ aResolutionRange[0]=nXResolution;
+ aResolutionRange[1]=nYResolution;
}
else
{
//this maybe can be optimized further ...
sal_Int32 nMaxResolution = std::max( nXResolution, nYResolution );
nMaxResolution*=2;
- for( auto& i : aResolution )
+ for( auto& i : asNonConstRange(aResolution) )
i = nMaxResolution;
}
return aResolution;
}
-Reference< XAxis > VCoordinateSystem::getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+rtl::Reference< Axis > VCoordinateSystem::getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
{
if( m_xCooSysModel.is() )
- return m_xCooSysModel->getAxisByDimension( nDimensionIndex, nAxisIndex );
+ return m_xCooSysModel->getAxisByDimension2( nDimensionIndex, nAxisIndex );
return nullptr;
}
-Sequence< Reference< beans::XPropertySet > > VCoordinateSystem::getGridListFromAxis( const Reference< XAxis >& xAxis )
+std::vector< rtl::Reference< ::chart::GridProperties > > VCoordinateSystem::getGridListFromAxis( const rtl::Reference< Axis >& xAxis )
{
- std::vector< Reference< beans::XPropertySet > > aRet;
+ std::vector< rtl::Reference< ::chart::GridProperties > > aRet;
if( xAxis.is() )
{
- aRet.push_back( xAxis->getGridProperties() );
- auto aSubGrids( comphelper::sequenceToContainer<std::vector< Reference< beans::XPropertySet > > >( xAxis->getSubGridProperties() ) );
+ aRet.push_back( xAxis->getGridProperties2() );
+ std::vector<rtl::Reference<::chart::GridProperties>> aSubGrids = xAxis->getSubGridProperties2();
aRet.insert( aRet.end(), aSubGrids.begin(), aSubGrids.end() );
}
- return comphelper::containerToSequence( aRet );
+ return aRet;
}
void VCoordinateSystem::impl_adjustDimension( sal_Int32& rDimensionIndex )
{
- if( rDimensionIndex<0 )
- rDimensionIndex=0;
- if( rDimensionIndex>2 )
- rDimensionIndex=2;
+ rDimensionIndex = std::clamp<sal_Int32>(rDimensionIndex, 0, 2);
}
void VCoordinateSystem::impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const
@@ -325,11 +323,12 @@ sal_Int32 VCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensio
}
void VCoordinateSystem::createVAxisList(
- const uno::Reference<chart2::XChartDocument> & /* xChartDoc */
- , const awt::Size& /* rFontReferenceSize */
- , const awt::Rectangle& /* rMaximumSpaceForLabels */
- , bool /* bLimitSpaceForLabels */
- )
+ const rtl::Reference<::chart::ChartModel> & /* xChartDoc */,
+ const awt::Size& /* rFontReferenceSize */,
+ const awt::Rectangle& /* rMaximumSpaceForLabels */,
+ bool /* bLimitSpaceForLabels */,
+ std::vector<std::unique_ptr<VSeriesPlotter>>& /*rSeriesPlotterList*/,
+ uno::Reference<uno::XComponentContext> const& /*rComponentContext*/)
{
}
@@ -342,7 +341,8 @@ void VCoordinateSystem::updateScalesAndIncrementsOnAxes()
void VCoordinateSystem::prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
{
- if( rScaleAutomatism.getScale().AxisType==AxisType::DATE && nDimIndex==0 )
+ bool bDateAxisX = (rScaleAutomatism.getScale().AxisType == AxisType::DATE) && (nDimIndex == 0);
+ if( bDateAxisX )
{
// This is a date X dimension. Determine proper time resolution.
sal_Int32 nTimeResolution = css::chart::TimeUnit::MONTH;
@@ -354,10 +354,8 @@ void VCoordinateSystem::prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAuto
m_aMergedMinMaxSupplier.setTimeResolutionOnXAxis( nTimeResolution, rScaleAutomatism.getNullDate() );
}
- double fMin = 0.0;
- double fMax = 0.0;
- ::rtl::math::setInf(&fMin, false);
- ::rtl::math::setInf(&fMax, true);
+ double fMin = std::numeric_limits<double>::infinity();
+ double fMax = -std::numeric_limits<double>::infinity();
if( nDimIndex == 0 )
{
// x dimension
@@ -368,8 +366,26 @@ void VCoordinateSystem::prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAuto
{
// y dimension
ExplicitScaleData aScale = getExplicitScale( 0, 0 );
+ double fMaximum = aScale.Maximum;
+ if (!aScale.m_bShiftedCategoryPosition && aScale.AxisType == AxisType::DATE)
+ {
+ // tdf#146066 Increase maximum date value by one month/year,
+ // because the automatic scaling of the Y axis was incorrect when the last Y value was the highest value.
+ Date aMaxDate(aScale.NullDate);
+ aMaxDate.AddDays(::rtl::math::approxFloor(fMaximum));
+ switch (aScale.TimeResolution)
+ {
+ case css::chart::TimeUnit::MONTH:
+ aMaxDate = DateHelper::GetDateSomeMonthsAway(aMaxDate, 1);
+ break;
+ case css::chart::TimeUnit::YEAR:
+ aMaxDate = DateHelper::GetDateSomeYearsAway(aMaxDate, 1);
+ break;
+ }
+ fMaximum = aMaxDate - aScale.NullDate;
+ }
fMin = m_aMergedMinMaxSupplier.getMinimumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
- fMax = m_aMergedMinMaxSupplier.getMaximumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
+ fMax = m_aMergedMinMaxSupplier.getMaximumYInRange(aScale.Minimum, fMaximum, nAxisIndex);
}
else if( nDimIndex == 2 )
{
@@ -387,6 +403,9 @@ void VCoordinateSystem::prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAuto
m_aMergedMinMaxSupplier.isExpandWideValuesToZero( nDimIndex ),
m_aMergedMinMaxSupplier.isExpandNarrowValuesTowardZero( nDimIndex ) );
+ if (bDateAxisX)
+ return;
+
VAxisBase* pVAxis = getVAxis(nDimIndex, nAxisIndex);
if( pVAxis )
rScaleAutomatism.setMaximumAutoMainIncrementCount( pVAxis->estimateMaximumAutoMainIncrementCount() );
@@ -399,7 +418,7 @@ VAxisBase* VCoordinateSystem::getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAx
tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
tVAxisMap::const_iterator aIt = m_aAxisMap.find( aFullAxisIndex );
- if( aIt != m_aAxisMap.end() )
+ if (aIt != m_aAxisMap.cend())
pRet = aIt->second.get();
return pRet;
@@ -435,26 +454,26 @@ void VCoordinateSystem::set3DWallPositions( CuboidPlanePosition eLeftWallPos, Cu
void VCoordinateSystem::createMaximumAxesLabels()
{
- for (auto const& elem : m_aAxisMap)
+ for (auto const&[unused, pVAxis] : m_aAxisMap)
{
- VAxisBase* pVAxis = elem.second.get();
- if( pVAxis )
+ (void)unused;
+ if (pVAxis)
{
- if(pVAxis->getDimensionCount()==2)
- pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ if (pVAxis->getDimensionCount() == 2)
+ pVAxis->setTransformationSceneToScreen(m_aMatrixSceneToScreen);
pVAxis->createMaximumLabels();
}
}
}
void VCoordinateSystem::createAxesLabels()
{
- for (auto const& elem : m_aAxisMap)
+ for (auto const&[unused, pVAxis] : m_aAxisMap)
{
- VAxisBase* pVAxis = elem.second.get();
- if( pVAxis )
+ (void)unused;
+ if (pVAxis)
{
- if(pVAxis->getDimensionCount()==2)
- pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ if (pVAxis->getDimensionCount() == 2)
+ pVAxis->setTransformationSceneToScreen(m_aMatrixSceneToScreen);
pVAxis->createLabels();
}
}
@@ -462,12 +481,12 @@ void VCoordinateSystem::createAxesLabels()
void VCoordinateSystem::updatePositions()
{
- for (auto const& elem : m_aAxisMap)
+ for (auto const&[unused, pVAxis] : m_aAxisMap)
{
- VAxisBase* pVAxis = elem.second.get();
- if( pVAxis )
+ (void)unused;
+ if (pVAxis)
{
- if(pVAxis->getDimensionCount()==2)
+ if (pVAxis->getDimensionCount() == 2)
pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
pVAxis->updatePositions();
}
@@ -476,24 +495,24 @@ void VCoordinateSystem::updatePositions()
void VCoordinateSystem::createAxesShapes()
{
- for (auto const& elem : m_aAxisMap)
+ for (auto const&[aFullAxisIndex, pVAxis] : m_aAxisMap)
{
- VAxisBase* pVAxis = elem.second.get();
- if( pVAxis )
+ if (pVAxis)
{
- if(pVAxis->getDimensionCount()==2)
+ auto const&[nDimensionIndex, nAxisIndex] = aFullAxisIndex;
+
+ if (pVAxis->getDimensionCount() == 2)
pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
- tFullAxisIndex aFullAxisIndex = elem.first;
- if( aFullAxisIndex.second == 0 )
+ if (nAxisIndex == 0)
{
- if( aFullAxisIndex.first == 0 )
+ if (nDimensionIndex == 0)
{
if( m_aExplicitScales[1].AxisType!=AxisType::CATEGORY )
pVAxis->setExtraLinePositionAtOtherAxis(
m_aExplicitScales[1].Origin );
}
- else if( aFullAxisIndex.first == 1 )
+ else if (nDimensionIndex == 1)
{
if( m_aExplicitScales[0].AxisType!=AxisType::CATEGORY )
pVAxis->setExtraLinePositionAtOtherAxis(
@@ -525,11 +544,10 @@ void VCoordinateSystem::clearMinimumAndMaximumSupplierList()
bool VCoordinateSystem::getPropertySwapXAndYAxis() const
{
- Reference<beans::XPropertySet> xProp(m_xCooSysModel, uno::UNO_QUERY );
bool bSwapXAndY = false;
- if( xProp.is()) try
+ if( m_xCooSysModel.is()) try
{
- xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
+ m_xCooSysModel->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
}
catch( const uno::Exception& )
{
@@ -548,8 +566,8 @@ void VCoordinateSystem::setSeriesNamesForAxis( const Sequence< OUString >& rSeri
}
sal_Int32 VCoordinateSystem::getNumberFormatKeyForAxis(
- const Reference< chart2::XAxis >& xAxis
- , const Reference<chart2::XChartDocument>& xChartDoc)
+ const rtl::Reference< Axis >& xAxis
+ , const rtl::Reference<::chart::ChartModel>& xChartDoc)
{
return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
xAxis, m_xCooSysModel, xChartDoc);
diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx
index 1a93888b7428..6c3f0790a573 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.cxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.cxx
@@ -22,10 +22,10 @@
#include "VPolarAngleAxis.hxx"
#include "VPolarGrid.hxx"
#include <ShapeFactory.hxx>
+#include <Axis.hxx>
#include <NumberFormatterWrapper.hxx>
#include <PolarLabelPositionHelper.hxx>
#include <PlottingPositionHelper.hxx>
-#include <com/sun/star/chart2/XAxis.hpp>
#include <tools/color.hxx>
#include <memory>
@@ -33,8 +33,6 @@
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
-using namespace ::rtl::math;
VPolarAngleAxis::VPolarAngleAxis( const AxisProperties& rAxisProperties
, const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
@@ -48,27 +46,25 @@ VPolarAngleAxis::~VPolarAngleAxis()
}
void VPolarAngleAxis::createTextShapes_ForAngleAxis(
- const uno::Reference< drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, EquidistantTickIter& rTickIter
, AxisLabelProperties const & rAxisLabelProperties
, double fLogicRadius
, double fLogicZ )
{
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
-
FixedNumberFormatter aFixedNumberFormatter(
- m_xNumberFormatsSupplier, rAxisLabelProperties.nNumberFormatKey );
+ m_xNumberFormatsSupplier, rAxisLabelProperties.m_nNumberFormatKey );
//prepare text properties for multipropertyset-interface of shape
tNameSequence aPropNames;
tAnySequence aPropValues;
- uno::Reference< beans::XPropertySet > xProps( m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProps( m_aAxisProperties.m_xAxisModel );
PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, aPropValues, false, -1, false, false );
LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps
, rAxisLabelProperties.m_aFontReferenceSize );
- uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,"CharColor");
+ uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,u"CharColor");
Color nColor = COL_AUTO;
if(pColorAny)
*pColorAny >>= nColor;
@@ -83,7 +79,7 @@ void VPolarAngleAxis::createTextShapes_ForAngleAxis(
; pTickInfo = rTickIter.nextInfo(), nTick++ )
{
//don't create labels which does not fit into the rhythm
- if( nTick%rAxisLabelProperties.nRhythm != 0)
+ if( nTick%rAxisLabelProperties.m_nRhythm != 0)
continue;
//don't create labels for invisible ticks
@@ -116,19 +112,19 @@ void VPolarAngleAxis::createTextShapes_ForAngleAxis(
double fLogicAngle = pTickInfo->getUnscaledTickValue();
LabelAlignment eLabelAlignment(LABEL_ALIGN_CENTER);
- PolarLabelPositionHelper aPolarLabelPositionHelper(m_pPosHelper.get(), 2/*nDimensionCount*/, xTarget, pShapeFactory);
+ PolarLabelPositionHelper aPolarLabelPositionHelper(&m_aPosHelper, 2/*nDimensionCount*/, xTarget);
sal_Int32 nScreenValueOffsetInRadiusDirection = m_aAxisLabelProperties.m_aMaximumSpaceForLabels.Height/15;
awt::Point aAnchorScreenPosition2D( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
eLabelAlignment, fLogicAngle, fLogicRadius, fLogicZ, nScreenValueOffsetInRadiusDirection ));
LabelPositionHelper::changeTextAdjustment( aPropValues, aPropNames, eLabelAlignment );
// #i78696# use mathematically correct rotation now
- const double fRotationAnglePi(-basegfx::deg2rad(rAxisLabelProperties.fRotationAngleDegree));
+ const double fRotationAnglePi(-basegfx::deg2rad(rAxisLabelProperties.m_fRotationAngleDegree));
uno::Any aATransformation = ShapeFactory::makeTransformation( aAnchorScreenPosition2D, fRotationAnglePi );
- OUString aStackedLabel = ShapeFactory::getStackedString( aLabel, rAxisLabelProperties.bStackCharacters );
+ OUString aStackedLabel = ShapeFactory::getStackedString( aLabel, rAxisLabelProperties.m_bStackCharacters );
- pTickInfo->xTextShape = pShapeFactory->createText( xTarget, aStackedLabel, aPropNames, aPropValues, aATransformation );
+ pTickInfo->xTextShape = ShapeFactory::createText( xTarget, aStackedLabel, aPropNames, aPropValues, aATransformation );
}
//if NO OVERLAP -> remove overlapping shapes
@@ -159,7 +155,7 @@ void VPolarAngleAxis::createLabels()
if( !prepareShapeCreation() )
return;
- double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
+ double fLogicRadius = m_aPosHelper.getOuterLogicRadius();
if( !m_aAxisProperties.m_bDisplayLabels )
return;
@@ -173,7 +169,7 @@ void VPolarAngleAxis::createLabels()
removeTextShapesFromTicks();
AxisLabelProperties aAxisLabelProperties( m_aAxisLabelProperties );
- aAxisLabelProperties.bOverlapAllowed = true;
+ aAxisLabelProperties.m_bOverlapAllowed = true;
double const fLogicZ = 1.0;//as defined
createTextShapes_ForAngleAxis( m_xTextTarget, aTickIter
, aAxisLabelProperties
@@ -188,13 +184,13 @@ void VPolarAngleAxis::createShapes()
if( !prepareShapeCreation() )
return;
- double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
+ double fLogicRadius = m_aPosHelper.getOuterLogicRadius();
double const fLogicZ = 1.0;//as defined
//create axis main lines
drawing::PointSequenceSequence aPoints(1);
- VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, m_aAllTickInfos, m_aIncrement, m_aScale, m_pPosHelper.get(), fLogicRadius, fLogicZ );
- uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, m_aAllTickInfos, m_aIncrement, m_aScale, &m_aPosHelper, fLogicRadius, fLogicZ );
+ rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
m_xGroupShape_Shapes, aPoints, &m_aAxisProperties.m_aLineProperties );
//because of this name this line will be used for marking the axis
::chart::ShapeFactory::setShapeName( xShape, "MarkHandles" );
diff --git a/chart2/source/view/axes/VPolarAngleAxis.hxx b/chart2/source/view/axes/VPolarAngleAxis.hxx
index 3ee9e7e15837..0e0774e9ebc5 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.hxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARANGLEAXIS_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARANGLEAXIS_HXX
+#pragma once
#include "VPolarAxis.hxx"
#include "Tickmarks_Equidistant.hxx"
@@ -41,13 +40,12 @@ public:
private: //methods
void createTextShapes_ForAngleAxis(
- const css::uno::Reference< css::drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, EquidistantTickIter& rTickIter
, AxisLabelProperties const & rAxisLabelProperties
, double fLogicRadius, double fLogicZ );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VPolarAxis.cxx b/chart2/source/view/axes/VPolarAxis.cxx
index 9e41857c29d4..89f65fee3745 100644
--- a/chart2/source/view/axes/VPolarAxis.cxx
+++ b/chart2/source/view/axes/VPolarAxis.cxx
@@ -25,7 +25,6 @@
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
std::shared_ptr<VPolarAxis> VPolarAxis::createAxis( const AxisProperties& rAxisProperties
, const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
@@ -40,19 +39,17 @@ VPolarAxis::VPolarAxis( const AxisProperties& rAxisProperties
, const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
, sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount )
: VAxisBase( nDimensionIndex, nDimensionCount, rAxisProperties, xNumberFormatsSupplier )
- , m_pPosHelper( new PolarPlottingPositionHelper() )
- , m_aIncrements()
{
- PlotterBase::m_pPosHelper = m_pPosHelper.get();
+ PlotterBase::m_pPosHelper = &m_aPosHelper;
}
VPolarAxis::~VPolarAxis()
{
}
-void VPolarAxis::setIncrements( const std::vector< ExplicitIncrementData >& rIncrements )
+void VPolarAxis::setIncrements( std::vector< ExplicitIncrementData >&& rIncrements )
{
- m_aIncrements = rIncrements;
+ m_aIncrements = std::move(rIncrements);
}
bool VPolarAxis::isAnythingToDraw()
diff --git a/chart2/source/view/axes/VPolarAxis.hxx b/chart2/source/view/axes/VPolarAxis.hxx
index 0a7056be72aa..dc6233a71e02 100644
--- a/chart2/source/view/axes/VPolarAxis.hxx
+++ b/chart2/source/view/axes/VPolarAxis.hxx
@@ -16,17 +16,15 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARAXIS_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARAXIS_HXX
+#pragma once
#include "VAxisBase.hxx"
+#include <PlottingPositionHelper.hxx>
#include <memory>
namespace chart
{
-class PolarPlottingPositionHelper;
-
class VPolarAxis : public VAxisBase
{
public:
@@ -34,7 +32,7 @@ public:
, const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
, sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount );
- void setIncrements( const std::vector< ExplicitIncrementData >& rIncrements );
+ void setIncrements( std::vector< ExplicitIncrementData >&& rIncrements );
virtual bool isAnythingToDraw() override;
@@ -46,11 +44,10 @@ protected:
, sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount );
protected: //member
- std::unique_ptr<PolarPlottingPositionHelper> m_pPosHelper;
+ PolarPlottingPositionHelper m_aPosHelper;
std::vector< ExplicitIncrementData > m_aIncrements;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
index 1fee84175444..ab7e603009ba 100644
--- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
@@ -20,18 +20,21 @@
#include "VPolarCoordinateSystem.hxx"
#include "VPolarGrid.hxx"
#include "VPolarAxis.hxx"
+#include <BaseCoordinateSystem.hxx>
#include <AxisIndexDefines.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
+#include <Diagram.hxx>
+#include <DataTable.hxx>
#include <ChartModel.hxx>
-#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <GridProperties.hxx>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
-VPolarCoordinateSystem::VPolarCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys )
+VPolarCoordinateSystem::VPolarCoordinateSystem( const rtl::Reference< BaseCoordinateSystem >& xCooSys )
: VCoordinateSystem(xCooSys)
{
}
@@ -48,15 +51,16 @@ uno::Sequence< sal_Int32 > VPolarCoordinateSystem::getCoordinateSystemResolution
if( aResolution.getLength() >= 2 )
{
+ auto pResolution = aResolution.getArray();
if( getPropertySwapXAndYAxis() )
{
- aResolution[0]/=2;//radius
- aResolution[1]*=4;//outer circle resolution
+ pResolution[0]/=2;//radius
+ pResolution[1]*=4;//outer circle resolution
}
else
{
- aResolution[0]*=4;//outer circle resolution
- aResolution[1]/=2;//radius
+ pResolution[0]*=4;//outer circle resolution
+ pResolution[1]/=2;//radius
}
}
@@ -64,16 +68,17 @@ uno::Sequence< sal_Int32 > VPolarCoordinateSystem::getCoordinateSystemResolution
}
void VPolarCoordinateSystem::createVAxisList(
- const uno::Reference<chart2::XChartDocument> & xChartDoc
- , const awt::Size& rFontReferenceSize
- , const awt::Rectangle& rMaximumSpaceForLabels
- , bool //bLimitSpaceForLabels
- )
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
+ const awt::Size& rFontReferenceSize,
+ const awt::Rectangle& rMaximumSpaceForLabels,
+ bool /*bLimitSpaceForLabels*/,
+ std::vector<std::unique_ptr<VSeriesPlotter>>& /*rSeriesPlotterList*/,
+ css::uno::Reference<css::uno::XComponentContext> const& /*rComponentContext*/)
{
// note: using xChartDoc itself as XNumberFormatsSupplier would cause
// a leak from VPolarAxis due to cyclic reference
uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier(
- dynamic_cast<ChartModel&>(*xChartDoc).getNumberFormatsSupplier());
+ xChartDoc->getNumberFormatsSupplier());
m_aAxisMap.clear();
sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
@@ -85,10 +90,12 @@ void VPolarCoordinateSystem::createVAxisList(
sal_Int32 nMaxAxisIndex = m_xCooSysModel->getMaximumAxisIndexByDimension(nDimensionIndex);
for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
{
- Reference< XAxis > xAxis( getAxisByDimension(nDimensionIndex,nAxisIndex) );
+ rtl::Reference< Axis > xAxis = getAxisByDimension(nDimensionIndex,nAxisIndex);
if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
continue;
- AxisProperties aAxisProperties(xAxis,getExplicitCategoriesProvider());
+
+ rtl::Reference<Diagram> xDiagram(xChartDoc->getFirstChartDiagram());
+ AxisProperties aAxisProperties(xAxis,getExplicitCategoriesProvider(), xDiagram->getDataTableRef());
aAxisProperties.init();
if(aAxisProperties.m_bDisplayLabels)
aAxisProperties.m_nNumberFormatKey = getNumberFormatKeyForAxis(xAxis, xChartDoc);
@@ -118,7 +125,7 @@ void VPolarCoordinateSystem::initVAxisInList()
sal_Int32 nDimensionIndex = elem.first.first;
sal_Int32 nAxisIndex = elem.first.second;
pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement(nDimensionIndex, nAxisIndex) );
- pVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
+ pVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget
, createCIDForAxis( nDimensionIndex, nAxisIndex ) );
VPolarAxis* pVPolarAxis = dynamic_cast< VPolarAxis* >( pVAxis );
if( pVPolarAxis )
@@ -168,13 +175,13 @@ void VPolarCoordinateSystem::createGridShapes()
{
sal_Int32 nAxisIndex = MAIN_AXIS_INDEX;
- Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, m_xCooSysModel ) );
+ rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, nAxisIndex, m_xCooSysModel );
if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
continue;
VPolarGrid aGrid(nDimensionIndex,nDimensionCount,getGridListFromAxis( xAxis ));
aGrid.setIncrements( getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
- aGrid.initPlotter(m_xLogicTargetForGrids,m_xFinalTarget,m_xShapeFactory
+ aGrid.initPlotter(m_xLogicTargetForGrids,m_xFinalTarget
, createCIDForGrid( nDimensionIndex, nAxisIndex ) );
if(nDimensionCount==2)
aGrid.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.hxx b/chart2/source/view/axes/VPolarCoordinateSystem.hxx
index 4976672963c8..a2ea0220f8bc 100644
--- a/chart2/source/view/axes/VPolarCoordinateSystem.hxx
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARCOORDINATESYSTEM_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARCOORDINATESYSTEM_HXX
+#pragma once
#include <VCoordinateSystem.hxx>
@@ -28,7 +27,7 @@ class VPolarCoordinateSystem : public VCoordinateSystem
{
public:
VPolarCoordinateSystem() = delete;
- explicit VPolarCoordinateSystem( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
+ explicit VPolarCoordinateSystem( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
virtual ~VPolarCoordinateSystem() override;
//better performance for big data
@@ -36,10 +35,12 @@ public:
, const css::awt::Size& rPageResolution ) override;
virtual void createVAxisList(
- const css::uno::Reference< css::chart2::XChartDocument> & xChartDoc
- , const css::awt::Size& rFontReferenceSize
- , const css::awt::Rectangle& rMaximumSpaceForLabels
- , bool bLimitSpaceForLabels ) override;
+ const rtl::Reference<::chart::ChartModel> &ChartDoc,
+ const css::awt::Size& rFontReferenceSize,
+ const css::awt::Rectangle& rMaximumSpaceForLabels,
+ bool bLimitSpaceForLabels,
+ std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+ css::uno::Reference<css::uno::XComponentContext> const& rComponentContext) override;
virtual void initVAxisInList() override;
virtual void updateScalesAndIncrementsOnAxes() override;
@@ -48,6 +49,5 @@ public:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VPolarGrid.cxx b/chart2/source/view/axes/VPolarGrid.cxx
index 46d176b6d91b..7c49842640a7 100644
--- a/chart2/source/view/axes/VPolarGrid.cxx
+++ b/chart2/source/view/axes/VPolarGrid.cxx
@@ -20,6 +20,7 @@
#include "VPolarGrid.hxx"
#include "VCartesianGrid.hxx"
#include "Tickmarks.hxx"
+#include <GridProperties.hxx>
#include <PlottingPositionHelper.hxx>
#include <ShapeFactory.hxx>
#include <ObjectIdentifier.hxx>
@@ -38,22 +39,20 @@ using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
VPolarGrid::VPolarGrid( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
- , const uno::Sequence< Reference< beans::XPropertySet > > & rGridPropertiesList )
+ , std::vector< rtl::Reference< ::chart::GridProperties > > aGridPropertiesList )
: VAxisOrGridBase( nDimensionIndex, nDimensionCount )
- , m_aGridPropertiesList( rGridPropertiesList )
- , m_pPosHelper( new PolarPlottingPositionHelper() )
- , m_aIncrements()
+ , m_aGridPropertiesList( std::move(aGridPropertiesList) )
{
- PlotterBase::m_pPosHelper = m_pPosHelper.get();
+ PlotterBase::m_pPosHelper = &m_aPosHelper;
}
VPolarGrid::~VPolarGrid()
{
}
-void VPolarGrid::setIncrements( const std::vector< ExplicitIncrementData >& rIncrements )
+void VPolarGrid::setIncrements( std::vector< ExplicitIncrementData >&& rIncrements )
{
- m_aIncrements = rIncrements;
+ m_aIncrements = std::move(rIncrements);
}
void VPolarGrid::getAllTickInfos( sal_Int32 nDimensionIndex, TickInfoArraysType& rAllTickInfos ) const
@@ -77,28 +76,31 @@ void VPolarGrid::createLinePointSequence_ForAngleAxis(
sal_Int32 nTick = 0;
EquidistantTickIter aIter( rAllTickInfos, rIncrement, 0 );
+ auto pPoints = rPoints.getArray();
for( TickInfo* pTickInfo = aIter.firstInfo()
; pTickInfo
; pTickInfo = aIter.nextInfo(), nTick++ )
{
if(nTick>=rPoints[0].getLength())
- rPoints[0].realloc(rPoints[0].getLength()+30);
+ pPoints[0].realloc(rPoints[0].getLength()+30);
+ auto pPoints0 = pPoints[0].getArray();
//xxxxx pTickInfo->updateUnscaledValue( xInverseScaling );
double fLogicAngle = pTickInfo->getUnscaledTickValue();
drawing::Position3D aScenePosition3D( pPosHelper->transformAngleRadiusToScene( fLogicAngle, fLogicRadius, fLogicZ ) );
- rPoints[0][nTick].X = static_cast<sal_Int32>(aScenePosition3D.PositionX);
- rPoints[0][nTick].Y = static_cast<sal_Int32>(aScenePosition3D.PositionY);
+ pPoints0[nTick].X = static_cast<sal_Int32>(aScenePosition3D.PositionX);
+ pPoints0[nTick].Y = static_cast<sal_Int32>(aScenePosition3D.PositionY);
}
if(rPoints[0].getLength()>1)
{
- rPoints[0].realloc(nTick+1);
- rPoints[0][nTick].X = rPoints[0][0].X;
- rPoints[0][nTick].Y = rPoints[0][0].Y;
+ pPoints[0].realloc(nTick+1);
+ auto pPoints0 = pPoints[0].getArray();
+ pPoints0[nTick].X = rPoints[0][0].X;
+ pPoints0[nTick].Y = rPoints[0][0].Y;
}
else
- rPoints[0].realloc(0);
+ pPoints[0].realloc(0);
}
#ifdef NOTYET
void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicTarget
@@ -144,7 +146,7 @@ void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicT
appendPointSequence( aAllPoints, aPoints );
}
- Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
xMainTarget, aAllPoints, &rLinePropertiesList[nDepth] );
//because of this name this line will be used for marking
m_pShapeFactory->setShapeName( xShape, "MarkHandles" );
@@ -152,13 +154,13 @@ void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicT
}
#endif
-void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogicTarget
+void VPolarGrid::create2DRadiusGrid( const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget
, TickInfoArraysType& rRadiusTickInfos
, TickInfoArraysType& rAngleTickInfos
, const std::vector<VLineProperties>& rLinePropertiesList )
{
- Reference< drawing::XShapes > xMainTarget(
- createGroupShape( xLogicTarget, m_aCID ) );
+ rtl::Reference<SvxShapeGroupAnyD> xMainTarget =
+ createGroupShape( xLogicTarget, m_aCID );
const std::vector<ExplicitScaleData>& rScales = m_pPosHelper->getScales();
const ExplicitScaleData& rRadiusScale = rScales[1];
@@ -178,14 +180,14 @@ void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogic
if( !rLinePropertiesList[nDepth].isLineVisible() )
continue;
- Reference< drawing::XShapes > xTarget( xMainTarget );
+ rtl::Reference<SvxShapeGroupAnyD> xTarget( xMainTarget );
if( nDepth > 0 )
{
- xTarget.set( createGroupShape( xLogicTarget
+ xTarget = createGroupShape( xLogicTarget
, ObjectIdentifier::addChildParticle( m_aCID, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_SUBGRID, nDepth-1 ) )
- ) );
+ );
if(!xTarget.is())
- xTarget.set( xMainTarget );
+ xTarget = xMainTarget;
}
//create axis main lines
@@ -201,12 +203,12 @@ void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogic
drawing::PointSequenceSequence aPoints(1);
VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, rAngleTickInfos
- , rAngleIncrement, rAngleScale, m_pPosHelper.get(), fLogicRadius, fLogicZ );
+ , rAngleIncrement, rAngleScale, &m_aPosHelper, fLogicRadius, fLogicZ );
if(aPoints[0].getLength())
appendPointSequence( aAllPoints, aPoints );
}
- Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
xTarget, aAllPoints, &rLinePropertiesList[nDepth] );
//because of this name this line will be used for marking
::chart::ShapeFactory::setShapeName( xShape, "MarkHandles" );
@@ -215,10 +217,10 @@ void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogic
void VPolarGrid::createShapes()
{
- OSL_PRECOND(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
- if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ OSL_PRECOND(m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
+ if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
return;
- if(!m_aGridPropertiesList.hasElements())
+ if(m_aGridPropertiesList.empty())
return;
//create all scaled tickmark values
diff --git a/chart2/source/view/axes/VPolarGrid.hxx b/chart2/source/view/axes/VPolarGrid.hxx
index 29fa8b27065a..5c0a21bb4733 100644
--- a/chart2/source/view/axes/VPolarGrid.hxx
+++ b/chart2/source/view/axes/VPolarGrid.hxx
@@ -16,11 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARGRID_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARGRID_HXX
+#pragma once
#include "VAxisOrGridBase.hxx"
#include "Tickmarks.hxx"
+#include <PlottingPositionHelper.hxx>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
#include <memory>
@@ -28,22 +28,21 @@ namespace chart { struct VLineProperties; }
namespace chart
{
-
-class PolarPlottingPositionHelper;
+class GridProperties;
class VPolarGrid : public VAxisOrGridBase
{
// public methods
public:
VPolarGrid( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
- , const css::uno::Sequence<
- css::uno::Reference< css::beans::XPropertySet > > & rGridPropertiesList //main grid, subgrid, subsubgrid etc
+ , std::vector<
+ rtl::Reference< ::chart::GridProperties > > aGridPropertiesList //main grid, subgrid, subsubgrid etc
);
virtual ~VPolarGrid() override;
virtual void createShapes() override;
- void setIncrements( const std::vector< ExplicitIncrementData >& rIncrements );
+ void setIncrements( std::vector< ExplicitIncrementData >&& rIncrements );
static void createLinePointSequence_ForAngleAxis(
css::drawing::PointSequenceSequence& rPoints
@@ -54,20 +53,19 @@ public:
, double fLogicRadius, double fLogicZ );
private: //member
- css::uno::Sequence<
- css::uno::Reference< css::beans::XPropertySet > > m_aGridPropertiesList;//main grid, subgrid, subsubgrid etc
- std::unique_ptr<PolarPlottingPositionHelper> m_pPosHelper;
+ std::vector<
+ rtl::Reference< ::chart::GridProperties > > m_aGridPropertiesList;//main grid, subgrid, subsubgrid etc
+ PolarPlottingPositionHelper m_aPosHelper;
std::vector< ExplicitIncrementData > m_aIncrements;
void getAllTickInfos( sal_Int32 nDimensionIndex, TickInfoArraysType& rAllTickInfos ) const;
- void create2DRadiusGrid( const css::uno::Reference<css::drawing::XShapes>& xLogicTarget
+ void create2DRadiusGrid( const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget
, TickInfoArraysType& rRadiusTickInfos
, TickInfoArraysType& rAngleTickInfos
, const std::vector<VLineProperties>& rLinePropertiesList );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/axes/VPolarRadiusAxis.cxx b/chart2/source/view/axes/VPolarRadiusAxis.cxx
index 6bf0b0f47d3b..f93315410e96 100644
--- a/chart2/source/view/axes/VPolarRadiusAxis.cxx
+++ b/chart2/source/view/axes/VPolarRadiusAxis.cxx
@@ -20,6 +20,7 @@
#include "VPolarRadiusAxis.hxx"
#include "VCartesianAxis.hxx"
#include <PlottingPositionHelper.hxx>
+#include <Axis.hxx>
#include <CommonConverters.hxx>
#include "Tickmarks_Equidistant.hxx"
@@ -27,7 +28,6 @@ namespace chart
{
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-using namespace ::rtl::math;
VPolarRadiusAxis::VPolarRadiusAxis( const AxisProperties& rAxisProperties
, const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
@@ -63,19 +63,18 @@ void VPolarRadiusAxis::setExplicitScaleAndIncrement(
m_apAxisWithLabels->setExplicitScaleAndIncrement( rScale, rIncrement );
}
-void VPolarRadiusAxis::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget
- , const uno::Reference< drawing::XShapes >& xFinalTarget
- , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
+void VPolarRadiusAxis::initPlotter( const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xFinalTarget
, const OUString& rCID )
{
- VPolarAxis::initPlotter( xLogicTarget, xFinalTarget, xShapeFactory, rCID );
- m_apAxisWithLabels->initPlotter( xLogicTarget, xFinalTarget, xShapeFactory, rCID );
+ VPolarAxis::initPlotter( xLogicTarget, xFinalTarget, rCID );
+ m_apAxisWithLabels->initPlotter( xLogicTarget, xFinalTarget, rCID );
}
-void VPolarRadiusAxis::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
+void VPolarRadiusAxis::setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis )
{
- VPolarAxis::setScales( rScales, bSwapXAndYAxis );
- m_apAxisWithLabels->setScales( rScales, bSwapXAndYAxis );
+ VPolarAxis::setScales( std::vector(rScales), bSwapXAndYAxis );
+ m_apAxisWithLabels->setScales( std::move(rScales), bSwapXAndYAxis );
}
void VPolarRadiusAxis::initAxisLabelProperties( const css::awt::Size& rFontReferenceSize
@@ -153,9 +152,9 @@ void VPolarRadiusAxis::createShapes()
VCartesianAxis aAxis(aAxisProperties,m_xNumberFormatsSupplier
,1,2,new PolarPlottingPositionHelper());
aAxis.setExplicitScaleAndIncrement( m_aScale, m_aIncrement );
- aAxis.initPlotter(m_xLogicTarget,m_xFinalTarget,m_xShapeFactory, m_aCID );
+ aAxis.initPlotter(m_xLogicTarget,m_xFinalTarget, m_aCID );
aAxis.setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( m_aMatrixScreenToScene ) );
- aAxis.setScales( m_pPosHelper->getScales(), false );
+ aAxis.setScales( std::vector(m_pPosHelper->getScales()), false );
aAxis.initAxisLabelProperties(m_aAxisLabelProperties.m_aFontReferenceSize,m_aAxisLabelProperties.m_aMaximumSpaceForLabels);
aAxis.createShapes();
}
diff --git a/chart2/source/view/axes/VPolarRadiusAxis.hxx b/chart2/source/view/axes/VPolarRadiusAxis.hxx
index 38ebd7b299a6..b2450e236268 100644
--- a/chart2/source/view/axes/VPolarRadiusAxis.hxx
+++ b/chart2/source/view/axes/VPolarRadiusAxis.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARRADIUSAXIS_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_AXES_VPOLARRADIUSAXIS_HXX
+#pragma once
#include "VPolarAxis.hxx"
#include <memory>
@@ -36,15 +35,14 @@ public:
virtual ~VPolarRadiusAxis() override;
virtual void initPlotter(
- const css::uno::Reference< css::drawing::XShapes >& xLogicTarget
- , const css::uno::Reference< css::drawing::XShapes >& xFinalTarget
- , const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory
+ const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xFinalTarget
, const OUString& rCID
) override;
virtual void setTransformationSceneToScreen( const css::drawing::HomogenMatrix& rMatrix ) override;
- virtual void setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis ) override;
+ virtual void setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis ) override;
virtual void setExplicitScaleAndIncrement(
const ExplicitScaleData& rScale
@@ -70,6 +68,5 @@ private: //member
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index a658a26d04a6..3bab48585148 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -24,40 +24,39 @@
#include <ExplicitCategoriesProvider.hxx>
#include <ObjectIdentifier.hxx>
#include "Splines.hxx"
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <LabelPositionHelper.hxx>
#include <Clipping.hxx>
#include <Stripe.hxx>
#include <DateHelper.hxx>
#include <unonames.hxx>
-#include <ConfigAccess.hxx>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
-#include <com/sun/star/drawing/DoubleSequence.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <officecfg/Office/Compatibility.hxx>
+#include <officecfg/Office/Chart.hxx>
+
+#include <limits>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::rtl::math;
using namespace ::com::sun::star::chart2;
-AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
+AreaChart::AreaChart( const rtl::Reference<ChartType>& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bCategoryXAxis
, bool bNoArea
)
: VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis )
- , m_pMainPosHelper(new PlottingPositionHelper())
, m_bArea(!bNoArea)
, m_bLine(bNoArea)
, m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) )
@@ -65,19 +64,19 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
, m_nCurveResolution(20)
, m_nSplineOrder(3)
{
+ PlotterBase::m_pPosHelper = &m_aMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = &m_aMainPosHelper;
+
m_pMainPosHelper->AllowShiftXAxisPos(true);
m_pMainPosHelper->AllowShiftZAxisPos(true);
- PlotterBase::m_pPosHelper = m_pMainPosHelper.get();
- VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper.get();
-
try
{
- if( m_xChartTypeModelProps.is() )
+ if( m_xChartTypeModel.is() )
{
- m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle;
- m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution;
- m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder;
+ m_xChartTypeModel->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle;
+ m_xChartTypeModel->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution;
+ m_xChartTypeModel->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder;
}
}
catch( uno::Exception& e )
@@ -154,122 +153,95 @@ void AreaChart::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 zSlot
VSeriesPlotter::addSeries( std::move(pSeries), zSlot, xSlot, ySlot );
}
-static void lcl_removeDuplicatePoints( drawing::PolyPolygonShape3D& rPolyPoly, PlottingPositionHelper& rPosHelper )
+static void lcl_removeDuplicatePoints( std::vector<std::vector<css::drawing::Position3D>>& rPolyPoly, PlottingPositionHelper& rPosHelper )
{
- sal_Int32 nPolyCount = rPolyPoly.SequenceX.getLength();
+ sal_Int32 nPolyCount = rPolyPoly.size();
if(!nPolyCount)
return;
- drawing::PolyPolygonShape3D aTmp;
- aTmp.SequenceX.realloc(nPolyCount);
- aTmp.SequenceY.realloc(nPolyCount);
- aTmp.SequenceZ.realloc(nPolyCount);
+ // TODO we could do with without a temporary array
+ std::vector<std::vector<css::drawing::Position3D>> aTmp;
+ aTmp.resize(nPolyCount);
for( sal_Int32 nPolygonIndex = 0; nPolygonIndex<nPolyCount; nPolygonIndex++ )
{
- drawing::DoubleSequence* pOuterSourceX = &rPolyPoly.SequenceX.getArray()[nPolygonIndex];
- drawing::DoubleSequence* pOuterSourceY = &rPolyPoly.SequenceY.getArray()[nPolygonIndex];
- drawing::DoubleSequence* pOuterSourceZ = &rPolyPoly.SequenceZ.getArray()[nPolygonIndex];
+ std::vector<css::drawing::Position3D>* pOuterSource = &rPolyPoly[nPolygonIndex];
+ std::vector<css::drawing::Position3D>* pOuterTarget = &aTmp[nPolygonIndex];
- drawing::DoubleSequence* pOuterTargetX = &aTmp.SequenceX.getArray()[nPolygonIndex];
- drawing::DoubleSequence* pOuterTargetY = &aTmp.SequenceY.getArray()[nPolygonIndex];
- drawing::DoubleSequence* pOuterTargetZ = &aTmp.SequenceZ.getArray()[nPolygonIndex];
-
- sal_Int32 nPointCount = pOuterSourceX->getLength();
+ sal_Int32 nPointCount = pOuterSource->size();
if( !nPointCount )
continue;
- pOuterTargetX->realloc(nPointCount);
- pOuterTargetY->realloc(nPointCount);
- pOuterTargetZ->realloc(nPointCount);
-
- double* pSourceX = pOuterSourceX->getArray();
- double* pSourceY = pOuterSourceY->getArray();
- double* pSourceZ = pOuterSourceZ->getArray();
+ pOuterTarget->resize(nPointCount);
- double* pTargetX = pOuterTargetX->getArray();
- double* pTargetY = pOuterTargetY->getArray();
- double* pTargetZ = pOuterTargetZ->getArray();
+ css::drawing::Position3D* pSource = pOuterSource->data();
+ css::drawing::Position3D* pTarget = pOuterTarget->data();
//copy first point
- *pTargetX=*pSourceX++;
- *pTargetY=*pSourceY++;
- *pTargetZ=*pSourceZ++;
+ *pTarget=*pSource++;
sal_Int32 nTargetPointCount=1;
for( sal_Int32 nSource=1; nSource<nPointCount; nSource++ )
{
- if( !rPosHelper.isSameForGivenResolution( *pTargetX, *pTargetY, *pTargetZ
- , *pSourceX, *pSourceY, *pSourceZ ) )
+ if( !rPosHelper.isSameForGivenResolution( pTarget->PositionX, pTarget->PositionY, pTarget->PositionZ
+ , pSource->PositionX, pSource->PositionY, pSource->PositionZ ) )
{
- pTargetX++; pTargetY++; pTargetZ++;
- *pTargetX=*pSourceX;
- *pTargetY=*pSourceY;
- *pTargetZ=*pSourceZ;
+ pTarget++;
+ *pTarget=*pSource;
nTargetPointCount++;
}
- pSourceX++; pSourceY++; pSourceZ++;
+ pSource++;
}
//free unused space
if( nTargetPointCount<nPointCount )
{
- pOuterTargetX->realloc(nTargetPointCount);
- pOuterTargetY->realloc(nTargetPointCount);
- pOuterTargetZ->realloc(nTargetPointCount);
+ pOuterTarget->resize(nTargetPointCount);
}
- pOuterSourceX->realloc(0);
- pOuterSourceY->realloc(0);
- pOuterSourceZ->realloc(0);
+ pOuterSource->clear();
}
//free space
- rPolyPoly.SequenceX.realloc(nPolyCount);
- rPolyPoly.SequenceY.realloc(nPolyCount);
- rPolyPoly.SequenceZ.realloc(nPolyCount);
+ rPolyPoly.resize(nPolyCount);
- rPolyPoly=aTmp;
+ rPolyPoly = std::move(aTmp);
}
-bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, chart2::CurveStyle eCurveStyle, PlottingPositionHelper const * pPosHelper, drawing::PolyPolygonShape3D &aPoly )
+bool AreaChart::create_stepped_line(
+ std::vector<std::vector<css::drawing::Position3D>> aStartPoly,
+ chart2::CurveStyle eCurveStyle,
+ PlottingPositionHelper const * pPosHelper,
+ std::vector<std::vector<css::drawing::Position3D>> &aPoly )
{
- sal_uInt32 nOuterCount = aStartPoly.SequenceX.getLength();
+ sal_uInt32 nOuterCount = aStartPoly.size();
if ( !nOuterCount )
return false;
- drawing::PolyPolygonShape3D aSteppedPoly;
- aSteppedPoly.SequenceX.realloc(nOuterCount);
- aSteppedPoly.SequenceY.realloc(nOuterCount);
- aSteppedPoly.SequenceZ.realloc(nOuterCount);
+ std::vector<std::vector<css::drawing::Position3D>> aSteppedPoly;
+ aSteppedPoly.resize(nOuterCount);
+
+ auto pSequence = aSteppedPoly.data();
for( sal_uInt32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
{
- if( aStartPoly.SequenceX[nOuter].getLength() <= 1 )
+ if( aStartPoly[nOuter].size() <= 1 )
continue; //we need at least two points
- sal_uInt32 nMaxIndexPoints = aStartPoly.SequenceX[nOuter].getLength()-1; // is >1
+ sal_uInt32 nMaxIndexPoints = aStartPoly[nOuter].size()-1; // is >1
sal_uInt32 nNewIndexPoints = 0;
if ( eCurveStyle==CurveStyle_STEP_START || eCurveStyle==CurveStyle_STEP_END)
nNewIndexPoints = nMaxIndexPoints * 2 + 1;
else
nNewIndexPoints = nMaxIndexPoints * 3 + 1;
- const double* pOldX = aStartPoly.SequenceX[nOuter].getConstArray();
- const double* pOldY = aStartPoly.SequenceY[nOuter].getConstArray();
- const double* pOldZ = aStartPoly.SequenceZ[nOuter].getConstArray();
+ const css::drawing::Position3D* pOld = aStartPoly[nOuter].data();
- aSteppedPoly.SequenceX[nOuter].realloc( nNewIndexPoints );
- aSteppedPoly.SequenceY[nOuter].realloc( nNewIndexPoints );
- aSteppedPoly.SequenceZ[nOuter].realloc( nNewIndexPoints );
+ pSequence[nOuter].resize( nNewIndexPoints );
- double* pNewX = aSteppedPoly.SequenceX[nOuter].getArray();
- double* pNewY = aSteppedPoly.SequenceY[nOuter].getArray();
- double* pNewZ = aSteppedPoly.SequenceZ[nOuter].getArray();
+ css::drawing::Position3D* pNew = pSequence[nOuter].data();
- pNewX[0] = pOldX[0];
- pNewY[0] = pOldY[0];
- pNewZ[0] = pOldZ[0];
+ pNew[0] = pOld[0];
for( sal_uInt32 oi = 0; oi < nMaxIndexPoints; oi++ )
{
switch ( eCurveStyle )
@@ -282,13 +254,11 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
O-----+
*/
// create the intermediate point
- pNewX[1+oi*2] = pOldX[oi+1];
- pNewY[1+oi*2] = pOldY[oi];
- pNewZ[1+oi*2] = pOldZ[oi];
+ pNew[1+oi*2].PositionX = pOld[oi+1].PositionX;
+ pNew[1+oi*2].PositionY = pOld[oi].PositionY;
+ pNew[1+oi*2].PositionZ = pOld[oi].PositionZ;
// and now the normal one
- pNewX[1+oi*2+1] = pOldX[oi+1];
- pNewY[1+oi*2+1] = pOldY[oi+1];
- pNewZ[1+oi*2+1] = pOldZ[oi+1];
+ pNew[1+oi*2+1] = pOld[oi+1];
break;
case CurveStyle_STEP_END:
/** +------O
@@ -298,13 +268,11 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
O
*/
// create the intermediate point
- pNewX[1+oi*2] = pOldX[oi];
- pNewY[1+oi*2] = pOldY[oi+1];
- pNewZ[1+oi*2] = pOldZ[oi];
+ pNew[1+oi*2].PositionX = pOld[oi].PositionX;
+ pNew[1+oi*2].PositionY = pOld[oi+1].PositionY;
+ pNew[1+oi*2].PositionZ = pOld[oi].PositionZ;
// and now the normal one
- pNewX[1+oi*2+1] = pOldX[oi+1];
- pNewY[1+oi*2+1] = pOldY[oi+1];
- pNewZ[1+oi*2+1] = pOldZ[oi+1];
+ pNew[1+oi*2+1] = pOld[oi+1];
break;
case CurveStyle_STEP_CENTER_X:
/** +--O
@@ -314,17 +282,15 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
O--+
*/
// create the first intermediate point
- pNewX[1+oi*3] = (pOldX[oi]+pOldX[oi+1])/2;
- pNewY[1+oi*3] = pOldY[oi];
- pNewZ[1+oi*3] = pOldZ[oi];
+ pNew[1+oi*3].PositionX = (pOld[oi].PositionX + pOld[oi+1].PositionX) / 2;
+ pNew[1+oi*3].PositionY = pOld[oi].PositionY;
+ pNew[1+oi*3].PositionZ = pOld[oi].PositionZ;
// create the second intermediate point
- pNewX[1+oi*3+1] = (pOldX[oi]+pOldX[oi+1])/2;
- pNewY[1+oi*3+1] = pOldY[oi+1];
- pNewZ[1+oi*3+1] = pOldZ[oi];
+ pNew[1+oi*3+1].PositionX = (pOld[oi].PositionX + pOld[oi+1].PositionX) / 2;
+ pNew[1+oi*3+1].PositionY = pOld[oi+1].PositionY;
+ pNew[1+oi*3+1].PositionZ = pOld[oi].PositionZ;
// and now the normal one
- pNewX[1+oi*3+2] = pOldX[oi+1];
- pNewY[1+oi*3+2] = pOldY[oi+1];
- pNewZ[1+oi*3+2] = pOldZ[oi+1];
+ pNew[1+oi*3+2] = pOld[oi+1];
break;
case CurveStyle_STEP_CENTER_Y:
/** O
@@ -334,17 +300,15 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
O
*/
// create the first intermediate point
- pNewX[1+oi*3] = pOldX[oi];
- pNewY[1+oi*3] = (pOldY[oi]+pOldY[oi+1])/2;
- pNewZ[1+oi*3] = pOldZ[oi];
+ pNew[1+oi*3].PositionX = pOld[oi].PositionX;
+ pNew[1+oi*3].PositionY = (pOld[oi].PositionY + pOld[oi+1].PositionY) / 2;
+ pNew[1+oi*3].PositionZ = pOld[oi].PositionZ;
// create the second intermediate point
- pNewX[1+oi*3+1] = pOldX[oi+1];
- pNewY[1+oi*3+1] = (pOldY[oi]+pOldY[oi+1])/2;
- pNewZ[1+oi*3+1] = pOldZ[oi];
+ pNew[1+oi*3+1].PositionX = pOld[oi+1].PositionX;
+ pNew[1+oi*3+1].PositionY = (pOld[oi].PositionY + pOld[oi+1].PositionY) / 2;
+ pNew[1+oi*3+1].PositionZ = pOld[oi].PositionZ;
// and now the normal one
- pNewX[1+oi*3+2] = pOldX[oi+1];
- pNewY[1+oi*3+2] = pOldY[oi+1];
- pNewZ[1+oi*3+2] = pOldZ[oi+1];
+ pNew[1+oi*3+2] = pOld[oi+1];
break;
default:
// this should never be executed
@@ -358,23 +322,23 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
}
bool AreaChart::impl_createLine( VDataSeries* pSeries
- , drawing::PolyPolygonShape3D const * pSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pSeriesPoly
, PlottingPositionHelper* pPosHelper )
{
//return true if a line was created successfully
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
- drawing::PolyPolygonShape3D aPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aPoly;
if(m_eCurveStyle==CurveStyle_CUBIC_SPLINES)
{
- drawing::PolyPolygonShape3D aSplinePoly;
+ std::vector<std::vector<css::drawing::Position3D>> aSplinePoly;
SplineCalculater::CalculateCubicSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution );
lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
}
else if(m_eCurveStyle==CurveStyle_B_SPLINES)
{
- drawing::PolyPolygonShape3D aSplinePoly;
+ std::vector<std::vector<css::drawing::Position3D>> aSplinePoly;
SplineCalculater::CalculateBSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution, m_nSplineOrder );
lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
@@ -403,26 +367,21 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
pPosHelper->transformScaledLogicToScene( aPoly );
//create line:
- uno::Reference< drawing::XShape > xShape;
+ rtl::Reference< SvxShape > xShape;
if(m_nDimension==3)
{
double fDepth = getTransformedDepth();
- sal_Int32 nPolyCount = aPoly.SequenceX.getLength();
+ sal_Int32 nPolyCount = aPoly.size();
for(sal_Int32 nPoly=0;nPoly<nPolyCount;nPoly++)
{
- sal_Int32 nPointCount = aPoly.SequenceX[nPoly].getLength();
+ sal_Int32 nPointCount = aPoly[nPoly].size();
for(sal_Int32 nPoint=0;nPoint<nPointCount-1;nPoint++)
{
drawing::Position3D aPoint1, aPoint2;
- aPoint1.PositionX = aPoly.SequenceX[nPoly][nPoint+1];
- aPoint1.PositionY = aPoly.SequenceY[nPoly][nPoint+1];
- aPoint1.PositionZ = aPoly.SequenceZ[nPoly][nPoint+1];
+ aPoint1 = aPoly[nPoly][nPoint+1];
+ aPoint2 = aPoly[nPoly][nPoint];
- aPoint2.PositionX = aPoly.SequenceX[nPoly][nPoint];
- aPoint2.PositionY = aPoly.SequenceY[nPoly][nPoint];
- aPoint2.PositionZ = aPoly.SequenceZ[nPoly][nPoint];
-
- m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes
+ ShapeFactory::createStripe(xSeriesGroupShape_Shapes
, Stripe( aPoint1, aPoint2, fDepth )
, pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 );
}
@@ -430,9 +389,8 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
}
else //m_nDimension!=3
{
- xShape = m_pShapeFactory->createLine2D( xSeriesGroupShape_Shapes
- , PolyToPointSequence( aPoly ) );
- setMappedProperties( xShape
+ xShape = ShapeFactory::createLine2D( xSeriesGroupShape_Shapes, aPoly );
+ PropertyMapper::setMappedProperties( *xShape
, pSeries->getPropertiesOfSeries()
, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
//because of this name this line will be used for marking
@@ -442,16 +400,16 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
}
bool AreaChart::impl_createArea( VDataSeries* pSeries
- , drawing::PolyPolygonShape3D const * pSeriesPoly
- , drawing::PolyPolygonShape3D const * pPreviousSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pPreviousSeriesPoly
, PlottingPositionHelper const * pPosHelper )
{
//return true if an area was created successfully
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
double zValue = pSeries->m_fLogicZPos;
- drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
+ std::vector<std::vector<css::drawing::Position3D>> aPoly( *pSeriesPoly );
//add second part to the polygon (grounding points or previous series points)
if(!pPreviousSeriesPoly)
{
@@ -484,7 +442,7 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
//apply clipping
{
- drawing::PolyPolygonShape3D aClippedPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aClippedPoly;
Clipping::clipPolygonAtRectangle( aPoly, pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false );
ShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping
aPoly = aClippedPoly;
@@ -497,18 +455,18 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
pPosHelper->transformScaledLogicToScene( aPoly );
//create area:
- uno::Reference< drawing::XShape > xShape;
+ rtl::Reference< SvxShape > xShape;
if(m_nDimension==3)
{
- xShape = m_pShapeFactory->createArea3D( xSeriesGroupShape_Shapes
+ xShape = ShapeFactory::createArea3D( xSeriesGroupShape_Shapes
, aPoly, getTransformedDepth() );
}
else //m_nDimension!=3
{
- xShape = m_pShapeFactory->createArea2D( xSeriesGroupShape_Shapes
+ xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes
, aPoly );
}
- setMappedProperties( xShape
+ PropertyMapper::setMappedProperties( *xShape
, pSeries->getPropertiesOfSeries()
, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
//because of this name this line will be used for marking
@@ -525,8 +483,8 @@ void AreaChart::impl_createSeriesShapes()
{
for( auto const& rXSlot : rZSlot )
{
- std::map< sal_Int32, drawing::PolyPolygonShape3D* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
- drawing::PolyPolygonShape3D* pSeriesPoly = nullptr;
+ std::map< sal_Int32, std::vector<std::vector<css::drawing::Position3D>>* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
+ std::vector<std::vector<css::drawing::Position3D>>* pSeriesPoly = nullptr;
//iterate through all series
for( std::unique_ptr<VDataSeries> const & pSeries : rXSlot.m_aSeriesVector )
@@ -589,10 +547,10 @@ struct FormerPoint
: m_fX(fX), m_fY(fY), m_fZ(fZ)
{}
FormerPoint()
+ : m_fX(std::numeric_limits<double>::quiet_NaN())
+ , m_fY(std::numeric_limits<double>::quiet_NaN())
+ , m_fZ(std::numeric_limits<double>::quiet_NaN())
{
- ::rtl::math::setNan( &m_fX );
- ::rtl::math::setNan( &m_fY );
- ::rtl::math::setNan( &m_fZ );
}
double m_fX;
@@ -611,8 +569,8 @@ void AreaChart::createShapes()
if( officecfg::Office::Compatibility::View::ReverseSeriesOrderAreaAndNetChart::get() && m_nDimension == 2 && ( m_bArea || !m_bCategoryXAxis ) )
lcl_reorderSeries( m_aZSlots );
- OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart is not proper initialized");
- if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ OSL_ENSURE(m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart is not proper initialized");
+ if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
return;
//the text labels should be always on top of the other series shapes
@@ -625,8 +583,8 @@ void AreaChart::createShapes()
m_xErrorBarTarget = createGroupShape( m_xLogicTarget );
else
m_xErrorBarTarget = m_xSeriesTarget;
- m_xTextTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget );
- m_xRegressionCurveEquationTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget );
+ m_xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget );
+ m_xRegressionCurveEquationTarget = ShapeFactory::createGroup2D( m_xFinalTarget );
//check necessary here that different Y axis can not be stacked in the same group? ... hm?
@@ -664,8 +622,7 @@ void AreaChart::createShapes()
{
std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex];
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
- if( rLogicYSumMap.find(nAttachedAxisIndex)==rLogicYSumMap.end() )
- rLogicYSumMap[nAttachedAxisIndex]=0.0;
+ rLogicYSumMap.insert({nAttachedAxisIndex, 0.0});
m_pPosHelper = &getPlottingPositionHelper(nAttachedAxisIndex);
@@ -677,6 +634,8 @@ void AreaChart::createShapes()
}
}
+ const bool bUseErrorRectangle = officecfg::Office::Chart::ErrorProperties::ErrorRectangle::get();
+
sal_Int32 nZ=1;
for( auto const& rZSlot : m_aZSlots )
{
@@ -691,9 +650,11 @@ void AreaChart::createShapes()
if(!pSeries)
continue;
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget);
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
+ double fXMin, fXMax;
+ pSeries->getMinMaxXValue(fXMin, fXMax);
PlottingPositionHelper& rPosHelper = getPlottingPositionHelper(nAttachedAxisIndex);
m_pPosHelper = &rPosHelper;
@@ -714,7 +675,7 @@ void AreaChart::createShapes()
double fLogicX = pSeries->getXValue(nIndex);
if (bDateCategory)
{
- if (std::isnan(fLogicX))
+ if (std::isnan(fLogicX) || (fLogicX < fXMin || fLogicX > fXMax))
continue;
fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution );
@@ -737,11 +698,11 @@ void AreaChart::createShapes()
{
if( pSeries->getMissingValueTreatment() == css::chart::MissingValueTreatment::LEAVE_GAP )
{
- drawing::PolyPolygonShape3D& rPolygon = pSeries->m_aPolyPolygonShape3D;
+ std::vector<std::vector<css::drawing::Position3D>>& rPolygon = pSeries->m_aPolyPolygonShape3D;
sal_Int32& rIndex = pSeries->m_nPolygonIndex;
- if( 0<= rIndex && rIndex < rPolygon.SequenceX.getLength() )
+ if( 0<= rIndex && o3tl::make_unsigned(rIndex) < rPolygon.size() )
{
- if( rPolygon.SequenceX[ rIndex ].hasElements() )
+ if( !rPolygon[ rIndex ].empty() )
rIndex++; //start a new polygon for the next point if the current poly is not empty
}
}
@@ -833,13 +794,6 @@ void AreaChart::createShapes()
!bCreateXErrorBar && !pSeries->getDataPointLabelIfLabel(nIndex) )
continue;
- //create a group shape for this point and add to the series shape:
- OUString aPointCID = ObjectIdentifier::createPointCID(
- pSeries->getPointCID_Stub(), nIndex );
- uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
- createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
- uno::Reference<drawing::XShape> xPointGroupShape_Shape( xPointGroupShape_Shapes, uno::UNO_QUERY );
-
{
nCreatedPoints++;
@@ -849,6 +803,13 @@ void AreaChart::createShapes()
{
if(m_nDimension!=3)
{
+ //create a group shape for this point and add to the series shape:
+ OUString aPointCID = ObjectIdentifier::createPointCID(
+ pSeries->getPointCID_Stub(), nIndex );
+ rtl::Reference<SvxShapeGroupAnyD> xPointGroupShape_Shapes;
+ if (pSymbolProperties->Style == SymbolStyle_STANDARD || pSymbolProperties->Style == SymbolStyle_GRAPHIC)
+ xPointGroupShape_Shapes = createGroupShape(xSeriesGroupShape_Shapes,aPointCID);
+
if (pSymbolProperties->Style != SymbolStyle_NONE)
{
aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
@@ -858,14 +819,14 @@ void AreaChart::createShapes()
if (pSymbolProperties->Style == SymbolStyle_STANDARD)
{
sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
- m_pShapeFactory->createSymbol2D(
+ ShapeFactory::createSymbol2D(
xPointGroupShape_Shapes, aScenePosition, aSymbolSize,
nSymbol, pSymbolProperties->BorderColor,
pSymbolProperties->FillColor);
}
else if (pSymbolProperties->Style == SymbolStyle_GRAPHIC)
{
- m_pShapeFactory->createGraphic2D(xPointGroupShape_Shapes,
+ ShapeFactory::createGraphic2D(xPointGroupShape_Shapes,
aScenePosition, aSymbolSize,
pSymbolProperties->Graphic);
}
@@ -873,7 +834,7 @@ void AreaChart::createShapes()
}
}
//create error bars or rectangles, depending on configuration
- if ( ConfigAccess::getUseErrorRectangle() )
+ if ( bUseErrorRectangle )
{
if ( bCreateXErrorBar || bCreateYErrorBar )
{
@@ -948,7 +909,7 @@ void AreaChart::createShapes()
{
if(eAlignment==LABEL_ALIGN_CENTER || m_nDimension == 3 )
nOffset = 0;
- aScreenPosition2D = LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ aScreenPosition2D = LabelPositionHelper(m_nDimension,m_xLogicTarget)
.transformSceneToScreenPosition( aScenePosition3D );
}
@@ -957,10 +918,6 @@ void AreaChart::createShapes()
, rLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset );
}
}
-
- //remove PointGroupShape if empty
- if(!xPointGroupShape_Shapes->getCount())
- xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
}
}//next series in x slot (next y slot)
diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx
index 786fcba8310e..411b9d6642aa 100644
--- a/chart2/source/view/charttypes/AreaChart.hxx
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -17,11 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_AREACHART_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_AREACHART_HXX
+#pragma once
#include <memory>
#include <VSeriesPlotter.hxx>
+#include <PlottingPositionHelper.hxx>
#include <com/sun/star/chart2/CurveStyle.hpp>
namespace chart
@@ -33,7 +33,7 @@ class AreaChart : public VSeriesPlotter
public:
AreaChart() = delete;
- AreaChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
+ AreaChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bCategoryXAxis, bool bNoArea=false
);
@@ -53,20 +53,19 @@ public:
private: //methods
void impl_createSeriesShapes();
bool impl_createArea( VDataSeries* pSeries
- , css::drawing::PolyPolygonShape3D const * pSeriesPoly
- , css::drawing::PolyPolygonShape3D const * pPreviousSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pPreviousSeriesPoly
, PlottingPositionHelper const * pPosHelper );
bool impl_createLine( VDataSeries* pSeries
- , css::drawing::PolyPolygonShape3D const * pSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pSeriesPoly
, PlottingPositionHelper* pPosHelper );
- static bool create_stepped_line( css::drawing::PolyPolygonShape3D aStartPoly
+ static bool create_stepped_line( std::vector<std::vector<css::drawing::Position3D>> aStartPoly
, css::chart2::CurveStyle eCurveStyle
, PlottingPositionHelper const * pPosHelper
- , css::drawing::PolyPolygonShape3D &aPoly );
+ , std::vector<std::vector<css::drawing::Position3D>> &aPoly );
private: //member
- std::unique_ptr<PlottingPositionHelper>
- m_pMainPosHelper;
+ PlottingPositionHelper m_aMainPosHelper;
bool m_bArea;//false -> line or symbol only
bool m_bLine;
@@ -77,12 +76,11 @@ private: //member
sal_Int32 m_nCurveResolution;
sal_Int32 m_nSplineOrder;
- css::uno::Reference< css::drawing::XShapes > m_xSeriesTarget;
- css::uno::Reference< css::drawing::XShapes > m_xErrorBarTarget;
- css::uno::Reference< css::drawing::XShapes > m_xTextTarget;
- css::uno::Reference< css::drawing::XShapes > m_xRegressionCurveEquationTarget;
+ rtl::Reference<SvxShapeGroupAnyD> m_xSeriesTarget;
+ rtl::Reference<SvxShapeGroupAnyD> m_xErrorBarTarget;
+ rtl::Reference<SvxShapeGroupAnyD> m_xTextTarget;
+ rtl::Reference<SvxShapeGroupAnyD> m_xRegressionCurveEquationTarget;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index 3641e67b4657..fcc969b898ad 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -20,6 +20,7 @@
#include "BarChart.hxx"
#include "BarPositionHelper.hxx"
+#include <ChartType.hxx>
#include <ShapeFactory.hxx>
#include <CommonConverters.hxx>
#include <ObjectIdentifier.hxx>
@@ -28,17 +29,13 @@
#include <Clipping.hxx>
#include <DateHelper.hxx>
#include <svx/scene3d.hxx>
-#include <svx/unoshape.hxx>
#include <comphelper/scopeguard.hxx>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
-#include <com/sun/star/chart2/XTransformation.hpp>
#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
#include <rtl/math.hxx>
-#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
-#include <unordered_set>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -46,20 +43,19 @@ using namespace ::com::sun::star;
using namespace ::rtl::math;
using namespace ::com::sun::star::chart2;
-BarChart::BarChart( const uno::Reference<XChartType>& xChartTypeModel
+BarChart::BarChart( const rtl::Reference<ChartType>& xChartTypeModel
, sal_Int32 nDimensionCount )
: VSeriesPlotter( xChartTypeModel, nDimensionCount )
- , m_pMainPosHelper( new BarPositionHelper() )
{
- PlotterBase::m_pPosHelper = m_pMainPosHelper.get();
- VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper.get();
+ PlotterBase::m_pPosHelper = &m_aMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = &m_aMainPosHelper;
try
{
- if( m_xChartTypeModelProps.is() )
+ if( m_xChartTypeModel.is() )
{
- m_xChartTypeModelProps->getPropertyValue( "OverlapSequence" ) >>= m_aOverlapSequence;
- m_xChartTypeModelProps->getPropertyValue( "GapwidthSequence" ) >>= m_aGapwidthSequence;
+ m_xChartTypeModel->getPropertyValue( "OverlapSequence" ) >>= m_aOverlapSequence;
+ m_xChartTypeModel->getPropertyValue( "GapwidthSequence" ) >>= m_aGapwidthSequence;
}
}
catch( const uno::Exception& )
@@ -126,9 +122,7 @@ drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const
}
if( m_pMainPosHelper && m_pMainPosHelper->isSwapXAndY() )
{
- double fTemp = aRet.DirectionX;
- aRet.DirectionX = aRet.DirectionY;
- aRet.DirectionY = fTemp;
+ std::swap(aRet.DirectionX, aRet.DirectionY);
}
}
else
@@ -292,12 +286,12 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment(
drawing::Position3D aScenePosition3D( pPosHelper->
transformScaledLogicToScene( fX, fY, fZ, true ) );
- return LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ return LabelPositionHelper(m_nDimension,m_xLogicTarget)
.transformSceneToScreenPosition( aScenePosition3D );
}
-uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar(
- const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference< SvxShape > BarChart::createDataPoint3D_Bar(
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
, const uno::Reference< beans::XPropertySet >& xObjectProperties
@@ -319,28 +313,28 @@ uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar(
TOOLS_WARN_EXCEPTION("chart2", "" );
}
- uno::Reference< drawing::XShape > xShape;
+ rtl::Reference< SvxShape > xShape;
switch( nGeometry3D )
{
case DataPointGeometry3D::CYLINDER:
- xShape = m_pShapeFactory->createCylinder( xTarget, rPosition, rSize, nRotateZAngleHundredthDegree );
+ xShape = ShapeFactory::createCylinder( xTarget, rPosition, rSize, nRotateZAngleHundredthDegree );
break;
case DataPointGeometry3D::CONE:
- xShape = m_pShapeFactory->createCone( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree );
+ xShape = ShapeFactory::createCone( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree );
break;
case DataPointGeometry3D::PYRAMID:
- xShape = m_pShapeFactory->createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree>0
+ xShape = ShapeFactory::createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree>0
, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
break;
case DataPointGeometry3D::CUBOID:
default:
- xShape = m_pShapeFactory->createCube( xTarget, rPosition, rSize
+ xShape = ShapeFactory::createCube( xTarget, rPosition, rSize
, nRotateZAngleHundredthDegree, xObjectProperties
, PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), bRoundedEdges );
return xShape;
}
if( nGeometry3D != DataPointGeometry3D::PYRAMID )
- setMappedProperties( xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ PropertyMapper::setMappedProperties( *xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
return xShape;
}
@@ -385,37 +379,13 @@ void BarChart::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 zSlot,
VSeriesPlotter::addSeries( std::move(pSeries), zSlot, xSlot, ySlot );
}
-namespace {
-
-//better performance for big data
-struct FormerBarPoint
-{
- FormerBarPoint( double fX, double fUpperY, double fLowerY, double fZ )
- : m_fX(fX), m_fUpperY(fUpperY), m_fLowerY(fLowerY), m_fZ(fZ)
- {}
- FormerBarPoint()
- {
- ::rtl::math::setNan( &m_fX );
- ::rtl::math::setNan( &m_fUpperY );
- ::rtl::math::setNan( &m_fLowerY );
- ::rtl::math::setNan( &m_fZ );
- }
-
- double m_fX;
- double m_fUpperY;
- double m_fLowerY;
- double m_fZ;
-};
-
-}
-
void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis()
{
//adapt m_aOverlapSequence and m_aGapwidthSequence for the groupBarsPerAxis feature
//thus the different series use the same settings
VDataSeries* pFirstSeries = getFirstSeries();
- if(!(pFirstSeries && !pFirstSeries->getGroupBarsPerAxis()) )
+ if(!pFirstSeries || pFirstSeries->getGroupBarsPerAxis())
return;
sal_Int32 nAxisIndex = pFirstSeries->getAttachedAxisIndex();
@@ -423,33 +393,22 @@ void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis()
sal_Int32 nUseThisIndex = nAxisIndex;
if( nUseThisIndex < 0 || nUseThisIndex >= m_aOverlapSequence.getLength() )
nUseThisIndex = 0;
+ auto aOverlapSequenceRange = asNonConstRange(m_aOverlapSequence);
for( nN = 0; nN < m_aOverlapSequence.getLength(); nN++ )
{
if(nN!=nUseThisIndex)
- m_aOverlapSequence[nN] = m_aOverlapSequence[nUseThisIndex];
+ aOverlapSequenceRange[nN] = m_aOverlapSequence[nUseThisIndex];
}
nUseThisIndex = nAxisIndex;
if( nUseThisIndex < 0 || nUseThisIndex >= m_aGapwidthSequence.getLength() )
nUseThisIndex = 0;
+ auto aGapwidthSequenceRange = asNonConstRange(m_aGapwidthSequence);
for( nN = 0; nN < m_aGapwidthSequence.getLength(); nN++ )
{
if(nN!=nUseThisIndex)
- m_aGapwidthSequence[nN] = m_aGapwidthSequence[nUseThisIndex];
- }
-}
-
-static E3dScene* lcl_getE3dScene(uno::Reference<uno::XInterface> const & xInterface)
-{
- E3dScene* pScene = nullptr;
-
- SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xInterface);
- if (pSvxShape)
- {
- SdrObject* pObject = pSvxShape->GetSdrObject();
- pScene = dynamic_cast<E3dScene*>(pObject);
+ aGapwidthSequenceRange[nN] = m_aGapwidthSequence[nUseThisIndex];
}
- return pScene;
}
void BarChart::createShapes()
@@ -457,8 +416,8 @@ void BarChart::createShapes()
if( m_aZSlots.empty() ) //no series
return;
- OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"BarChart is not proper initialized");
- if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ OSL_ENSURE(m_xLogicTarget.is()&&m_xFinalTarget.is(),"BarChart is not proper initialized");
+ if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
return;
//the text labels should be always on top of the other series shapes
@@ -468,33 +427,26 @@ void BarChart::createShapes()
//the regression curves should always be on top of the bars but beneath the text labels
//to achieve this the regression curve target is created after the series target and before the text target
- uno::Reference< drawing::XShapes > xSeriesTarget(
- createGroupShape( m_xLogicTarget ));
- uno::Reference< drawing::XShapes > xRegressionCurveTarget(
- createGroupShape( m_xLogicTarget ));
- uno::Reference< drawing::XShapes > xTextTarget(
- m_pShapeFactory->createGroup2D( m_xFinalTarget ));
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesTarget = createGroupShape( m_xLogicTarget );
+ rtl::Reference<SvxShapeGroupAnyD> xRegressionCurveTarget = createGroupShape( m_xLogicTarget );
+ rtl::Reference<SvxShapeGroupAnyD> xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget );
- uno::Reference< drawing::XShapes > xRegressionCurveEquationTarget(
- m_pShapeFactory->createGroup2D( m_xFinalTarget ));
+ rtl::Reference<SvxShapeGroupAnyD> xRegressionCurveEquationTarget =
+ ShapeFactory::createGroup2D( m_xFinalTarget );
//check necessary here that different Y axis can not be stacked in the same group? ... hm?
- double fLogicZ = 1.0;//as defined
-
bool bDrawConnectionLines = false;
bool bDrawConnectionLinesInited = false;
- bool bOnlyConnectionLinesForThisPoint = false;
- std::unordered_set<uno::Reference<drawing::XShape>> aShapeSet;
+ std::unordered_set<rtl::Reference<SvxShape>> aShapeSet;
const comphelper::ScopeGuard aGuard([aShapeSet]() {
std::unordered_set<E3dScene*> aSceneSet;
- for (uno::Reference<drawing::XShape> const & rShape : aShapeSet)
+ for (rtl::Reference<SvxShape> const & rShape : aShapeSet)
{
- E3dScene* pScene = lcl_getE3dScene(rShape);
- if(nullptr != pScene)
+ if(E3dScene* pScene = DynCastE3dScene(rShape->GetSdrObject()))
{
aSceneSet.insert(pScene->getRootE3dSceneFromE3dObject());
}
@@ -511,8 +463,6 @@ void BarChart::createShapes()
//better performance for big data
std::map< VDataSeries*, FormerBarPoint > aSeriesFormerPointMap;
m_bPointsWereSkipped = false;
- sal_Int32 nSkippedPoints = 0;
- sal_Int32 nCreatedPoints = 0;
sal_Int32 nStartIndex = 0;
sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
@@ -526,8 +476,7 @@ void BarChart::createShapes()
for( auto& rXSlot : rZSlot )
{
sal_Int32 nAttachedAxisIndex = rXSlot.getAttachedAxisIndexForFirstSeries();
- if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() )
- aLogicYSumMap[nAttachedAxisIndex]=0.0;
+ aLogicYSumMap.insert({nAttachedAxisIndex, 0.0});
const sal_Int32 nSlotPoints = rXSlot.getPointCount();
if( nPointIndex >= nSlotPoints )
@@ -547,380 +496,9 @@ void BarChart::createShapes()
sal_Int32 nZ=1;
for( auto& rZSlot : m_aZSlots )
{
- //iterate through all x slots in this category
- double fSlotX=0;
- for( auto& rXSlot : rZSlot )
- {
- sal_Int32 nAttachedAxisIndex = rXSlot.getAttachedAxisIndexForFirstSeries();
- //2ND_AXIS_IN_BARS so far one can assume to have the same plotter for each z slot
- BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( getPlottingPositionHelper( nAttachedAxisIndex ) ) );
- if(!pPosHelper)
- pPosHelper = m_pMainPosHelper.get();
-
- PlotterBase::m_pPosHelper = pPosHelper;
-
- //update/create information for current group
- pPosHelper->updateSeriesCount( rZSlot.size() );
- double fLogicBaseWidth = pPosHelper->getScaledSlotWidth();
-
- // get distance from base value to maximum and minimum
-
- double fMinimumY = 0.0, fMaximumY = 0.0;
- if( nPointIndex < rXSlot.getPointCount())
- rXSlot.calculateYMinAndMaxForCategory( nPointIndex
- , isSeparateStackingForDifferentSigns( 1 ), fMinimumY, fMaximumY, nAttachedAxisIndex );
-
- double fLogicPositiveYSum = 0.0;
- if( !std::isnan( fMaximumY ) )
- fLogicPositiveYSum = fMaximumY;
-
- double fLogicNegativeYSum = 0.0;
- if( !std::isnan( fMinimumY ) )
- fLogicNegativeYSum = fMinimumY;
-
- if( pPosHelper->isPercentY() )
- {
- /* #i70395# fLogicPositiveYSum contains sum of all positive
- values, if any, otherwise the highest negative value.
- fLogicNegativeYSum contains sum of all negative values,
- if any, otherwise the lowest positive value.
- Afterwards, fLogicPositiveYSum will contain the maximum
- (positive) value that is related to 100%. */
-
- // do nothing if there are positive values only
- if( fLogicNegativeYSum < 0.0 )
- {
- // fLogicPositiveYSum<0 => negative values only, use absolute of negative sum
- if( fLogicPositiveYSum < 0.0 )
- fLogicPositiveYSum = -fLogicNegativeYSum;
- // otherwise there are positive and negative values, calculate total distance
- else
- fLogicPositiveYSum -= fLogicNegativeYSum;
- }
- fLogicNegativeYSum = 0.0;
- }
-
- double fBaseValue = 0.0;
- if( !pPosHelper->isPercentY() && rXSlot.m_aSeriesVector.size()<=1 )
- fBaseValue = pPosHelper->getBaseValueY();
- double fPositiveLogicYForNextSeries = fBaseValue;
- double fNegativeLogicYForNextSeries = fBaseValue;
-
- //iterate through all series in this x slot
- for( std::unique_ptr<VDataSeries> const & pSeries : rXSlot.m_aSeriesVector )
- {
- if(!pSeries)
- continue;
-
- bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor");
-
- bOnlyConnectionLinesForThisPoint = false;
-
- if(nPointIndex==nStartIndex)//do not create a regression line for each point
- createRegressionCurvesShapes( *pSeries, xRegressionCurveTarget, xRegressionCurveEquationTarget,
- m_pPosHelper->maySkipPointsInRegressionCalculation());
-
- if( !bDrawConnectionLinesInited )
- {
- bDrawConnectionLines = pSeries->getConnectBars();
- if( m_nDimension==3 )
- bDrawConnectionLines = false;
- if( bDrawConnectionLines && rXSlot.m_aSeriesVector.size()==1 )
- {
- //detect whether we have a stacked chart or not:
- StackingDirection eDirection = pSeries->getStackingDirection();
- if( eDirection != StackingDirection_Y_STACKING )
- bDrawConnectionLines = false;
- }
- bDrawConnectionLinesInited = true;
- }
-
- uno::Reference<drawing::XShapes> xSeriesGroupShape_Shapes(getSeriesGroupShape(pSeries.get(), xSeriesTarget));
- uno::Reference<drawing::XShape> xSeriesGroupShape(xSeriesGroupShape_Shapes, uno::UNO_QUERY);
- // Suspend setting rects dirty for the duration of this call
- aShapeSet.insert(xSeriesGroupShape);
- E3dScene* pScene = lcl_getE3dScene(xSeriesGroupShape);
- if (pScene)
- pScene->SuspendReportingDirtyRects();
-
- //collect data point information (logic coordinates, style ):
- double fUnscaledLogicX = pSeries->getXValue( nPointIndex );
- fUnscaledLogicX = DateHelper::RasterizeDateValue( fUnscaledLogicX, m_aNullDate, m_nTimeResolution );
- if(std::isnan(fUnscaledLogicX))
- continue;//point not visible
- if(fUnscaledLogicX<pPosHelper->getLogicMinX())
- continue;//point not visible
- if(fUnscaledLogicX>pPosHelper->getLogicMaxX())
- continue;//point not visible
- if(pPosHelper->isStrongLowerRequested(0) && fUnscaledLogicX==pPosHelper->getLogicMaxX())
- continue;//point not visible
- double fLogicX = pPosHelper->getScaledSlotPos( fUnscaledLogicX, fSlotX );
-
- double fLogicBarHeight = pSeries->getYValue( nPointIndex );
- if( std::isnan( fLogicBarHeight )) //no value at this category
- continue;
-
- double fLogicValueForLabeDisplay = fLogicBarHeight;
- fLogicBarHeight-=fBaseValue;
-
- if( pPosHelper->isPercentY() )
- {
- if(fLogicPositiveYSum!=0.0)
- fLogicBarHeight = fabs( fLogicBarHeight )/fLogicPositiveYSum;
- else
- fLogicBarHeight = 0.0;
- }
-
- // tdf#114141 to draw the top of the zero height 3D bar
- // we set a small positive value, here the smallest one for the type double (DBL_MIN)
- if( fLogicBarHeight == 0.0 )
- fLogicBarHeight = DBL_MIN;
-
- //sort negative and positive values, to display them on different sides of the x axis
- bool bPositive = fLogicBarHeight >= 0.0;
- double fLowerYValue = bPositive ? fPositiveLogicYForNextSeries : fNegativeLogicYForNextSeries;
- double fUpperYValue = fLowerYValue+fLogicBarHeight;
- if( bPositive )
- fPositiveLogicYForNextSeries += fLogicBarHeight;
- else
- fNegativeLogicYForNextSeries += fLogicBarHeight;
-
- if(m_nDimension==3)
- fLogicZ = nZ+0.5;
-
- drawing::Position3D aUnscaledLogicPosition( fUnscaledLogicX, fUpperYValue, fLogicZ );
-
- //@todo ... start an iteration over the different breaks of the axis
- //each subsystem may add an additional shape to form the whole point
- //create a group shape for this point and add to the series shape:
- // uno::Reference< drawing::XShapes > xPointGroupShape_Shapes( createGroupShape(xSeriesGroupShape_Shapes) );
- // uno::Reference<drawing::XShape> xPointGroupShape_Shape =
- // uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
- //as long as we do not iterate we do not need to create an additional group for each point
- uno::Reference< beans::XPropertySet > xDataPointProperties( pSeries->getPropertiesOfPoint( nPointIndex ) );
- sal_Int32 nGeometry3D = DataPointGeometry3D::CUBOID;
- if(m_nDimension==3) try
- {
- xDataPointProperties->getPropertyValue( "Geometry3D") >>= nGeometry3D;
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
-
- //@todo iterate through all subsystems to create partial points
- {
- //@todo select a suitable PositionHelper for this subsystem
- BarPositionHelper* pSubPosHelper = pPosHelper;
-
- double fUnclippedUpperYValue = fUpperYValue;
-
- //apply clipping to Y
- if( !pPosHelper->clipYRange(fLowerYValue,fUpperYValue) )
- {
- if( bDrawConnectionLines )
- bOnlyConnectionLinesForThisPoint = true;
- else
- continue;
- }
- //@todo clipping of X and Z is not fully integrated so far, as there is a need to create different objects
-
- //apply scaling to Y before calculating width (necessary to maintain gradient in clipped objects)
- pSubPosHelper->doLogicScaling(nullptr,&fLowerYValue,nullptr);
- pSubPosHelper->doLogicScaling(nullptr,&fUpperYValue,nullptr);
- //scaling of X and Z is not provided as the created objects should be symmetric in that dimensions
-
- pSubPosHelper->doLogicScaling(nullptr,&fUnclippedUpperYValue,nullptr);
-
- //calculate resulting width
- double fCompleteHeight = bPositive ? fLogicPositiveYSum : fLogicNegativeYSum;
- if( pPosHelper->isPercentY() )
- fCompleteHeight = 1.0;
- double fLogicBarWidth = fLogicBaseWidth;
- double fTopHeight=approxSub(fCompleteHeight,fUpperYValue);
- if(!bPositive)
- fTopHeight=approxSub(fCompleteHeight,fLowerYValue);
- double fLogicYStart = bPositive ? fLowerYValue : fUpperYValue;
- double fMiddleHeight = fUpperYValue-fLowerYValue;
- if(!bPositive)
- fMiddleHeight*=-1.0;
- double fLogicBarDepth = 0.5;
- if(m_nDimension==3)
- {
- if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 )
- {
- double fHeight = fCompleteHeight-fLowerYValue;
- if(!bPositive)
- fHeight = fCompleteHeight-fUpperYValue;
- fLogicBarWidth = fLogicBaseWidth*fHeight/fCompleteHeight;
- if(fLogicBarWidth<=0.0)
- fLogicBarWidth=fLogicBaseWidth;
- fLogicBarDepth = fLogicBarDepth*fHeight/fCompleteHeight;
- if(fLogicBarDepth<=0.0)
- fLogicBarDepth*=-1.0;
- }
- }
-
- //better performance for big data
- FormerBarPoint aFormerPoint( aSeriesFormerPointMap[pSeries.get()] );
- pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
- if( !pSeries->isAttributedDataPoint(nPointIndex)
- &&
- pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fUpperY, aFormerPoint.m_fZ
- , fLogicX, fUpperYValue, fLogicZ )
- &&
- pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fLowerY, aFormerPoint.m_fZ
- , fLogicX, fLowerYValue, fLogicZ )
- )
- {
- nSkippedPoints++;
- m_bPointsWereSkipped = true;
- continue;
- }
- aSeriesFormerPointMap[pSeries.get()] = FormerBarPoint(fLogicX,fUpperYValue,fLowerYValue,fLogicZ);
-
- if( bDrawConnectionLines )
- {
- //store point information for connection lines
-
- drawing::Position3D aLeftUpperPoint( fLogicX-fLogicBarWidth/2.0,fUnclippedUpperYValue,fLogicZ );
- drawing::Position3D aRightUpperPoint( fLogicX+fLogicBarWidth/2.0,fUnclippedUpperYValue,fLogicZ );
-
- if( isValidPosition(aLeftUpperPoint) )
- AddPointToPoly( pSeries->m_aPolyPolygonShape3D, aLeftUpperPoint );
- if( isValidPosition(aRightUpperPoint) )
- AddPointToPoly( pSeries->m_aPolyPolygonShape3D, aRightUpperPoint );
- }
-
- if( bOnlyConnectionLinesForThisPoint )
- continue;
-
- //maybe additional possibility for performance improvement
- //bool bCreateLineInsteadOfComplexGeometryDueToMissingSpace = false;
- //pPosHelper->isSameForGivenResolution( fLogicX-fLogicBarWidth/2.0, fLowerYValue, fLogicZ
- // , fLogicX+fLogicBarWidth/2.0, fLowerYValue, fLogicZ );
-
- nCreatedPoints++;
- //create partial point
- if( !approxEqual(fLowerYValue,fUpperYValue) )
- {
- uno::Reference< drawing::XShape > xShape;
- if( m_nDimension==3 )
- {
- drawing::Position3D aLogicBottom (fLogicX,fLogicYStart,fLogicZ);
- drawing::Position3D aLogicLeftBottomFront (fLogicX+fLogicBarWidth/2.0,fLogicYStart,fLogicZ-fLogicBarDepth/2.0);
- drawing::Position3D aLogicRightDeepTop (fLogicX-fLogicBarWidth/2.0,fLogicYStart+fMiddleHeight,fLogicZ+fLogicBarDepth/2.0);
- drawing::Position3D aLogicTopTop (fLogicX,fLogicYStart+fMiddleHeight+fTopHeight,fLogicZ);
-
- uno::Reference< XTransformation > xTransformation = pSubPosHelper->getTransformationScaledLogicToScene();
-
- //transformation 3) -> 4)
- drawing::Position3D aTransformedBottom ( SequenceToPosition3D( xTransformation->transform( Position3DToSequence(aLogicBottom) ) ) );
- drawing::Position3D aTransformedLeftBottomFront ( SequenceToPosition3D( xTransformation->transform( Position3DToSequence(aLogicLeftBottomFront) ) ) );
- drawing::Position3D aTransformedRightDeepTop ( SequenceToPosition3D( xTransformation->transform( Position3DToSequence(aLogicRightDeepTop) ) ) );
- drawing::Position3D aTransformedTopTop ( SequenceToPosition3D( xTransformation->transform( Position3DToSequence(aLogicTopTop) ) ) );
-
- drawing::Direction3D aSize = aTransformedRightDeepTop - aTransformedLeftBottomFront;
- drawing::Direction3D aTopSize( aTransformedTopTop - aTransformedRightDeepTop );
- fTopHeight = aTopSize.DirectionY;
-
- sal_Int32 nRotateZAngleHundredthDegree = 0;
- if( pPosHelper->isSwapXAndY() )
- {
- fTopHeight = aTopSize.DirectionX;
- nRotateZAngleHundredthDegree = 90*100;
- aSize = drawing::Direction3D(aSize.DirectionY,aSize.DirectionX,aSize.DirectionZ);
- }
-
- if( aSize.DirectionX < 0 )
- aSize.DirectionX *= -1.0;
- if( aSize.DirectionZ < 0 )
- aSize.DirectionZ *= -1.0;
- if( fTopHeight < 0 )
- fTopHeight *= -1.0;
-
- xShape = createDataPoint3D_Bar(
- xSeriesGroupShape_Shapes, aTransformedBottom, aSize, fTopHeight, nRotateZAngleHundredthDegree
- , xDataPointProperties, nGeometry3D );
- }
- else //m_nDimension!=3
- {
- // performance improvement: alloc the sequence before the rendering
- // otherwise we have 2 realloc calls
- drawing::PolyPolygonShape3D aPoly;
- aPoly.SequenceX.realloc(1);
- aPoly.SequenceY.realloc(1);
- aPoly.SequenceZ.realloc(1);
- drawing::Position3D aLeftUpperPoint( fLogicX-fLogicBarWidth/2.0,fUpperYValue,fLogicZ );
- drawing::Position3D aRightUpperPoint( fLogicX+fLogicBarWidth/2.0,fUpperYValue,fLogicZ );
-
- AddPointToPoly( aPoly, drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ) );
- AddPointToPoly( aPoly, drawing::Position3D( fLogicX+fLogicBarWidth/2.0,fLowerYValue,fLogicZ) );
- AddPointToPoly( aPoly, aRightUpperPoint );
- AddPointToPoly( aPoly, aLeftUpperPoint );
- AddPointToPoly( aPoly, drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ) );
- pPosHelper->transformScaledLogicToScene( aPoly );
- xShape = m_pShapeFactory->createArea2D( xSeriesGroupShape_Shapes, aPoly );
- setMappedProperties( xShape, xDataPointProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
- }
-
- if(bHasFillColorMapping)
- {
- double nPropVal = pSeries->getValueByProperty(nPointIndex, "FillColor");
- if(!std::isnan(nPropVal))
- {
- uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
- xProps->setPropertyValue("FillColor", uno::Any(static_cast<sal_Int32>(nPropVal)));
- }
- }
- //set name/classified ObjectID (CID)
- ShapeFactory::setShapeName(xShape
- , ObjectIdentifier::createPointCID(
- pSeries->getPointCID_Stub(),nPointIndex) );
- }
-
- //create error bar
- createErrorBar_Y( aUnscaledLogicPosition, *pSeries, nPointIndex, m_xLogicTarget, &fLogicX );
-
- //create data point label
- if( pSeries->getDataPointLabelIfLabel(nPointIndex) )
- {
- double fLogicSum = aLogicYSumMap[nAttachedAxisIndex];
-
- LabelAlignment eAlignment(LABEL_ALIGN_CENTER);
- sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nPointIndex, m_xChartTypeModel, pPosHelper->isSwapXAndY() );
-
- double fLowerBarDepth = fLogicBarDepth;
- double fUpperBarDepth = fLogicBarDepth;
- {
- if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 )
- {
- double fOuterBarDepth = fLogicBarDepth * fTopHeight/(fabs(fCompleteHeight));
- fLowerBarDepth = (fBaseValue < fUpperYValue) ? fabs(fLogicBarDepth) : fabs(fOuterBarDepth);
- fUpperBarDepth = (fBaseValue < fUpperYValue) ? fabs(fOuterBarDepth) : fabs(fLogicBarDepth);
- }
- }
-
- awt::Point aScreenPosition2D = getLabelScreenPositionAndAlignment(
- eAlignment, nLabelPlacement, fLogicX, fLowerYValue, fUpperYValue, fLogicZ,
- fLowerBarDepth, fUpperBarDepth, fBaseValue, pPosHelper);
- sal_Int32 nOffset = 0;
- if(eAlignment!=LABEL_ALIGN_CENTER)
- {
- nOffset = 100;//add some spacing //@todo maybe get more intelligent values
- if( m_nDimension == 3 )
- nOffset = 260;
- }
- createDataLabel(
- xTextTarget, *pSeries, nPointIndex,
- fLogicValueForLabeDisplay, fLogicSum, aScreenPosition2D, eAlignment, nOffset);
- }
-
- }//end iteration through partial points
-
- }//next series in x slot (next y slot)
- fSlotX+=1.0;
- }//next x slot
+ doZSlot(bDrawConnectionLines, bDrawConnectionLinesInited, rZSlot, nZ, nPointIndex, nStartIndex,
+ xSeriesTarget, xRegressionCurveTarget, xRegressionCurveEquationTarget, xTextTarget,
+ aShapeSet, aSeriesFormerPointMap, aLogicYSumMap);
++nZ;
}//next z slot
}//next category
@@ -928,14 +506,14 @@ void BarChart::createShapes()
{
for( auto const& rZSlot : m_aZSlots )
{
- BarPositionHelper* pPosHelper = m_pMainPosHelper.get();
+ BarPositionHelper* pPosHelper = &m_aMainPosHelper;
if( !rZSlot.empty() )
{
sal_Int32 nAttachedAxisIndex = rZSlot.front().getAttachedAxisIndexForFirstSeries();
//2ND_AXIS_IN_BARS so far one can assume to have the same plotter for each z slot
pPosHelper = dynamic_cast<BarPositionHelper*>(&( getPlottingPositionHelper( nAttachedAxisIndex ) ) );
if(!pPosHelper)
- pPosHelper = m_pMainPosHelper.get();
+ pPosHelper = &m_aMainPosHelper;
}
PlotterBase::m_pPosHelper = pPosHelper;
@@ -947,11 +525,11 @@ void BarChart::createShapes()
{
if(!pSeries)
continue;
- drawing::PolyPolygonShape3D* pSeriesPoly = &pSeries->m_aPolyPolygonShape3D;
+ std::vector<std::vector<css::drawing::Position3D>>* pSeriesPoly = &pSeries->m_aPolyPolygonShape3D;
if(!ShapeFactory::hasPolygonAnyLines(*pSeriesPoly))
continue;
- drawing::PolyPolygonShape3D aPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aPoly;
Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
if(!ShapeFactory::hasPolygonAnyLines(aPoly))
@@ -960,12 +538,10 @@ void BarChart::createShapes()
//transformation 3) -> 4)
pPosHelper->transformScaledLogicToScene( aPoly );
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes(
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes(
getSeriesGroupShape(pSeries.get(), xSeriesTarget) );
- uno::Reference< drawing::XShape > xShape( m_pShapeFactory->createLine2D(
- xSeriesGroupShape_Shapes, PolyToPointSequence( aPoly ) ) );
- setMappedProperties( xShape, pSeries->getPropertiesOfSeries()
- , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ rtl::Reference<SvxShapePolyPolygon> xShape( ShapeFactory::createLine2D(
+ xSeriesGroupShape_Shapes, aPoly ) );
}
}
}
@@ -973,11 +549,420 @@ void BarChart::createShapes()
/* @todo remove series shapes if empty
*/
+}
+
+void BarChart::doZSlot(
+ bool& bDrawConnectionLines, bool& bDrawConnectionLinesInited,
+ const std::vector< VDataSeriesGroup >& rZSlot,
+ const sal_Int32 nZ, const sal_Int32 nPointIndex, const sal_Int32 nStartIndex,
+ const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveEquationTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget,
+ std::unordered_set<rtl::Reference<SvxShape>>& aShapeSet,
+ std::map< VDataSeries*, FormerBarPoint >& aSeriesFormerPointMap,
+ std::map< sal_Int32, double >& aLogicYSumMap)
+{
+ //iterate through all x slots in this category
+ double fSlotX=0;
+ for( auto& rXSlot : rZSlot )
+ {
+ sal_Int32 nAttachedAxisIndex = rXSlot.getAttachedAxisIndexForFirstSeries();
+ //2ND_AXIS_IN_BARS so far one can assume to have the same plotter for each z slot
+ BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( getPlottingPositionHelper( nAttachedAxisIndex ) ) );
+ if(!pPosHelper)
+ pPosHelper = &m_aMainPosHelper;
+
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ //update/create information for current group
+ pPosHelper->updateSeriesCount( rZSlot.size() );
+ double fLogicBaseWidth = pPosHelper->getScaledSlotWidth();
+
+ // get distance from base value to maximum and minimum
+
+ double fMinimumY = 0.0, fMaximumY = 0.0;
+ if( nPointIndex < rXSlot.getPointCount())
+ rXSlot.calculateYMinAndMaxForCategory( nPointIndex
+ , isSeparateStackingForDifferentSigns( 1 ), fMinimumY, fMaximumY, nAttachedAxisIndex );
+
+ double fLogicPositiveYSum = 0.0;
+ if( !std::isnan( fMaximumY ) )
+ fLogicPositiveYSum = fMaximumY;
+
+ double fLogicNegativeYSum = 0.0;
+ if( !std::isnan( fMinimumY ) )
+ fLogicNegativeYSum = fMinimumY;
+
+ if( pPosHelper->isPercentY() )
+ {
+ /* #i70395# fLogicPositiveYSum contains sum of all positive
+ values, if any, otherwise the highest negative value.
+ fLogicNegativeYSum contains sum of all negative values,
+ if any, otherwise the lowest positive value.
+ Afterwards, fLogicPositiveYSum will contain the maximum
+ (positive) value that is related to 100%. */
+
+ // do nothing if there are positive values only
+ if( fLogicNegativeYSum < 0.0 )
+ {
+ // fLogicPositiveYSum<0 => negative values only, use absolute of negative sum
+ if( fLogicPositiveYSum < 0.0 )
+ fLogicPositiveYSum = -fLogicNegativeYSum;
+ // otherwise there are positive and negative values, calculate total distance
+ else
+ fLogicPositiveYSum -= fLogicNegativeYSum;
+ }
+ fLogicNegativeYSum = 0.0;
+ }
+
+ doXSlot(rXSlot, bDrawConnectionLines, bDrawConnectionLinesInited, nZ, nPointIndex, nStartIndex,
+ xSeriesTarget, xRegressionCurveTarget, xRegressionCurveEquationTarget, xTextTarget,
+ aShapeSet, aSeriesFormerPointMap, aLogicYSumMap,
+ fLogicBaseWidth, fSlotX, pPosHelper, fLogicPositiveYSum, fLogicNegativeYSum, nAttachedAxisIndex);
+
+ fSlotX+=1.0;
+ }//next x slot
+}
+
+
+void BarChart::doXSlot(
+ const VDataSeriesGroup& rXSlot,
+ bool& bDrawConnectionLines, bool& bDrawConnectionLinesInited,
+ const sal_Int32 nZ, const sal_Int32 nPointIndex, const sal_Int32 nStartIndex,
+ const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveEquationTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget,
+ std::unordered_set<rtl::Reference<SvxShape>>& aShapeSet,
+ std::map< VDataSeries*, FormerBarPoint >& aSeriesFormerPointMap,
+ std::map< sal_Int32, double >& aLogicYSumMap,
+ const double fLogicBaseWidth, const double fSlotX,
+ BarPositionHelper* const pPosHelper,
+ const double fLogicPositiveYSum, const double fLogicNegativeYSum,
+ const sal_Int32 nAttachedAxisIndex)
+{
+ double fBaseValue = 0.0;
+ if( !pPosHelper->isPercentY() && rXSlot.m_aSeriesVector.size()<=1 )
+ fBaseValue = pPosHelper->getBaseValueY();
+ double fPositiveLogicYForNextSeries = fBaseValue;
+ double fNegativeLogicYForNextSeries = fBaseValue;
+
+ //iterate through all series in this x slot
+ for( std::unique_ptr<VDataSeries> const & pSeries : rXSlot.m_aSeriesVector )
+ {
+ if(!pSeries)
+ continue;
+
+ bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor");
+
+ bool bOnlyConnectionLinesForThisPoint = false;
+
+ if(nPointIndex==nStartIndex)//do not create a regression line for each point
+ createRegressionCurvesShapes( *pSeries, xRegressionCurveTarget, xRegressionCurveEquationTarget,
+ m_pPosHelper->maySkipPointsInRegressionCalculation());
+
+ if( !bDrawConnectionLinesInited )
+ {
+ bDrawConnectionLines = pSeries->getConnectBars();
+ if( m_nDimension==3 )
+ bDrawConnectionLines = false;
+ if( bDrawConnectionLines && rXSlot.m_aSeriesVector.size()==1 )
+ {
+ //detect whether we have a stacked chart or not:
+ StackingDirection eDirection = pSeries->getStackingDirection();
+ if( eDirection != StackingDirection_Y_STACKING )
+ bDrawConnectionLines = false;
+ }
+ bDrawConnectionLinesInited = true;
+ }
+
+ // Use another XShapes for background, so we can avoid needing to set the Z-order on all of them,
+ // which is expensive in bulk.
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes(getSeriesGroupShape(pSeries.get(), xSeriesTarget));
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesBackgroundShape_Shapes(getSeriesGroupShape(pSeries.get(), xSeriesTarget));
+ aShapeSet.insert(xSeriesGroupShape_Shapes);
+ aShapeSet.insert(xSeriesBackgroundShape_Shapes);
+ // Suspend setting rects dirty for the duration of this call
+ E3dScene* pScene = DynCastE3dScene(xSeriesGroupShape_Shapes->GetSdrObject());
+ if (pScene)
+ pScene->SuspendReportingDirtyRects();
+ pScene = DynCastE3dScene(xSeriesBackgroundShape_Shapes->GetSdrObject());
+ if (pScene)
+ pScene->SuspendReportingDirtyRects();
+
+ //collect data point information (logic coordinates, style ):
+ double fUnscaledLogicX = pSeries->getXValue( nPointIndex );
+ fUnscaledLogicX = DateHelper::RasterizeDateValue( fUnscaledLogicX, m_aNullDate, m_nTimeResolution );
+ if(std::isnan(fUnscaledLogicX))
+ continue;//point not visible
+ if(fUnscaledLogicX<pPosHelper->getLogicMinX())
+ continue;//point not visible
+ if(fUnscaledLogicX>pPosHelper->getLogicMaxX())
+ continue;//point not visible
+ if(pPosHelper->isStrongLowerRequested(0) && fUnscaledLogicX==pPosHelper->getLogicMaxX())
+ continue;//point not visible
+ double fLogicX = pPosHelper->getScaledSlotPos( fUnscaledLogicX, fSlotX );
+
+ double fLogicBarHeight = pSeries->getYValue( nPointIndex );
+ if( std::isnan( fLogicBarHeight )) //no value at this category
+ continue;
+
+ double fLogicValueForLabeDisplay = fLogicBarHeight;
+ fLogicBarHeight-=fBaseValue;
+
+ if( pPosHelper->isPercentY() )
+ {
+ if(fLogicPositiveYSum!=0.0)
+ fLogicBarHeight = fabs( fLogicBarHeight )/fLogicPositiveYSum;
+ else
+ fLogicBarHeight = 0.0;
+ }
+
+ // tdf#114141 to draw the top of the zero height 3D bar
+ // we set a small positive value, here the smallest one for the type double (DBL_MIN)
+ if( fLogicBarHeight == 0.0 )
+ fLogicBarHeight = DBL_MIN;
+
+ //sort negative and positive values, to display them on different sides of the x axis
+ bool bPositive = fLogicBarHeight >= 0.0;
+ double fLowerYValue = bPositive ? fPositiveLogicYForNextSeries : fNegativeLogicYForNextSeries;
+ double fUpperYValue = fLowerYValue+fLogicBarHeight;
+ if( bPositive )
+ fPositiveLogicYForNextSeries += fLogicBarHeight;
+ else
+ fNegativeLogicYForNextSeries += fLogicBarHeight;
+
+ double fLogicZ = 1.0;//as defined
+ if(m_nDimension==3)
+ fLogicZ = nZ+0.5;
+
+ drawing::Position3D aUnscaledLogicPosition( fUnscaledLogicX, fUpperYValue, fLogicZ );
+
+ //@todo ... start an iteration over the different breaks of the axis
+ //each subsystem may add an additional shape to form the whole point
+ //create a group shape for this point and add to the series shape:
+// uno::Reference< drawing::XShapes > xPointGroupShape_Shapes( createGroupShape(xSeriesGroupShape_Shapes) );
+// uno::Reference<drawing::XShape> xPointGroupShape_Shape =
+// uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
+ //as long as we do not iterate we do not need to create an additional group for each point
+ uno::Reference< beans::XPropertySet > xDataPointProperties( pSeries->getPropertiesOfPoint( nPointIndex ) );
+ sal_Int32 nGeometry3D = DataPointGeometry3D::CUBOID;
+ if(m_nDimension==3) try
+ {
+ xDataPointProperties->getPropertyValue( "Geometry3D") >>= nGeometry3D;
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+
+ //@todo iterate through all subsystems to create partial points
+ {
+ //@todo select a suitable PositionHelper for this subsystem
+ BarPositionHelper* pSubPosHelper = pPosHelper;
+
+ double fUnclippedUpperYValue = fUpperYValue;
+
+ //apply clipping to Y
+ if( !pPosHelper->clipYRange(fLowerYValue,fUpperYValue) )
+ {
+ if( bDrawConnectionLines )
+ bOnlyConnectionLinesForThisPoint = true;
+ else
+ continue;
+ }
+ //@todo clipping of X and Z is not fully integrated so far, as there is a need to create different objects
+
+ //apply scaling to Y before calculating width (necessary to maintain gradient in clipped objects)
+ pSubPosHelper->doLogicScaling(nullptr,&fLowerYValue,nullptr);
+ pSubPosHelper->doLogicScaling(nullptr,&fUpperYValue,nullptr);
+ //scaling of X and Z is not provided as the created objects should be symmetric in that dimensions
+
+ pSubPosHelper->doLogicScaling(nullptr,&fUnclippedUpperYValue,nullptr);
+
+ //calculate resulting width
+ double fCompleteHeight = bPositive ? fLogicPositiveYSum : fLogicNegativeYSum;
+ if( pPosHelper->isPercentY() )
+ fCompleteHeight = 1.0;
+ double fLogicBarWidth = fLogicBaseWidth;
+ double fTopHeight=approxSub(fCompleteHeight,fUpperYValue);
+ if(!bPositive)
+ fTopHeight=approxSub(fCompleteHeight,fLowerYValue);
+ double fLogicYStart = bPositive ? fLowerYValue : fUpperYValue;
+ double fMiddleHeight = fUpperYValue-fLowerYValue;
+ if(!bPositive)
+ fMiddleHeight*=-1.0;
+ double fLogicBarDepth = 0.5;
+ if(m_nDimension==3)
+ {
+ if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 )
+ {
+ double fHeight = fCompleteHeight-fLowerYValue;
+ if(!bPositive)
+ fHeight = fCompleteHeight-fUpperYValue;
+ fLogicBarWidth = fLogicBaseWidth*fHeight/fCompleteHeight;
+ if(fLogicBarWidth<=0.0)
+ fLogicBarWidth=fLogicBaseWidth;
+ fLogicBarDepth = fLogicBarDepth*fHeight/fCompleteHeight;
+ if(fLogicBarDepth<=0.0)
+ fLogicBarDepth*=-1.0;
+ }
+ }
+
+ //better performance for big data
+ FormerBarPoint aFormerPoint( aSeriesFormerPointMap[pSeries.get()] );
+ pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
+ if( !pSeries->isAttributedDataPoint(nPointIndex)
+ &&
+ pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fUpperY, aFormerPoint.m_fZ
+ , fLogicX, fUpperYValue, fLogicZ )
+ &&
+ pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fLowerY, aFormerPoint.m_fZ
+ , fLogicX, fLowerYValue, fLogicZ )
+ )
+ {
+ m_bPointsWereSkipped = true;
+ continue;
+ }
+ aSeriesFormerPointMap[pSeries.get()] = FormerBarPoint(fLogicX,fUpperYValue,fLowerYValue,fLogicZ);
+
+ if( bDrawConnectionLines )
+ {
+ //store point information for connection lines
+
+ drawing::Position3D aLeftUpperPoint( fLogicX-fLogicBarWidth/2.0,fUnclippedUpperYValue,fLogicZ );
+ drawing::Position3D aRightUpperPoint( fLogicX+fLogicBarWidth/2.0,fUnclippedUpperYValue,fLogicZ );
+
+ if( isValidPosition(aLeftUpperPoint) )
+ AddPointToPoly( pSeries->m_aPolyPolygonShape3D, aLeftUpperPoint );
+ if( isValidPosition(aRightUpperPoint) )
+ AddPointToPoly( pSeries->m_aPolyPolygonShape3D, aRightUpperPoint );
+ }
+
+ if( bOnlyConnectionLinesForThisPoint )
+ continue;
+
+ //maybe additional possibility for performance improvement
+ //bool bCreateLineInsteadOfComplexGeometryDueToMissingSpace = false;
+ //pPosHelper->isSameForGivenResolution( fLogicX-fLogicBarWidth/2.0, fLowerYValue, fLogicZ
+ // , fLogicX+fLogicBarWidth/2.0, fLowerYValue, fLogicZ );
+
+ //create partial point
+ if( !approxEqual(fLowerYValue,fUpperYValue) )
+ {
+ rtl::Reference< SvxShape > xShape;
+ if( m_nDimension==3 )
+ {
+ drawing::Position3D aLogicBottom (fLogicX,fLogicYStart,fLogicZ);
+ drawing::Position3D aLogicLeftBottomFront (fLogicX+fLogicBarWidth/2.0,fLogicYStart,fLogicZ-fLogicBarDepth/2.0);
+ drawing::Position3D aLogicRightDeepTop (fLogicX-fLogicBarWidth/2.0,fLogicYStart+fMiddleHeight,fLogicZ+fLogicBarDepth/2.0);
+ drawing::Position3D aLogicTopTop (fLogicX,fLogicYStart+fMiddleHeight+fTopHeight,fLogicZ);
+
+ ::chart::XTransformation2* pTransformation = pSubPosHelper->getTransformationScaledLogicToScene();
+
+ //transformation 3) -> 4)
+ drawing::Position3D aTransformedBottom ( pTransformation->transform( aLogicBottom ) );
+ drawing::Position3D aTransformedLeftBottomFront ( pTransformation->transform( aLogicLeftBottomFront ) );
+ drawing::Position3D aTransformedRightDeepTop ( pTransformation->transform( aLogicRightDeepTop ) );
+ drawing::Position3D aTransformedTopTop ( pTransformation->transform( aLogicTopTop ) );
+
+ drawing::Direction3D aSize = aTransformedRightDeepTop - aTransformedLeftBottomFront;
+ drawing::Direction3D aTopSize( aTransformedTopTop - aTransformedRightDeepTop );
+ fTopHeight = aTopSize.DirectionY;
+
+ sal_Int32 nRotateZAngleHundredthDegree = 0;
+ if( pPosHelper->isSwapXAndY() )
+ {
+ fTopHeight = aTopSize.DirectionX;
+ nRotateZAngleHundredthDegree = 90*100;
+ aSize = drawing::Direction3D(aSize.DirectionY,aSize.DirectionX,aSize.DirectionZ);
+ }
+
+ if( aSize.DirectionX < 0 )
+ aSize.DirectionX *= -1.0;
+ if( aSize.DirectionZ < 0 )
+ aSize.DirectionZ *= -1.0;
+ if( fTopHeight < 0 )
+ fTopHeight *= -1.0;
+
+ xShape = createDataPoint3D_Bar(
+ xSeriesGroupShape_Shapes, aTransformedBottom, aSize, fTopHeight, nRotateZAngleHundredthDegree
+ , xDataPointProperties, nGeometry3D );
+ }
+ else //m_nDimension!=3
+ {
+ drawing::Position3D aLeftUpperPoint( fLogicX-fLogicBarWidth/2.0,fUpperYValue,fLogicZ );
+ drawing::Position3D aRightUpperPoint( fLogicX+fLogicBarWidth/2.0,fUpperYValue,fLogicZ );
+ std::vector<std::vector<css::drawing::Position3D>> aPoly
+ {
+ { // inner vector
+ drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ),
+ drawing::Position3D( fLogicX+fLogicBarWidth/2.0,fLowerYValue,fLogicZ),
+ aRightUpperPoint,
+ aLeftUpperPoint,
+ drawing::Position3D( fLogicX-fLogicBarWidth/2.0,fLowerYValue,fLogicZ)
+ }
+ };
+ pPosHelper->transformScaledLogicToScene( aPoly );
+ xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes, aPoly );
+ PropertyMapper::setMappedProperties( *xShape, xDataPointProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ }
+
+ if(bHasFillColorMapping)
+ {
+ double nPropVal = pSeries->getValueByProperty(nPointIndex, "FillColor");
+ if(!std::isnan(nPropVal))
+ {
+ xShape->setPropertyValue("FillColor", uno::Any(static_cast<sal_Int32>(nPropVal)));
+ }
+ }
+ //set name/classified ObjectID (CID)
+ ShapeFactory::setShapeName(xShape
+ , ObjectIdentifier::createPointCID(
+ pSeries->getPointCID_Stub(),nPointIndex) );
+ }
+
+ //create error bar
+ createErrorBar_Y( aUnscaledLogicPosition, *pSeries, nPointIndex, m_xLogicTarget, &fLogicX );
+
+ //create data point label
+ if( pSeries->getDataPointLabelIfLabel(nPointIndex) )
+ {
+ double fLogicSum = aLogicYSumMap[nAttachedAxisIndex];
+
+ LabelAlignment eAlignment(LABEL_ALIGN_CENTER);
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nPointIndex, m_xChartTypeModel, pPosHelper->isSwapXAndY() );
+
+ double fLowerBarDepth = fLogicBarDepth;
+ double fUpperBarDepth = fLogicBarDepth;
+ {
+ if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 )
+ {
+ double fOuterBarDepth = fLogicBarDepth * fTopHeight/(fabs(fCompleteHeight));
+ fLowerBarDepth = (fBaseValue < fUpperYValue) ? fabs(fLogicBarDepth) : fabs(fOuterBarDepth);
+ fUpperBarDepth = (fBaseValue < fUpperYValue) ? fabs(fOuterBarDepth) : fabs(fLogicBarDepth);
+ }
+ }
+
+ awt::Point aScreenPosition2D = getLabelScreenPositionAndAlignment(
+ eAlignment, nLabelPlacement, fLogicX, fLowerYValue, fUpperYValue, fLogicZ,
+ fLowerBarDepth, fUpperBarDepth, fBaseValue, pPosHelper);
+ sal_Int32 nOffset = 0;
+ if(eAlignment!=LABEL_ALIGN_CENTER)
+ {
+ nOffset = 100;//add some spacing //@todo maybe get more intelligent values
+ if( m_nDimension == 3 )
+ nOffset = 260;
+ }
+ createDataLabel(
+ xTextTarget, *pSeries, nPointIndex,
+ fLogicValueForLabeDisplay, fLogicSum, aScreenPosition2D, eAlignment, nOffset);
+ }
+
+ }//end iteration through partial points
- SAL_INFO(
- "chart2",
- "skipped points: " << nSkippedPoints << " created points: "
- << nCreatedPoints);
+ }//next series in x slot (next y slot)
}
} //namespace chart
diff --git a/chart2/source/view/charttypes/BarChart.hxx b/chart2/source/view/charttypes/BarChart.hxx
index ed4457affb71..ff46786afcbb 100644
--- a/chart2/source/view/charttypes/BarChart.hxx
+++ b/chart2/source/view/charttypes/BarChart.hxx
@@ -17,15 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_BARCHART_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_BARCHART_HXX
+#pragma once
#include <memory>
#include <VSeriesPlotter.hxx>
+#include "BarPositionHelper.hxx"
namespace chart
{
-class BarPositionHelper;
class BarChart : public VSeriesPlotter
{
@@ -33,7 +32,7 @@ class BarChart : public VSeriesPlotter
public:
BarChart() = delete;
- BarChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
+ BarChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel
, sal_Int32 nDimensionCount );
virtual ~BarChart() override;
@@ -43,9 +42,9 @@ public:
virtual css::drawing::Direction3D getPreferredDiagramAspectRatio() const override;
private: //methods
- css::uno::Reference< css::drawing::XShape >
+ static rtl::Reference< SvxShape >
createDataPoint3D_Bar(
- const css::uno::Reference< css::drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
@@ -62,12 +61,58 @@ private: //methods
void adaptOverlapAndGapwidthForGroupBarsPerAxis();
+ //better performance for big data
+ struct FormerBarPoint
+ {
+ FormerBarPoint( double fX, double fUpperY, double fLowerY, double fZ )
+ : m_fX(fX), m_fUpperY(fUpperY), m_fLowerY(fLowerY), m_fZ(fZ)
+ {}
+ FormerBarPoint()
+ : m_fX(std::numeric_limits<double>::quiet_NaN())
+ , m_fUpperY(std::numeric_limits<double>::quiet_NaN())
+ , m_fLowerY(std::numeric_limits<double>::quiet_NaN())
+ , m_fZ(std::numeric_limits<double>::quiet_NaN())
+ {
+ }
+
+ double m_fX;
+ double m_fUpperY;
+ double m_fLowerY;
+ double m_fZ;
+ };
+
+ void doZSlot(
+ bool& bDrawConnectionLines, bool& bDrawConnectionLinesInited, const std::vector< VDataSeriesGroup >& rZSlot,
+ sal_Int32 nZ, sal_Int32 nPointIndex, sal_Int32 nStartIndex,
+ const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveEquationTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget,
+ std::unordered_set<rtl::Reference<SvxShape>>& aShapeSet,
+ std::map< VDataSeries*, FormerBarPoint >& aSeriesFormerPointMap,
+ std::map< sal_Int32, double >& aLogicYSumMap);
+
+ void doXSlot(
+ const VDataSeriesGroup& rXSlot,
+ bool& bDrawConnectionLines, bool& bDrawConnectionLinesInited,
+ sal_Int32 nZ, sal_Int32 nPointIndex, sal_Int32 nStartIndex,
+ const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveEquationTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget,
+ std::unordered_set<rtl::Reference<SvxShape>>& aShapeSet,
+ std::map< VDataSeries*, FormerBarPoint >& aSeriesFormerPointMap,
+ std::map< sal_Int32, double >& aLogicYSumMap,
+ double fLogicBaseWidth, double fSlotX,
+ BarPositionHelper* const pPosHelper,
+ double fLogicPositiveYSum, double fLogicNegativeYSum,
+ sal_Int32 nAttachedAxisIndex);
+
private: //member
- std::unique_ptr<BarPositionHelper> m_pMainPosHelper;
+ BarPositionHelper m_aMainPosHelper;
css::uno::Sequence< sal_Int32 > m_aOverlapSequence;
css::uno::Sequence< sal_Int32 > m_aGapwidthSequence;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/BarPositionHelper.cxx b/chart2/source/view/charttypes/BarPositionHelper.cxx
index f8ac3e7d62ef..279d998a02e4 100644
--- a/chart2/source/view/charttypes/BarPositionHelper.cxx
+++ b/chart2/source/view/charttypes/BarPositionHelper.cxx
@@ -23,7 +23,6 @@
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
BarPositionHelper::BarPositionHelper()
: CategoryPositionHelper( 1 )
diff --git a/chart2/source/view/charttypes/BarPositionHelper.hxx b/chart2/source/view/charttypes/BarPositionHelper.hxx
index e63fa883708e..961ea988f604 100644
--- a/chart2/source/view/charttypes/BarPositionHelper.hxx
+++ b/chart2/source/view/charttypes/BarPositionHelper.hxx
@@ -17,31 +17,28 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_BARPOSITIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_BARPOSITIONHELPER_HXX
+#pragma once
#include <PlottingPositionHelper.hxx>
#include "CategoryPositionHelper.hxx"
namespace chart
{
-
class BarPositionHelper : public CategoryPositionHelper, public PlottingPositionHelper
{
public:
explicit BarPositionHelper();
- BarPositionHelper( const BarPositionHelper& rSource );
+ BarPositionHelper(const BarPositionHelper& rSource);
virtual ~BarPositionHelper() override;
virtual std::unique_ptr<PlottingPositionHelper> clone() const override;
- void updateSeriesCount( double fSeriesCount ); /*only enter the size of x stacked series*/
+ void updateSeriesCount(double fSeriesCount); /*only enter the size of x stacked series*/
- virtual double getScaledSlotPos( double fCategoryX, double fSeriesNumber ) const override;
- virtual void setScaledCategoryWidth( double fScaledCategoryWidth ) override;
+ virtual double getScaledSlotPos(double fCategoryX, double fSeriesNumber) const override;
+ virtual void setScaledCategoryWidth(double fScaledCategoryWidth) override;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
index 9ad349b9f455..d5bd2c3a16fc 100644
--- a/chart2/source/view/charttypes/BubbleChart.cxx
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -22,21 +22,19 @@
#include <ShapeFactory.hxx>
#include <ObjectIdentifier.hxx>
#include <LabelPositionHelper.hxx>
+#include <ChartType.hxx>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
-#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <limits>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::rtl::math;
-using namespace ::com::sun::star::chart2;
-BubbleChart::BubbleChart( const uno::Reference<XChartType>& xChartTypeModel
+BubbleChart::BubbleChart( const rtl::Reference<ChartType>& xChartTypeModel
, sal_Int32 nDimensionCount )
: VSeriesPlotter( xChartTypeModel, nDimensionCount, false )
, m_fMaxLogicBubbleSize( 0.0 )
@@ -88,8 +86,8 @@ void BubbleChart::calculateBubbleSizeScalingFactor()
drawing::Position3D aSceneMinPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMinX(),m_pMainPosHelper->getLogicMinY(),fLogicZ, false ) );
drawing::Position3D aSceneMaxPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMaxX(),m_pMainPosHelper->getLogicMaxY(),fLogicZ, false ) );
- awt::Point aScreenMinPos( LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMinPos ) );
- awt::Point aScreenMaxPos( LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMaxPos ) );
+ awt::Point aScreenMinPos( LabelPositionHelper(m_nDimension,m_xLogicTarget).transformSceneToScreenPosition( aSceneMinPos ) );
+ awt::Point aScreenMaxPos( LabelPositionHelper(m_nDimension,m_xLogicTarget).transformSceneToScreenPosition( aSceneMaxPos ) );
sal_Int32 nWidth = abs( aScreenMaxPos.X - aScreenMinPos.X );
sal_Int32 nHeight = abs( aScreenMaxPos.Y - aScreenMinPos.Y );
@@ -107,8 +105,8 @@ drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize
double fMaxSize = m_fMaxLogicBubbleSize;
- double fMaxRadius = sqrt( fMaxSize / F_PI );
- double fRadius = sqrt( fLogicSize / F_PI );
+ double fMaxRadius = sqrt( fMaxSize / M_PI );
+ double fRadius = sqrt( fLogicSize / M_PI );
aRet.DirectionX = m_fBubbleSizeFactorToScreen * fRadius / fMaxRadius;
aRet.DirectionY = aRet.DirectionX;
@@ -145,10 +143,10 @@ struct FormerPoint
: m_fX(fX), m_fY(fY), m_fZ(fZ)
{}
FormerPoint()
+ : m_fX(std::numeric_limits<double>::quiet_NaN())
+ , m_fY(std::numeric_limits<double>::quiet_NaN())
+ , m_fZ(std::numeric_limits<double>::quiet_NaN())
{
- ::rtl::math::setNan( &m_fX );
- ::rtl::math::setNan( &m_fY );
- ::rtl::math::setNan( &m_fZ );
}
double m_fX;
@@ -163,16 +161,14 @@ void BubbleChart::createShapes()
if( m_aZSlots.empty() ) //no series
return;
- OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"BubbleChart is not proper initialized");
- if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ OSL_ENSURE(m_xLogicTarget.is()&&m_xFinalTarget.is(),"BubbleChart is not proper initialized");
+ if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
return;
//therefore create an own group for the texts and the error bars to move them to front
//(because the text group is created after the series group the texts are displayed on top)
- uno::Reference< drawing::XShapes > xSeriesTarget(
- createGroupShape( m_xLogicTarget ));
- uno::Reference< drawing::XShapes > xTextTarget(
- m_pShapeFactory->createGroup2D( m_xFinalTarget ));
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesTarget = createGroupShape( m_xLogicTarget );
+ rtl::Reference< SvxShapeGroup > xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget );
//update/create information for current group
double fLogicZ = 1.0;//as defined
@@ -209,7 +205,7 @@ void BubbleChart::createShapes()
bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor");
bool bHasBorderColorMapping = pSeries->hasPropertyMapping("LineColor");
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries.get(), xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries.get(), xSeriesTarget);
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
PlottingPositionHelper& rPosHelper
@@ -263,19 +259,18 @@ void BubbleChart::createShapes()
//create a group shape for this point and add to the series shape:
OUString aPointCID = ObjectIdentifier::createPointCID(
pSeries->getPointCID_Stub(), nIndex );
- uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
+ rtl::Reference<SvxShapeGroupAnyD> xPointGroupShape_Shapes(
createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
- uno::Reference<drawing::XShape> xPointGroupShape_Shape( xPointGroupShape_Shapes, uno::UNO_QUERY );
{
nCreatedPoints++;
//create data point
drawing::Direction3D aSymbolSize = transformToScreenBubbleSize( fBubbleSize );
- uno::Reference<drawing::XShape> xShape = m_pShapeFactory->createCircle2D( xPointGroupShape_Shapes
+ rtl::Reference<SvxShapeCircle> xShape = ShapeFactory::createCircle2D( xPointGroupShape_Shapes
, aScenePosition, aSymbolSize );
- setMappedProperties( xShape
+ PropertyMapper::setMappedProperties( *xShape
, pSeries->getPropertiesOfPoint( nIndex )
, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
@@ -284,8 +279,7 @@ void BubbleChart::createShapes()
double nPropVal = pSeries->getValueByProperty(nIndex, "FillColor");
if(!std::isnan(nPropVal))
{
- uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
- xProps->setPropertyValue("FillColor", uno::Any(static_cast<sal_Int32>(nPropVal)));
+ xShape->SvxShape::setPropertyValue("FillColor", uno::Any(static_cast<sal_Int32>(nPropVal)));
}
}
if(bHasBorderColorMapping)
@@ -293,8 +287,7 @@ void BubbleChart::createShapes()
double nPropVal = pSeries->getValueByProperty(nIndex, "LineColor");
if(!std::isnan(nPropVal))
{
- uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
- xProps->setPropertyValue("LineColor", uno::Any(static_cast<sal_Int32>(nPropVal)));
+ xShape->SvxShape::setPropertyValue("LineColor", uno::Any(static_cast<sal_Int32>(nPropVal)));
}
}
@@ -339,7 +332,7 @@ void BubbleChart::createShapes()
break;
}
- awt::Point aScreenPosition2D( LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ awt::Point aScreenPosition2D( LabelPositionHelper(m_nDimension,m_xLogicTarget)
.transformSceneToScreenPosition( aScenePosition3D ) );
sal_Int32 nOffset = 0;
if(eAlignment!=LABEL_ALIGN_CENTER)
@@ -351,7 +344,7 @@ void BubbleChart::createShapes()
//remove PointGroupShape if empty
if(!xPointGroupShape_Shapes->getCount())
- xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
+ xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shapes);
}//next series in x slot (next y slot)
}//next x slot
diff --git a/chart2/source/view/charttypes/BubbleChart.hxx b/chart2/source/view/charttypes/BubbleChart.hxx
index a4e9f7a75621..c25e5b6345bf 100644
--- a/chart2/source/view/charttypes/BubbleChart.hxx
+++ b/chart2/source/view/charttypes/BubbleChart.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_BUBBLECHART_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_BUBBLECHART_HXX
+#pragma once
#include <VSeriesPlotter.hxx>
#include <com/sun/star/drawing/Direction3D.hpp>
@@ -31,7 +30,7 @@ class BubbleChart : public VSeriesPlotter
public:
BubbleChart() = delete;
- BubbleChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
+ BubbleChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel
, sal_Int32 nDimensionCount );
virtual ~BubbleChart() override;
@@ -57,6 +56,5 @@ private: //member
double m_fBubbleSizeFactorToScreen;//calculated values
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx
index a82c8896592b..5f3a19582e12 100644
--- a/chart2/source/view/charttypes/CandleStickChart.cxx
+++ b/chart2/source/view/charttypes/CandleStickChart.cxx
@@ -18,6 +18,7 @@
*/
#include "CandleStickChart.hxx"
+#include <ChartType.hxx>
#include <ShapeFactory.hxx>
#include <CommonConverters.hxx>
#include <ExplicitCategoriesProvider.hxx>
@@ -25,23 +26,19 @@
#include "BarPositionHelper.hxx"
#include <DateHelper.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::rtl::math;
-using namespace ::com::sun::star::chart2;
-CandleStickChart::CandleStickChart( const uno::Reference<XChartType>& xChartTypeModel
+CandleStickChart::CandleStickChart( const rtl::Reference<ChartType>& xChartTypeModel
, sal_Int32 nDimensionCount )
: VSeriesPlotter( xChartTypeModel, nDimensionCount )
- , m_pMainPosHelper( new BarPositionHelper() )
{
- PlotterBase::m_pPosHelper = m_pMainPosHelper.get();
- VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper.get();
+ PlotterBase::m_pPosHelper = &m_aMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = &m_aMainPosHelper;
}
CandleStickChart::~CandleStickChart()
@@ -79,24 +76,24 @@ void CandleStickChart::createShapes()
if( m_nDimension!=2 )
return;
- OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"CandleStickChart is not proper initialized");
- if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ OSL_ENSURE(m_xLogicTarget.is()&&m_xFinalTarget.is(),"CandleStickChart is not proper initialized");
+ if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
return;
//the text labels should be always on top of the other series shapes
//therefore create an own group for the texts to move them to front
//(because the text group is created after the series group the texts are displayed on top)
- uno::Reference< drawing::XShapes > xSeriesTarget(
- createGroupShape( m_xLogicTarget ));
- uno::Reference< drawing::XShapes > xLossTarget(
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesTarget =
+ createGroupShape( m_xLogicTarget );
+ rtl::Reference<SvxShapeGroupAnyD> xLossTarget =
createGroupShape( m_xLogicTarget, ObjectIdentifier::createClassifiedIdentifier(
- OBJECTTYPE_DATA_STOCK_LOSS, OUString() )));
- uno::Reference< drawing::XShapes > xGainTarget(
+ OBJECTTYPE_DATA_STOCK_LOSS, u"" ));
+ rtl::Reference<SvxShapeGroupAnyD> xGainTarget =
createGroupShape( m_xLogicTarget, ObjectIdentifier::createClassifiedIdentifier(
- OBJECTTYPE_DATA_STOCK_GAIN, OUString() )));
- uno::Reference< drawing::XShapes > xTextTarget(
- m_pShapeFactory->createGroup2D( m_xFinalTarget ));
+ OBJECTTYPE_DATA_STOCK_GAIN, u"" ));
+ rtl::Reference< SvxShapeGroup > xTextTarget =
+ ShapeFactory::createGroup2D( m_xFinalTarget );
//check necessary here that different Y axis can not be stacked in the same group? ... hm?
@@ -106,15 +103,15 @@ void CandleStickChart::createShapes()
tAnySequence aWhiteBox_Values, aBlackBox_Values;
try
{
- if( m_xChartTypeModelProps.is() )
+ if( m_xChartTypeModel.is() )
{
- m_xChartTypeModelProps->getPropertyValue( "ShowFirst" ) >>= bShowFirst;
+ m_xChartTypeModel->getPropertyValue( "ShowFirst" ) >>= bShowFirst;
uno::Reference< beans::XPropertySet > xWhiteDayProps;
uno::Reference< beans::XPropertySet > xBlackDayProps;
- m_xChartTypeModelProps->getPropertyValue( "Japanese" ) >>= bJapaneseStyle;
- m_xChartTypeModelProps->getPropertyValue( "WhiteDay" ) >>= xWhiteDayProps;
- m_xChartTypeModelProps->getPropertyValue( "BlackDay" ) >>= xBlackDayProps;
+ m_xChartTypeModel->getPropertyValue( "Japanese" ) >>= bJapaneseStyle;
+ m_xChartTypeModel->getPropertyValue( "WhiteDay" ) >>= xWhiteDayProps;
+ m_xChartTypeModel->getPropertyValue( "BlackDay" ) >>= xBlackDayProps;
tPropertyNameValueMap aWhiteBox_Map;
PropertyMapper::getValueMap( aWhiteBox_Map, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xWhiteDayProps );
@@ -138,15 +135,14 @@ void CandleStickChart::createShapes()
{
for( auto const& rZSlot : m_aZSlots )
{
- sal_Int32 nAttachedAxisIndex = 0;
- BarPositionHelper* pPosHelper = m_pMainPosHelper.get();
+ BarPositionHelper* pPosHelper = &m_aMainPosHelper;
if( !rZSlot.empty() )
{
- nAttachedAxisIndex = rZSlot.front().getAttachedAxisIndexForFirstSeries();
+ sal_Int32 nAttachedAxisIndex = rZSlot.front().getAttachedAxisIndexForFirstSeries();
//2ND_AXIS_IN_BARS so far one can assume to have the same plotter for each z slot
pPosHelper = dynamic_cast<BarPositionHelper*>(&( getPlottingPositionHelper( nAttachedAxisIndex ) ) );
if(!pPosHelper)
- pPosHelper = m_pMainPosHelper.get();
+ pPosHelper = &m_aMainPosHelper;
}
PlotterBase::m_pPosHelper = pPosHelper;
@@ -203,30 +199,27 @@ void CandleStickChart::createShapes()
drawing::Position3D aPosMiddleMinimum( pPosHelper->transformScaledLogicToScene( fScaledX, fScaledY_Min ,0 ,true ) );
drawing::Position3D aPosMiddleMaximum( pPosHelper->transformScaledLogicToScene( fScaledX, fScaledY_Max ,0 ,true ) );
- uno::Reference< drawing::XShapes > xLossGainTarget( xGainTarget );
- if(bBlack)
- xLossGainTarget = xLossTarget;
+ rtl::Reference<SvxShapeGroupAnyD> xLossGainTarget(bBlack ? xLossTarget : xGainTarget);
uno::Reference< beans::XPropertySet > xPointProp( pSeries->getPropertiesOfPoint( nIndex ));
- uno::Reference< drawing::XShapes > xPointGroupShape_Shapes;
+ rtl::Reference<SvxShapeGroupAnyD> xPointGroupShape_Shapes;
{
OUString aPointCID = ObjectIdentifier::createPointCID( pSeries->getPointCID_Stub(), nIndex );
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes( getSeriesGroupShape(pSeries.get(), xSeriesTarget) );
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes( getSeriesGroupShape(pSeries.get(), xSeriesTarget) );
xPointGroupShape_Shapes = createGroupShape(xSeriesGroupShape_Shapes,aPointCID);
}
//create min-max line
if( isValidPosition(aPosMiddleMinimum) && isValidPosition(aPosMiddleMaximum) )
{
- drawing::PolyPolygonShape3D aPoly;
- sal_Int32 nLineIndex =0;
- AddPointToPoly( aPoly, aPosMiddleMinimum, nLineIndex);
- AddPointToPoly( aPoly, aPosMiddleMaximum, nLineIndex);
-
- uno::Reference< drawing::XShape > xShape =
- m_pShapeFactory->createLine2D( xPointGroupShape_Shapes,
- PolyToPointSequence(aPoly));
- setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
+ std::vector<std::vector<css::drawing::Position3D>> aPoly
+ {
+ { aPosMiddleMinimum, aPosMiddleMaximum }
+ };
+
+ rtl::Reference<SvxShapePolyPolygon> xShape =
+ ShapeFactory::createLine2D( xPointGroupShape_Shapes, aPoly);
+ PropertyMapper::setMappedProperties( *xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
}
//create first-last shape
@@ -241,23 +234,19 @@ void CandleStickChart::createShapes()
tNameSequence aNames;
tAnySequence aValues;
- uno::Reference< drawing::XShape > xShape =
- m_pShapeFactory->createRectangle( xLossGainTarget,
+ rtl::Reference<SvxShapeRect> xShape =
+ ShapeFactory::createRectangle( xLossGainTarget,
aAWTSize, Position3DToAWTPoint( aPosLeftFirst ),
aNames, aValues);
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- if(xProp.is())
- {
- if(bBlack)
- PropertyMapper::setMultiProperties( aBlackBox_Names, aBlackBox_Values, xProp );
- else
- PropertyMapper::setMultiProperties( aWhiteBox_Names, aWhiteBox_Values, xProp );
- }
+ if(bBlack)
+ PropertyMapper::setMultiProperties( aBlackBox_Names, aBlackBox_Values, *xShape );
+ else
+ PropertyMapper::setMultiProperties( aWhiteBox_Names, aWhiteBox_Values, *xShape );
}
else
{
- drawing::PolyPolygonShape3D aPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aPoly;
sal_Int32 nLineIndex = 0;
if( bShowFirst && pPosHelper->isLogicVisible( fUnscaledX, fUnscaledY_First ,fLogicZ )
@@ -273,16 +262,11 @@ void CandleStickChart::createShapes()
AddPointToPoly( aPoly, aPosRightLast, nLineIndex );
}
- if( aPoly.SequenceX.hasElements() )
+ if( !aPoly.empty() )
{
- uno::Reference< drawing::XShape > xShape =
- m_pShapeFactory->createLine2D( xPointGroupShape_Shapes,
- PolyToPointSequence(aPoly) );
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- if(xProp.is())
- {
- setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
- }
+ rtl::Reference<SvxShapePolyPolygon> xShape =
+ ShapeFactory::createLine2D( xPointGroupShape_Shapes, aPoly );
+ PropertyMapper::setMappedProperties( *xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
}
}
diff --git a/chart2/source/view/charttypes/CandleStickChart.hxx b/chart2/source/view/charttypes/CandleStickChart.hxx
index 2d289131827a..3202cf0d7eaf 100644
--- a/chart2/source/view/charttypes/CandleStickChart.hxx
+++ b/chart2/source/view/charttypes/CandleStickChart.hxx
@@ -17,15 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_CANDLESTICKCHART_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_CANDLESTICKCHART_HXX
+#pragma once
#include <memory>
+#include "BarPositionHelper.hxx"
#include <VSeriesPlotter.hxx>
namespace chart
{
-class BarPositionHelper;
class CandleStickChart : public VSeriesPlotter
{
@@ -33,7 +32,7 @@ class CandleStickChart : public VSeriesPlotter
public:
CandleStickChart() = delete;
- CandleStickChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
+ CandleStickChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel
, sal_Int32 nDimensionCount );
virtual ~CandleStickChart() override;
@@ -48,9 +47,8 @@ public:
virtual LegendSymbolStyle getLegendSymbolStyle() override;
private: //member
- std::unique_ptr<BarPositionHelper> m_pMainPosHelper;
+ BarPositionHelper m_aMainPosHelper;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/CategoryPositionHelper.hxx b/chart2/source/view/charttypes/CategoryPositionHelper.hxx
index 2fd0d3d0aaaa..ebc784ef66cc 100644
--- a/chart2/source/view/charttypes/CategoryPositionHelper.hxx
+++ b/chart2/source/view/charttypes/CategoryPositionHelper.hxx
@@ -17,43 +17,41 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_CATEGORYPOSITIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_CATEGORYPOSITIONHELPER_HXX
+#pragma once
namespace chart
{
-
class CategoryPositionHelper
{
public:
- CategoryPositionHelper( double fSeriesCount, double CategoryWidth = 1.0);
+ CategoryPositionHelper(double fSeriesCount, double CategoryWidth = 1.0);
virtual ~CategoryPositionHelper();
- CategoryPositionHelper(CategoryPositionHelper const &) = default;
- CategoryPositionHelper(CategoryPositionHelper &&) = default;
- CategoryPositionHelper & operator =(CategoryPositionHelper const &) = default;
- CategoryPositionHelper & operator =(CategoryPositionHelper &&) = default;
+ CategoryPositionHelper(CategoryPositionHelper const&) = default;
+ CategoryPositionHelper(CategoryPositionHelper&&) = default;
+ CategoryPositionHelper& operator=(CategoryPositionHelper const&) = default;
+ CategoryPositionHelper& operator=(CategoryPositionHelper&&) = default;
double getScaledSlotWidth() const;
- virtual double getScaledSlotPos( double fCategoryX, double fSeriesNumber ) const;
- void setCategoryWidth( double fCategoryWidth );
+ virtual double getScaledSlotPos(double fCategoryX, double fSeriesNumber) const;
+ void setCategoryWidth(double fCategoryWidth);
//Distance between two neighboring bars in same category, seen relative to width of the bar
- void setInnerDistance( double fInnerDistance );
+ void setInnerDistance(double fInnerDistance);
//Distance between two neighboring bars in different category, seen relative to width of the bar:
- void setOuterDistance( double fOuterDistance );
+ void setOuterDistance(double fOuterDistance);
protected:
double m_fSeriesCount;
double m_fCategoryWidth;
//Distance between two neighboring bars in same category, seen relative to width of the bar:
- double m_fInnerDistance; //[-1,1] m_fInnerDistance=1 --> distance == width; m_fInnerDistance=-1-->all rects are painted on the same position
+ double
+ m_fInnerDistance; //[-1,1] m_fInnerDistance=1 --> distance == width; m_fInnerDistance=-1-->all rects are painted on the same position
//Distance between two neighboring bars in different category, seen relative to width of the bar:
double m_fOuterDistance; //>=0 m_fOuterDistance=1 --> distance == width
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/ConfigAccess.cxx b/chart2/source/view/charttypes/ConfigAccess.cxx
deleted file mode 100644
index 964e58ce43f7..000000000000
--- a/chart2/source/view/charttypes/ConfigAccess.cxx
+++ /dev/null
@@ -1,82 +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 <ConfigAccess.hxx>
-
-#include <unotools/configitem.hxx>
-#include <o3tl/any.hxx>
-#include <rtl/instance.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-namespace chart
-{
-using namespace ::com::sun::star;
-
-namespace
-{
-class ChartConfigItem : public ::utl::ConfigItem
-{
-private:
- virtual void ImplCommit() override;
-
-public:
- ChartConfigItem();
-
- bool getUseErrorRectangle();
- virtual void Notify(const uno::Sequence<OUString>& aPropertyNames) override;
-};
-}
-
-ChartConfigItem::ChartConfigItem()
- : ConfigItem("Office.Chart/ErrorProperties")
-{
-}
-
-void ChartConfigItem::ImplCommit() {}
-void ChartConfigItem::Notify(const uno::Sequence<OUString>&) {}
-
-bool ChartConfigItem::getUseErrorRectangle()
-{
- uno::Sequence<OUString> aNames(1);
- aNames[0] = "ErrorRectangle";
-
- auto b = o3tl::tryAccess<bool>(GetProperties(aNames)[0]);
- return b && *b;
-}
-
-namespace
-{
-//a ChartConfigItem Singleton
-struct theChartConfigItem : public rtl::Static<ChartConfigItem, theChartConfigItem>
-{
-};
-}
-
-namespace ConfigAccess
-{
-bool getUseErrorRectangle()
-{
- bool bResult(theChartConfigItem::get().getUseErrorRectangle());
- return bResult;
-}
-} //namespace ConfigAccess
-
-} //namespace chart
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx
index a8a0f776dd24..5b8f1db34be5 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -27,24 +27,25 @@
#include <Clipping.hxx>
#include <PolarLabelPositionHelper.hxx>
#include <DateHelper.hxx>
+#include <ChartType.hxx>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
-#include <rtl/math.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <officecfg/Office/Compatibility.hxx>
+#include <limits>
+
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::rtl::math;
using namespace ::com::sun::star::chart2;
-NetChart::NetChart( const uno::Reference<XChartType>& xChartTypeModel
+NetChart::NetChart( const rtl::Reference<ChartType>& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bNoArea
, std::unique_ptr<PlottingPositionHelper> pPlottingPositionHelper
@@ -111,13 +112,13 @@ drawing::Direction3D NetChart::getPreferredDiagramAspectRatio() const
}
bool NetChart::impl_createLine( VDataSeries* pSeries
- , drawing::PolyPolygonShape3D* pSeriesPoly
+ , const std::vector<std::vector<css::drawing::Position3D>>* pSeriesPoly
, PlottingPositionHelper const * pPosHelper )
{
//return true if a line was created successfully
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
- drawing::PolyPolygonShape3D aPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aPoly;
{
bool bIsClipped = false;
if( !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
@@ -130,10 +131,10 @@ bool NetChart::impl_createLine( VDataSeries* pSeries
{
// connect last point in last polygon with first point in first polygon
::basegfx::B2DRectangle aScaledLogicClipDoubleRect( pPosHelper->getScaledLogicClipDoubleRect() );
- drawing::PolyPolygonShape3D aTmpPoly(*pSeriesPoly);
- drawing::Position3D aLast(aScaledLogicClipDoubleRect.getMaxX(),aTmpPoly.SequenceY[0][0],aTmpPoly.SequenceZ[0][0]);
+ std::vector<std::vector<css::drawing::Position3D>> aTmpPoly(*pSeriesPoly);
+ drawing::Position3D aLast(aScaledLogicClipDoubleRect.getMaxX(),aTmpPoly[0][0].PositionY,aTmpPoly[0][0].PositionZ);
// add connector line to last polygon
- AddPointToPoly( aTmpPoly, aLast, pSeriesPoly->SequenceX.getLength() - 1 );
+ AddPointToPoly( aTmpPoly, aLast, pSeriesPoly->size() - 1 );
Clipping::clipPolygonAtRectangle( aTmpPoly, aScaledLogicClipDoubleRect, aPoly );
bIsClipped = true;
}
@@ -150,11 +151,10 @@ bool NetChart::impl_createLine( VDataSeries* pSeries
pPosHelper->transformScaledLogicToScene( aPoly );
//create line:
- uno::Reference< drawing::XShape > xShape;
+ rtl::Reference<SvxShapePolyPolygon> xShape;
{
- xShape = m_pShapeFactory->createLine2D( xSeriesGroupShape_Shapes
- , PolyToPointSequence( aPoly ) );
- setMappedProperties( xShape
+ xShape = ShapeFactory::createLine2D( xSeriesGroupShape_Shapes, aPoly );
+ PropertyMapper::setMappedProperties( *xShape
, pSeries->getPropertiesOfSeries()
, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
//because of this name this line will be used for marking
@@ -164,16 +164,16 @@ bool NetChart::impl_createLine( VDataSeries* pSeries
}
bool NetChart::impl_createArea( VDataSeries* pSeries
- , drawing::PolyPolygonShape3D* pSeriesPoly
- , drawing::PolyPolygonShape3D const * pPreviousSeriesPoly
+ , const std::vector<std::vector<css::drawing::Position3D>>* pSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pPreviousSeriesPoly
, PlottingPositionHelper const * pPosHelper )
{
//return true if an area was created successfully
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
double zValue = pSeries->m_fLogicZPos;
- drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
+ std::vector<std::vector<css::drawing::Position3D>> aPoly( *pSeriesPoly );
//add second part to the polygon (grounding points or previous series points)
if( !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
{
@@ -209,7 +209,7 @@ bool NetChart::impl_createArea( VDataSeries* pSeries
//apply clipping
{
- drawing::PolyPolygonShape3D aClippedPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aClippedPoly;
Clipping::clipPolygonAtRectangle( aPoly, pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false );
ShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping
aPoly = aClippedPoly;
@@ -222,10 +222,10 @@ bool NetChart::impl_createArea( VDataSeries* pSeries
pPosHelper->transformScaledLogicToScene( aPoly );
//create area:
- uno::Reference< drawing::XShape >
- xShape = m_pShapeFactory->createArea2D( xSeriesGroupShape_Shapes
+ rtl::Reference<SvxShapePolyPolygon>
+ xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes
, aPoly );
- setMappedProperties( xShape
+ PropertyMapper::setMappedProperties( *xShape
, pSeries->getPropertiesOfSeries()
, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
//because of this name this line will be used for marking
@@ -242,8 +242,8 @@ void NetChart::impl_createSeriesShapes()
{
for( auto const& rXSlot : rZSlot )
{
- std::map< sal_Int32, drawing::PolyPolygonShape3D* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
- drawing::PolyPolygonShape3D* pSeriesPoly = nullptr;
+ std::map< sal_Int32, std::vector<std::vector<css::drawing::Position3D>>* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
+ std::vector<std::vector<css::drawing::Position3D>>* pSeriesPoly = nullptr;
//iterate through all series
for( std::unique_ptr<VDataSeries> const & pSeries : rXSlot.m_aSeriesVector )
@@ -301,10 +301,11 @@ struct FormerPoint
: m_fX(fX), m_fY(fY), m_fZ(fZ)
{}
FormerPoint()
+ : m_fX(std::numeric_limits<double>::quiet_NaN())
+ , m_fY(std::numeric_limits<double>::quiet_NaN())
+ , m_fZ(std::numeric_limits<double>::quiet_NaN())
+
{
- ::rtl::math::setNan( &m_fX );
- ::rtl::math::setNan( &m_fY );
- ::rtl::math::setNan( &m_fZ );
}
double m_fX;
@@ -323,8 +324,8 @@ void NetChart::createShapes()
if (officecfg::Office::Compatibility::View::ReverseSeriesOrderAreaAndNetChart::get() && m_bArea)
lcl_reorderSeries( m_aZSlots );
- OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"NetChart is not proper initialized");
- if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ OSL_ENSURE(m_xLogicTarget.is()&&m_xFinalTarget.is(),"NetChart is not proper initialized");
+ if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
return;
//the text labels should be always on top of the other series shapes
@@ -333,7 +334,7 @@ void NetChart::createShapes()
//therefore create an own group for the texts and the error bars to move them to front
//(because the text group is created after the series group the texts are displayed on top)
m_xSeriesTarget = createGroupShape( m_xLogicTarget );
- m_xTextTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget );
+ m_xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget );
//check necessary here that different Y axis can not be stacked in the same group? ... hm?
@@ -369,8 +370,7 @@ void NetChart::createShapes()
pSeries->doSortByXValues();
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
- if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() )
- aLogicYSumMap[nAttachedAxisIndex]=0.0;
+ aLogicYSumMap.insert({nAttachedAxisIndex, 0.0});
m_pPosHelper = &getPlottingPositionHelper(nAttachedAxisIndex);
@@ -400,7 +400,7 @@ void NetChart::createShapes()
if( m_bArea && (rXSlot.m_aSeriesVector.size() == 1) && (nIndex >= pSeries->getTotalPointCount()) )
continue;
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget);
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
m_pPosHelper = &getPlottingPositionHelper(nAttachedAxisIndex);
@@ -439,11 +439,11 @@ void NetChart::createShapes()
{
if( pSeries->getMissingValueTreatment() == css::chart::MissingValueTreatment::LEAVE_GAP )
{
- drawing::PolyPolygonShape3D& rPolygon = pSeries->m_aPolyPolygonShape3D;
+ std::vector<std::vector<css::drawing::Position3D>>& rPolygon = pSeries->m_aPolyPolygonShape3D;
sal_Int32& rIndex = pSeries->m_nPolygonIndex;
- if( 0<= rIndex && rIndex < rPolygon.SequenceX.getLength() )
+ if( 0<= rIndex && o3tl::make_unsigned(rIndex) < rPolygon.size() )
{
- if( rPolygon.SequenceX[ rIndex ].hasElements() )
+ if( !rPolygon[ rIndex ].empty() )
rIndex++; //start a new polygon for the next point if the current poly is not empty
}
}
@@ -527,9 +527,8 @@ void NetChart::createShapes()
//create a group shape for this point and add to the series shape:
OUString aPointCID = ObjectIdentifier::createPointCID(
pSeries->getPointCID_Stub(), nIndex );
- uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
+ rtl::Reference<SvxShapeGroupAnyD> xPointGroupShape_Shapes(
createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
- uno::Reference<drawing::XShape> xPointGroupShape_Shape( xPointGroupShape_Shapes, uno::UNO_QUERY );
{
//create data point
@@ -545,13 +544,13 @@ void NetChart::createShapes()
if (pSymbolProperties->Style == SymbolStyle_STANDARD)
{
sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
- m_pShapeFactory->createSymbol2D(
+ ShapeFactory::createSymbol2D(
xPointGroupShape_Shapes, aScenePosition, aSymbolSize, nSymbol,
pSymbolProperties->BorderColor, pSymbolProperties->FillColor);
}
else if (pSymbolProperties->Style == SymbolStyle_GRAPHIC)
{
- m_pShapeFactory->createGraphic2D(xPointGroupShape_Shapes,
+ ShapeFactory::createGraphic2D(xPointGroupShape_Shapes,
aScenePosition, aSymbolSize,
pSymbolProperties->Graphic);
}
@@ -606,7 +605,7 @@ void NetChart::createShapes()
= dynamic_cast<PolarPlottingPositionHelper*>(m_pPosHelper);
if( pPolarPosHelper )
{
- PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
+ PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget);
aScreenPosition2D = aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
eAlignment, fLogicX, fLogicY, fLogicZ, nOffset );
}
@@ -615,7 +614,7 @@ void NetChart::createShapes()
{
if(eAlignment==LABEL_ALIGN_CENTER )
nOffset = 0;
- aScreenPosition2D = LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ aScreenPosition2D = LabelPositionHelper(m_nDimension,m_xLogicTarget)
.transformSceneToScreenPosition( aScenePosition3D );
}
@@ -627,7 +626,7 @@ void NetChart::createShapes()
//remove PointGroupShape if empty
if(!xPointGroupShape_Shapes->getCount())
- xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
+ xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shapes);
}//next series in x slot (next y slot)
}//next x slot
diff --git a/chart2/source/view/charttypes/NetChart.hxx b/chart2/source/view/charttypes/NetChart.hxx
index 2d948d2e2138..a536daf15fd2 100644
--- a/chart2/source/view/charttypes/NetChart.hxx
+++ b/chart2/source/view/charttypes/NetChart.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_NETCHART_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_NETCHART_HXX
+#pragma once
#include <memory>
#include <VSeriesPlotter.hxx>
@@ -32,7 +31,7 @@ class NetChart : public VSeriesPlotter
public:
NetChart() = delete;
- NetChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
+ NetChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bNoArea
, std::unique_ptr<PlottingPositionHelper> pPlottingPositionHelper //takes ownership
@@ -54,11 +53,11 @@ public:
private: //methods
void impl_createSeriesShapes();
bool impl_createArea( VDataSeries* pSeries
- , css::drawing::PolyPolygonShape3D* pSeriesPoly
- , css::drawing::PolyPolygonShape3D const * pPreviousSeriesPoly
+ , const std::vector<std::vector<css::drawing::Position3D>>* pSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pPreviousSeriesPoly
, PlottingPositionHelper const * pPosHelper );
bool impl_createLine( VDataSeries* pSeries
- , css::drawing::PolyPolygonShape3D* pSeriesPoly
+ , const std::vector<std::vector<css::drawing::Position3D>>* pSeriesPoly
, PlottingPositionHelper const * pPosHelper );
private: //member
@@ -67,10 +66,9 @@ private: //member
bool m_bArea;//false -> line or symbol only
bool m_bLine;
- css::uno::Reference< css::drawing::XShapes > m_xSeriesTarget;
- css::uno::Reference< css::drawing::XShapes > m_xTextTarget;
+ rtl::Reference<SvxShapeGroupAnyD> m_xSeriesTarget;
+ rtl::Reference<SvxShapeGroupAnyD> m_xTextTarget;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 5ab60729cf93..ff8cf62f133a 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -20,29 +20,29 @@
#include <BaseGFXHelper.hxx>
#include <VLineProperties.hxx>
#include "PieChart.hxx"
-#include <PlottingPositionHelper.hxx>
#include <ShapeFactory.hxx>
#include <PolarLabelPositionHelper.hxx>
#include <CommonConverters.hxx>
#include <ObjectIdentifier.hxx>
+#include <ChartType.hxx>
+#include <DataSeries.hxx>
+#include <DataSeriesProperties.hxx>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
-#include <com/sun/star/chart2/XChartType.hpp>
#include <com/sun/star/chart2/XColorScheme.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <rtl/math.hxx>
+#include <com/sun/star/drawing/XShapes.hpp>
#include <sal/log.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/helpers.hxx>
+#include <limits>
#include <memory>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
namespace chart {
@@ -101,17 +101,28 @@ struct PieChart::ShapeParam
mfDepth(0.0) {}
};
-class PiePositionHelper : public PolarPlottingPositionHelper
+namespace
+{
+::basegfx::B2IRectangle lcl_getRect(const rtl::Reference<SvxShape>& xShape)
{
-public:
- PiePositionHelper( double fAngleDegreeOffset );
+ ::basegfx::B2IRectangle aRect;
+ if (xShape.is())
+ aRect = BaseGFXHelper::makeRectangle(xShape->getPosition(), xShape->getSize());
+ return aRect;
+}
- bool getInnerAndOuterRadius( double fCategoryX, double& fLogicInnerRadius, double& fLogicOuterRadius, bool bUseRings, double fMaxOffset ) const;
+bool lcl_isInsidePage(const awt::Point& rPos, const awt::Size& rSize, const awt::Size& rPageSize)
+{
+ if (rPos.X < 0 || rPos.Y < 0)
+ return false;
+ if ((rPos.X + rSize.Width) > rPageSize.Width)
+ return false;
+ if ((rPos.Y + rSize.Height) > rPageSize.Height)
+ return false;
+ return true;
+}
-public:
- //Distance between different category rings, seen relative to width of a ring:
- double m_fRingDistance; //>=0 m_fRingDistance=1 --> distance == width
-};
+} //end anonymous namespace
PiePositionHelper::PiePositionHelper( double fAngleDegreeOffset )
: m_fRingDistance(0.0)
@@ -167,49 +178,64 @@ bool PiePositionHelper::getInnerAndOuterRadius( double fCategoryX
return true;
}
-PieChart::PieChart( const uno::Reference<XChartType>& xChartTypeModel
+
+bool PiePositionHelper::clockwiseWedges() const
+{
+ const ExplicitScaleData& rAngleScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[0];
+ return rAngleScale.Orientation == AxisOrientation_REVERSE;
+}
+
+
+PieChart::PieChart( const rtl::Reference<ChartType>& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bExcludingPositioning )
: VSeriesPlotter( xChartTypeModel, nDimensionCount )
- , m_pPosHelper( new PiePositionHelper( (m_nDimension==3) ? 0.0 : 90.0 ) )
+ , m_aPosHelper( (m_nDimension==3) ? 0.0 : 90.0 )
, m_bUseRings(false)
, m_bSizeExcludesLabelsAndExplodedSegments(bExcludingPositioning)
+ , m_eSubType(PieChartSubType_NONE)
+ , m_fMaxOffset(std::numeric_limits<double>::quiet_NaN())
{
- ::rtl::math::setNan(&m_fMaxOffset);
+ PlotterBase::m_pPosHelper = &m_aPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = &m_aPosHelper;
+ m_aPosHelper.m_fRadiusOffset = 0.0;
+ m_aPosHelper.m_fRingDistance = 0.0;
- PlotterBase::m_pPosHelper = m_pPosHelper.get();
- VSeriesPlotter::m_pMainPosHelper = m_pPosHelper.get();
- m_pPosHelper->m_fRadiusOffset = 0.0;
- m_pPosHelper->m_fRingDistance = 0.0;
-
- uno::Reference< beans::XPropertySet > xChartTypeProps( xChartTypeModel, uno::UNO_QUERY );
- if( !xChartTypeProps.is() )
+ if( !xChartTypeModel.is() )
return;
try
{
- xChartTypeProps->getPropertyValue( "UseRings") >>= m_bUseRings;
+ xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_USE_RINGS) >>= m_bUseRings; // "UseRings"
if( m_bUseRings )
{
- m_pPosHelper->m_fRadiusOffset = 1.0;
+ m_aPosHelper.m_fRadiusOffset = 1.0;
if( nDimensionCount==3 )
- m_pPosHelper->m_fRingDistance = 0.1;
+ m_aPosHelper.m_fRingDistance = 0.1;
}
}
catch( const uno::Exception& )
{
TOOLS_WARN_EXCEPTION("chart2", "" );
}
+ try
+ {
+ xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_SUBTYPE) >>= m_eSubType; // "SubType"
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
}
PieChart::~PieChart()
{
}
-void PieChart::setScales( const std::vector< ExplicitScaleData >& rScales, bool /* bSwapXAndYAxis */ )
+void PieChart::setScales( std::vector< ExplicitScaleData >&& rScales, bool /* bSwapXAndYAxis */ )
{
OSL_ENSURE(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension of Plotter does not fit two dimension of given scale sequence");
- m_pPosHelper->setScales( rScales, true );
+ m_aPosHelper.setScales( std::move(rScales), true );
}
drawing::Direction3D PieChart::getPreferredDiagramAspectRatio() const
@@ -224,46 +250,143 @@ bool PieChart::shouldSnapRectToUsedArea()
return true;
}
-uno::Reference< drawing::XShape > PieChart::createDataPoint(
- const uno::Reference<drawing::XShapes>& xTarget,
+rtl::Reference<SvxShape> PieChart::createDataPoint(
+ const SubPieType e_subType,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const uno::Reference<beans::XPropertySet>& xObjectProperties,
- tPropertyNameValueMap const * pOverwritePropertiesMap,
- const ShapeParam& rParam )
+ const ShapeParam& rParam,
+ const sal_Int32 nPointCount,
+ const bool bConcentricExplosion)
{
//transform position:
drawing::Direction3D aOffset;
- if (rParam.mfExplodePercentage != 0.0)
- {
- double fAngle = rParam.mfUnitCircleStartAngleDegree + rParam.mfUnitCircleWidthAngleDegree/2.0;
- double fRadius = (rParam.mfUnitCircleOuterRadius-rParam.mfUnitCircleInnerRadius)*rParam.mfExplodePercentage;
- drawing::Position3D aOrigin = m_pPosHelper->transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
- drawing::Position3D aNewOrigin = m_pPosHelper->transformUnitCircleToScene(fAngle, fRadius, rParam.mfLogicZ);
- aOffset = aNewOrigin - aOrigin;
+ double fExplodedInnerRadius = rParam.mfUnitCircleInnerRadius;
+ double fExplodedOuterRadius = rParam.mfUnitCircleOuterRadius;
+ double fStartAngle = rParam.mfUnitCircleStartAngleDegree;
+ double fWidthAngle = rParam.mfUnitCircleWidthAngleDegree;
+
+ if (rParam.mfExplodePercentage != 0.0) {
+ double fRadius = (fExplodedOuterRadius-fExplodedInnerRadius)*rParam.mfExplodePercentage;
+
+ if (bConcentricExplosion) {
+
+ // For concentric explosion, increase the radius but retain the original
+ // arc length of all ring segments together. This results in a gap
+ // that's evenly divided among all segments, assuming they all have
+ // the same explosion percentage
+ assert(fExplodedInnerRadius >= 0 && fExplodedOuterRadius > 0);
+ double fAngleRatio = (fExplodedInnerRadius + fExplodedOuterRadius) /
+ (fExplodedInnerRadius + fExplodedOuterRadius + 2 * fRadius);
+
+ assert(nPointCount > 0);
+ double fAngleGap = 360 * (1.0 - fAngleRatio) / nPointCount;
+ fStartAngle += fAngleGap / 2;
+ fWidthAngle -= fAngleGap;
+
+ fExplodedInnerRadius += fRadius;
+ fExplodedOuterRadius += fRadius;
+
+ } else {
+ // For the non-concentric explosion case, keep the original radius
+ // but shift the circle origin
+ double fAngle = fStartAngle + fWidthAngle/2.0;
+
+ drawing::Position3D aOrigin = m_aPosHelper.transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
+ drawing::Position3D aNewOrigin = m_aPosHelper.transformUnitCircleToScene(fAngle, fRadius, rParam.mfLogicZ);
+ aOffset = aNewOrigin - aOrigin;
+ }
+ } else {
+ drawing::Position3D aOrigin, aNewOrigin;
+ switch (e_subType) {
+ case SubPieType::LEFT:
+ // Draw the main pie for bar-of-pie/pie-of-pie smaller and to the left
+ aOrigin = m_aPosHelper.transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
+ aNewOrigin = m_aPosHelper.transformUnitCircleToScene(180, 0.75, rParam.mfLogicZ);
+ aOffset = aNewOrigin - aOrigin;
+ fExplodedOuterRadius *= 2.0/3;
+ break;
+ case SubPieType::RIGHT:
+ // Draw the sub-pie for pie-of-pie much smaller and to the right
+ aOrigin = m_aPosHelper.transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
+ aNewOrigin = m_aPosHelper.transformUnitCircleToScene(0, 0.75, rParam.mfLogicZ);
+ aOffset = aNewOrigin - aOrigin;
+ fExplodedOuterRadius *= 1.0/3;
+ break;
+ case SubPieType::NONE:
+ default:
+ // no change
+ break;
+ }
}
+
//create point
- uno::Reference< drawing::XShape > xShape;
+ rtl::Reference<SvxShape> xShape;
if(m_nDimension==3)
{
- xShape = m_pShapeFactory->createPieSegment( xTarget
- , rParam.mfUnitCircleStartAngleDegree, rParam.mfUnitCircleWidthAngleDegree
- , rParam.mfUnitCircleInnerRadius, rParam.mfUnitCircleOuterRadius
- , aOffset, B3DHomMatrixToHomogenMatrix( m_pPosHelper->getUnitCartesianToScene() )
+ xShape = ShapeFactory::createPieSegment( xTarget
+ , fStartAngle, fWidthAngle
+ , fExplodedInnerRadius, fExplodedOuterRadius
+ , aOffset, B3DHomMatrixToHomogenMatrix( m_aPosHelper.getUnitCartesianToScene() )
, rParam.mfDepth );
}
else
{
- xShape = m_pShapeFactory->createPieSegment2D( xTarget
- , rParam.mfUnitCircleStartAngleDegree, rParam.mfUnitCircleWidthAngleDegree
- , rParam.mfUnitCircleInnerRadius, rParam.mfUnitCircleOuterRadius
- , aOffset, B3DHomMatrixToHomogenMatrix( m_pPosHelper->getUnitCartesianToScene() ) );
+ xShape = ShapeFactory::createPieSegment2D( xTarget
+ , fStartAngle, fWidthAngle
+ , fExplodedInnerRadius, fExplodedOuterRadius
+ , aOffset, B3DHomMatrixToHomogenMatrix( m_aPosHelper.getUnitCartesianToScene() ) );
}
- setMappedProperties( xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), pOverwritePropertiesMap );
+ PropertyMapper::setMappedProperties( *xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ return xShape;
+}
+
+rtl::Reference<SvxShape> PieChart::createBarDataPoint(
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
+ const uno::Reference<beans::XPropertySet>& xObjectProperties,
+ const ShapeParam& rParam,
+ double fBarSegBottom, double fBarSegTop)
+{
+ drawing::Position3D aP0, aP1;
+
+ // Draw the bar for bar-of-pie small and to the right. Width and
+ // position are hard-coded for now.
+
+#if 0
+ aP0 = cartesianPosHelper.transformLogicToScene(0.75, fBarSegBottom,
+ rParam.mfLogicZ, false);
+ aP1 = cartesianPosHelper.transformLogicToScene(1.25, fBarSegTop,
+ rParam.mfLogicZ, false);
+#else
+ double x0 = m_aPosHelper.transformUnitCircleToScene(0, 0.75, 0).PositionX;
+ double x1 = m_aPosHelper.transformUnitCircleToScene(0, 1.25, 0).PositionX;
+ double y0 = m_aPosHelper.transformUnitCircleToScene(
+ 90, fBarSegBottom, 0).PositionY;
+ double y1 = m_aPosHelper.transformUnitCircleToScene(
+ 90, fBarSegTop, 0).PositionY;
+
+ aP0 = drawing::Position3D(x0, y0, rParam.mfLogicZ);
+ aP1 = drawing::Position3D(x1, y1, rParam.mfLogicZ);
+#endif
+
+ const css::awt::Point aPos(aP0.PositionX, aP1.PositionY);
+ const css::awt::Size aSz(fabs(aP0.PositionX - aP1.PositionX),
+ fabs(aP0.PositionY - aP1.PositionY));
+
+ const tNameSequence emptyNameSeq;
+ const tAnySequence emptyValSeq;
+ //create point
+ rtl::Reference<SvxShape> xShape = ShapeFactory::createRectangle(
+ xTarget,
+ aSz, aPos,
+ emptyNameSeq, emptyValSeq);
+
+ PropertyMapper::setMappedProperties( *xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
return xShape;
}
void PieChart::createTextLabelShape(
- const uno::Reference<drawing::XShapes>& xTextTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget,
VDataSeries& rSeries, sal_Int32 nPointIndex, ShapeParam& rParam )
{
if (!rSeries.getDataPointLabelIfLabel(nPointIndex))
@@ -284,7 +407,12 @@ void PieChart::createTextLabelShape(
///get the required label placement type. Available placements are
///`AVOID_OVERLAP`, `CENTER`, `OUTSIDE` and `INSIDE`;
sal_Int32 nLabelPlacement = rSeries.getLabelPlacement(
- nPointIndex, m_xChartTypeModel, m_pPosHelper->isSwapXAndY());
+ nPointIndex, m_xChartTypeModel, m_aPosHelper.isSwapXAndY());
+
+ // has an X/Y offset (relative to the OUTSIDE label default position) been provided?
+ const bool bHasCustomLabelPlacement = nLabelPlacement == css::chart::DataLabelPlacement::CUSTOM;
+ if (bHasCustomLabelPlacement)
+ nLabelPlacement = css::chart::DataLabelPlacement::OUTSIDE;
///when the placement is of `AVOID_OVERLAP` type a later rearrangement of
///the label position is allowed; the `createTextLabelShape` treats the
@@ -292,7 +420,7 @@ void PieChart::createTextLabelShape(
double nVal = rSeries.getYValue(nPointIndex);
//AVOID_OVERLAP is in fact "Best fit" in the UI.
- bool bMovementAllowed = ( nLabelPlacement == css::chart::DataLabelPlacement::AVOID_OVERLAP );
+ bool bMovementAllowed = nLabelPlacement == css::chart::DataLabelPlacement::AVOID_OVERLAP;
if( bMovementAllowed )
nLabelPlacement = css::chart::DataLabelPlacement::CENTER;
@@ -314,7 +442,7 @@ void PieChart::createTextLabelShape(
///the scene position of the label anchor point is calculated (see notes for
///`PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCircleValues`),
///and immediately transformed into the screen position.
- PolarLabelPositionHelper aPolarPosHelper(m_pPosHelper.get(),m_nDimension,m_xLogicTarget,m_pShapeFactory);
+ PolarLabelPositionHelper aPolarPosHelper(&m_aPosHelper,m_nDimension,m_xLogicTarget);
awt::Point aScreenPosition2D(
aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment, nLabelPlacement
, rParam.mfUnitCircleStartAngleDegree, rParam.mfUnitCircleWidthAngleDegree
@@ -323,7 +451,7 @@ void PieChart::createTextLabelShape(
///the screen position of the pie/donut center is calculated.
PieLabelInfo aPieLabelInfo;
aPieLabelInfo.aFirstPosition = basegfx::B2IVector( aScreenPosition2D.X, aScreenPosition2D.Y );
- awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( m_pPosHelper->transformUnitCircleToScene( 0.0, 0.0, rParam.mfLogicZ+1.0 ) ) );
+ awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( m_aPosHelper.transformUnitCircleToScene( 0.0, 0.0, rParam.mfLogicZ+1.0 ) ) );
aPieLabelInfo.aOrigin = basegfx::B2IVector( aOrigin.X, aOrigin.Y );
///add a scaling independent Offset if requested
@@ -337,19 +465,81 @@ void PieChart::createTextLabelShape(
// compute outer pie radius
awt::Point aOuterCirclePoint = PlottingPositionHelper::transformSceneToScreenPosition(
- m_pPosHelper->transformUnitCircleToScene(
+ m_aPosHelper.transformUnitCircleToScene(
0,
rParam.mfUnitCircleOuterRadius,
0 ),
- m_xLogicTarget, m_pShapeFactory, m_nDimension );
+ m_xLogicTarget, m_nDimension );
basegfx::B2IVector aRadiusVector(
aOuterCirclePoint.X - aPieLabelInfo.aOrigin.getX(),
aOuterCirclePoint.Y - aPieLabelInfo.aOrigin.getY() );
double fSquaredPieRadius = aRadiusVector.scalar(aRadiusVector);
double fPieRadius = sqrt( fSquaredPieRadius );
+ const double fHalfWidthAngleDegree = rParam.mfUnitCircleWidthAngleDegree / 2.0;
+ // fAngleDegree: the angle through the center of the slice / the bisecting ray
+ const double fAngleDegree
+ = NormAngle360(rParam.mfUnitCircleStartAngleDegree + fHalfWidthAngleDegree);
+
+ // aOuterPosition: slice midpoint on the circumference,
+ // which is where an outside/custom label would be connected
+ awt::Point aOuterPosition = PlottingPositionHelper::transformSceneToScreenPosition(
+ m_aPosHelper.transformUnitCircleToScene(fAngleDegree, rParam.mfUnitCircleOuterRadius, 0),
+ m_xLogicTarget, m_nDimension);
+ aPieLabelInfo.aOuterPosition = basegfx::B2IVector(aOuterPosition.X, aOuterPosition.Y);
+
+ /* There are basically three places where a label could be placed in a pie chart
+ * 1.) outside the slice
+ * -typically used for long labels or charts with many, thin slices
+ * 2.) inside the slice (center or edge)
+ * -typically used for charts with 5 or less slices
+ * 3.) in a custom location
+ * -typically set (by auto-positioning I presume) when labels overlap
+ *
+ * Selecting a good width for the text is critical to achieving good-looking labels.
+ * Our bestFit algorithm completely depends on a good starting guess.
+ * Lots of room for improvement here...
+ * Warning: complication due to 3D ovals (so can't use normal circle functions),
+ * donuts(m_bUseRings), auto re-scaling of the pie chart, etc.
+ *
+ * Based on observation, Microsoft uses 1/5 of the chart space as its text limit,
+ * although it will reduce the width (as long as it is not a custom position)
+ * if doing so means that the now-taller-text will fit inside the slice,
+ * so best if we do the same for our charts.
+ */
- // set the maximum text width to be used when text wrapping is enabled
+ // set the maximum text width to be used when text wrapping is enabled (default text wrap is on)
+ /* A reasonable start for bestFitting a 90deg slice oriented on an Axis is 80% of the radius */
double fTextMaximumFrameWidth = 0.8 * fPieRadius;
+ const double fCompatMaxTextLen = m_aAvailableOuterRect.getWidth() / 5.0;
+ if (m_aAvailableOuterRect.getWidth())
+ {
+ if (bHasCustomLabelPlacement)
+ {
+ // if a custom width has been provided, then use that of course,
+ // otherwise use the interoperability-compliant 1/5 of the chart space as max width
+ const awt::Size aCustomSize = rSeries.getLabelCustomSize(nPointIndex);
+ if (aCustomSize.Width > 0)
+ fTextMaximumFrameWidth = aCustomSize.Width;
+ else
+ fTextMaximumFrameWidth = fCompatMaxTextLen;
+ }
+ else if (nLabelPlacement == css::chart::DataLabelPlacement::OUTSIDE)
+ {
+ // use up to 80% of the available space from the slice edge to the edge of the chart
+ const sal_Int32 nOuterX = aPieLabelInfo.aOuterPosition.getX();
+ if (fAngleDegree < 90 || fAngleDegree > 270) // label is placed on the right side
+ fTextMaximumFrameWidth = 0.8 * abs(m_aAvailableOuterRect.getWidth() - nOuterX);
+ else // label is placed on the left side
+ fTextMaximumFrameWidth = 0.8 * nOuterX;
+
+ // limited of course to the 1/5 maximum allowed for compatibility
+ fTextMaximumFrameWidth = std::min(fTextMaximumFrameWidth, fCompatMaxTextLen);
+ }
+ }
+ /* TODO: better guesses for INSIDE: does the slice better handle wide text or tall/wrapped text?
+ * * wide: center near X-axis, shorter text content, slice > 90degree wide
+ * * tall: center near Y-axis, longer text content, many categories shown
+ */
sal_Int32 nTextMaximumFrameWidth = ceil(fTextMaximumFrameWidth);
///the text shape for the label is created
@@ -359,24 +549,163 @@ void PieChart::createTextLabelShape(
///a new `PieLabelInfo` instance is initialized with all the info related to
///the current label in order to simplify later label position rearrangement;
- uno::Reference< container::XChild > xChild( aPieLabelInfo.xTextShape, uno::UNO_QUERY );
+ rtl::Reference< SvxShape > xChild = aPieLabelInfo.xTextShape;
///text shape could be empty; in that case there is no need to add label info
if( !xChild.is() )
return;
- aPieLabelInfo.xLabelGroupShape.set( xChild->getParent(), uno::UNO_QUERY );
+ aPieLabelInfo.xLabelGroupShape = dynamic_cast<SvxShapeGroupAnyD*>(xChild->getParent().get());
- aPieLabelInfo.fValue = nVal;
- aPieLabelInfo.bMovementAllowed = bMovementAllowed;
- aPieLabelInfo.bMoved= false;
- aPieLabelInfo.xTextTarget = xTextTarget;
+ if (bMovementAllowed && !m_bUseRings)
+ {
+ /** Handle the placement of the label in the best fit case.
+ * First off the routine try to place the label inside the related pie slice,
+ * if this is not possible the label is placed outside.
+ */
+
+ /* Note: bestFit surprisingly does not adjust the width of the label,
+ * so having an optimal width already set when createDataLabel ran earlier
+ * is crucial (and currently lacking)!
+ * TODO: * change bestFit to treat the width as a max width, and reduce if beneficial
+ */
+ if (!performLabelBestFitInnerPlacement(rParam, aPieLabelInfo))
+ {
+ if (m_aAvailableOuterRect.getWidth())
+ {
+ /* This tried to bestFit, but it didn't fit. So how best to handle this?
+ *
+ * Two possible cases relating to compatibility
+ * 1.) It did fit for Microsoft, but our bestFit wasn't able to do the same
+ * * In that case, the best response is to be as small as possible
+ * (the distance from the chart edge to where the label attaches to the slice)
+ * to avoid scaling the diagram with too long outside labels,
+ * and to encourage fixing the bestFit algorithm.
+ * 2.) It didn't fit for Microsoft either (possible, but less likely situation)
+ * * In that case, the compatible max length would be best
+ * * can expect the chart space has been properly sized to handle the max length
+ *
+ * In the native LO case, it is also best to be as small as possible,
+ * so that the user creating the diagram is annoyed and makes the chart area larger.
+ *
+ * Therefore, handle this by making the label as small as possible.
+ *
+ * Complication (tdf122765.pptx): it is possible for the aOuterPosition
+ * to be outside of the available outer rectangle (somehow),
+ * so in that bizarre case just try the positive value of the result...
+ */
+ const sal_Int32 nOuterX = aPieLabelInfo.aOuterPosition.getX();
+ if (fAngleDegree < 90 || fAngleDegree > 270) // label is placed on the right side
+ fTextMaximumFrameWidth = 0.8 * abs(m_aAvailableOuterRect.getWidth() - nOuterX);
+ else // label is placed on the left side
+ fTextMaximumFrameWidth = 0.8 * nOuterX;
+
+ nTextMaximumFrameWidth = ceil(std::min(fTextMaximumFrameWidth, fCompatMaxTextLen));
+ }
- if (bMovementAllowed)
+ // find the position to connect an Outside label to
+ nScreenValueOffsetInRadiusDirection = (m_nDimension != 3) ? 150 : 0;
+ aScreenPosition2D
+ = aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(
+ eAlignment, css::chart::DataLabelPlacement::OUTSIDE,
+ rParam.mfUnitCircleStartAngleDegree,
+ rParam.mfUnitCircleWidthAngleDegree, rParam.mfUnitCircleInnerRadius,
+ rParam.mfUnitCircleOuterRadius, rParam.mfLogicZ + 0.5, 0);
+ aPieLabelInfo.aFirstPosition
+ = basegfx::B2IVector(aScreenPosition2D.X, aScreenPosition2D.Y);
+
+ //add a scaling independent Offset if requested
+ if (nScreenValueOffsetInRadiusDirection != 0)
+ {
+ basegfx::B2IVector aDirection(aScreenPosition2D.X - aOrigin.X,
+ aScreenPosition2D.Y - aOrigin.Y);
+ aDirection.setLength(nScreenValueOffsetInRadiusDirection);
+ aScreenPosition2D.X += aDirection.getX();
+ aScreenPosition2D.Y += aDirection.getY();
+ }
+
+ uno::Reference<drawing::XShapes> xShapes(xChild->getParent(), uno::UNO_QUERY);
+ /* question: why remove and rebuild? Can't the existing one just be changed? */
+ xShapes->remove(aPieLabelInfo.xTextShape);
+ aPieLabelInfo.xTextShape
+ = createDataLabel(xTextTarget, rSeries, nPointIndex, nVal, rParam.mfLogicYSum,
+ aScreenPosition2D, eAlignment, 0, nTextMaximumFrameWidth);
+ xChild = aPieLabelInfo.xTextShape;
+ if (!xChild.is())
+ return;
+
+ aPieLabelInfo.xLabelGroupShape = dynamic_cast<SvxShapeGroupAnyD*>(xChild->getParent().get());
+ }
+ }
+
+ bool bShowLeaderLine = rSeries.getModel()
+ ->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES) // "ShowCustomLeaderLines"
+ .get<sal_Bool>();
+ if (m_bPieLabelsAllowToMove)
{
- performLabelBestFit(rParam, aPieLabelInfo);
+ ::basegfx::B2IRectangle aRect(lcl_getRect(aPieLabelInfo.xLabelGroupShape));
+ sal_Int32 nPageWidth = m_aPageReferenceSize.Width;
+ sal_Int32 nPageHeight = m_aPageReferenceSize.Height;
+
+ // the data label should be inside the chart area
+ awt::Point aShapePos = aPieLabelInfo.xLabelGroupShape->getPosition();
+ if (aRect.getMinX() < 0)
+ aPieLabelInfo.xLabelGroupShape->setPosition(
+ awt::Point(aShapePos.X - aRect.getMinX(), aShapePos.Y));
+ if (aRect.getMinY() < 0)
+ aPieLabelInfo.xLabelGroupShape->setPosition(
+ awt::Point(aShapePos.X, aShapePos.Y - aRect.getMinY()));
+ if (aRect.getMaxX() > nPageWidth)
+ aPieLabelInfo.xLabelGroupShape->setPosition(
+ awt::Point(aShapePos.X - (aRect.getMaxX() - nPageWidth), aShapePos.Y));
+ if (aRect.getMaxY() > nPageHeight)
+ aPieLabelInfo.xLabelGroupShape->setPosition(
+ awt::Point(aShapePos.X, aShapePos.Y - (aRect.getMaxY() - nPageHeight)));
+
+ if (rSeries.isLabelCustomPos(nPointIndex) && bShowLeaderLine)
+ {
+ sal_Int32 nX1 = aPieLabelInfo.aOuterPosition.getX();
+ sal_Int32 nY1 = aPieLabelInfo.aOuterPosition.getY();
+ const sal_Int32 nX2 = std::clamp(nX1, aRect.getMinX(), aRect.getMaxX());
+ const sal_Int32 nY2 = std::clamp(nY1, aRect.getMinY(), aRect.getMaxY());
+
+ const sal_Int32 nLabelSquaredDistanceFromOrigin
+ = (nX2 - aOrigin.X) * (nX2 - aOrigin.X) + (nY2 - aOrigin.Y) * (nY2 - aOrigin.Y);
+ // can't use fSquaredPieRadius for 3D charts, since no longer a true circle
+ const sal_Int32 nPieEdgeSquaredDistanceFromOrigin
+ = (nX1 - aOrigin.X) * (nX1 - aOrigin.X) + (nY1 - aOrigin.Y) * (nY1 - aOrigin.Y);
+
+ // tdf#138018 Don't show leader line when custom positioned data label is inside pie chart
+ if (nLabelSquaredDistanceFromOrigin > nPieEdgeSquaredDistanceFromOrigin)
+ {
+ //when the line is very short compared to the page size don't create one
+ ::basegfx::B2DVector aLength(nX1 - nX2, nY1 - nY2);
+ double fPageDiagonaleLength = std::hypot(nPageWidth, nPageHeight);
+ if ((aLength.getLength() / fPageDiagonaleLength) >= 0.01)
+ {
+ drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } };
+
+ VLineProperties aVLineProperties;
+ if (aPieLabelInfo.xTextShape.is())
+ {
+ sal_Int32 nColor = 0;
+ aPieLabelInfo.xTextShape->SvxShape::getPropertyValue("CharColor") >>= nColor;
+ //automatic font color does not work for lines -> fallback to black
+ if (nColor != -1)
+ aVLineProperties.Color <<= nColor;
+ }
+ ShapeFactory::createLine2D(xTextTarget, aPoints, &aVLineProperties);
+ }
+ }
+ }
}
+ aPieLabelInfo.fValue = nVal;
+ aPieLabelInfo.bMovementAllowed = bMovementAllowed;
+ aPieLabelInfo.bMoved = false;
+ aPieLabelInfo.xTextTarget = xTextTarget;
+ aPieLabelInfo.bShowLeaderLine = bShowLeaderLine && !rSeries.isLabelCustomPos(nPointIndex);
+
m_aLabelInfoList.push_back(aPieLabelInfo);
}
@@ -406,19 +735,20 @@ double PieChart::getMaxOffset()
return m_fMaxOffset;
VDataSeries* pSeries = rSeriesList.front().get();
- uno::Reference< beans::XPropertySet > xSeriesProp( pSeries->getPropertiesOfSeries() );
- if( !xSeriesProp.is() )
+ rtl::Reference< DataSeries > xSeries( pSeries->getModel() );
+ if( !xSeries.is() )
return m_fMaxOffset;
double fExplodePercentage=0.0;
- xSeriesProp->getPropertyValue( "Offset") >>= fExplodePercentage;
+ xSeries->getPropertyValue( "Offset") >>= fExplodePercentage;
if(fExplodePercentage>m_fMaxOffset)
m_fMaxOffset=fExplodePercentage;
if(!m_bSizeExcludesLabelsAndExplodedSegments)
{
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ // "AttributedDataPoints"
+ if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -498,18 +828,16 @@ void PieChart::createShapes()
///( a member of a VDiagram object); this initialization occurs in
///`ChartView::impl_createDiagramAndContent`.
- OSL_ENSURE(m_pShapeFactory && m_xLogicTarget.is() && m_xFinalTarget.is(), "PieChart is not properly initialized.");
- if (!m_pShapeFactory || !m_xLogicTarget.is() || !m_xFinalTarget.is())
+ OSL_ENSURE(m_xLogicTarget.is() && m_xFinalTarget.is(), "PieChart is not properly initialized.");
+ if (!m_xLogicTarget.is() || !m_xFinalTarget.is())
return;
///the text labels should be always on top of the other series shapes
///therefore create an own group for the texts to move them to front
///(because the text group is created after the series group the texts are
///displayed on top)
- uno::Reference< drawing::XShapes > xSeriesTarget(
- createGroupShape( m_xLogicTarget ));
- uno::Reference< drawing::XShapes > xTextTarget(
- m_pShapeFactory->createGroup2D( m_xFinalTarget ));
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesTarget = createGroupShape( m_xLogicTarget );
+ rtl::Reference<SvxShapeGroup> xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget );
//check necessary here that different Y axis can not be stacked in the same group? ... hm?
///pay attention that the `m_bSwapXAndY` parameter used by the polar
@@ -531,22 +859,14 @@ void PieChart::createShapes()
///the angle axis scale range is [0, 1]. The max_offset parameter is used
///for exploded pie chart and its value is 0.5.
- ///the `explodeable` ring is the first one except when the radius axis
- ///orientation is reversed (always!?) and we are dealing with a donut: in
- ///such a case the `explodeable` ring is the last one.
- std::vector< VDataSeriesGroup >::size_type nExplodeableSlot = 0;
- if( m_pPosHelper->isMathematicalOrientationRadius() && m_bUseRings )
- nExplodeableSlot = m_aZSlots.front().size()-1;
-
m_aLabelInfoList.clear();
- ::rtl::math::setNan(&m_fMaxOffset);
+ m_fMaxOffset = std::numeric_limits<double>::quiet_NaN();
sal_Int32 n3DRelativeHeight = 100;
- uno::Reference< beans::XPropertySet > xPropertySet( m_xChartTypeModel, uno::UNO_QUERY );
- if ( (m_nDimension==3) && xPropertySet.is())
+ if ( (m_nDimension==3) && m_xChartTypeModel.is())
{
try
{
- uno::Any aAny = xPropertySet->getPropertyValue( "3DRelativeHeight" );
+ uno::Any aAny = m_xChartTypeModel->getFastPropertyValue( PROP_PIECHARTTYPE_3DRELATIVEHEIGHT ); // "3DRelativeHeight"
aAny >>= n3DRelativeHeight;
}
catch (const uno::Exception&) { }
@@ -557,8 +877,6 @@ void PieChart::createShapes()
///(m_bUseRings||fSlotX<0.5)
for( double fSlotX=0; aXSlotIter != aXSlotEnd && (m_bUseRings||fSlotX<0.5 ); ++aXSlotIter, fSlotX+=1.0 )
{
- ShapeParam aParam;
-
std::vector< std::unique_ptr<VDataSeries> >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
if(pSeriesList->empty())//there should be only one series in each x slot
continue;
@@ -566,17 +884,17 @@ void PieChart::createShapes()
if(!pSeries)
continue;
- bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor");
-
/// The angle degree offset is set by the same property of the
/// data series.
/// Counter-clockwise offset from the 3 o'clock position.
- m_pPosHelper->m_fAngleDegreeOffset = pSeries->getStartingAngle();
+ m_aPosHelper.m_fAngleDegreeOffset = pSeries->getStartingAngle();
///iterate through all points to get the sum of all entries of
///the current data series
sal_Int32 nPointIndex=0;
sal_Int32 nPointCount=pSeries->getTotalPointCount();
+ ShapeParam aParam;
+
for( nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++ )
{
double fY = pSeries->getYValue( nPointIndex );
@@ -589,165 +907,464 @@ void PieChart::createShapes()
aParam.mfLogicYSum += fabs(fY);
}
- if (aParam.mfLogicYSum == 0.0)
+ if (aParam.mfLogicYSum == 0.0) {
// Total sum of all Y values in this series is zero. Skip the whole series.
continue;
+ }
- double fLogicYForNextPoint = 0.0;
- ///iterate through all points to create shapes
- for( nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++ )
+ PieDataSrcBase *pDataSrc = nullptr;
+ PieDataSrc normalPieSrc;
+ OfPieDataSrc ofPieSrc;
+
+ // Default to regular pie if too few points for of-pie
+ ::css::chart2::PieChartSubType eSubType =
+ nPointCount >= OfPieDataSrc::minPoints ?
+ m_eSubType :
+ PieChartSubType_NONE;
+
+ switch (eSubType) {
+ case PieChartSubType_NONE:
+ pDataSrc = &normalPieSrc;
+ createOneRing(SubPieType::NONE, fSlotX, aParam, xSeriesTarget,
+ xTextTarget, pSeries, pDataSrc, n3DRelativeHeight);
+ break;
+ case PieChartSubType_BAR:
{
- double fLogicInnerRadius, fLogicOuterRadius;
-
- ///compute the maximum relative distance offset of the current slice
- ///from the pie center
- ///it is worth noting that after the first invocation the maximum
- ///offset value is cached, so it is evaluated only once per each
- ///call to `createShapes`
- double fOffset = getMaxOffset();
-
- ///compute the outer and the inner radius for the current ring slice
- bool bIsVisible = m_pPosHelper->getInnerAndOuterRadius( fSlotX+1.0, fLogicInnerRadius, fLogicOuterRadius, m_bUseRings, fOffset );
- if( !bIsVisible )
- continue;
+ pDataSrc = &ofPieSrc;
+ createOneRing(SubPieType::LEFT, 0, aParam, xSeriesTarget,
+ xTextTarget, pSeries, pDataSrc, n3DRelativeHeight);
+ createOneBar(SubPieType::RIGHT, aParam, xSeriesTarget,
+ xTextTarget, pSeries, pDataSrc, n3DRelativeHeight);
+
+ //
+ // Draw connecting lines
+ //
+ double xl0, xl1, yl0, yl1, x0, y0, x1, y1, y2, y3;
+
+ // Get coordinates of "corners" of left composite wedge
+ sal_Int32 nEnd = pDataSrc->getNPoints(pSeries, SubPieType::LEFT);
+ double compFrac = pDataSrc->getData(pSeries, nEnd - 1,
+ SubPieType::LEFT) / aParam.mfLogicYSum;
+ if (compFrac < 0.5) {
+ xl0 = aParam.mfUnitCircleOuterRadius * m_fLeftScale *
+ cos(compFrac * M_PI) + m_fLeftShift;
+ yl0 = aParam.mfUnitCircleOuterRadius * m_fLeftScale *
+ sin(compFrac * M_PI);
+ } else {
+ xl0 = m_fLeftShift;
+ yl0 = aParam.mfUnitCircleOuterRadius * m_fLeftScale;
+ }
- aParam.mfDepth = getTransformedDepth() * (n3DRelativeHeight / 100.0);
+ // Coordinates of bar top left corner
+ xl1 = m_fBarLeft;
+ yl1 = m_fFullBarHeight / 2;
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries, xSeriesTarget);
- ///collect data point information (logic coordinates, style ):
- double fLogicYValue = fabs(pSeries->getYValue( nPointIndex ));
- if( std::isnan(fLogicYValue) )
- continue;
- if(fLogicYValue==0.0)//@todo: continue also if the resolution is too small
- continue;
- double fLogicYPos = fLogicYForNextPoint;
- fLogicYForNextPoint += fLogicYValue;
+ x0 = m_aPosHelper.transformUnitCircleToScene(0, xl0, 0).PositionX;
+ y0 = m_aPosHelper.transformUnitCircleToScene(90, yl0, 0).PositionY;
+ x1 = m_aPosHelper.transformUnitCircleToScene(0, xl1, 0).PositionX;
+ y1 = m_aPosHelper.transformUnitCircleToScene(90, yl1, 0).PositionY;
+ y2 = m_aPosHelper.transformUnitCircleToScene(90, -yl0, 0).PositionY;
+ y3 = m_aPosHelper.transformUnitCircleToScene(90, -yl1, 0).PositionY;
- uno::Reference< beans::XPropertySet > xPointProperties = pSeries->getPropertiesOfPoint( nPointIndex );
-
- //iterate through all subsystems to create partial points
- {
- //logic values on angle axis:
- double fLogicStartAngleValue = fLogicYPos / aParam.mfLogicYSum;
- double fLogicEndAngleValue = (fLogicYPos+fLogicYValue) / aParam.mfLogicYSum;
-
- ///note that the explode percentage is set to the `Offset`
- ///property of the current data series entry only for slices
- ///belonging to the outer ring
- aParam.mfExplodePercentage = 0.0;
- bool bDoExplode = ( nExplodeableSlot == static_cast< std::vector< VDataSeriesGroup >::size_type >(fSlotX) );
- if(bDoExplode) try
- {
- xPointProperties->getPropertyValue( "Offset") >>= aParam.mfExplodePercentage;
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ std::vector<std::vector<css::drawing::Position3D>> linePts;
+ linePts.resize(2);
+ linePts[0].push_back(css::drawing::Position3D(x0, y0, aParam.mfLogicZ));
+ linePts[0].push_back(css::drawing::Position3D(x1, y1, aParam.mfLogicZ));
+ linePts[1].push_back(css::drawing::Position3D(x0, y2, aParam.mfLogicZ));
+ linePts[1].push_back(css::drawing::Position3D(x1, y3, aParam.mfLogicZ));
- ///see notes for `PolarPlottingPositionHelper` methods
- ///transform to unit circle:
- aParam.mfUnitCircleWidthAngleDegree = m_pPosHelper->getWidthAngleDegree( fLogicStartAngleValue, fLogicEndAngleValue );
- aParam.mfUnitCircleStartAngleDegree = m_pPosHelper->transformToAngleDegree( fLogicStartAngleValue );
- aParam.mfUnitCircleInnerRadius = m_pPosHelper->transformToRadius( fLogicInnerRadius );
- aParam.mfUnitCircleOuterRadius = m_pPosHelper->transformToRadius( fLogicOuterRadius );
+ VLineProperties aVLineProperties; // default black
- ///point color:
- std::unique_ptr< tPropertyNameValueMap > apOverwritePropertiesMap;
- if (!pSeries->hasPointOwnColor(nPointIndex) && m_xColorScheme.is())
- {
- apOverwritePropertiesMap.reset( new tPropertyNameValueMap );
- (*apOverwritePropertiesMap)["FillColor"] <<=
- m_xColorScheme->getColorByIndex( nPointIndex );
- }
+ //create line
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes =
+ getSeriesGroupShape(pSeries, xSeriesTarget);
+ rtl::Reference<SvxShape> xShape = ShapeFactory::createLine2D(
+ xSeriesGroupShape_Shapes, linePts, &aVLineProperties);
- ///create data point
- aParam.mfLogicZ = -1.0; // For 3D pie chart label position
- uno::Reference<drawing::XShape> xPointShape =
- createDataPoint(
- xSeriesGroupShape_Shapes, xPointProperties, apOverwritePropertiesMap.get(), aParam);
+ // need to set properties?
+ //PropertyMapper::setMappedProperties( *xShape, xObjectProperties,
+ // PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
- if(bHasFillColorMapping)
- {
- double nPropVal = pSeries->getValueByProperty(nPointIndex, "FillColor");
- if(!std::isnan(nPropVal))
- {
- uno::Reference< beans::XPropertySet > xProps( xPointShape, uno::UNO_QUERY_THROW );
- xProps->setPropertyValue("FillColor", uno::Any(static_cast<sal_Int32>( nPropVal)));
- }
- }
+ break;
+ }
+ case PieChartSubType_PIE:
+ {
+ pDataSrc = &ofPieSrc;
+ createOneRing(SubPieType::LEFT, 0, aParam, xSeriesTarget,
+ xTextTarget, pSeries, pDataSrc, n3DRelativeHeight);
+ createOneRing(SubPieType::RIGHT, 0, aParam, xSeriesTarget,
+ xTextTarget, pSeries, pDataSrc, n3DRelativeHeight);
+
+ //
+ // Draw connecting lines
+ //
+ double xl0, xl1, yl0, yl1, x0, y0, x1, y1, y2, y3;
+
+ // Get coordinates of "corners" of left composite wedge
+ sal_Int32 nEnd = pDataSrc->getNPoints(pSeries, SubPieType::LEFT);
+ double compFrac = pDataSrc->getData(pSeries, nEnd - 1,
+ SubPieType::LEFT) / aParam.mfLogicYSum;
+ // The following isn't quite right. The tangent points on the left
+ // pie are only at pi/2 and -pi/2 for composite wedges over 1/2 the
+ // total if left and right pies are the same diameter. And the
+ // threshold of 1/2 isn't quite right either. So there
+ // really should be a more sophisticated approach here. TODO
+ if (compFrac < 0.5) {
+ // Translated, per below
+ xl0 = aParam.mfUnitCircleOuterRadius * m_fLeftScale *
+ cos(compFrac * M_PI) + m_fLeftShift - m_fRightShift;
+ yl0 = aParam.mfUnitCircleOuterRadius * m_fLeftScale *
+ sin(compFrac * M_PI);
+ } else {
+ // Translated, per below
+ xl0 = m_fLeftShift - m_fRightShift;
+ yl0 = aParam.mfUnitCircleOuterRadius * m_fLeftScale;
+ }
- ///create label
- createTextLabelShape(xTextTarget, *pSeries, nPointIndex, aParam);
+ // Compute tangent point on the right-hand circle of the line
+ // through (xl0, yl0). If we translate things so the right-hand
+ // circle is centered on the origin, then this point (x,y)
+ // satisfies these two equations, where r is the radius of the
+ // right-hand circle:
+ // (1) x^2 + y^2 = r^2
+ // (2) (y - yl0) / (x - xl0) = -x / y
+ const double r = aParam.mfUnitCircleOuterRadius * m_fRightScale;
+
+ xl1 = (r*r * xl0 + yl0 * r * sqrt(xl0*xl0 + yl0*yl0 - r*r)) /
+ (xl0*xl0 + yl0*yl0);
+ yl1 = sqrt(r*r - xl1*xl1);
+
+ // Now translate back to the coordinates we use
+ xl0 += m_fRightShift;
+ xl1 += m_fRightShift;
+
+ x0 = m_aPosHelper.transformUnitCircleToScene(0, xl0, 0).PositionX;
+ y0 = m_aPosHelper.transformUnitCircleToScene(90, yl0, 0).PositionY;
+ x1 = m_aPosHelper.transformUnitCircleToScene(0, xl1, 0).PositionX;
+ y1 = m_aPosHelper.transformUnitCircleToScene(90, yl1, 0).PositionY;
+ y2 = m_aPosHelper.transformUnitCircleToScene(90, -yl0, 0).PositionY;
+ y3 = m_aPosHelper.transformUnitCircleToScene(90, -yl1, 0).PositionY;
+
+ std::vector<std::vector<css::drawing::Position3D>> linePts;
+ linePts.resize(2);
+ linePts[0].push_back(css::drawing::Position3D(x0, y0, aParam.mfLogicZ));
+ linePts[0].push_back(css::drawing::Position3D(x1, y1, aParam.mfLogicZ));
+ linePts[1].push_back(css::drawing::Position3D(x0, y2, aParam.mfLogicZ));
+ linePts[1].push_back(css::drawing::Position3D(x1, y3, aParam.mfLogicZ));
+
+ VLineProperties aVLineProperties; // default black
+
+ //create line
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes =
+ getSeriesGroupShape(pSeries, xSeriesTarget);
+ rtl::Reference<SvxShape> xShape = ShapeFactory::createLine2D(
+ xSeriesGroupShape_Shapes, linePts, &aVLineProperties);
- if(!bDoExplode)
- {
- ShapeFactory::setShapeName( xPointShape
- , ObjectIdentifier::createPointCID( pSeries->getPointCID_Stub(), nPointIndex ) );
- }
- else try
- {
- ///enable dragging of outer segments
-
- double fAngle = aParam.mfUnitCircleStartAngleDegree + aParam.mfUnitCircleWidthAngleDegree/2.0;
- double fMaxDeltaRadius = aParam.mfUnitCircleOuterRadius-aParam.mfUnitCircleInnerRadius;
- drawing::Position3D aOrigin = m_pPosHelper->transformUnitCircleToScene( fAngle, aParam.mfUnitCircleOuterRadius, aParam.mfLogicZ );
- drawing::Position3D aNewOrigin = m_pPosHelper->transformUnitCircleToScene( fAngle, aParam.mfUnitCircleOuterRadius + fMaxDeltaRadius, aParam.mfLogicZ );
-
- sal_Int32 nOffsetPercent( static_cast<sal_Int32>(aParam.mfExplodePercentage * 100.0) );
-
- awt::Point aMinimumPosition( PlottingPositionHelper::transformSceneToScreenPosition(
- aOrigin, m_xLogicTarget, m_pShapeFactory, m_nDimension ) );
- awt::Point aMaximumPosition( PlottingPositionHelper::transformSceneToScreenPosition(
- aNewOrigin, m_xLogicTarget, m_pShapeFactory, m_nDimension ) );
-
- //enable dragging of piesegments
- OUString aPointCIDStub( ObjectIdentifier::createSeriesSubObjectStub( OBJECTTYPE_DATA_POINT
- , pSeries->getSeriesParticle()
- , ObjectIdentifier::getPieSegmentDragMethodServiceName()
- , ObjectIdentifier::createPieSegmentDragParameterString(
- nOffsetPercent, aMinimumPosition, aMaximumPosition )
- ) );
-
- ShapeFactory::setShapeName( xPointShape
- , ObjectIdentifier::createPointCID( aPointCIDStub, nPointIndex ) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
- }//next series in x slot (next y slot)
- }//next category
+ break;
+ }
+ default:
+ assert(false); // this shouldn't happen
+ }
}//next x slot
}
-namespace
+static sal_Int32 propIndex(
+ sal_Int32 nPointIndex,
+ enum SubPieType eType,
+ const PieDataSrcBase *pDataSrc,
+ VDataSeries* pSeries)
{
-::basegfx::B2IRectangle lcl_getRect( const uno::Reference< drawing::XShape >& xShape )
-{
- ::basegfx::B2IRectangle aRect;
- if( xShape.is() )
- aRect = BaseGFXHelper::makeRectangle(xShape->getPosition(),xShape->getSize() );
- return aRect;
+ switch (eType) {
+ case SubPieType::LEFT:
+ if (nPointIndex == pDataSrc->getNPoints(pSeries,
+ SubPieType::LEFT) - 1) {
+ return pSeries->getTotalPointCount();
+ } else {
+ return nPointIndex;
+ }
+ break;
+ case SubPieType::RIGHT:
+ return pDataSrc->getNPoints(pSeries, SubPieType::LEFT) +
+ nPointIndex - 1;
+ break;
+ case SubPieType::NONE:
+ return nPointIndex;
+ break;
+ default: // shouldn't happen
+ assert(false);
+ return 0; // suppress compile warning
+ }
}
-bool lcl_isInsidePage( const awt::Point& rPos, const awt::Size& rSize, const awt::Size& rPageSize )
+
+void PieChart::createOneRing(
+ enum SubPieType eType,
+ double fSlotX,
+ ShapeParam& aParam,
+ const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
+ const rtl::Reference<SvxShapeGroup>& xTextTarget,
+ VDataSeries* pSeries,
+ const PieDataSrcBase *pDataSrc,
+ sal_Int32 n3DRelativeHeight)
{
- if( rPos.X < 0 || rPos.Y < 0 )
- return false;
- if( (rPos.X + rSize.Width) > rPageSize.Width )
- return false;
- if( (rPos.Y + rSize.Height) > rPageSize.Height )
- return false;
- return true;
+ bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor");
+
+ sal_Int32 nRingPtCnt = pDataSrc->getNPoints(pSeries, eType);
+
+ // Find sum of entries for this ring or sub-pie
+ double ringSum = 0;
+ for (sal_Int32 nPointIndex = 0; nPointIndex < nRingPtCnt; nPointIndex++ ) {
+ double fY = pDataSrc->getData(pSeries, nPointIndex, eType);
+ if (!std::isnan(fY) ) ringSum += fY;
+ }
+
+ // determine the starting angle around the ring
+ auto sAngle = [&]()
+ {
+ if (eType == SubPieType::LEFT) {
+ // Left of-pie has the "composite" wedge (the one expanded in the right
+ // subgraph) facing to the right in the chart, to allow the expansion
+ // lines to meet it
+ const double compositeVal = pDataSrc->getData(pSeries, nRingPtCnt - 1, eType);
+ const double degAng = compositeVal * 360 / (ringSum * 2);
+ return m_aPosHelper.clockwiseWedges() ? 360 - degAng : degAng;
+ } else {
+ /// The angle degree offset is set by the same property of the
+ /// data series.
+ /// Counter-clockwise offset from the 3 o'clock position.
+ return static_cast<double>(pSeries->getStartingAngle());
+ }
+ };
+
+ m_aPosHelper.m_fAngleDegreeOffset = sAngle();
+
+ ///the `explodeable` ring is the first one except when the radius axis
+ ///orientation is reversed (always!?) and we are dealing with a donut: in
+ ///such a case the `explodeable` ring is the last one.
+ std::vector< VDataSeriesGroup >::size_type nExplodeableSlot = 0;
+ if( m_aPosHelper.isMathematicalOrientationRadius() && m_bUseRings )
+ nExplodeableSlot = m_aZSlots.front().size()-1;
+
+ double fLogicYForNextPoint = 0.0;
+ ///iterate through all points to create shapes
+ for(sal_Int32 nPointIndex = 0; nPointIndex < nRingPtCnt; nPointIndex++ )
+ {
+ double fLogicInnerRadius, fLogicOuterRadius;
+
+ ///compute the maximum relative distance offset of the current slice
+ ///from the pie center
+ ///it is worth noting that after the first invocation the maximum
+ ///offset value is cached, so it is evaluated only once per each
+ ///call to `createShapes`
+ double fOffset = getMaxOffset();
+
+ ///compute the outer and the inner radius for the current ring slice
+ bool bIsVisible = m_aPosHelper.getInnerAndOuterRadius( fSlotX+1.0, fLogicInnerRadius, fLogicOuterRadius, m_bUseRings, fOffset );
+ if( !bIsVisible )
+ continue;
+
+ aParam.mfDepth = getTransformedDepth() * (n3DRelativeHeight / 100.0);
+
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries, xSeriesTarget);
+
+ ///collect data point information (logic coordinates, style ):
+ double fLogicYValue = pDataSrc->getData(pSeries, nPointIndex, eType);
+ if( std::isnan(fLogicYValue) )
+ continue;
+ if(fLogicYValue==0.0)//@todo: continue also if the resolution is too small
+ continue;
+ double fLogicYPos = fLogicYForNextPoint;
+ fLogicYForNextPoint += fLogicYValue;
+
+ uno::Reference< beans::XPropertySet > xPointProperties =
+ pDataSrc->getProps(pSeries, nPointIndex, eType);
+
+ //iterate through all subsystems to create partial points
+ {
+ //logic values on angle axis:
+ double fLogicStartAngleValue = fLogicYPos / ringSum;
+ double fLogicEndAngleValue = (fLogicYPos+fLogicYValue) / ringSum;
+
+ ///note that the explode percentage is set to the `Offset`
+ ///property of the current data series entry only for slices
+ ///belonging to the outer ring
+ aParam.mfExplodePercentage = 0.0;
+ bool bDoExplode = ( nExplodeableSlot == static_cast< std::vector< VDataSeriesGroup >::size_type >(fSlotX) );
+ if(bDoExplode) try
+ {
+ xPointProperties->getPropertyValue( "Offset") >>= aParam.mfExplodePercentage;
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+
+ ///see notes for `PolarPlottingPositionHelper` methods
+ ///transform to unit circle:
+ aParam.mfUnitCircleWidthAngleDegree = m_aPosHelper.getWidthAngleDegree( fLogicStartAngleValue, fLogicEndAngleValue );
+ aParam.mfUnitCircleStartAngleDegree = m_aPosHelper.transformToAngleDegree( fLogicStartAngleValue );
+ aParam.mfUnitCircleInnerRadius = m_aPosHelper.transformToRadius( fLogicInnerRadius );
+ aParam.mfUnitCircleOuterRadius = m_aPosHelper.transformToRadius( fLogicOuterRadius );
+
+ ///create data point
+ aParam.mfLogicZ = -1.0; // For 3D pie chart label position
+
+ // Do concentric explosion if it's a donut chart with more than one series
+ const bool bConcentricExplosion = m_bUseRings && (m_aZSlots.front().size() > 1);
+ rtl::Reference<SvxShape> xPointShape =
+ createDataPoint(eType, xSeriesGroupShape_Shapes,
+ xPointProperties, aParam, nRingPtCnt,
+ bConcentricExplosion);
+
+ // Handle coloring of the composite wedge
+ sal_Int32 nPropIdx = propIndex(nPointIndex, eType, pDataSrc,
+ pSeries);
+
+ ///point color:
+ if (!pSeries->hasPointOwnColor(nPropIdx) && m_xColorScheme.is())
+ {
+ xPointShape->setPropertyValue("FillColor",
+ uno::Any(m_xColorScheme->getColorByIndex( nPropIdx )));
+ }
+
+
+ if(bHasFillColorMapping)
+ {
+ double nPropVal = pSeries->getValueByProperty(nPropIdx, "FillColor");
+ if(!std::isnan(nPropVal))
+ {
+ xPointShape->setPropertyValue("FillColor", uno::Any(static_cast<sal_Int32>( nPropVal)));
+ }
+ }
+
+ ///create label
+ createTextLabelShape(xTextTarget, *pSeries, nPropIdx, aParam);
+
+ if(!bDoExplode)
+ {
+ ShapeFactory::setShapeName( xPointShape
+ , ObjectIdentifier::createPointCID(
+ pSeries->getPointCID_Stub(), nPropIdx ) );
+ }
+ else try
+ {
+ ///enable dragging of outer segments
+
+ double fAngle = aParam.mfUnitCircleStartAngleDegree + aParam.mfUnitCircleWidthAngleDegree/2.0;
+ double fMaxDeltaRadius = aParam.mfUnitCircleOuterRadius-aParam.mfUnitCircleInnerRadius;
+ drawing::Position3D aOrigin = m_aPosHelper.transformUnitCircleToScene( fAngle, aParam.mfUnitCircleOuterRadius, aParam.mfLogicZ );
+ drawing::Position3D aNewOrigin = m_aPosHelper.transformUnitCircleToScene( fAngle, aParam.mfUnitCircleOuterRadius + fMaxDeltaRadius, aParam.mfLogicZ );
+
+ sal_Int32 nOffsetPercent( static_cast<sal_Int32>(aParam.mfExplodePercentage * 100.0) );
+
+ awt::Point aMinimumPosition( PlottingPositionHelper::transformSceneToScreenPosition(
+ aOrigin, m_xLogicTarget, m_nDimension ) );
+ awt::Point aMaximumPosition( PlottingPositionHelper::transformSceneToScreenPosition(
+ aNewOrigin, m_xLogicTarget, m_nDimension ) );
+
+ //enable dragging of piesegments
+ OUString aPointCIDStub( ObjectIdentifier::createSeriesSubObjectStub( OBJECTTYPE_DATA_POINT
+ , pSeries->getSeriesParticle()
+ , ObjectIdentifier::getPieSegmentDragMethodServiceName()
+ , ObjectIdentifier::createPieSegmentDragParameterString(
+ nOffsetPercent, aMinimumPosition, aMaximumPosition )
+ ) );
+
+ ShapeFactory::setShapeName( xPointShape
+ , ObjectIdentifier::createPointCID( aPointCIDStub,
+ nPropIdx ) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+ }//next series in x slot (next y slot)
+ }//next category
}
-}//end anonymous namespace
+void PieChart::createOneBar(
+ enum SubPieType eType,
+ ShapeParam& aParam,
+ const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
+ const rtl::Reference<SvxShapeGroup>& xTextTarget,
+ VDataSeries* pSeries,
+ const PieDataSrcBase *pDataSrc,
+ sal_Int32 n3DRelativeHeight)
+{
+ bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor");
+
+ sal_Int32 nBarPtCnt = pDataSrc->getNPoints(pSeries, eType);
+
+ // Find sum of entries for this bar chart
+ double barSum = 0;
+ for (sal_Int32 nPointIndex = 0; nPointIndex < nBarPtCnt; nPointIndex++ ) {
+ double fY = pDataSrc->getData(pSeries, nPointIndex, eType);
+ if (!std::isnan(fY) ) barSum += fY;
+ }
+
+ double fBarBottom = 0.0;
+ double fBarTop = -0.5; // make the bar go from -0.5 to 0.5
+ ///iterate through all points to create shapes
+ for(sal_Int32 nPointIndex = 0; nPointIndex < nBarPtCnt; nPointIndex++ )
+ {
+ aParam.mfDepth = getTransformedDepth() * (n3DRelativeHeight / 100.0);
+
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries, xSeriesTarget);
+
+ ///collect data point information (logic coordinates, style ):
+ double fY = pDataSrc->getData(pSeries, nPointIndex, eType) / barSum;
+ if( std::isnan(fY) )
+ continue;
+ if(fY==0.0)//@todo: continue also if the resolution is too small
+ continue;
+ fBarBottom = fBarTop;
+ fBarTop += fY;
+
+ uno::Reference< beans::XPropertySet > xPointProperties =
+ pDataSrc->getProps(pSeries, nPointIndex, eType);
+
+ ///create data point
+ aParam.mfLogicZ = -1.0; // For 3D pie chart label position
+
+ rtl::Reference<SvxShape> xPointShape =
+ createBarDataPoint(xSeriesGroupShape_Shapes,
+ xPointProperties, aParam,
+ fBarBottom, fBarTop);
+
+ sal_Int32 nPropIdx = propIndex(nPointIndex, eType, pDataSrc, pSeries);
+
+ ///point color:
+ if (!pSeries->hasPointOwnColor(nPropIdx) && m_xColorScheme.is())
+ {
+ xPointShape->setPropertyValue("FillColor",
+ uno::Any(m_xColorScheme->getColorByIndex( nPropIdx )));
+ }
+
+
+ if(bHasFillColorMapping)
+ {
+ double nPropVal = pSeries->getValueByProperty(nPropIdx, "FillColor");
+ if(!std::isnan(nPropVal))
+ {
+ xPointShape->setPropertyValue("FillColor", uno::Any(static_cast<sal_Int32>( nPropVal)));
+ }
+ }
+
+ ///create label
+ createTextLabelShape(xTextTarget, *pSeries, nPropIdx, aParam);
+
+ ShapeFactory::setShapeName( xPointShape,
+ ObjectIdentifier::createPointCID( pSeries->getPointCID_Stub(),
+ nPropIdx ) );
+ }//next category
+}
PieChart::PieLabelInfo::PieLabelInfo()
- : aFirstPosition(), aOrigin(), fValue(0.0)
- , bMovementAllowed(false), bMoved(false), pPrevious(nullptr),pNext(nullptr)
+ : fValue(0.0)
+ , bMovementAllowed(false), bMoved(false)
+ , bShowLeaderLine(false), pPrevious(nullptr)
+ , pNext(nullptr)
{
}
@@ -770,48 +1387,49 @@ bool PieChart::PieLabelInfo::moveAwayFrom( const PieChart::PieLabelInfo* pFix, c
///boxes (`aOverlap`).
::basegfx::B2IRectangle aOverlap( lcl_getRect( xLabelGroupShape ) );
aOverlap.intersect( lcl_getRect( pFix->xLabelGroupShape ) );
- if( !aOverlap.isEmpty() )
- {
- //TODO: alternative move direction
-
- ///the label is shifted along the direction orthogonal to the vector
- ///starting at the pie/donut center and ending at this label anchor
- ///point;
-
- ///named `aTangentialDirection` the unit vector related to such a
- ///direction, the magnitude of the shift along such a direction is
- ///calculated in this way: if the horizontal component of
- ///`aTangentialDirection` is greater than the vertical component,
- ///the magnitude of the shift is equal to `aOverlap.Width` else to
- ///`aOverlap.Height`;
- basegfx::B2IVector aRadiusDirection = aFirstPosition - aOrigin;
- aRadiusDirection.setLength(1.0);
- basegfx::B2IVector aTangentialDirection( -aRadiusDirection.getY(), aRadiusDirection.getX() );
- bool bShiftHorizontal = abs(aTangentialDirection.getX()) > abs(aTangentialDirection.getY());
- sal_Int32 nShift = bShiftHorizontal ? static_cast<sal_Int32>(aOverlap.getWidth()) : static_cast<sal_Int32>(aOverlap.getHeight());
- ///the magnitude of the shift is also increased by 1/50-th of the width
- ///or the height of the document page;
- nShift += (bShiftHorizontal ? nLabelDistanceX : nLabelDistanceY);
- ///in case the `bMoveHalfWay` parameter is true the magnitude of
- ///the shift is halved.
- if( bMoveHalfWay )
- nShift/=2;
- ///in case the `bMoveClockwise` parameter is false the direction of
- ///`aTangentialDirection` is reversed;
- if(!bMoveClockwise)
- nShift*=-1;
- awt::Point aOldPos( xLabelGroupShape->getPosition() );
- basegfx::B2IVector aNewPos = basegfx::B2IVector( aOldPos.X, aOldPos.Y ) + nShift*aTangentialDirection;
-
- ///a final check is performed in order to be sure that the moved label
- ///is still inside the page document;
- awt::Point aNewAWTPos( aNewPos.getX(), aNewPos.getY() );
- if( !lcl_isInsidePage( aNewAWTPos, xLabelGroupShape->getSize(), rPageSize ) )
- return false;
+ if( aOverlap.isEmpty() )
+ return true;
+
+ //TODO: alternative move direction
+
+ ///the label is shifted along the direction orthogonal to the vector
+ ///starting at the pie/donut center and ending at this label anchor
+ ///point;
+
+ ///named `aTangentialDirection` the unit vector related to such a
+ ///direction, the magnitude of the shift along such a direction is
+ ///calculated in this way: if the horizontal component of
+ ///`aTangentialDirection` is greater than the vertical component,
+ ///the magnitude of the shift is equal to `aOverlap.Width` else to
+ ///`aOverlap.Height`;
+ basegfx::B2IVector aRadiusDirection = aFirstPosition - aOrigin;
+ aRadiusDirection.setLength(1.0);
+ basegfx::B2IVector aTangentialDirection( -aRadiusDirection.getY(), aRadiusDirection.getX() );
+ bool bShiftHorizontal = abs(aTangentialDirection.getX()) > abs(aTangentialDirection.getY());
+ sal_Int32 nShift = bShiftHorizontal ? static_cast<sal_Int32>(aOverlap.getWidth()) : static_cast<sal_Int32>(aOverlap.getHeight());
+ ///the magnitude of the shift is also increased by 1/50-th of the width
+ ///or the height of the document page;
+ nShift += (bShiftHorizontal ? nLabelDistanceX : nLabelDistanceY);
+ ///in case the `bMoveHalfWay` parameter is true the magnitude of
+ ///the shift is halved.
+ if( bMoveHalfWay )
+ nShift/=2;
+ ///in case the `bMoveClockwise` parameter is false the direction of
+ ///`aTangentialDirection` is reversed;
+ if(!bMoveClockwise)
+ nShift*=-1;
+ awt::Point aOldPos( xLabelGroupShape->getPosition() );
+ basegfx::B2IVector aNewPos = basegfx::B2IVector( aOldPos.X, aOldPos.Y ) + nShift*aTangentialDirection;
+
+ ///a final check is performed in order to be sure that the moved label
+ ///is still inside the page document;
+ awt::Point aNewAWTPos( aNewPos.getX(), aNewPos.getY() );
+ if( !lcl_isInsidePage( aNewAWTPos, xLabelGroupShape->getSize(), rPageSize ) )
+ return false;
+
+ xLabelGroupShape->setPosition( aNewAWTPos );
+ bMoved = true;
- xLabelGroupShape->setPosition( aNewAWTPos );
- bMoved = true;
- }
return true;
///note that no further test is performed in order to check that the
@@ -989,7 +1607,7 @@ bool PieChart::tryMoveLabels( PieLabelInfo const * pFirstBorder, PieLabelInfo co
PieLabelInfo* p2 = pCenter->pNext;
//return true when successful
- bool bLabelOrderIsAntiClockWise = m_pPosHelper->isMathematicalOrientationAngle();
+ bool bLabelOrderIsAntiClockWise = m_aPosHelper.isMathematicalOrientationAngle();
///two loops are performed simultaneously: the outer loop iterates on
///`PieLabelInfo` objects in the list starting from the central element
@@ -1099,7 +1717,7 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi
if(!bMoveableFound)
return;
- double fPageDiagonaleLength = sqrt( double(rPageSize.Width)*double(rPageSize.Width) + double(rPageSize.Height)*double(rPageSize.Height) );
+ double fPageDiagonaleLength = std::hypot(rPageSize.Width, rPageSize.Height);
if( fPageDiagonaleLength == 0.0 )
return;
@@ -1127,44 +1745,29 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi
VLineProperties aVLineProperties;
for (auto const& labelInfo : m_aLabelInfoList)
{
- if( labelInfo.bMoved )
+ if( labelInfo.bMoved && labelInfo.bShowLeaderLine )
{
- sal_Int32 nX1 = labelInfo.aFirstPosition.getX();
- sal_Int32 nY1 = labelInfo.aFirstPosition.getY();
- sal_Int32 nX2 = nX1;
- sal_Int32 nY2 = nY1;
- ::basegfx::B2IRectangle aRect( lcl_getRect( labelInfo.xLabelGroupShape ) );
- if( nX1 < aRect.getMinX() )
- nX2 = aRect.getMinX();
- else if( nX1 > aRect.getMaxX() )
- nX2 = aRect.getMaxX();
-
- if( nY1 < aRect.getMinY() )
- nY2 = aRect.getMinY();
- else if( nY1 > aRect.getMaxY() )
- nY2 = aRect.getMaxY();
+ const basegfx::B2IRectangle aRect(lcl_getRect(labelInfo.xLabelGroupShape));
+ sal_Int32 nX1 = labelInfo.aOuterPosition.getX();
+ sal_Int32 nY1 = labelInfo.aOuterPosition.getY();
+ const sal_Int32 nX2 = std::clamp(nX1, aRect.getMinX(), aRect.getMaxX());
+ const sal_Int32 nY2 = std::clamp(nY1, aRect.getMinY(), aRect.getMaxY());
//when the line is very short compared to the page size don't create one
::basegfx::B2DVector aLength(nX1-nX2, nY1-nY2);
if( (aLength.getLength()/fPageDiagonaleLength) < 0.01 )
continue;
- drawing::PointSequenceSequence aPoints(1);
- aPoints[0].realloc(2);
- aPoints[0][0].X = nX1;
- aPoints[0][0].Y = nY1;
- aPoints[0][1].X = nX2;
- aPoints[0][1].Y = nY2;
+ drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } };
- uno::Reference< beans::XPropertySet > xProp( labelInfo.xTextShape, uno::UNO_QUERY);
- if( xProp.is() )
+ if( labelInfo.xTextShape.is() )
{
sal_Int32 nColor = 0;
- xProp->getPropertyValue("CharColor") >>= nColor;
+ labelInfo.xTextShape->SvxShape::getPropertyValue("CharColor") >>= nColor;
if( nColor != -1 )//automatic font color does not work for lines -> fallback to black
aVLineProperties.Color <<= nColor;
}
- m_pShapeFactory->createLine2D( labelInfo.xTextTarget, aPoints, &aVLineProperties );
+ ShapeFactory::createLine2D( labelInfo.xTextTarget, aPoints, &aVLineProperties );
}
}
}
@@ -1259,11 +1862,11 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab
// get the middle point of the arc representing the pie slice border
double fLogicZ = rShapeParam.mfLogicZ + 1.0;
awt::Point aMiddleArcPoint = PlottingPositionHelper::transformSceneToScreenPosition(
- m_pPosHelper->transformUnitCircleToScene(
+ m_aPosHelper.transformUnitCircleToScene(
fBisectingRayAngleDeg,
rShapeParam.mfUnitCircleOuterRadius,
fLogicZ ),
- m_xLogicTarget, m_pShapeFactory, m_nDimension );
+ m_xLogicTarget, m_nDimension );
// compute the pie radius
basegfx::B2IVector aPieCenter = rPieLabelInfo.aOrigin;
@@ -1345,8 +1948,7 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab
// compute the length of the diagonal vector d,
// that is the distance between P and F
- double fSquaredDistancePF = fDistancePM * fDistancePM + fOrthogonalEdgeLength * fOrthogonalEdgeLength;
- double fDistancePF = sqrt( fSquaredDistancePF );
+ double fDistancePF = std::hypot(fDistancePM, fOrthogonalEdgeLength);
SAL_INFO( "chart2.pie.label.bestfit.inside",
" width = " << fLabelWidth );
@@ -1556,64 +2158,90 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab
return true;
}
-/** Handle the placement of the label in the best fit case.
- * First off the routine try to place the label inside the related pie slice,
- * if this is not possible the label is placed outside.
- */
-void PieChart::performLabelBestFit(ShapeParam& rShapeParam, PieLabelInfo const & rPieLabelInfo)
+//=======================
+// class PieDataSrc
+//=======================
+double PieDataSrc::getData(const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ [[maybe_unused]] enum SubPieType eType) const
{
- if( m_bUseRings )
- return;
+ return fabs(pSeries->getYValue( nPtIdx ));
+}
- if( performLabelBestFitInnerPlacement(rShapeParam, rPieLabelInfo) )
- return;
+sal_Int32 PieDataSrc::getNPoints(const VDataSeries* pSeries,
+ [[maybe_unused]] enum SubPieType eType) const
+{
+ assert(eType == SubPieType::NONE);
+ return pSeries->getTotalPointCount();
+}
- // If it does not fit inside, let's put it outside
- awt::Point aOldPos(rPieLabelInfo.xLabelGroupShape->getPosition());
- basegfx::B2IVector aTranslationVector = rPieLabelInfo.aFirstPosition - rPieLabelInfo.aOrigin;
- awt::Point aScreenPosition2D(aOldPos.X + aTranslationVector.getX(),
- aOldPos.Y + aTranslationVector.getY());
+uno::Reference< beans::XPropertySet > PieDataSrc::getProps(
+ const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ [[maybe_unused]] enum SubPieType eType) const
+{
+ assert(eType == SubPieType::NONE);
+ return pSeries->getPropertiesOfPoint(nPtIdx);
+}
- double fAngleDegree = rShapeParam.mfUnitCircleStartAngleDegree + rShapeParam.mfUnitCircleWidthAngleDegree / 2.0;
- ::basegfx::B2IRectangle aBb(lcl_getRect(rPieLabelInfo.xLabelGroupShape));
- double fLabelWidth = aBb.getWidth();
- double fLabelHeight = aBb.getHeight();
- while (fAngleDegree > 360.0)
- fAngleDegree -= 360.0;
- while (fAngleDegree < 0.0)
- fAngleDegree += 360.0;
+//=======================
+// class OfPieDataSrc
+//=======================
- if (fAngleDegree <= 22.5 || fAngleDegree >= 337.5)
- aScreenPosition2D.X += fLabelWidth / 2;
- else if (fAngleDegree < 67.5)
- {
- aScreenPosition2D.X += fLabelWidth / 2;
- aScreenPosition2D.Y -= fLabelHeight / 2;
- }
- else if (fAngleDegree < 112.5)
- aScreenPosition2D.Y -= fLabelHeight / 2;
- else if (fAngleDegree <= 157.5)
- {
- aScreenPosition2D.X -= fLabelWidth / 2;
- aScreenPosition2D.Y -= fLabelHeight / 2;
- }
- else if (fAngleDegree <= 202.5)
- aScreenPosition2D.X -= fLabelWidth / 2;
- else if (fAngleDegree < 247.5)
- {
- aScreenPosition2D.X -= fLabelWidth / 2;
- aScreenPosition2D.Y += fLabelHeight / 2;
+// For now, just implement the default Excel behavior, which is that the
+// right pie consists of the last three entries in the series. Other
+// behaviors should be supported later.
+// TODO
+
+sal_Int32 OfPieDataSrc::getNPoints(const VDataSeries* pSeries,
+ enum SubPieType eType) const
+{
+ if (eType == SubPieType::LEFT) {
+ return pSeries->getTotalPointCount() - 2;
+ } else {
+ assert(eType == SubPieType::RIGHT);
+ return 3;
}
- else if (fAngleDegree < 292.5)
- aScreenPosition2D.Y += fLabelHeight / 2;
- else
- {
- aScreenPosition2D.X += fLabelWidth / 2;
- aScreenPosition2D.Y += fLabelHeight / 2;
+}
+
+double OfPieDataSrc::getData(const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ enum SubPieType eType) const
+{
+ const sal_Int32 n = pSeries->getTotalPointCount() - 3;
+ if (eType == SubPieType::LEFT) {
+ // nPtIdx should be in [0, n]
+ if (nPtIdx < n) {
+ return fabs(pSeries->getYValue( nPtIdx ));
+ } else {
+ assert(nPtIdx == n);
+ return fabs(pSeries->getYValue(n)) +
+ fabs(pSeries->getYValue(n+1)) +
+ fabs(pSeries->getYValue(n+2));
+ }
+ } else {
+ assert(eType == SubPieType::RIGHT);
+ return fabs(pSeries->getYValue(nPtIdx + n));
}
+}
- rPieLabelInfo.xLabelGroupShape->setPosition(aScreenPosition2D);
+uno::Reference< beans::XPropertySet > OfPieDataSrc::getProps(
+ const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ enum SubPieType eType) const
+{
+ const sal_Int32 nPts = pSeries->getTotalPointCount();
+ const sal_Int32 n = nPts - 3;
+ if (eType == SubPieType::LEFT) {
+ // nPtIdx should be in [0, n]
+ if (nPtIdx < n) {
+ return pSeries->getPropertiesOfPoint( nPtIdx );
+ } else {
+ // The aggregated wedge
+ assert(nPtIdx == n);
+ return pSeries->getPropertiesOfPoint(nPts);
+ }
+ } else {
+ assert(eType == SubPieType::RIGHT);
+ return pSeries->getPropertiesOfPoint(nPtIdx + n);
+ }
}
} //namespace chart
diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx
index a176adaaf44a..ccbe9cb94d94 100644
--- a/chart2/source/view/charttypes/PieChart.hxx
+++ b/chart2/source/view/charttypes/PieChart.hxx
@@ -17,18 +17,107 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_PIECHART_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_PIECHART_HXX
+#pragma once
#include <memory>
#include <VSeriesPlotter.hxx>
+#include <PlottingPositionHelper.hxx>
#include <basegfx/vector/b2ivector.hxx>
#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
namespace chart
{
-class PiePositionHelper;
+class PiePositionHelper : public PolarPlottingPositionHelper
+{
+public:
+ PiePositionHelper( double fAngleDegreeOffset );
+
+ bool getInnerAndOuterRadius( double fCategoryX, double& fLogicInnerRadius, double& fLogicOuterRadius, bool bUseRings, double fMaxOffset ) const;
+
+ // Determine if the pie wedges are ordered clockwise (returns true) or
+ // counterclockwise (returns false)
+ bool clockwiseWedges() const;
+
+public:
+ //Distance between different category rings, seen relative to width of a ring:
+ double m_fRingDistance; //>=0 m_fRingDistance=1 --> distance == width
+};
+
+enum class SubPieType {
+ NONE, // solo pie or donut
+ LEFT, // left pie in pie-of-pie
+ RIGHT // right pie in pie-of-pie
+};
+
+
+//=======================
+// class PieDataSrcBase
+//=======================
+class PieDataSrcBase
+{
+public:
+ PieDataSrcBase() = default;
+ virtual ~PieDataSrcBase() = default;
+
+ // Number of data points for given pie subtype
+ virtual sal_Int32 getNPoints(const VDataSeries* pSeries,
+ enum SubPieType eType) const = 0;
+
+ // Get the value for the given pie wedge, for the given subtype
+ virtual double getData(const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ enum SubPieType eType) const = 0;
+
+ // Get the properties for the wedge and subtype
+ virtual uno::Reference< beans::XPropertySet > getProps(
+ const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ enum SubPieType eType) const = 0;
+};
+
+//=======================
+// class PieDataSrc
+//=======================
+class PieDataSrc : public PieDataSrcBase
+{
+public:
+ sal_Int32 getNPoints(const VDataSeries* pSeries,
+ enum SubPieType eType) const;
+
+ double getData(const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ [[maybe_unused]]enum SubPieType eType) const;
+
+ virtual uno::Reference< beans::XPropertySet > getProps(
+ const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ enum SubPieType eType) const;
+};
+
+//=======================
+// class OfPieDataSrc
+//=======================
+class OfPieDataSrc : public PieDataSrcBase
+{
+public:
+ // Minimum sensible number of data points
+ static constexpr sal_Int32 minPoints = 4;
+
+ sal_Int32 getNPoints(const VDataSeries* pSeries,
+ enum SubPieType eType) const;
+
+ double getData(const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ enum SubPieType eType) const;
+
+ virtual uno::Reference< beans::XPropertySet > getProps(
+ const VDataSeries* pSeries, sal_Int32 nPtIdx,
+ enum SubPieType eType) const;
+};
+
+//=======================
+// class PieChart
+//=======================
class PieChart : public VSeriesPlotter
{
struct ShapeParam;
@@ -36,7 +125,7 @@ class PieChart : public VSeriesPlotter
public:
PieChart() = delete;
- PieChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
+ PieChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel
, sal_Int32 nDimensionCount, bool bExcludingPositioning );
virtual ~PieChart() override;
@@ -45,7 +134,7 @@ public:
virtual void createShapes() override;
virtual void rearrangeLabelToAvoidOverlapIfRequested( const css::awt::Size& rPageSize ) override;
- virtual void setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis ) override;
+ virtual void setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis ) override;
virtual void addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot ) override;
virtual css::drawing::Direction3D getPreferredDiagramAspectRatio() const override;
@@ -64,13 +153,20 @@ public:
virtual bool isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) override;
private: //methods
- css::uno::Reference<css::drawing::XShape>
+ rtl::Reference<SvxShape>
createDataPoint(
- const css::uno::Reference<css::drawing::XShapes>& xTarget,
+ enum SubPieType eType,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const css::uno::Reference<css::beans::XPropertySet>& xObjectProperties,
- tPropertyNameValueMap const * pOverWritePropertiesMap,
- const ShapeParam& rParam );
+ const ShapeParam& rParam,
+ const sal_Int32 nPointCount,
+ const bool bConcentricExplosion);
+ rtl::Reference<SvxShape> createBarDataPoint(
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
+ const uno::Reference<beans::XPropertySet>& xObjectProperties,
+ const ShapeParam& rParam,
+ double fBarSegBottom, double fBarSegTop);
/** This method creates a text shape for a label of a data point.
*
* @param xTextTarget
@@ -83,7 +179,7 @@ private: //methods
* ShapeParam object.
*/
void createTextLabelShape(
- const css::uno::Reference<css::drawing::XShapes>& xTextTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget,
VDataSeries& rSeries, sal_Int32 nPointIndex, ShapeParam& rParam );
/** This method sets `m_fMaxOffset` to the maximum `Offset` property and
@@ -106,14 +202,51 @@ struct PieLabelInfo;
, PieLabelInfo* pCenter, bool bSingleCenter, bool& rbAlternativeMoveDirection
, const css::awt::Size& rPageSize );
- bool performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLabelInfo const & rPieLabelInfo);
- void performLabelBestFit(ShapeParam& rShapeParam, PieLabelInfo const & rPieLabelInfo);
+ bool performLabelBestFitInnerPlacement( ShapeParam& rShapeParam
+ , PieLabelInfo const & rPieLabelInfo );
+
+ // A standalone pie, one pie in a pie-of-pie, or one ring of a donut
+ void createOneRing([[maybe_unused]]enum SubPieType eType
+ , double fSlotX
+ , ShapeParam& aParam
+ , const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget
+ , const rtl::Reference<SvxShapeGroup>& xTextTarget
+ , VDataSeries* pSeries
+ , const PieDataSrcBase *pDataSrc
+ , sal_Int32 n3DRelativeHeight);
+
+ // A bar chart in a bar-of-pie
+ void createOneBar(
+ enum SubPieType eType,
+ ShapeParam& aParam,
+ const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
+ const rtl::Reference<SvxShapeGroup>& xTextTarget,
+ VDataSeries* pSeries,
+ const PieDataSrcBase *pDataSrc,
+ sal_Int32 n3DRelativeHeight);
private: //member
- std::unique_ptr<PiePositionHelper>
- m_pPosHelper;
+ // Constants for of-pie charts. Some of these will want to become
+ // user-selectable values. TODO
+
+ // Radius scalings for left and right of-pie subcharts
+ static constexpr double m_fLeftScale = 2.0/3;
+ static constexpr double m_fRightScale = 1.0/3;
+ // Shifts left/right for of-pie subcharts
+ static constexpr double m_fLeftShift = -0.75;
+ static constexpr double m_fRightShift = 0.75;
+ // Height of bar-of-pie bar
+ static constexpr double m_fFullBarHeight = 1.0;
+ // Bar-of-pie bar left side position
+ static constexpr double m_fBarLeft = 0.75;
+ // Bar-of-pie bar right side position
+ static constexpr double m_fBarRight = 1.25;
+
+ PiePositionHelper m_aPosHelper;
+
bool m_bUseRings;
bool m_bSizeExcludesLabelsAndExplodedSegments;
+ ::css::chart2::PieChartSubType m_eSubType;
struct PieLabelInfo
{
@@ -121,14 +254,16 @@ private: //member
bool moveAwayFrom( const PieLabelInfo* pFix, const css::awt::Size& rPageSize
, bool bMoveHalfWay, bool bMoveClockwise );
- css::uno::Reference< css::drawing::XShape > xTextShape;
- css::uno::Reference< css::drawing::XShape > xLabelGroupShape;
+ rtl::Reference< SvxShapeText > xTextShape;
+ rtl::Reference< SvxShapeGroupAnyD > xLabelGroupShape;
::basegfx::B2IVector aFirstPosition;
+ ::basegfx::B2IVector aOuterPosition;
::basegfx::B2IVector aOrigin;
double fValue;
bool bMovementAllowed;
bool bMoved;
- css::uno::Reference< css::drawing::XShapes > xTextTarget;
+ bool bShowLeaderLine;
+ rtl::Reference<SvxShapeGroupAnyD> xTextTarget;
PieLabelInfo* pPrevious;
PieLabelInfo* pNext;
css::awt::Point aPreviousPosition;
@@ -138,7 +273,7 @@ private: //member
double m_fMaxOffset; /// cached max offset value (init'ed to NaN)
};
+
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
index 774d5fc1d7ac..15980b638bc8 100644
--- a/chart2/source/view/charttypes/Splines.cxx
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -18,13 +18,14 @@
*/
#include "Splines.hxx"
-#include <rtl/math.hxx>
#include <osl/diagnose.h>
-#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
#include <vector>
#include <algorithm>
-#include <memory>
+#include <optional>
+#include <cmath>
+#include <limits>
namespace chart
{
@@ -51,7 +52,7 @@ public:
derivation equal to this value at the x-value of the last point
of rSortedPoints
*/
- lcl_SplineCalculation( const tPointVecType & rSortedPoints,
+ lcl_SplineCalculation( tPointVecType && rSortedPoints,
double fY1FirstDerivation,
double fYnFirstDerivation );
@@ -61,7 +62,7 @@ public:
@param rSortedPoints the points for which splines shall be calculated,
they need to be sorted in x values. First and last y value must be equal
*/
- explicit lcl_SplineCalculation( const tPointVecType & rSortedPoints);
+ explicit lcl_SplineCalculation( tPointVecType && rSortedPoints);
/** @descr this function corresponds to the function splint in [1].
@@ -112,30 +113,28 @@ private:
};
lcl_SplineCalculation::lcl_SplineCalculation(
- const tPointVecType & rSortedPoints,
+ tPointVecType && rSortedPoints,
double fY1FirstDerivation,
double fYnFirstDerivation )
- : m_aPoints( rSortedPoints ),
+ : m_aPoints( std::move(rSortedPoints) ),
m_fYp1( fY1FirstDerivation ),
m_fYpN( fYnFirstDerivation ),
m_nKLow( 0 ),
- m_nKHigh( rSortedPoints.size() - 1 ),
- m_fLastInterpolatedValue(0.0)
+ m_nKHigh( m_aPoints.size() - 1 ),
+ m_fLastInterpolatedValue(std::numeric_limits<double>::infinity())
{
- ::rtl::math::setInf( &m_fLastInterpolatedValue, false );
Calculate();
}
lcl_SplineCalculation::lcl_SplineCalculation(
- const tPointVecType & rSortedPoints)
- : m_aPoints( rSortedPoints ),
+ tPointVecType && rSortedPoints)
+ : m_aPoints( std::move(rSortedPoints) ),
m_fYp1( 0.0 ), /*dummy*/
m_fYpN( 0.0 ), /*dummy*/
m_nKLow( 0 ),
- m_nKHigh( rSortedPoints.size() - 1 ),
- m_fLastInterpolatedValue(0.0)
+ m_nKHigh( m_aPoints.size() - 1 ),
+ m_fLastInterpolatedValue(std::numeric_limits<double>::infinity())
{
- ::rtl::math::setInf( &m_fLastInterpolatedValue, false );
CalculatePeriodic();
}
@@ -198,7 +197,7 @@ void lcl_SplineCalculation::Calculate()
( m_fYpN - ( m_aPoints[ n ].second - m_aPoints[ n - 1 ].second ) / xDiff );
}
- m_aSecDerivY[ n ] = ( un - qn * u[ n - 1 ] ) * ( qn * m_aSecDerivY[ n - 1 ] + 1.0 );
+ m_aSecDerivY[ n ] = ( un - qn * u[ n - 1 ] ) / ( qn * m_aSecDerivY[ n - 1 ] + 1.0 );
// note: the algorithm in [1] iterates from n-1 to 0, but as size_type
// may be (usually is) an unsigned type, we can not write k >= 0, as this
@@ -411,26 +410,19 @@ bool createParameterT(const tPointVecType& rUniquePoints, double* t)
bool bIsSuccessful = true;
const lcl_tSizeType n = rUniquePoints.size() - 1;
t[0]=0.0;
- double dx = 0.0;
- double dy = 0.0;
- double fDiffMax = 1.0; //dummy values
double fDenominator = 0.0; // initialized for summing up
for (lcl_tSizeType i=1; i<=n ; ++i)
{ // 4th root(dx^2+dy^2)
- dx = rUniquePoints[i].first - rUniquePoints[i-1].first;
- dy = rUniquePoints[i].second - rUniquePoints[i-1].second;
- // scaling to avoid underflow or overflow
- fDiffMax = std::max(fabs(dx), fabs(dy));
- if (fDiffMax == 0.0)
+ double dx = rUniquePoints[i].first - rUniquePoints[i-1].first;
+ double dy = rUniquePoints[i].second - rUniquePoints[i-1].second;
+ if (dx == 0 && dy == 0)
{
bIsSuccessful = false;
break;
}
else
{
- dx /= fDiffMax;
- dy /= fDiffMax;
- fDenominator += sqrt(sqrt(dx * dx + dy * dy)) * sqrt(fDiffMax);
+ fDenominator += sqrt(std::hypot(dx, dy));
}
}
if (fDenominator == 0.0)
@@ -444,13 +436,9 @@ bool createParameterT(const tPointVecType& rUniquePoints, double* t)
double fNumerator = 0.0;
for (lcl_tSizeType i=1; i<=j ; ++i)
{
- dx = rUniquePoints[i].first - rUniquePoints[i-1].first;
- dy = rUniquePoints[i].second - rUniquePoints[i-1].second;
- fDiffMax = std::max(fabs(dx), fabs(dy));
- // same as above, so should not be zero
- dx /= fDiffMax;
- dy /= fDiffMax;
- fNumerator += sqrt(sqrt(dx * dx + dy * dy)) * sqrt(fDiffMax);
+ double dx = rUniquePoints[i].first - rUniquePoints[i-1].first;
+ double dy = rUniquePoints[i].second - rUniquePoints[i-1].second;
+ fNumerator += sqrt(std::hypot(dx, dy));
}
t[j] = fNumerator / fDenominator;
@@ -532,30 +520,28 @@ void applyNtoParameterT(const lcl_tSizeType i,const double tk,const sal_uInt32 p
// Calculates uniform parametric splines with subinterval length 1,
// according ODF1.2 part 1, chapter 'chart interpolation'.
void SplineCalculater::CalculateCubicSplines(
- const drawing::PolyPolygonShape3D& rInput
- , drawing::PolyPolygonShape3D& rResult
+ const std::vector<std::vector<css::drawing::Position3D>>& rInput
+ , std::vector<std::vector<css::drawing::Position3D>>& rResult
, sal_uInt32 nGranularity )
{
OSL_PRECOND( nGranularity > 0, "Granularity is invalid" );
- sal_uInt32 nOuterCount = rInput.SequenceX.getLength();
+ sal_uInt32 nOuterCount = rInput.size();
- rResult.SequenceX.realloc(nOuterCount);
- rResult.SequenceY.realloc(nOuterCount);
- rResult.SequenceZ.realloc(nOuterCount);
+ rResult.resize(nOuterCount);
+
+ auto pSequence = rResult.data();
if( !nOuterCount )
return;
for( sal_uInt32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
{
- if( rInput.SequenceX[nOuter].getLength() <= 1 )
+ if( rInput[nOuter].size() <= 1 )
continue; //we need at least two points
- sal_uInt32 nMaxIndexPoints = rInput.SequenceX[nOuter].getLength()-1; // is >=1
- const double* pOldX = rInput.SequenceX[nOuter].getConstArray();
- const double* pOldY = rInput.SequenceY[nOuter].getConstArray();
- const double* pOldZ = rInput.SequenceZ[nOuter].getConstArray();
+ sal_uInt32 nMaxIndexPoints = rInput[nOuter].size()-1; // is >=1
+ const css::drawing::Position3D* pOld = rInput[nOuter].data();
std::vector < double > aParameter(nMaxIndexPoints+1);
aParameter[0]=0.0;
@@ -574,57 +560,50 @@ void SplineCalculater::CalculateCubicSplines(
for (sal_uInt32 nN=0;nN<=nMaxIndexPoints; nN++ )
{
aInputX[ nN ].first=aParameter[nN];
- aInputX[ nN ].second=pOldX[ nN ];
+ aInputX[ nN ].second=pOld[ nN ].PositionX;
aInputY[ nN ].first=aParameter[nN];
- aInputY[ nN ].second=pOldY[ nN ];
+ aInputY[ nN ].second=pOld[ nN ].PositionY;
aInputZ[ nN ].first=aParameter[nN];
- aInputZ[ nN ].second=pOldZ[ nN ];
+ aInputZ[ nN ].second=pOld[ nN ].PositionZ;
}
// generate a spline for each coordinate. It holds the complete
// information to calculate each point of the curve
- std::unique_ptr<lcl_SplineCalculation> aSplineX;
- std::unique_ptr<lcl_SplineCalculation> aSplineY;
+ std::optional<lcl_SplineCalculation> aSplineX;
+ std::optional<lcl_SplineCalculation> aSplineY;
// lcl_SplineCalculation* aSplineZ; the z-coordinates of all points in
// a data series are equal. No spline calculation needed, but copy
// coordinate to output
- if( pOldX[ 0 ] == pOldX[nMaxIndexPoints] &&
- pOldY[ 0 ] == pOldY[nMaxIndexPoints] &&
- pOldZ[ 0 ] == pOldZ[nMaxIndexPoints] &&
+ if( pOld[ 0 ].PositionX == pOld[nMaxIndexPoints].PositionX &&
+ pOld[ 0 ].PositionY == pOld[nMaxIndexPoints].PositionY &&
+ pOld[ 0 ].PositionZ == pOld[nMaxIndexPoints].PositionZ &&
nMaxIndexPoints >=2 )
{ // periodic spline
- aSplineX.reset(new lcl_SplineCalculation( aInputX));
- aSplineY.reset(new lcl_SplineCalculation( aInputY));
- // aSplineZ = new lcl_SplineCalculation( aInputZ) ;
+ aSplineX.emplace(std::move(aInputX));
+ aSplineY.emplace(std::move(aInputY));
}
else // generate the kind "natural spline"
{
- double fInfty;
- ::rtl::math::setInf( &fInfty, false );
- double fXDerivation = fInfty;
- double fYDerivation = fInfty;
- aSplineX.reset(new lcl_SplineCalculation( aInputX, fXDerivation, fXDerivation ));
- aSplineY.reset(new lcl_SplineCalculation( aInputY, fYDerivation, fYDerivation ));
+ double fXDerivation = std::numeric_limits<double>::infinity();
+ double fYDerivation = std::numeric_limits<double>::infinity();
+ aSplineX.emplace(std::move(aInputX), fXDerivation, fXDerivation);
+ aSplineY.emplace(std::move(aInputY), fYDerivation, fYDerivation);
}
// fill result polygon with calculated values
- rResult.SequenceX[nOuter].realloc( nMaxIndexPoints*nGranularity + 1);
- rResult.SequenceY[nOuter].realloc( nMaxIndexPoints*nGranularity + 1);
- rResult.SequenceZ[nOuter].realloc( nMaxIndexPoints*nGranularity + 1);
+ pSequence[nOuter].resize( nMaxIndexPoints*nGranularity + 1);
- double* pNewX = rResult.SequenceX[nOuter].getArray();
- double* pNewY = rResult.SequenceY[nOuter].getArray();
- double* pNewZ = rResult.SequenceZ[nOuter].getArray();
+ css::drawing::Position3D* pNew = pSequence[nOuter].data();
sal_uInt32 nNewPointIndex = 0; // Index in result points
for( sal_uInt32 ni = 0; ni < nMaxIndexPoints; ni++ )
{
// given point is surely a curve point
- pNewX[nNewPointIndex] = pOldX[ni];
- pNewY[nNewPointIndex] = pOldY[ni];
- pNewZ[nNewPointIndex] = pOldZ[ni];
+ pNew[nNewPointIndex].PositionX = pOld[ni].PositionX;
+ pNew[nNewPointIndex].PositionY = pOld[ni].PositionY;
+ pNew[nNewPointIndex].PositionZ = pOld[ni].PositionZ;
nNewPointIndex++;
// calculate intermediate points
@@ -633,31 +612,21 @@ void SplineCalculater::CalculateCubicSplines(
{
double fParam = aParameter[ni] + ( fInc * static_cast< double >( nj ) );
- pNewX[nNewPointIndex]=aSplineX->GetInterpolatedValue( fParam );
- pNewY[nNewPointIndex]=aSplineY->GetInterpolatedValue( fParam );
+ pNew[nNewPointIndex].PositionX = aSplineX->GetInterpolatedValue( fParam );
+ pNew[nNewPointIndex].PositionY = aSplineY->GetInterpolatedValue( fParam );
// pNewZ[nNewPointIndex]=aSplineZ->GetInterpolatedValue( fParam );
- pNewZ[nNewPointIndex] = pOldZ[ni];
+ pNew[nNewPointIndex].PositionZ = pOld[ni].PositionZ;
nNewPointIndex++;
}
}
// add last point
- pNewX[nNewPointIndex] = pOldX[nMaxIndexPoints];
- pNewY[nNewPointIndex] = pOldY[nMaxIndexPoints];
- pNewZ[nNewPointIndex] = pOldZ[nMaxIndexPoints];
+ pNew[nNewPointIndex] = pOld[nMaxIndexPoints];
}
}
-// The implementation follows closely ODF1.2 spec, chapter chart:interpolation
-// using the same names as in spec as far as possible, without prefix.
-// More details can be found on
-// Dr. C.-K. Shene: CS3621 Introduction to Computing with Geometry Notes
-// Unit 9: Interpolation and Approximation/Curve Global Interpolation
-// Department of Computer Science, Michigan Technological University
-// http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/
-// [last called 2011-05-20]
void SplineCalculater::CalculateBSplines(
- const css::drawing::PolyPolygonShape3D& rInput
- , css::drawing::PolyPolygonShape3D& rResult
+ const std::vector<std::vector<css::drawing::Position3D>>& rInput
+ , std::vector<std::vector<css::drawing::Position3D>>& rResult
, sal_uInt32 nResolution
, sal_uInt32 nDegree )
{
@@ -671,34 +640,32 @@ void SplineCalculater::CalculateBSplines(
// limit the b-spline degree at 15 to prevent insanely large sets of points
sal_uInt32 p = std::min<sal_uInt32>(nDegree, 15);
- sal_Int32 nOuterCount = rInput.SequenceX.getLength();
+ sal_Int32 nOuterCount = rInput.size();
+
+ rResult.resize(nOuterCount);
- rResult.SequenceX.realloc(nOuterCount);
- rResult.SequenceY.realloc(nOuterCount);
- rResult.SequenceZ.realloc(nOuterCount);
+ auto pSequence = rResult.data();
if( !nOuterCount )
return; // no input
for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
{
- if( rInput.SequenceX[nOuter].getLength() <= 1 )
+ if( rInput[nOuter].size() <= 1 )
continue; // need at least 2 points, next piece of the series
// Copy input to vector of points and remove adjacent double points. The
// Z-coordinate is equal for all points in a series and holds the depth
// in 3D mode, simple copying is enough.
- lcl_tSizeType nMaxIndexPoints = rInput.SequenceX[nOuter].getLength()-1; // is >=1
- const double* pOldX = rInput.SequenceX[nOuter].getConstArray();
- const double* pOldY = rInput.SequenceY[nOuter].getConstArray();
- const double* pOldZ = rInput.SequenceZ[nOuter].getConstArray();
- double fZCoordinate = pOldZ[0];
+ lcl_tSizeType nMaxIndexPoints = rInput[nOuter].size()-1; // is >=1
+ const css::drawing::Position3D* pOld = rInput[nOuter].data();
+ double fZCoordinate = pOld[0].PositionZ;
tPointVecType aPointsIn;
aPointsIn.resize(nMaxIndexPoints+1);
for (lcl_tSizeType i = 0; i <= nMaxIndexPoints; ++i )
{
- aPointsIn[ i ].first = pOldX[i];
- aPointsIn[ i ].second = pOldY[i];
+ aPointsIn[ i ].first = pOld[i].PositionX;
+ aPointsIn[ i ].second = pOld[i].PositionY;
}
aPointsIn.erase( std::unique( aPointsIn.begin(), aPointsIn.end()),
aPointsIn.end() );
@@ -710,29 +677,23 @@ void SplineCalculater::CalculateBSplines(
continue; // need at least 2 points, degree p needs at least n+1 points
// next piece of series
- std::unique_ptr<double[]> t(new double [n+1]);
- if (!createParameterT(aPointsIn, t.get()))
+ std::vector<double> t(n + 1);
+ if (!createParameterT(aPointsIn, t.data()))
{
continue; // next piece of series
}
lcl_tSizeType m = n + p + 1;
- std::unique_ptr<double[]> u(new double [m+1]);
- createKnotVector(n, p, t.get(), u.get());
+ std::vector<double> u(m + 1);
+ createKnotVector(n, p, t.data(), u.data());
// The matrix N contains the B-spline basis functions applied to parameters.
// In each row only p+1 adjacent elements are non-zero. The starting
// column in a higher row is equal or greater than in the lower row.
// To store this matrix the non-zero elements are shifted to column 0
// and the amount of shifting is remembered in an array.
- std::unique_ptr<double*[]> aMatN(new double*[n+1]);
- for (lcl_tSizeType row = 0; row <=n; ++row)
- {
- aMatN[row] = new double[p+1];
- for (sal_uInt32 col = 0; col <= p; ++col)
- aMatN[row][col] = 0.0;
- }
- std::unique_ptr<lcl_tSizeType[]> aShift(new lcl_tSizeType[n+1]);
+ std::vector<std::vector<double>> aMatN(n + 1, std::vector<double>(p + 1));
+ std::vector<lcl_tSizeType> aShift(n + 1);
aMatN[0][0] = 1.0; //all others are zero
aShift[0] = 0;
aMatN[n][0] = 1.0;
@@ -752,7 +713,7 @@ void SplineCalculater::CalculateBSplines(
// index in reduced matrix aMatN = (index in full matrix N) - (i-p)
aShift[k] = i - p;
- applyNtoParameterT(i, t[k], p, u.get(), aMatN[k]);
+ applyNtoParameterT(i, t[k], p, u.data(), aMatN[k].data());
} // next row k
// Get matrix C of control points from the matrix equation aMatN * C = aPointsIn
@@ -762,9 +723,6 @@ void SplineCalculater::CalculateBSplines(
lcl_tSizeType c = 0; // true column index
double fDivisor = 1.0; // used for diagonal element
double fEliminate = 1.0; // used for the element, that will become zero
- double fHelp;
- tPointType aHelp;
- lcl_tSizeType nHelp; // used in triangle change
bool bIsSuccessful = true;
for (c = 0 ; c <= n && bIsSuccessful; ++c)
{
@@ -784,18 +742,9 @@ void SplineCalculater::CalculateBSplines(
// exchange total row r with total row c if necessary
if (r != c)
{
- for ( sal_uInt32 i = 0; i <= p ; ++i)
- {
- fHelp = aMatN[r][i];
- aMatN[r][i] = aMatN[c][i];
- aMatN[c][i] = fHelp;
- }
- aHelp = aPointsIn[r];
- aPointsIn[r] = aPointsIn[c];
- aPointsIn[c] = aHelp;
- nHelp = aShift[r];
- aShift[r] = aShift[c];
- aShift[c] = nHelp;
+ std::swap( aMatN[r], aMatN[c] );
+ std::swap( aPointsIn[r], aPointsIn[c] );
+ std::swap( aShift[r], aShift[c] );
}
// divide row c, so that element(c,c) becomes 1
@@ -855,19 +804,15 @@ void SplineCalculater::CalculateBSplines(
// calculate the intermediate points according given resolution
// using deBoor-Cox algorithm
lcl_tSizeType nNewSize = nResolution * n + 1;
- rResult.SequenceX[nOuter].realloc(nNewSize);
- rResult.SequenceY[nOuter].realloc(nNewSize);
- rResult.SequenceZ[nOuter].realloc(nNewSize);
- double* pNewX = rResult.SequenceX[nOuter].getArray();
- double* pNewY = rResult.SequenceY[nOuter].getArray();
- double* pNewZ = rResult.SequenceZ[nOuter].getArray();
- pNewX[0] = aPointsIn[0].first;
- pNewY[0] = aPointsIn[0].second;
- pNewZ[0] = fZCoordinate; // Precondition: z-coordinates of all points of a series are equal
- pNewX[nNewSize -1 ] = aPointsIn[n].first;
- pNewY[nNewSize -1 ] = aPointsIn[n].second;
- pNewZ[nNewSize -1 ] = fZCoordinate;
- std::unique_ptr<double[]> aP(new double[m+1]);
+ pSequence[nOuter].resize(nNewSize);
+ css::drawing::Position3D* pNew = pSequence[nOuter].data();
+ pNew[0].PositionX = aPointsIn[0].first;
+ pNew[0].PositionY = aPointsIn[0].second;
+ pNew[0].PositionZ = fZCoordinate; // Precondition: z-coordinates of all points of a series are equal
+ pNew[nNewSize -1 ].PositionX = aPointsIn[n].first;
+ pNew[nNewSize -1 ].PositionY = aPointsIn[n].second;
+ pNew[nNewSize -1 ].PositionZ = fZCoordinate;
+ std::vector<double> aP(m + 1);
lcl_tSizeType nLow = 0;
for ( lcl_tSizeType nTIndex = 0; nTIndex <= n-1; ++nTIndex)
{
@@ -899,7 +844,7 @@ void SplineCalculater::CalculateBSplines(
aP[i] = (1 - fFactor)* aP[i-1] + fFactor * aP[i];
}
}
- pNewX[nNewIndex] = aP[nLow];
+ pNew[nNewIndex].PositionX = aP[nLow];
// y-coordinate
for (lcl_tSizeType i = nLow - p; i <= nLow; ++i)
@@ -914,15 +859,11 @@ void SplineCalculater::CalculateBSplines(
aP[i] = (1 - fFactor)* aP[i-1] + fFactor * aP[i];
}
}
- pNewY[nNewIndex] = aP[nLow];
- pNewZ[nNewIndex] = fZCoordinate;
+ pNew[nNewIndex].PositionY = aP[nLow];
+ pNew[nNewIndex].PositionZ = fZCoordinate;
}
}
}
- for (lcl_tSizeType row = 0; row <=n; ++row)
- {
- delete[] aMatN[row];
- }
} // next piece of the series
}
diff --git a/chart2/source/view/charttypes/Splines.hxx b/chart2/source/view/charttypes/Splines.hxx
index af0d82ea7ce4..b83c13931b47 100644
--- a/chart2/source/view/charttypes/Splines.hxx
+++ b/chart2/source/view/charttypes/Splines.hxx
@@ -17,12 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_SPLINES_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_CHARTTYPES_SPLINES_HXX
+#pragma once
#include <sal/types.h>
+#include <vector>
namespace com::sun::star::drawing { struct PolyPolygonShape3D; }
+namespace com::sun::star::drawing { struct Position3D; }
namespace chart
{
@@ -31,18 +32,17 @@ class SplineCalculater
{
public:
static void CalculateCubicSplines(
- const css::drawing::PolyPolygonShape3D& rPoints
- , css::drawing::PolyPolygonShape3D& rResult
+ const std::vector<std::vector<css::drawing::Position3D>>& rPoints
+ , std::vector<std::vector<css::drawing::Position3D>>& rResult
, sal_uInt32 nGranularity );
static void CalculateBSplines(
- const css::drawing::PolyPolygonShape3D& rPoints
- , css::drawing::PolyPolygonShape3D& rResult
+ const std::vector<std::vector<css::drawing::Position3D>>& rPoints
+ , std::vector<std::vector<css::drawing::Position3D>>& rResult
, sal_uInt32 nGranularity
, sal_uInt32 nSplineDepth );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index bbc1788ec148..b9773494d785 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -17,23 +17,32 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <cstddef>
+#include <limits>
#include <memory>
#include <VSeriesPlotter.hxx>
#include <BaseGFXHelper.hxx>
#include <VLineProperties.hxx>
#include <ShapeFactory.hxx>
+#include <Diagram.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <DataSeries.hxx>
+#include <DataSeriesProperties.hxx>
#include <CommonConverters.hxx>
#include <ExplicitCategoriesProvider.hxx>
+#include <FormattedString.hxx>
#include <ObjectIdentifier.hxx>
#include <StatisticsHelper.hxx>
#include <PlottingPositionHelper.hxx>
#include <LabelPositionHelper.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <Clipping.hxx>
#include <servicenames_charttypes.hxx>
#include <NumberFormatterWrapper.hxx>
#include <DataSeriesHelper.hxx>
+#include <RegressionCurveModel.hxx>
#include <RegressionCurveHelper.hxx>
#include <VLegendSymbolFactory.hxx>
#include <FormattedStringHelper.hxx>
@@ -56,27 +65,25 @@
#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart/TimeUnit.hpp>
+#include <com/sun/star/chart2/MovingAverageType.hpp>
#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
-#include <editeng/unoprnms.hxx>
+#include <o3tl/safeint.hxx>
#include <tools/color.hxx>
+#include <tools/UnitConversion.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
#include <basegfx/vector/b2dvector.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-
-#include <com/sun/star/style/ParagraphAdjust.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <unotools/localedatawrapper.hxx>
#include <comphelper/sequence.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
#include <functional>
@@ -89,6 +96,7 @@ namespace chart {
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart;
using namespace ::com::sun::star::chart2;
+using namespace ::chart::DataSeriesProperties;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -103,7 +111,6 @@ VDataSeriesGroup::VDataSeriesGroup( std::unique_ptr<VDataSeries> pSeries )
: m_aSeriesVector(1)
, m_bMaxPointCountDirty(true)
, m_nMaxPointCount(0)
- , m_aListOfCachedYValues()
{
m_aSeriesVector[0] = std::move(pSeries);
}
@@ -137,20 +144,18 @@ sal_Int32 VDataSeriesGroup::getSeriesCount() const
return m_aSeriesVector.size();
}
-VSeriesPlotter::VSeriesPlotter( const uno::Reference<XChartType>& xChartTypeModel
+VSeriesPlotter::VSeriesPlotter( rtl::Reference<ChartType> xChartTypeModel
, sal_Int32 nDimensionCount, bool bCategoryXAxis )
: PlotterBase( nDimensionCount )
, m_pMainPosHelper( nullptr )
- , m_xChartTypeModel(xChartTypeModel)
- , m_xChartTypeModelProps( uno::Reference< beans::XPropertySet >::query( xChartTypeModel ))
- , m_aZSlots()
+ , m_xChartTypeModel(std::move(xChartTypeModel))
, m_bCategoryXAxis(bCategoryXAxis)
, m_nTimeResolution(css::chart::TimeUnit::DAY)
, m_aNullDate(30,12,1899)
- , m_xColorScheme()
, m_pExplicitCategoriesProvider(nullptr)
, m_bPointsWereSkipped(false)
, m_bPieLabelsAllowToMove(false)
+ , m_aAvailableOuterRect(0, 0, 0, 0)
{
SAL_WARN_IF(!m_xChartTypeModel.is(),"chart2","no XChartType available in view, fallback to default values may be wrong");
}
@@ -194,7 +199,7 @@ void VSeriesPlotter::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32
pSeries->setXValuesIfNone( m_pExplicitCategoriesProvider->getOriginalCategories() );
}
- if(zSlot<0 || zSlot>=static_cast<sal_Int32>(m_aZSlots.size()))
+ if(zSlot<0 || o3tl::make_unsigned(zSlot)>=m_aZSlots.size())
{
//new z slot
std::vector< VDataSeriesGroup > aZSlot;
@@ -206,7 +211,7 @@ void VSeriesPlotter::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32
//existing zslot
std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[zSlot];
- if(xSlot<0 || xSlot>=static_cast<sal_Int32>(rXSlots.size()))
+ if(xSlot<0 || o3tl::make_unsigned(xSlot)>=rXSlots.size())
{
//append the series to already existing x series
rXSlots.emplace_back( std::move(pSeries) );
@@ -272,81 +277,68 @@ void VSeriesPlotter::releaseShapes()
}
}
-uno::Reference< drawing::XShapes > VSeriesPlotter::getSeriesGroupShape( VDataSeries* pDataSeries
- , const uno::Reference< drawing::XShapes >& xTarget )
+rtl::Reference<SvxShapeGroupAnyD> VSeriesPlotter::getSeriesGroupShape( VDataSeries* pDataSeries
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget )
{
- uno::Reference< drawing::XShapes > xShapes( pDataSeries->m_xGroupShape );
- if( !xShapes.is() )
- {
+ if( !pDataSeries->m_xGroupShape )
//create a group shape for this series and add to logic target:
- xShapes = createGroupShape( xTarget,pDataSeries->getCID() );
- pDataSeries->m_xGroupShape = xShapes;
- }
- return xShapes;
+ pDataSeries->m_xGroupShape = createGroupShape( xTarget,pDataSeries->getCID() );
+ return pDataSeries->m_xGroupShape;
}
-uno::Reference< drawing::XShapes > VSeriesPlotter::getSeriesGroupShapeFrontChild( VDataSeries* pDataSeries
- , const uno::Reference< drawing::XShapes >& xTarget )
+rtl::Reference<SvxShapeGroupAnyD> VSeriesPlotter::getSeriesGroupShapeFrontChild( VDataSeries* pDataSeries
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget )
{
- uno::Reference< drawing::XShapes > xShapes( pDataSeries->m_xFrontSubGroupShape );
- if(!xShapes.is())
+ if(!pDataSeries->m_xFrontSubGroupShape)
{
//ensure that the series group shape is already created
- uno::Reference< drawing::XShapes > xSeriesShapes( getSeriesGroupShape( pDataSeries, xTarget ) );
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesShapes( getSeriesGroupShape( pDataSeries, xTarget ) );
//ensure that the back child is created first
getSeriesGroupShapeBackChild( pDataSeries, xTarget );
//use series group shape as parent for the new created front group shape
- xShapes = createGroupShape( xSeriesShapes );
- pDataSeries->m_xFrontSubGroupShape = xShapes;
+ pDataSeries->m_xFrontSubGroupShape = createGroupShape( xSeriesShapes );
}
- return xShapes;
+ return pDataSeries->m_xFrontSubGroupShape;
}
-uno::Reference< drawing::XShapes > VSeriesPlotter::getSeriesGroupShapeBackChild( VDataSeries* pDataSeries
- , const uno::Reference< drawing::XShapes >& xTarget )
+rtl::Reference<SvxShapeGroupAnyD> VSeriesPlotter::getSeriesGroupShapeBackChild( VDataSeries* pDataSeries
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget )
{
- uno::Reference< drawing::XShapes > xShapes( pDataSeries->m_xBackSubGroupShape );
- if(!xShapes.is())
+ if(!pDataSeries->m_xBackSubGroupShape)
{
//ensure that the series group shape is already created
- uno::Reference< drawing::XShapes > xSeriesShapes( getSeriesGroupShape( pDataSeries, xTarget ) );
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesShapes( getSeriesGroupShape( pDataSeries, xTarget ) );
//use series group shape as parent for the new created back group shape
- xShapes = createGroupShape( xSeriesShapes );
- pDataSeries->m_xBackSubGroupShape = xShapes;
+ pDataSeries->m_xBackSubGroupShape = createGroupShape( xSeriesShapes );
}
- return xShapes;
+ return pDataSeries->m_xBackSubGroupShape;
}
-uno::Reference< drawing::XShapes > VSeriesPlotter::getLabelsGroupShape( VDataSeries& rDataSeries
- , const uno::Reference< drawing::XShapes >& xTextTarget )
+rtl::Reference<SvxShapeGroup> VSeriesPlotter::getLabelsGroupShape( VDataSeries& rDataSeries
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget )
{
//xTextTarget needs to be a 2D shape container always!
-
- uno::Reference< drawing::XShapes > xShapes( rDataSeries.m_xLabelsGroupShape );
- if(!xShapes.is())
+ if(!rDataSeries.m_xLabelsGroupShape)
{
//create a 2D group shape for texts of this series and add to text target:
- xShapes = m_pShapeFactory->createGroup2D( xTextTarget, rDataSeries.getLabelsCID() );
- rDataSeries.m_xLabelsGroupShape = xShapes;
+ rDataSeries.m_xLabelsGroupShape = ShapeFactory::createGroup2D( xTextTarget, rDataSeries.getLabelsCID() );
}
- return xShapes;
+ return rDataSeries.m_xLabelsGroupShape;
}
-uno::Reference< drawing::XShapes > VSeriesPlotter::getErrorBarsGroupShape( VDataSeries& rDataSeries
- , const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<SvxShapeGroupAnyD> VSeriesPlotter::getErrorBarsGroupShape( VDataSeries& rDataSeries
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, bool bYError )
{
- uno::Reference< css::drawing::XShapes > &rShapeGroup =
+ rtl::Reference<SvxShapeGroupAnyD> &rShapeGroup =
bYError ? rDataSeries.m_xErrorYBarsGroupShape : rDataSeries.m_xErrorXBarsGroupShape;
- uno::Reference< drawing::XShapes > xShapes( rShapeGroup );
- if(!xShapes.is())
+ if(!rShapeGroup)
{
//create a group shape for this series and add to logic target:
- xShapes = createGroupShape( xTarget,rDataSeries.getErrorBarsCID(bYError) );
- rShapeGroup = xShapes;
+ rShapeGroup = createGroupShape( xTarget,rDataSeries.getErrorBarsCID(bYError) );
}
- return xShapes;
+ return rShapeGroup;
}
@@ -393,7 +385,7 @@ OUString VSeriesPlotter::getLabelTextForValue( VDataSeries const & rDataSeries
return aNumber;
}
-uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<SvxShapeText> VSeriesPlotter::createDataLabel( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, VDataSeries& rDataSeries
, sal_Int32 nPointIndex
, double fValue
@@ -403,7 +395,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
, sal_Int32 nOffset
, sal_Int32 nTextWidth )
{
- uno::Reference< drawing::XShape > xTextShape;
+ rtl::Reference<SvxShapeText> xTextShape;
Sequence<uno::Reference<XDataPointCustomLabelField>> aCustomLabels;
try
@@ -429,8 +421,8 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
else if(eAlignment==LABEL_ALIGN_BOTTOM)
aScreenPosition2D.Y += nOffset;
- uno::Reference< drawing::XShapes > xTarget_ =
- m_pShapeFactory->createGroup2D(
+ rtl::Reference<SvxShapeGroup> xTarget_ =
+ ShapeFactory::createGroup2D(
getLabelsGroupShape(rDataSeries, xTarget),
ObjectIdentifier::createPointCID( rDataSeries.getLabelCID_Stub(), nPointIndex));
@@ -452,13 +444,12 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
uno::Reference< beans::XPropertySet > xProps( rDataSeries.getPropertiesOfPoint( nPointIndex ) );
if( xProps.is() )
xProps->getPropertyValue( "CharHeight") >>= fViewFontSize;
- // pt -> 1/100th mm
- fViewFontSize *= (2540.0f / 72.0f);
+ fViewFontSize = convertPointToMm100(fViewFontSize);
}
// the font height is used for computing the size of an optional legend
// symbol to be prepended to the text label.
- Reference< drawing::XShape > xSymbol;
+ rtl::Reference< SvxShapeGroup > xSymbol;
if(pLabel->ShowLegendSymbol)
{
sal_Int32 nSymbolHeight = static_cast< sal_Int32 >( fViewFontSize * 0.6 );
@@ -471,9 +462,9 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
awt::Size aMaxSymbolExtent( nSymbolWidth, nSymbolHeight );
if( rDataSeries.isVaryColorsByPoint() )
- xSymbol.set( VSeriesPlotter::createLegendSymbolForPoint( aMaxSymbolExtent, rDataSeries, nPointIndex, xTarget_, m_xShapeFactory ) );
+ xSymbol = VSeriesPlotter::createLegendSymbolForPoint( aMaxSymbolExtent, rDataSeries, nPointIndex, xTarget_ );
else
- xSymbol.set( VSeriesPlotter::createLegendSymbolForSeries( aMaxSymbolExtent, rDataSeries, xTarget_, m_xShapeFactory ) );
+ xSymbol = VSeriesPlotter::createLegendSymbolForSeries( aMaxSymbolExtent, rDataSeries, xTarget_ );
}
//prepare text
@@ -498,7 +489,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
}
sal_Int32 nLineCountForSymbolsize = 0;
- sal_uInt32 nTextListLength = 3;
+ sal_uInt32 nTextListLength = 4;
sal_uInt32 nCustomLabelsCount = aCustomLabels.getLength();
Sequence< OUString > aTextList( nTextListLength );
@@ -508,18 +499,19 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
nTextListLength = ( nCustomLabelsCount > 3 ) ? nCustomLabelsCount : 3;
aSeparator = "";
aTextList = Sequence< OUString >( nTextListLength );
+ auto pTextList = aTextList.getArray();
for( sal_uInt32 i = 0; i < nCustomLabelsCount; ++i )
{
switch( aCustomLabels[i]->getFieldType() )
{
case DataPointCustomLabelFieldType_VALUE:
{
- aTextList[i] = getLabelTextForValue( rDataSeries, nPointIndex, fValue, false );
+ pTextList[i] = getLabelTextForValue( rDataSeries, nPointIndex, fValue, false );
break;
}
case DataPointCustomLabelFieldType_CATEGORYNAME:
{
- aTextList[i] = getCategoryName( nPointIndex );
+ pTextList[i] = getCategoryName( nPointIndex );
break;
}
case DataPointCustomLabelFieldType_SERIESNAME:
@@ -527,29 +519,43 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
OUString aRole;
if ( m_xChartTypeModel )
aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel();
- const uno::Reference< XDataSeries >& xSeries( rDataSeries.getModel() );
- aTextList[i] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole );
+ const rtl::Reference< DataSeries >& xSeries( rDataSeries.getModel() );
+ pTextList[i] = xSeries->getLabelForRole( aRole );
break;
}
case DataPointCustomLabelFieldType_PERCENTAGE:
{
- aTextList[i] = getLabelTextForValue( rDataSeries, nPointIndex, fValue, true );
+ if(fSumValue == 0.0)
+ fSumValue = 1.0;
+ fValue /= fSumValue;
+ if(fValue < 0)
+ fValue *= -1.0;
+
+ pTextList[i] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true);
+ break;
+ }
+ case DataPointCustomLabelFieldType_CELLRANGE:
+ {
+ if (aCustomLabels[i]->getDataLabelsRange())
+ pTextList[i] = aCustomLabels[i]->getString();
+ else
+ pTextList[i] = OUString();
break;
}
case DataPointCustomLabelFieldType_CELLREF:
{
// TODO: for now doesn't show placeholder
- aTextList[i] = OUString();
+ pTextList[i] = OUString();
break;
}
case DataPointCustomLabelFieldType_TEXT:
{
- aTextList[i] = aCustomLabels[i]->getString();
+ pTextList[i] = aCustomLabels[i]->getString();
break;
}
case DataPointCustomLabelFieldType_NEWLINE:
{
- aTextList[i] = "\n";
+ pTextList[i] = "\n";
break;
}
default:
@@ -560,14 +566,24 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
}
else
{
+ auto pTextList = aTextList.getArray();
if( pLabel->ShowCategoryName )
{
- aTextList[0] = getCategoryName( nPointIndex );
+ pTextList[0] = getCategoryName( nPointIndex );
+ }
+
+ if( pLabel->ShowSeriesName )
+ {
+ OUString aRole;
+ if ( m_xChartTypeModel )
+ aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel();
+ const rtl::Reference< DataSeries >& xSeries( rDataSeries.getModel() );
+ pTextList[1] = xSeries->getLabelForRole( aRole );
}
if( pLabel->ShowNumber )
{
- aTextList[1] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, false);
+ pTextList[2] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, false);
}
if( pLabel->ShowNumberInPercent )
@@ -578,11 +594,11 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
if( fValue < 0 )
fValue*=-1.0;
- aTextList[2] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true);
+ pTextList[3] = getLabelTextForValue(rDataSeries, nPointIndex, fValue, true);
}
}
- for( auto const & line : std::as_const(aTextList) )
+ for (auto const& line : aTextList)
{
if( !line.isEmpty() )
{
@@ -607,46 +623,14 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
if( bUseCustomLabel )
{
- Sequence< uno::Reference< XFormattedString > > aFormattedLabels( aCustomLabels.getLength() );
- for( int i = 0; i < aFormattedLabels.getLength(); i++ )
- {
- aFormattedLabels[i] = aCustomLabels[i];
- }
-
- // center the text
- sal_uInt32 nProperties = pPropNames->getLength();
- pPropNames->realloc( nProperties + 1 );
- pPropValues->realloc( nProperties + 1 );
- (*pPropNames)[ nProperties ] = UNO_NAME_EDIT_PARA_ADJUST;
- (*pPropValues)[ nProperties ] <<= style::ParagraphAdjust_CENTER;
+ Sequence< uno::Reference< XFormattedString > > aFormattedLabels(
+ comphelper::containerToSequence<uno::Reference<XFormattedString>>(aCustomLabels));
// create text shape
- xTextShape = ShapeFactory::getOrCreateShapeFactory( m_xShapeFactory )->
+ xTextShape = ShapeFactory::
createText( xTarget_, aFormattedLabels, *pPropNames, *pPropValues,
ShapeFactory::makeTransformation( aScreenPosition2D ) );
}
- else if( bMultiLineLabel )
- {
- // prepare properties for each paragraph
- // we want to have the value and percent value centered respect
- // with the category name
- Sequence< tNameSequence > aParaPropNames(3);
- aParaPropNames[1].realloc(1);
- aParaPropNames[1][0] = "ParaAdjust";
- aParaPropNames[2].realloc(1);
- aParaPropNames[2][0] = "ParaAdjust";
-
- Sequence< tAnySequence > aParaPropValues(3);
- aParaPropValues[1].realloc(1);
- aParaPropValues[1][0] <<= style::ParagraphAdjust_CENTER;
- aParaPropValues[2].realloc(1);
- aParaPropValues[2][0] <<= style::ParagraphAdjust_CENTER;
-
- //create text shape
- xTextShape = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)->
- createText( xTarget_, aTextList, aParaPropNames, aParaPropValues
- , *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) );
- }
else
{
// join text list elements
@@ -664,9 +648,9 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
}
//create text shape
- xTextShape = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)->
- createText( xTarget_, aText.makeStringAndClear()
- , *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) );
+ xTextShape = ShapeFactory::
+ createText( xTarget_, aText.makeStringAndClear(), *pPropNames, *pPropValues,
+ ShapeFactory::makeTransformation( aScreenPosition2D ) );
}
if( !xTextShape.is() )
@@ -686,25 +670,21 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
// for the text shape
if( nTextWidth != 0 && bTextWrap )
{
- uno::Reference< beans::XPropertySet > xProp( xTextShape, uno::UNO_QUERY );
- if( xProp.is() )
+ // compute the height of a line of text
+ if( !bMultiLineLabel || nLineCountForSymbolsize <= 0 )
{
- // compute the height of a line of text
- if( !bMultiLineLabel || nLineCountForSymbolsize <= 0 )
- {
- nLineCountForSymbolsize = 1;
- }
- awt::Size aTextSize = xTextShape->getSize();
- sal_Int32 aTextLineHeight = aTextSize.Height / nLineCountForSymbolsize;
+ nLineCountForSymbolsize = 1;
+ }
+ awt::Size aTextSize = xTextShape->getSize();
+ sal_Int32 aTextLineHeight = aTextSize.Height / nLineCountForSymbolsize;
- // set maximum text width
- uno::Any aTextMaximumFrameWidth( nTextWidth );
- xProp->setPropertyValue( "TextMaximumFrameWidth", aTextMaximumFrameWidth );
+ // set maximum text width
+ uno::Any aTextMaximumFrameWidth( nTextWidth );
+ xTextShape->SvxShape::setPropertyValue( "TextMaximumFrameWidth", aTextMaximumFrameWidth );
- // compute the total lines of text
- aTextSize = xTextShape->getSize();
- nLineCountForSymbolsize = aTextSize.Height / aTextLineHeight;
- }
+ // compute the total lines of text
+ aTextSize = xTextShape->getSize();
+ nLineCountForSymbolsize = aTextSize.Height / aTextLineHeight;
}
// in case text is rotated, the transformation property of the text
@@ -712,9 +692,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
if( fRotationDegrees != 0.0 )
{
const double fDegreesPi( -basegfx::deg2rad(fRotationDegrees) );
- uno::Reference< beans::XPropertySet > xProp( xTextShape, uno::UNO_QUERY );
- if( xProp.is() )
- xProp->setPropertyValue( "Transformation", ShapeFactory::makeTransformation( aScreenPosition2D, fDegreesPi ) );
+ xTextShape->SvxShape::setPropertyValue( "Transformation", ShapeFactory::makeTransformation( aScreenPosition2D, fDegreesPi ) );
LabelPositionHelper::correctPositionForRotation( xTextShape, eAlignment, fRotationDegrees, true /*bRotateAroundCenter*/ );
}
@@ -725,37 +703,27 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
if( aRelPos.X != -1 )
{
xTextShape->setPosition(aRelPos);
- if( !m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ if( !m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) &&
+ // "ShowCustomLeaderLines"
+ rDataSeries.getModel()->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES ).get<sal_Bool>())
{
+ const basegfx::B2IRectangle aRect(
+ BaseGFXHelper::makeRectangle(aRelPos, xTextShape->getSize()));
sal_Int32 nX1 = rScreenPosition2D.X;
sal_Int32 nY1 = rScreenPosition2D.Y;
- sal_Int32 nX2 = nX1;
- sal_Int32 nY2 = nY1;
- ::basegfx::B2IRectangle aRect(BaseGFXHelper::makeRectangle(aRelPos, xTextShape->getSize()));
- if (nX1 < aRelPos.X)
- nX2 = aRelPos.X;
- else if (nX1 > aRect.getMaxX())
- nX2 = aRect.getMaxX();
-
- if (nY1 < aRect.getMinY())
- nY2 = aRect.getMinY();
- else if (nY1 > aRect.getMaxY())
- nY2 = aRect.getMaxY();
+ const sal_Int32 nX2 = std::clamp(nX1, aRelPos.X, aRect.getMaxX());
+ const sal_Int32 nY2 = std::clamp(nY1, aRect.getMinY(), aRect.getMaxY());
//when the line is very short compared to the page size don't create one
::basegfx::B2DVector aLength(nX1 - nX2, nY1 - nY2);
- double fPageDiagonaleLength = sqrt(double(m_aPageReferenceSize.Width)*double(m_aPageReferenceSize.Width) + double(m_aPageReferenceSize.Height)*double(m_aPageReferenceSize.Height));
+ double fPageDiagonaleLength
+ = std::hypot(m_aPageReferenceSize.Width, m_aPageReferenceSize.Height);
if ((aLength.getLength() / fPageDiagonaleLength) >= 0.01)
{
- drawing::PointSequenceSequence aPoints(1);
- aPoints[0].realloc(2);
- aPoints[0][0].X = nX1;
- aPoints[0][0].Y = nY1;
- aPoints[0][1].X = nX2;
- aPoints[0][1].Y = nY2;
+ drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } };
VLineProperties aVLineProperties;
- m_pShapeFactory->createLine2D(xTarget, aPoints, &aVLineProperties);
+ ShapeFactory::createLine2D(xTarget, aPoints, &aVLineProperties);
}
}
}
@@ -763,13 +731,11 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
// in case legend symbol has to be displayed, text shape position is
// slightly changed.
- const awt::Point aUnrotatedTextPos(xTextShape->getPosition());
if( xSymbol.is() )
{
- const awt::Point aOldTextPos( xTextShape->getPosition() );
- awt::Point aNewTextPos( aOldTextPos );
+ awt::Point aNewTextPos(xTextShape->getPosition());
- awt::Point aSymbolPosition( aUnrotatedTextPos );
+ awt::Point aSymbolPosition(aNewTextPos);
awt::Size aSymbolSize( xSymbol->getSize() );
awt::Size aTextSize = xTextShape->getSize();
@@ -820,8 +786,7 @@ double lcl_getErrorBarLogicLength(
bool bPositive,
bool bYError )
{
- double fResult;
- ::rtl::math::setNan( & fResult );
+ double fResult = std::numeric_limits<double>::quiet_NaN();
try
{
switch( nErrorBarStyle )
@@ -863,8 +828,7 @@ double lcl_getErrorBarLogicLength(
? OUString("PositiveError")
: OUString("NegativeError") ) >>= fPercent )
{
- double fMaxValue;
- ::rtl::math::setInf(&fMaxValue, true);
+ double fMaxValue = -std::numeric_limits<double>::infinity();
for(double d : rData)
{
if(fMaxValue < d)
@@ -900,7 +864,7 @@ double lcl_getErrorBarLogicLength(
}
void lcl_AddErrorBottomLine( const drawing::Position3D& rPosition, ::basegfx::B2DVector aMainDirection
- , drawing::PolyPolygonShape3D& rPoly, sal_Int32 nSequenceIndex )
+ , std::vector<std::vector<css::drawing::Position3D>>& rPoly, sal_Int32 nSequenceIndex )
{
double fFixedWidth = 200.0;
@@ -973,7 +937,7 @@ drawing::Position3D lcl_transformMixedToScene( PlottingPositionHelper const * pP
} // anonymous namespace
void VSeriesPlotter::createErrorBar(
- const uno::Reference< drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rUnscaledLogicPosition
, const uno::Reference< beans::XPropertySet > & xErrorBarProperties
, const VDataSeries& rVDataSeries
@@ -1075,7 +1039,21 @@ void VSeriesPlotter::createErrorBar(
fLocalX-=fLength;
aNegative = m_pPosHelper->transformLogicToScene( fLocalX, fLocalY, fZ, true );
}
- bCreateNegativeBorder = m_pPosHelper->isLogicVisible( fLocalX, fLocalY, fZ);
+ if (std::isfinite(aNegative.PositionX) &&
+ std::isfinite(aNegative.PositionY) &&
+ std::isfinite(aNegative.PositionZ)) {
+ bCreateNegativeBorder = m_pPosHelper->isLogicVisible( fLocalX, fLocalY, fZ);
+ } else {
+ // If error bars result in a numerical problem (e.g., an
+ // error bar on a logarithmic chart that results in a point
+ // <= 0) then just turn off the error bar.
+ //
+ // TODO: This perhaps should display a warning, so the user
+ // knows why a bar is not appearing.
+ // TODO: This test could also be added to the positive case,
+ // though a numerical overflow there is less likely.
+ bShowNegative = false;
+ }
}
else
bShowNegative = false;
@@ -1084,7 +1062,7 @@ void VSeriesPlotter::createErrorBar(
if(!bShowPositive && !bShowNegative)
return;
- drawing::PolyPolygonShape3D aPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aPoly;
sal_Int32 nSequenceIndex=0;
if( bShowNegative )
@@ -1106,8 +1084,8 @@ void VSeriesPlotter::createErrorBar(
lcl_AddErrorBottomLine( aPositive, aMainDirection, aPoly, nSequenceIndex );
}
- uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D( xTarget, PolyToPointSequence( aPoly) );
- setMappedProperties( xShape, xErrorBarProperties, PropertyMapper::getPropertyNameMapForLineProperties() );
+ rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D( xTarget, aPoly );
+ PropertyMapper::setMappedProperties( *xShape, xErrorBarProperties, PropertyMapper::getPropertyNameMapForLineProperties() );
}
catch( const uno::Exception & )
{
@@ -1119,16 +1097,13 @@ void VSeriesPlotter::createErrorBar(
void VSeriesPlotter::addErrorBorder(
const drawing::Position3D& rPos0
,const drawing::Position3D& rPos1
- ,const uno::Reference< drawing::XShapes >& rTarget
+ ,const rtl::Reference<SvxShapeGroupAnyD>& rTarget
,const uno::Reference< beans::XPropertySet >& rErrorBorderProp )
{
- drawing::PolyPolygonShape3D aPoly;
- sal_Int32 nSequenceIndex = 0;
- AddPointToPoly( aPoly, rPos0, nSequenceIndex );
- AddPointToPoly( aPoly, rPos1, nSequenceIndex );
- uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
- rTarget, PolyToPointSequence( aPoly) );
- setMappedProperties( xShape, rErrorBorderProp,
+ std::vector<std::vector<css::drawing::Position3D>> aPoly { { rPos0, rPos1} };
+ rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
+ rTarget, aPoly );
+ PropertyMapper::setMappedProperties( *xShape, rErrorBorderProp,
PropertyMapper::getPropertyNameMapForLineProperties() );
}
@@ -1136,7 +1111,7 @@ void VSeriesPlotter::createErrorRectangle(
const drawing::Position3D& rUnscaledLogicPosition
,VDataSeries& rVDataSeries
,sal_Int32 nIndex
- ,const uno::Reference< drawing::XShapes >& rTarget
+ ,const rtl::Reference<SvxShapeGroupAnyD>& rTarget
,bool bUseXErrorData
,bool bUseYErrorData )
{
@@ -1151,8 +1126,8 @@ void VSeriesPlotter::createErrorRectangle(
if ( !xErrorBorderPropX.is() )
return;
}
- uno::Reference< drawing::XShapes > xErrorBorder_ShapesX(
- getErrorBarsGroupShape( rVDataSeries, rTarget, false ) );
+ rtl::Reference<SvxShapeGroupAnyD> xErrorBorder_ShapesX =
+ getErrorBarsGroupShape( rVDataSeries, rTarget, false );
if ( bUseYErrorData )
{
@@ -1160,8 +1135,8 @@ void VSeriesPlotter::createErrorRectangle(
if ( !xErrorBorderPropY.is() )
return;
}
- uno::Reference< drawing::XShapes > xErrorBorder_ShapesY(
- getErrorBarsGroupShape( rVDataSeries, rTarget, true ) );
+ rtl::Reference<SvxShapeGroupAnyD> xErrorBorder_ShapesY =
+ getErrorBarsGroupShape( rVDataSeries, rTarget, true );
if( !ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension ) )
return;
@@ -1279,7 +1254,7 @@ void VSeriesPlotter::createErrorRectangle(
void VSeriesPlotter::createErrorBar_X( const drawing::Position3D& rUnscaledLogicPosition
, VDataSeries& rVDataSeries, sal_Int32 nPointIndex
- , const uno::Reference< drawing::XShapes >& xTarget )
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget )
{
if(m_nDimension!=2)
return;
@@ -1287,8 +1262,8 @@ void VSeriesPlotter::createErrorBar_X( const drawing::Position3D& rUnscaledLogic
uno::Reference< beans::XPropertySet > xErrorBarProp(rVDataSeries.getXErrorBarProperties(nPointIndex));
if( xErrorBarProp.is())
{
- uno::Reference< drawing::XShapes > xErrorBarsGroup_Shapes(
- getErrorBarsGroupShape(rVDataSeries, xTarget, false) );
+ rtl::Reference<SvxShapeGroupAnyD> xErrorBarsGroup_Shapes =
+ getErrorBarsGroupShape(rVDataSeries, xTarget, false);
createErrorBar( xErrorBarsGroup_Shapes
, rUnscaledLogicPosition, xErrorBarProp
@@ -1300,7 +1275,7 @@ void VSeriesPlotter::createErrorBar_X( const drawing::Position3D& rUnscaledLogic
void VSeriesPlotter::createErrorBar_Y( const drawing::Position3D& rUnscaledLogicPosition
, VDataSeries& rVDataSeries, sal_Int32 nPointIndex
- , const uno::Reference< drawing::XShapes >& xTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, double const * pfScaledLogicX )
{
if(m_nDimension!=2)
@@ -1309,8 +1284,8 @@ void VSeriesPlotter::createErrorBar_Y( const drawing::Position3D& rUnscaledLogic
uno::Reference< beans::XPropertySet > xErrorBarProp(rVDataSeries.getYErrorBarProperties(nPointIndex));
if( xErrorBarProp.is())
{
- uno::Reference< drawing::XShapes > xErrorBarsGroup_Shapes(
- getErrorBarsGroupShape(rVDataSeries, xTarget, true) );
+ rtl::Reference<SvxShapeGroupAnyD> xErrorBarsGroup_Shapes =
+ getErrorBarsGroupShape(rVDataSeries, xTarget, true);
createErrorBar( xErrorBarsGroup_Shapes
, rUnscaledLogicPosition, xErrorBarProp
@@ -1321,47 +1296,48 @@ void VSeriesPlotter::createErrorBar_Y( const drawing::Position3D& rUnscaledLogic
}
void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSeries,
- const uno::Reference< drawing::XShapes >& xTarget,
- const uno::Reference< drawing::XShapes >& xEquationTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xEquationTarget,
bool bMaySkipPoints )
{
if(m_nDimension!=2)
return;
- uno::Reference< XRegressionCurveContainer > xContainer( rVDataSeries.getModel(), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xContainer( rVDataSeries.getModel() );
if(!xContainer.is())
return;
if (!m_pPosHelper)
return;
- uno::Sequence< uno::Reference< XRegressionCurve > > aCurveList = xContainer->getRegressionCurves();
+ const std::vector< rtl::Reference< ::chart::RegressionCurveModel > > & aCurveList = xContainer->getRegressionCurves2();
- for(sal_Int32 nN=0; nN<aCurveList.getLength(); nN++)
+ for(std::size_t nN=0; nN<aCurveList.size(); nN++)
{
- uno::Reference< XRegressionCurveCalculator > xCalculator( aCurveList[nN]->getCalculator() );
+ const auto & rCurve = aCurveList[nN];
+ uno::Reference< XRegressionCurveCalculator > xCalculator( rCurve->getCalculator() );
if( !xCalculator.is())
continue;
- uno::Reference< beans::XPropertySet > xProperties( aCurveList[nN], uno::UNO_QUERY );
-
- bool bAverageLine = RegressionCurveHelper::isMeanValueLine( aCurveList[nN] );
+ bool bAverageLine = RegressionCurveHelper::isMeanValueLine( rCurve );
sal_Int32 aDegree = 2;
sal_Int32 aPeriod = 2;
+ sal_Int32 aMovingAverageType = css::chart2::MovingAverageType::Prior;
double aExtrapolateForward = 0.0;
double aExtrapolateBackward = 0.0;
bool bForceIntercept = false;
double aInterceptValue = 0.0;
- if ( xProperties.is() && !bAverageLine )
+ if ( !bAverageLine )
{
- xProperties->getPropertyValue( "PolynomialDegree") >>= aDegree;
- xProperties->getPropertyValue( "MovingAveragePeriod") >>= aPeriod;
- xProperties->getPropertyValue( "ExtrapolateForward") >>= aExtrapolateForward;
- xProperties->getPropertyValue( "ExtrapolateBackward") >>= aExtrapolateBackward;
- xProperties->getPropertyValue( "ForceIntercept") >>= bForceIntercept;
+ rCurve->getPropertyValue( "PolynomialDegree") >>= aDegree;
+ rCurve->getPropertyValue( "MovingAveragePeriod") >>= aPeriod;
+ rCurve->getPropertyValue( "MovingAverageType") >>= aMovingAverageType;
+ rCurve->getPropertyValue( "ExtrapolateForward") >>= aExtrapolateForward;
+ rCurve->getPropertyValue( "ExtrapolateBackward") >>= aExtrapolateBackward;
+ rCurve->getPropertyValue( "ForceIntercept") >>= bForceIntercept;
if (bForceIntercept)
- xProperties->getPropertyValue( "InterceptValue") >>= aInterceptValue;
+ rCurve->getPropertyValue( "InterceptValue") >>= aInterceptValue;
}
double fChartMinX = m_pPosHelper->getLogicMinX();
@@ -1383,8 +1359,9 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer
fPointScale = std::min(fPointScale, 1000.0);
}
- xCalculator->setRegressionProperties(aDegree, bForceIntercept, aInterceptValue, aPeriod);
- xCalculator->recalculateRegression( rVDataSeries.getAllX(), rVDataSeries.getAllY() );
+ xCalculator->setRegressionProperties(aDegree, bForceIntercept, aInterceptValue, aPeriod,
+ aMovingAverageType);
+ xCalculator->recalculateRegression(rVDataSeries.getAllX(), rVDataSeries.getAllY());
sal_Int32 nPointCount = 100 * fPointScale;
if ( nPointCount < 2 )
@@ -1410,9 +1387,13 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer
aRegressionPoly.SequenceX.realloc(1);
aRegressionPoly.SequenceY.realloc(1);
aRegressionPoly.SequenceZ.realloc(1);
- aRegressionPoly.SequenceX[0].realloc(nPointCount);
- aRegressionPoly.SequenceY[0].realloc(nPointCount);
- aRegressionPoly.SequenceZ[0].realloc(nPointCount);
+ auto pSequenceX = aRegressionPoly.SequenceX.getArray();
+ auto pSequenceY = aRegressionPoly.SequenceY.getArray();
+ auto pSequenceZ = aRegressionPoly.SequenceZ.getArray();
+ pSequenceX[0].realloc(nPointCount);
+ pSequenceY[0].realloc(nPointCount);
+ auto pSequenceX0 = pSequenceX[0].getArray();
+ auto pSequenceY0 = pSequenceY[0].getArray();
sal_Int32 nRealPointCount = 0;
@@ -1430,14 +1411,14 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer
!std::isnan(fLogicY) && !std::isinf(fLogicY) &&
!std::isnan(fLogicZ) && !std::isinf(fLogicZ) )
{
- aRegressionPoly.SequenceX[0][nRealPointCount] = fLogicX;
- aRegressionPoly.SequenceY[0][nRealPointCount] = fLogicY;
+ pSequenceX0[nRealPointCount] = fLogicX;
+ pSequenceY0[nRealPointCount] = fLogicY;
nRealPointCount++;
}
}
- aRegressionPoly.SequenceX[0].realloc(nRealPointCount);
- aRegressionPoly.SequenceY[0].realloc(nRealPointCount);
- aRegressionPoly.SequenceZ[0].realloc(nRealPointCount);
+ pSequenceX[0].realloc(nRealPointCount);
+ pSequenceY[0].realloc(nRealPointCount);
+ pSequenceZ[0].realloc(nRealPointCount);
drawing::PolyPolygonShape3D aClippedPoly;
Clipping::clipPolygonAtRectangle( aRegressionPoly, m_pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly );
@@ -1448,19 +1429,19 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer
if( aRegressionPoly.SequenceX.hasElements() && aRegressionPoly.SequenceX[0].hasElements() )
{
VLineProperties aVLineProperties;
- aVLineProperties.initFromPropertySet( xProperties );
+ aVLineProperties.initFromPropertySet( rCurve );
//create an extra group shape for each curve for selection handling
- uno::Reference< drawing::XShapes > xRegressionGroupShapes =
+ rtl::Reference<SvxShapeGroupAnyD> xRegressionGroupShapes =
createGroupShape( xTarget, rVDataSeries.getDataCurveCID( nN, bAverageLine ) );
- uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
xRegressionGroupShapes, PolyToPointSequence( aRegressionPoly ), &aVLineProperties );
ShapeFactory::setShapeName( xShape, "MarkHandles" );
aDefaultPos = xShape->getPosition();
}
// curve equation and correlation coefficient
- uno::Reference< beans::XPropertySet > xEquationProperties( aCurveList[nN]->getEquationProperties());
+ uno::Reference< beans::XPropertySet > xEquationProperties( rCurve->getEquationProperties());
if( xEquationProperties.is())
{
createRegressionCurveEquationShapes(
@@ -1493,7 +1474,7 @@ static sal_Int32 lcl_getOUStringMaxLineLength ( OUStringBuffer const & aString )
void VSeriesPlotter::createRegressionCurveEquationShapes(
const OUString & rEquationCID,
const uno::Reference< beans::XPropertySet > & xEquationProperties,
- const uno::Reference< drawing::XShapes >& xEquationTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xEquationTarget,
const uno::Reference< chart2::XRegressionCurveCalculator > & xRegressionCurveCalculator,
awt::Point aDefaultPos )
{
@@ -1551,7 +1532,7 @@ void VSeriesPlotter::createRegressionCurveEquationShapes(
}
if( bShowCorrCoeff )
{
- aFormula.append( "R" ).append( OUStringChar( aSuperscriptFigures[2] ) ).append( " = " );
+ aFormula.append( "R" + OUStringChar( aSuperscriptFigures[2] ) + " = " );
double fR( xRegressionCurveCalculator->getCorrelationCoefficient());
if (m_apNumberFormatterWrapper)
{
@@ -1592,65 +1573,51 @@ void VSeriesPlotter::createRegressionCurveEquationShapes(
tAnySequence aValues;
PropertyMapper::getPreparedTextShapePropertyLists( xEquationProperties, aNames, aValues );
- uno::Reference< drawing::XShape > xTextShape = m_pShapeFactory->createText(
+ rtl::Reference<SvxShapeText> xTextShape = ShapeFactory::createText(
xEquationTarget, aFormula.makeStringAndClear(),
aNames, aValues, ShapeFactory::makeTransformation( aScreenPosition2D ));
- OSL_ASSERT( xTextShape.is());
- if( xTextShape.is())
+ ShapeFactory::setShapeName( xTextShape, rEquationCID );
+ awt::Size aSize( xTextShape->getSize() );
+ awt::Point aPos( RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
+ aScreenPosition2D, aSize, aRelativePosition.Anchor ) );
+ //ensure that the equation is fully placed within the page (if possible)
+ if( (aPos.X + aSize.Width) > m_aPageReferenceSize.Width )
+ aPos.X = m_aPageReferenceSize.Width - aSize.Width;
+ if( aPos.X < 0 )
{
- ShapeFactory::setShapeName( xTextShape, rEquationCID );
- awt::Size aSize( xTextShape->getSize() );
- awt::Point aPos( RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
- aScreenPosition2D, aSize, aRelativePosition.Anchor ) );
- //ensure that the equation is fully placed within the page (if possible)
- if( (aPos.X + aSize.Width) > m_aPageReferenceSize.Width )
- aPos.X = m_aPageReferenceSize.Width - aSize.Width;
- if( aPos.X < 0 )
+ aPos.X = 0;
+ if ( nFormulaWidth > 0 )
{
- aPos.X = 0;
- if ( nFormulaWidth > 0 )
- {
- bResizeEquation = true;
- if ( nCountIteration < nMaxIteration-1 )
- xEquationTarget->remove( xTextShape ); // remove equation
- nFormulaWidth *= m_aPageReferenceSize.Width / static_cast< double >(aSize.Width);
- nFormulaWidth -= nCountIteration;
- if ( nFormulaWidth < 0 )
- nFormulaWidth = 0;
- }
+ bResizeEquation = true;
+ if ( nCountIteration < nMaxIteration-1 )
+ xEquationTarget->remove( xTextShape ); // remove equation
+ nFormulaWidth *= m_aPageReferenceSize.Width / static_cast< double >(aSize.Width);
+ nFormulaWidth -= nCountIteration;
+ if ( nFormulaWidth < 0 )
+ nFormulaWidth = 0;
}
- if( (aPos.Y + aSize.Height) > m_aPageReferenceSize.Height )
- aPos.Y = m_aPageReferenceSize.Height - aSize.Height;
- if( aPos.Y < 0 )
- aPos.Y = 0;
- if ( !bResizeEquation || nCountIteration == nMaxIteration-1 )
- xTextShape->setPosition(aPos); // if equation was not removed
}
+ if( (aPos.Y + aSize.Height) > m_aPageReferenceSize.Height )
+ aPos.Y = m_aPageReferenceSize.Height - aSize.Height;
+ if( aPos.Y < 0 )
+ aPos.Y = 0;
+ if ( !bResizeEquation || nCountIteration == nMaxIteration-1 )
+ xTextShape->setPosition(aPos); // if equation was not removed
}
}
}
-void VSeriesPlotter::setMappedProperties(
- const uno::Reference< drawing::XShape >& xTargetShape
- , const uno::Reference< beans::XPropertySet >& xSource
- , const tPropertyNameMap& rMap
- , tPropertyNameValueMap const * pOverwriteMap )
-{
- uno::Reference< beans::XPropertySet > xTargetProp( xTargetShape, uno::UNO_QUERY );
- PropertyMapper::setMappedProperties(xTargetProp,xSource,rMap,pOverwriteMap);
-}
-
-void VSeriesPlotter::setTimeResolutionOnXAxis( long TimeResolution, const Date& rNullDate )
+void VSeriesPlotter::setTimeResolutionOnXAxis( tools::Long TimeResolution, const Date& rNullDate )
{
m_nTimeResolution = TimeResolution;
m_aNullDate = rNullDate;
}
// MinimumAndMaximumSupplier
-long VSeriesPlotter::calculateTimeResolutionOnXAxis()
+tools::Long VSeriesPlotter::calculateTimeResolutionOnXAxis()
{
- long nRet = css::chart::TimeUnit::YEAR;
+ tools::Long nRet = css::chart::TimeUnit::YEAR;
if (!m_pExplicitCategoriesProvider)
return nRet;
@@ -1696,13 +1663,13 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis()
double VSeriesPlotter::getMinimumX()
{
double fMinimum, fMaximum;
- getMinimumAndMaximiumX( fMinimum, fMaximum );
+ getMinimumAndMaximumX( fMinimum, fMaximum );
return fMinimum;
}
double VSeriesPlotter::getMaximumX()
{
double fMinimum, fMaximum;
- getMinimumAndMaximiumX( fMinimum, fMaximum );
+ getMinimumAndMaximumX( fMinimum, fMaximum );
return fMaximum;
}
@@ -1711,13 +1678,12 @@ double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, s
if( !m_bCategoryXAxis || ( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() ) )
{
double fMinY, fMaxY;
- getMinimumAndMaximiumYInContinuousXRange( fMinY, fMaxY, fMinimumX, fMaximumX, nAxisIndex );
+ getMinimumAndMaximumYInContinuousXRange( fMinY, fMaxY, fMinimumX, fMaximumX, nAxisIndex );
return fMinY;
}
- double fMinimum, fMaximum;
- ::rtl::math::setInf(&fMinimum, false);
- ::rtl::math::setInf(&fMaximum, true);
+ double fMinimum = std::numeric_limits<double>::infinity();
+ double fMaximum = -std::numeric_limits<double>::infinity();
for(std::vector<VDataSeriesGroup> & rXSlots : m_aZSlots)
{
for(VDataSeriesGroup & rXSlot : rXSlots)
@@ -1735,7 +1701,7 @@ double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, s
}
}
if(std::isinf(fMinimum))
- ::rtl::math::setNan(&fMinimum);
+ return std::numeric_limits<double>::quiet_NaN();
return fMinimum;
}
@@ -1744,13 +1710,12 @@ double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, s
if( !m_bCategoryXAxis || ( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() ) )
{
double fMinY, fMaxY;
- getMinimumAndMaximiumYInContinuousXRange( fMinY, fMaxY, fMinimumX, fMaximumX, nAxisIndex );
+ getMinimumAndMaximumYInContinuousXRange( fMinY, fMaxY, fMinimumX, fMaximumX, nAxisIndex );
return fMaxY;
}
- double fMinimum, fMaximum;
- ::rtl::math::setInf(&fMinimum, false);
- ::rtl::math::setInf(&fMaximum, true);
+ double fMinimum = std::numeric_limits<double>::infinity();
+ double fMaximum = -std::numeric_limits<double>::infinity();
for( std::vector< VDataSeriesGroup > & rXSlots : m_aZSlots)
{
for(VDataSeriesGroup & rXSlot : rXSlots)
@@ -1768,7 +1733,7 @@ double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, s
}
}
if(std::isinf(fMaximum))
- ::rtl::math::setNan(&fMaximum);
+ return std::numeric_limits<double>::quiet_NaN();
return fMaximum;
}
@@ -1824,17 +1789,17 @@ bool VSeriesPlotter::isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIn
return nDimensionIndex == 1;
}
-void VSeriesPlotter::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const
+void VSeriesPlotter::getMinimumAndMaximumX( double& rfMinimum, double& rfMaximum ) const
{
- ::rtl::math::setInf(&rfMinimum, false);
- ::rtl::math::setInf(&rfMaximum, true);
+ rfMinimum = std::numeric_limits<double>::infinity();
+ rfMaximum = -std::numeric_limits<double>::infinity();
for (auto const& ZSlot : m_aZSlots)
{
for (auto const& XSlot : ZSlot)
{
double fLocalMinimum, fLocalMaximum;
- XSlot.getMinimumAndMaximiumX( fLocalMinimum, fLocalMaximum );
+ XSlot.getMinimumAndMaximumX( fLocalMinimum, fLocalMaximum );
if( !std::isnan(fLocalMinimum) && fLocalMinimum< rfMinimum )
rfMinimum = fLocalMinimum;
if( !std::isnan(fLocalMaximum) && fLocalMaximum> rfMaximum )
@@ -1842,22 +1807,22 @@ void VSeriesPlotter::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximu
}
}
if(std::isinf(rfMinimum))
- ::rtl::math::setNan(&rfMinimum);
+ rfMinimum = std::numeric_limits<double>::quiet_NaN();
if(std::isinf(rfMaximum))
- ::rtl::math::setNan(&rfMaximum);
+ rfMaximum = std::numeric_limits<double>::quiet_NaN();
}
-void VSeriesPlotter::getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const
+void VSeriesPlotter::getMinimumAndMaximumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const
{
- ::rtl::math::setInf(&rfMinY, false);
- ::rtl::math::setInf(&rfMaxY, true);
+ rfMinY = std::numeric_limits<double>::infinity();
+ rfMaxY = -std::numeric_limits<double>::infinity();
for (auto const& ZSlot : m_aZSlots)
{
for (auto const& XSlot : ZSlot)
{
double fLocalMinimum, fLocalMaximum;
- XSlot.getMinimumAndMaximiumYInContinuousXRange( fLocalMinimum, fLocalMaximum, fMinX, fMaxX, nAxisIndex );
+ XSlot.getMinimumAndMaximumYInContinuousXRange( fLocalMinimum, fLocalMaximum, fMinX, fMaxX, nAxisIndex );
if( !std::isnan(fLocalMinimum) && fLocalMinimum< rfMinY )
rfMinY = fLocalMinimum;
if( !std::isnan(fLocalMaximum) && fLocalMaximum> rfMaxY )
@@ -1865,9 +1830,9 @@ void VSeriesPlotter::getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, d
}
}
if(std::isinf(rfMinY))
- ::rtl::math::setNan(&rfMinY);
+ rfMinY = std::numeric_limits<double>::quiet_NaN();
if(std::isinf(rfMaxY))
- ::rtl::math::setNan(&rfMaxY);
+ rfMaxY = std::numeric_limits<double>::quiet_NaN();
}
sal_Int32 VSeriesPlotter::getPointCount() const
@@ -1932,11 +1897,11 @@ sal_Int32 VDataSeriesGroup::getAttachedAxisIndexForFirstSeries() const
return nRet;
}
-void VDataSeriesGroup::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const
+void VDataSeriesGroup::getMinimumAndMaximumX( double& rfMinimum, double& rfMaximum ) const
{
- ::rtl::math::setInf(&rfMinimum, false);
- ::rtl::math::setInf(&rfMaximum, true);
+ rfMinimum = std::numeric_limits<double>::infinity();
+ rfMaximum = -std::numeric_limits<double>::infinity();
for (std::unique_ptr<VDataSeries> const & pSeries : m_aSeriesVector)
{
@@ -1953,9 +1918,9 @@ void VDataSeriesGroup::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaxi
}
}
if(std::isinf(rfMinimum))
- ::rtl::math::setNan(&rfMinimum);
+ rfMinimum = std::numeric_limits<double>::quiet_NaN();
if(std::isinf(rfMaximum))
- ::rtl::math::setNan(&rfMaximum);
+ rfMaximum = std::numeric_limits<double>::quiet_NaN();
}
namespace {
@@ -1978,7 +1943,7 @@ class PerXMinMaxCalculator
{
typedef std::pair<double, double> MinMaxType;
typedef std::map<size_t, MinMaxType> SeriesMinMaxType;
- typedef std::map<double, std::unique_ptr<SeriesMinMaxType>> GroupMinMaxType;
+ typedef std::map<double, SeriesMinMaxType> GroupMinMaxType;
typedef std::unordered_map<double, MinMaxType> TotalStoreType;
GroupMinMaxType m_SeriesGroup;
size_t mnCurSeries;
@@ -2016,14 +1981,15 @@ public:
void getTotalRange(double& rfMin, double& rfMax) const
{
- rtl::math::setNan(&rfMin);
- rtl::math::setNan(&rfMax);
-
TotalStoreType aStore;
getTotalStore(aStore);
if (aStore.empty())
+ {
+ rfMin = std::numeric_limits<double>::quiet_NaN();
+ rfMax = std::numeric_limits<double>::quiet_NaN();
return;
+ }
TotalStoreType::const_iterator it = aStore.begin(), itEnd = aStore.end();
rfMin = it->second.first;
@@ -2049,7 +2015,7 @@ private:
{
double fX = it.first;
- const SeriesMinMaxType& rSeries = *it.second;
+ const SeriesMinMaxType& rSeries = it.second;
for (auto const& series : rSeries)
{
double fYMin = series.second.first, fYMax = series.second.second;
@@ -2076,7 +2042,7 @@ private:
if (it == m_SeriesGroup.end())
{
std::pair<GroupMinMaxType::iterator,bool> r =
- m_SeriesGroup.insert(std::make_pair(fX, std::make_unique<SeriesMinMaxType>()));
+ m_SeriesGroup.insert(std::make_pair(fX, SeriesMinMaxType{}));
if (!r.second)
// insertion failed.
@@ -2085,17 +2051,17 @@ private:
it = r.first;
}
- return it->second.get();
+ return &it->second;
}
};
}
-void VDataSeriesGroup::getMinimumAndMaximiumYInContinuousXRange(
+void VDataSeriesGroup::getMinimumAndMaximumYInContinuousXRange(
double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const
{
- ::rtl::math::setNan(&rfMinY);
- ::rtl::math::setNan(&rfMaxY);
+ rfMinY = std::numeric_limits<double>::quiet_NaN();
+ rfMaxY = std::numeric_limits<double>::quiet_NaN();
if (m_aSeriesVector.empty())
// No data series. Bail out.
@@ -2134,13 +2100,13 @@ void VDataSeriesGroup::getMinimumAndMaximiumYInContinuousXRange(
void VDataSeriesGroup::calculateYMinAndMaxForCategory( sal_Int32 nCategoryIndex
, bool bSeparateStackingForDifferentSigns
- , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex )
+ , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex ) const
{
assert(nCategoryIndex >= 0);
assert(nCategoryIndex < getPointCount());
- ::rtl::math::setInf(&rfMinimumY, false);
- ::rtl::math::setInf(&rfMaximumY, true);
+ rfMinimumY = std::numeric_limits<double>::infinity();
+ rfMaximumY = -std::numeric_limits<double>::infinity();
if(m_aSeriesVector.empty())
return;
@@ -2154,12 +2120,11 @@ void VDataSeriesGroup::calculateYMinAndMaxForCategory( sal_Int32 nCategoryIndex
return;
}
- double fTotalSum, fPositiveSum, fNegativeSum, fFirstPositiveY, fFirstNegativeY;
- ::rtl::math::setNan( &fTotalSum );
- ::rtl::math::setNan( &fPositiveSum );
- ::rtl::math::setNan( &fNegativeSum );
- ::rtl::math::setNan( &fFirstPositiveY );
- ::rtl::math::setNan( &fFirstNegativeY );
+ double fTotalSum = std::numeric_limits<double>::quiet_NaN();
+ double fPositiveSum = std::numeric_limits<double>::quiet_NaN();
+ double fNegativeSum = std::numeric_limits<double>::quiet_NaN();
+ double fFirstPositiveY = std::numeric_limits<double>::quiet_NaN();
+ double fFirstNegativeY = std::numeric_limits<double>::quiet_NaN();
if( bSeparateStackingForDifferentSigns )
{
@@ -2227,8 +2192,8 @@ void VDataSeriesGroup::calculateYMinAndMaxForCategoryRange(
, double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex )
{
//@todo maybe cache these values
- ::rtl::math::setInf(&rfMinimumY, false);
- ::rtl::math::setInf(&rfMaximumY, true);
+ rfMinimumY = std::numeric_limits<double>::infinity();
+ rfMaximumY = -std::numeric_limits<double>::infinity();
//iterate through the given categories
if(nStartCategoryIndex<0)
@@ -2242,8 +2207,8 @@ void VDataSeriesGroup::calculateYMinAndMaxForCategoryRange(
nEndCategoryIndex=0;
for( sal_Int32 nCatIndex = nStartCategoryIndex; nCatIndex <= nEndCategoryIndex; nCatIndex++ )
{
- double fMinimumY; ::rtl::math::setNan(&fMinimumY);
- double fMaximumY; ::rtl::math::setNan(&fMaximumY);
+ double fMinimumY = std::numeric_limits<double>::quiet_NaN();
+ double fMaximumY = std::numeric_limits<double>::quiet_NaN();
calculateYMinAndMaxForCategory( nCatIndex
, bSeparateStackingForDifferentSigns, fMinimumY, fMaximumY, nAxisIndex );
@@ -2294,8 +2259,7 @@ PlottingPositionHelper& VSeriesPlotter::getPlottingPositionHelper( sal_Int32 nAx
}
if( !pRet )
pRet = m_pMainPosHelper;
- if(pRet)
- pRet->setTimeResolution( m_nTimeResolution, m_aNullDate );
+ pRet->setTimeResolution( m_nTimeResolution, m_aNullDate );
return *pRet;
}
@@ -2333,12 +2297,83 @@ OUString VSeriesPlotter::getCategoryName( sal_Int32 nPointIndex ) const
return OUString();
}
-uno::Sequence< OUString > VSeriesPlotter::getSeriesNames() const
+namespace {
+// The following it to support rendering order for combo charts. A chart type
+// with a lower rendering order is rendered before (i.e., behind) a chart with a
+// higher rendering order. The rendering orders are based on rough guesses about
+// how much one chart (type) will obscure another chart (type). The intent is to
+// minimize obscuring of data, by putting charts that generally cover more
+// pixels (e.g., area charts) behind ones that generally cover fewer (e.g., line
+// charts).
+struct ROrderPair
+{
+ ROrderPair(OUString n, sal_Int32 r) : chartName(n), renderOrder(r) {}
+
+ OUString chartName;
+ sal_Int32 renderOrder;
+};
+
+const ROrderPair pairList[] = {
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_AREA, 0),
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_BAR, 6), // bar & column are same
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN, 6),
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_LINE, 8),
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER, 5),
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_PIE, 1),
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_NET, 3),
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET, 2),
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK, 7),
+ ROrderPair(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE, 4)
+};
+} // unnamed
+
+sal_Int32 VSeriesPlotter::getRenderOrder() const
+{
+ OUString aChartType = m_xChartTypeModel->getChartType();
+ for (const auto& elem : pairList) {
+ if (aChartType.equalsIgnoreAsciiCase(elem.chartName)) {
+ return elem.renderOrder;
+ }
+ }
+ SAL_WARN("chart2", "Unsupported chart type in getRenderOrder()");
+ return 0;
+}
+
+std::vector<VDataSeries const*> VSeriesPlotter::getAllSeries() const
+{
+ std::vector<VDataSeries const*> aAllSeries;
+ for (std::vector<VDataSeriesGroup> const & rXSlot : m_aZSlots)
+ {
+ for(VDataSeriesGroup const & rGroup : rXSlot)
+ {
+ for (std::unique_ptr<VDataSeries> const & p : rGroup.m_aSeriesVector)
+ aAllSeries.push_back(p.get());
+ }
+ }
+ return aAllSeries;
+}
+
+
+std::vector<VDataSeries*> VSeriesPlotter::getAllSeries()
+{
+ std::vector<VDataSeries*> aAllSeries;
+ for (std::vector<VDataSeriesGroup> const & rXSlot : m_aZSlots)
+ {
+ for(VDataSeriesGroup const & rGroup : rXSlot)
+ {
+ for (std::unique_ptr<VDataSeries> const & p : rGroup.m_aSeriesVector)
+ aAllSeries.push_back(p.get());
+ }
+ }
+ return aAllSeries;
+}
+
+uno::Sequence<OUString> VSeriesPlotter::getSeriesNames() const
{
std::vector<OUString> aRetVector;
OUString aRole;
- if( m_xChartTypeModel.is() )
+ if (m_xChartTypeModel.is())
aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel();
for (auto const& rGroup : m_aZSlots)
@@ -2349,10 +2384,10 @@ uno::Sequence< OUString > VSeriesPlotter::getSeriesNames() const
if (!rSeriesGroup.m_aSeriesVector.empty())
{
VDataSeries const * pSeries = rSeriesGroup.m_aSeriesVector[0].get();
- uno::Reference< XDataSeries > xSeries( pSeries ? pSeries->getModel() : nullptr );
+ rtl::Reference< DataSeries > xSeries( pSeries ? pSeries->getModel() : nullptr );
if( xSeries.is() )
{
- OUString aSeriesName( DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ) );
+ OUString aSeriesName( xSeries->getLabelForRole( aRole ) );
aRetVector.push_back( aSeriesName );
}
}
@@ -2361,6 +2396,25 @@ uno::Sequence< OUString > VSeriesPlotter::getSeriesNames() const
return comphelper::containerToSequence( aRetVector );
}
+uno::Sequence<OUString> VSeriesPlotter::getAllSeriesNames() const
+{
+ std::vector<OUString> aRetVector;
+
+ OUString aRole;
+ if (m_xChartTypeModel.is())
+ aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel();
+
+ for (VDataSeries const* pSeries : getAllSeries())
+ {
+ if (pSeries)
+ {
+ OUString aSeriesName(pSeries->getModel()->getLabelForRole(aRole));
+ aRetVector.push_back(aSeriesName);
+ }
+ }
+ return comphelper::containerToSequence(aRetVector);
+}
+
void VSeriesPlotter::setPageReferenceSize( const css::awt::Size & rPageRefSize )
{
m_aPageReferenceSize = rPageRefSize;
@@ -2397,8 +2451,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
const awt::Size& rEntryKeyAspectRatio
, LegendPosition eLegendPosition
, const Reference< beans::XPropertySet >& xTextProperties
- , const Reference< drawing::XShapes >& xTarget
- , const Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const Reference< uno::XComponentContext >& xContext
, ChartModel& rModel
)
@@ -2407,14 +2460,13 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
if( xTarget.is() )
{
- uno::Reference< XCoordinateSystemContainer > xCooSysCnt( rModel.getFirstDiagram(), uno::UNO_QUERY );
- Reference< chart2::XCoordinateSystem > xCooSys(xCooSysCnt->getCoordinateSystems()[0]);
- Reference< beans::XPropertySet > xProp( xCooSys, uno::UNO_QUERY );
+ rtl::Reference< Diagram > xDiagram = rModel.getFirstChartDiagram();
+ rtl::Reference< BaseCoordinateSystem > xCooSys(xDiagram->getBaseCoordinateSystems()[0]);
bool bSwapXAndY = false;
- if( xProp.is()) try
+ try
{
- xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
+ xCooSys->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
}
catch( const uno::Exception& )
{
@@ -2434,7 +2486,8 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
if (!pSeries)
continue;
- if (!pSeries->getPropertiesOfSeries()->getPropertyValue("ShowLegendEntry").get<sal_Bool>())
+ // "ShowLegendEntry"
+ if (!pSeries->getModel()->getFastPropertyValue(PROP_DATASERIES_SHOW_LEGEND_ENTRY).get<sal_Bool>())
{
continue;
}
@@ -2442,7 +2495,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
std::vector<ViewLegendEntry> aSeriesEntries(
createLegendEntriesForSeries(
rEntryKeyAspectRatio, *pSeries, xTextProperties,
- xTarget, xShapeFactory, xContext));
+ xTarget, xContext));
//add series entries to the result now
@@ -2480,18 +2533,45 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
return aResult;
}
-std::vector<VDataSeries*> VSeriesPlotter::getAllSeries()
+std::vector<ViewLegendSymbol> VSeriesPlotter::createSymbols(const awt::Size& rEntryKeyAspectRatio
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const Reference<uno::XComponentContext>& xContext)
{
- std::vector<VDataSeries*> aAllSeries;
- for (std::vector<VDataSeriesGroup> const & rXSlot : m_aZSlots)
+ std::vector<ViewLegendSymbol> aResult;
+
+ if( xTarget.is() )
{
- for(VDataSeriesGroup const & rGroup : rXSlot)
+ bool bBreak = false;
+ bool bFirstSeries = true;
+
+ for (std::vector<VDataSeriesGroup> const & rGroupVector : m_aZSlots)
{
- for (std::unique_ptr<VDataSeries> const & p : rGroup.m_aSeriesVector)
- aAllSeries.push_back(p.get());
+ for (VDataSeriesGroup const & rGroup : rGroupVector)
+ {
+ for (std::unique_ptr<VDataSeries> const & pSeries : rGroup.m_aSeriesVector)
+ {
+ if (!pSeries)
+ continue;
+
+ std::vector<ViewLegendSymbol> aSeriesSymbols = createSymbolsForSeries(rEntryKeyAspectRatio, *pSeries, xTarget, xContext);
+
+ //add series entries to the result now
+
+ // use only the first series if VaryColorsByPoint is set for the first series
+ if (bFirstSeries && pSeries->isVaryColorsByPoint())
+ bBreak = true;
+
+ bFirstSeries = false;
+
+ aResult.insert(aResult.end(), aSeriesSymbols.begin(), aSeriesSymbols.end());
+ }
+ if (bBreak)
+ return aResult;
+ }
}
}
- return aAllSeries;
+
+ return aResult;
}
namespace
@@ -2514,19 +2594,11 @@ bool lcl_HasVisibleLine( const uno::Reference< beans::XPropertySet >& xProps, bo
bool lcl_HasRegressionCurves( const VDataSeries& rSeries, bool& rbHasDashedLine )
{
bool bHasRegressionCurves = false;
- Reference< XRegressionCurveContainer > xRegrCont( rSeries.getModel(), uno::UNO_QUERY );
- if( xRegrCont.is())
+ rtl::Reference< DataSeries > xRegrCont( rSeries.getModel() );
+ for( const rtl::Reference< RegressionCurveModel > & rCurve : xRegrCont->getRegressionCurves2() )
{
- Sequence< Reference< XRegressionCurve > > aCurves( xRegrCont->getRegressionCurves() );
- sal_Int32 i = 0, nCount = aCurves.getLength();
- for( i=0; i<nCount; ++i )
- {
- if( aCurves[i].is() )
- {
- bHasRegressionCurves = true;
- lcl_HasVisibleLine( uno::Reference< beans::XPropertySet >( aCurves[i], uno::UNO_QUERY ), rbHasDashedLine );
- }
- }
+ bHasRegressionCurves = true;
+ lcl_HasVisibleLine( rCurve, rbHasDashedLine );
}
return bHasRegressionCurves;
}
@@ -2587,11 +2659,10 @@ uno::Any VSeriesPlotter::getExplicitSymbol( const VDataSeries& /*rSeries*/, sal_
return uno::Any();
}
-Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForSeries(
+rtl::Reference<SvxShapeGroup> VSeriesPlotter::createLegendSymbolForSeries(
const awt::Size& rEntryKeyAspectRatio
, const VDataSeries& rSeries
- , const Reference< drawing::XShapes >& xTarget
- , const Reference< lang::XMultiServiceFactory >& xShapeFactory )
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget )
{
LegendSymbolStyle eLegendSymbolStyle = getLegendSymbolStyle();
@@ -2610,19 +2681,18 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForSeries(
default:
break;
}
- Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
- xTarget, eLegendSymbolStyle, xShapeFactory
- , rSeries.getPropertiesOfSeries(), ePropType, aExplicitSymbol ));
+ rtl::Reference<SvxShapeGroup> xShape = VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
+ xTarget, eLegendSymbolStyle,
+ rSeries.getPropertiesOfSeries(), ePropType, aExplicitSymbol );
return xShape;
}
-Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForPoint(
+rtl::Reference< SvxShapeGroup > VSeriesPlotter::createLegendSymbolForPoint(
const awt::Size& rEntryKeyAspectRatio
, const VDataSeries& rSeries
, sal_Int32 nPointIndex
- , const Reference< drawing::XShapes >& xTarget
- , const Reference< lang::XMultiServiceFactory >& xShapeFactory )
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget )
{
LegendSymbolStyle eLegendSymbolStyle = getLegendSymbolStyle();
@@ -2666,8 +2736,8 @@ Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForPoint(
}
}
- Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
- xTarget, eLegendSymbolStyle, xShapeFactory, xPointSet, ePropType, aExplicitSymbol ));
+ rtl::Reference< SvxShapeGroup > xShape = VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
+ xTarget, eLegendSymbolStyle, xPointSet, ePropType, aExplicitSymbol );
return xShape;
}
@@ -2676,14 +2746,13 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
const awt::Size& rEntryKeyAspectRatio
, const VDataSeries& rSeries
, const Reference< beans::XPropertySet >& xTextProperties
- , const Reference< drawing::XShapes >& xTarget
- , const Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const Reference< uno::XComponentContext >& xContext
)
{
std::vector< ViewLegendEntry > aResult;
- if( ! ( xShapeFactory.is() && xTarget.is() && xContext.is() ) )
+ if( ! ( xTarget.is() && xContext.is() ) )
return aResult;
try
@@ -2691,7 +2760,23 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
ViewLegendEntry aEntry;
OUString aLabelText;
bool bVaryColorsByPoint = rSeries.isVaryColorsByPoint();
- if( bVaryColorsByPoint )
+ bool bIsPie = m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(
+ CHART2_SERVICE_NAME_CHARTTYPE_PIE);
+ try
+ {
+ if (bIsPie)
+ {
+ bool bDonut = false;
+ // "UseRings"
+ if ((m_xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_USE_RINGS) >>= bDonut) && bDonut)
+ bIsPie = false;
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ }
+
+ if (bVaryColorsByPoint || bIsPie)
{
Sequence< OUString > aCategoryNames;
if( m_pExplicitCategoriesProvider )
@@ -2699,7 +2784,8 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
Sequence<sal_Int32> deletedLegendEntries;
try
{
- rSeries.getPropertiesOfSeries()->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntries;
+ // "DeletedLegendEntries"
+ rSeries.getModel()->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntries;
}
catch (const uno::Exception&)
{
@@ -2707,7 +2793,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
for( sal_Int32 nIdx=0; nIdx<aCategoryNames.getLength(); ++nIdx )
{
bool deletedLegendEntry = false;
- for (auto& deletedLegendEntryIdx : deletedLegendEntries)
+ for (const auto& deletedLegendEntryIdx : deletedLegendEntries)
{
if (nIdx == deletedLegendEntryIdx)
{
@@ -2719,16 +2805,16 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
continue;
// symbol
- uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory::getOrCreateShapeFactory(xShapeFactory)->createGroup2D( xTarget ));
+ rtl::Reference< SvxShapeGroup > xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
// create the symbol
- Reference< drawing::XShape > xShape( createLegendSymbolForPoint( rEntryKeyAspectRatio,
- rSeries, nIdx, xSymbolGroup, xShapeFactory ) );
+ rtl::Reference< SvxShapeGroup > xShape = createLegendSymbolForPoint( rEntryKeyAspectRatio,
+ rSeries, nIdx, xSymbolGroup );
// set CID to symbol for selection
if( xShape.is() )
{
- aEntry.aSymbol.set( xSymbolGroup, uno::UNO_QUERY );
+ aEntry.xSymbol = xSymbolGroup;
OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_DATA_POINT, nIdx ) );
aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
@@ -2740,7 +2826,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
aLabelText = aCategoryNames[nIdx];
if( xShape.is() || !aLabelText.isEmpty() )
{
- aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aLabelText, xTextProperties );
+ aEntry.xLabel = FormattedStringHelper::createFormattedString( aLabelText, xTextProperties );
aResult.push_back(aEntry);
}
}
@@ -2748,16 +2834,16 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
else
{
// symbol
- uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory::getOrCreateShapeFactory(xShapeFactory)->createGroup2D( xTarget ));
+ rtl::Reference< SvxShapeGroup > xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
// create the symbol
- Reference< drawing::XShape > xShape( createLegendSymbolForSeries(
- rEntryKeyAspectRatio, rSeries, xSymbolGroup, xShapeFactory ) );
+ rtl::Reference<SvxShapeGroup> xShape = createLegendSymbolForSeries(
+ rEntryKeyAspectRatio, rSeries, xSymbolGroup );
// set CID to symbol for selection
if( xShape.is())
{
- aEntry.aSymbol.set( xSymbolGroup, uno::UNO_QUERY );
+ aEntry.xSymbol = xSymbolGroup;
OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle );
@@ -2765,8 +2851,8 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
}
// label
- aLabelText = DataSeriesHelper::getDataSeriesLabel( rSeries.getModel(), m_xChartTypeModel.is() ? m_xChartTypeModel->getRoleOfSequenceForSeriesLabel() : "values-y");
- aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aLabelText, xTextProperties );
+ aLabelText = rSeries.getModel()->getLabelForRole( m_xChartTypeModel.is() ? m_xChartTypeModel->getRoleOfSequenceForSeriesLabel() : "values-y");
+ aEntry.xLabel = FormattedStringHelper::createFormattedString( aLabelText, xTextProperties );
aResult.push_back(aEntry);
}
@@ -2776,44 +2862,41 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
if (!ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension ))
return aResult;
- Reference< XRegressionCurveContainer > xRegrCont( rSeries.getModel(), uno::UNO_QUERY );
+ rtl::Reference< DataSeries > xRegrCont = rSeries.getModel();
if( xRegrCont.is())
{
- Sequence< Reference< XRegressionCurve > > aCurves( xRegrCont->getRegressionCurves());
- sal_Int32 i = 0, nCount = aCurves.getLength();
+ const std::vector< rtl::Reference< RegressionCurveModel > > & aCurves = xRegrCont->getRegressionCurves2();
+ sal_Int32 i = 0, nCount = aCurves.size();
for( i=0; i<nCount; ++i )
{
- if( aCurves[i].is() )
+ //label
+ OUString aResStr( RegressionCurveHelper::getUINameForRegressionCurve( aCurves[i] ) );
+ replaceParamterInString( aResStr, u"%SERIESNAME", aLabelText );
+ aEntry.xLabel = FormattedStringHelper::createFormattedString( aResStr, xTextProperties );
+
+ // symbol
+ rtl::Reference<SvxShapeGroup> xSymbolGroup(ShapeFactory::createGroup2D( xTarget ));
+
+ // create the symbol
+ rtl::Reference<SvxShapeGroup> xShape = VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
+ xSymbolGroup, LegendSymbolStyle::Line,
+ aCurves[i],
+ VLegendSymbolFactory::PropertyType::Line, uno::Any() );
+
+ // set CID to symbol for selection
+ if( xShape.is())
{
- //label
- OUString aResStr( RegressionCurveHelper::getUINameForRegressionCurve( aCurves[i] ) );
- replaceParamterInString( aResStr, "%SERIESNAME", aLabelText );
- aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aResStr, xTextProperties );
-
- // symbol
- uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory::getOrCreateShapeFactory(xShapeFactory)->createGroup2D( xTarget ));
-
- // create the symbol
- Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio,
- xSymbolGroup, LegendSymbolStyle::Line, xShapeFactory,
- Reference< beans::XPropertySet >( aCurves[i], uno::UNO_QUERY ),
- VLegendSymbolFactory::PropertyType::Line, uno::Any() ));
-
- // set CID to symbol for selection
- if( xShape.is())
- {
- aEntry.aSymbol.set( xSymbolGroup, uno::UNO_QUERY );
-
- bool bAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[i] );
- ObjectType eObjectType = bAverageLine ? OBJECTTYPE_DATA_AVERAGE_LINE : OBJECTTYPE_DATA_CURVE;
- OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( eObjectType, i ) );
- aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
- OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle );
- ShapeFactory::setShapeName( xShape, aCID );
- }
+ aEntry.xSymbol = xSymbolGroup;
- aResult.push_back(aEntry);
+ bool bAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[i] );
+ ObjectType eObjectType = bAverageLine ? OBJECTTYPE_DATA_AVERAGE_LINE : OBJECTTYPE_DATA_CURVE;
+ OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( eObjectType, i ) );
+ aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
+ OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle );
+ ShapeFactory::setShapeName( xShape, aCID );
}
+
+ aResult.push_back(aEntry);
}
}
}
@@ -2824,8 +2907,42 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
return aResult;
}
+std::vector<ViewLegendSymbol> VSeriesPlotter::createSymbolsForSeries(
+ const awt::Size& rEntryKeyAspectRatio
+ , const VDataSeries& rSeries
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const Reference<uno::XComponentContext>& xContext)
+{
+ std::vector<ViewLegendSymbol> aResult;
+
+ if (!(xTarget.is() && xContext.is()))
+ return aResult;
+
+ try
+ {
+ ViewLegendSymbol aEntry;
+ // symbol
+ rtl::Reference<SvxShapeGroup> xSymbolGroup(ShapeFactory::createGroup2D(xTarget));
+
+ // create the symbol
+ rtl::Reference<SvxShapeGroup> xShape = createLegendSymbolForSeries(rEntryKeyAspectRatio, rSeries, xSymbolGroup );
+
+ // set CID to symbol for selection
+ if (xShape.is())
+ {
+ aEntry.xSymbol = xSymbolGroup;
+ aResult.push_back(aEntry);
+ }
+ }
+ catch (const uno::Exception &)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2" );
+ }
+ return aResult;
+}
+
VSeriesPlotter* VSeriesPlotter::createSeriesPlotter(
- const uno::Reference<XChartType>& xChartTypeModel
+ const rtl::Reference<ChartType>& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bExcludingPositioning )
{
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index bf9b9b70d343..ff660a485d04 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -19,21 +19,21 @@
#include <ShapeFactory.hxx>
#include <VDiagram.hxx>
+#include <Diagram.hxx>
#include <PropertyMapper.hxx>
#include <ViewDefines.hxx>
#include <Stripe.hxx>
#include <ObjectIdentifier.hxx>
#include <DiagramHelper.hxx>
+#include <ChartType.hxx>
#include <BaseGFXHelper.hxx>
#include <ChartTypeHelper.hxx>
#include <ThreeDHelper.hxx>
#include <defines.hxx>
#include <editeng/unoprnms.hxx>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <svx/unoshape.hxx>
#include <svx/scene3d.hxx>
#include <svx/e3dsceneupdater.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -41,13 +41,11 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
VDiagram::VDiagram(
- const uno::Reference<XDiagram> & xDiagram, const drawing::Direction3D& rPreferredAspectRatio,
+ const rtl::Reference<Diagram> & xDiagram, const drawing::Direction3D& rPreferredAspectRatio,
sal_Int32 nDimension )
- : m_pShapeFactory(nullptr)
- , m_nDimensionCount(nDimension)
+ : m_nDimensionCount(nDimension)
, m_xDiagram(xDiagram)
, m_aPreferredAspectRatio(rPreferredAspectRatio)
- , m_xAspectRatio3D()
, m_fXAnglePi(0)
, m_fYAnglePi(0)
, m_fZAnglePi(0)
@@ -56,13 +54,12 @@ VDiagram::VDiagram(
if( m_nDimensionCount != 3)
return;
- uno::Reference< beans::XPropertySet > xSourceProp( m_xDiagram, uno::UNO_QUERY );
- ThreeDHelper::getRotationAngleFromDiagram( xSourceProp, m_fXAnglePi, m_fYAnglePi, m_fZAnglePi );
+ xDiagram->getRotationAngle( m_fXAnglePi, m_fYAnglePi, m_fZAnglePi );
if( ChartTypeHelper::isSupportingRightAngledAxes(
- DiagramHelper::getChartTypeByIndex( m_xDiagram, 0 ) ) )
+ m_xDiagram->getChartTypeByIndex( 0 ) ) )
{
- if(xSourceProp.is())
- xSourceProp->getPropertyValue("RightAngledAxes") >>= m_bRightAngledAxes;
+ if(xDiagram.is())
+ xDiagram->getPropertyValue("RightAngledAxes") >>= m_bRightAngledAxes;
if( m_bRightAngledAxes )
{
ThreeDHelper::adaptRadAnglesForRightAngledAxes( m_fXAnglePi, m_fYAnglePi );
@@ -75,14 +72,9 @@ VDiagram::~VDiagram()
{
}
-void VDiagram::init(
- const uno::Reference< drawing::XShapes >& xTarget, const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+void VDiagram::init( const rtl::Reference<SvxShapeGroupAnyD>& xTarget )
{
- OSL_PRECOND(xFactory.is(), "no proper initialization parameters");
-
m_xTarget = xTarget;
- m_xShapeFactory = xFactory;
- m_pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xFactory);
}
void VDiagram::createShapes( const awt::Point& rPos, const awt::Size& rSize )
@@ -138,81 +130,60 @@ void VDiagram::createShapes( const awt::Point& rPos, const awt::Size& rSize )
void VDiagram::createShapes_2d()
{
- OSL_PRECOND(m_pShapeFactory && m_xTarget.is() && m_xShapeFactory.is(), "is not proper initialized");
- if (!m_pShapeFactory || !m_xTarget.is() || !m_xShapeFactory.is())
+ OSL_PRECOND(m_xTarget.is(), "is not proper initialized");
+ if (!m_xTarget.is())
return;
//create group shape
- uno::Reference< drawing::XShapes > xOuterGroup_Shapes = m_pShapeFactory->createGroup2D(m_xTarget);
- m_xOuterGroupShape.set( xOuterGroup_Shapes, uno::UNO_QUERY );
+ rtl::Reference<SvxShapeGroupAnyD> xOuterGroup_Shapes = ShapeFactory::createGroup2D(m_xTarget);
+ m_xOuterGroupShape = xOuterGroup_Shapes;
- uno::Reference< drawing::XShapes > xGroupForWall( m_pShapeFactory->createGroup2D(xOuterGroup_Shapes,"PlotAreaExcludingAxes") );
+ rtl::Reference<SvxShapeGroupAnyD> xGroupForWall( ShapeFactory::createGroup2D(xOuterGroup_Shapes,"PlotAreaExcludingAxes") );
//create independent group shape as container for datapoints and such things
- {
- uno::Reference< drawing::XShapes > xShapes = m_pShapeFactory->createGroup2D(xOuterGroup_Shapes,"testonly;CooContainer=XXX_CID");
- m_xCoordinateRegionShape.set( xShapes, uno::UNO_QUERY );
- }
+ m_xCoordinateRegionShape = ShapeFactory::createGroup2D(xOuterGroup_Shapes,"testonly;CooContainer=XXX_CID");
- bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram );
+ bool bAddFloorAndWall = m_xDiagram->isSupportingFloorAndWall();
//add back wall
{
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
- m_xWall2D = pShapeFactory->createRectangle(
- xGroupForWall );
+ m_xWall2D = ShapeFactory::createRectangle( xGroupForWall );
- uno::Reference< beans::XPropertySet > xProp( m_xWall2D, uno::UNO_QUERY );
- if( xProp.is())
+ try
{
- try
+ OSL_ENSURE( m_xDiagram.is(), "Invalid Diagram model" );
+ if( m_xDiagram.is() )
{
- OSL_ENSURE( m_xDiagram.is(), "Invalid Diagram model" );
- if( m_xDiagram.is() )
- {
- uno::Reference< beans::XPropertySet > xWallProp( m_xDiagram->getWall());
- if( xWallProp.is())
- PropertyMapper::setMappedProperties( xProp, xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties() );
- }
- if( !bAddFloorAndWall )
- {
- //we always need this object as dummy object for correct scene dimensions
- //but it should not be visible in this case:
- ShapeFactory::makeShapeInvisible( m_xWall2D );
- }
- else
- {
- //CID for selection handling
- OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, OUString() ) );//@todo read CID from model
- xProp->setPropertyValue( UNO_NAME_MISC_OBJ_NAME, uno::Any( aWallCID ) );
- }
+ uno::Reference< beans::XPropertySet > xWallProp( m_xDiagram->getWall());
+ if( xWallProp.is())
+ PropertyMapper::setMappedProperties( *m_xWall2D, xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties() );
+ }
+ if( !bAddFloorAndWall )
+ {
+ //we always need this object as dummy object for correct scene dimensions
+ //but it should not be visible in this case:
+ ShapeFactory::makeShapeInvisible( m_xWall2D );
}
- catch( const uno::Exception& )
+ else
{
- TOOLS_WARN_EXCEPTION("chart2", "" );
+ //CID for selection handling
+ OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" ) );//@todo read CID from model
+ m_xWall2D->SvxShape::setPropertyValue( UNO_NAME_MISC_OBJ_NAME, uno::Any( aWallCID ) );
}
}
-
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
}
//position and size for diagram
adjustPosAndSize_2d( m_aAvailablePosIncludingAxes, m_aAvailableSizeIncludingAxes );
}
-static E3dScene* lcl_getE3dScene( const uno::Reference< drawing::XShape >& xShape )
+static E3dScene* lcl_getE3dScene( const rtl::Reference<SvxShapeGroupAnyD>& xShape )
{
- E3dScene* pRet=nullptr;
- uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY );
- if(xTypeProvider.is())
- {
- SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
- if(pSvxShape)
- {
- SdrObject* pObj = pSvxShape->GetSdrObject();
- pRet = dynamic_cast< E3dScene* >(pObj);
- }
- }
- return pRet;
+ return DynCastE3dScene(xShape->GetSdrObject());
}
static void lcl_setLightSources(
@@ -456,21 +427,22 @@ void VDiagram::adjustAspectRatio3d( const awt::Size& rAvailableSize )
void VDiagram::createShapes_3d()
{
- OSL_PRECOND(m_pShapeFactory && m_xTarget.is() && m_xShapeFactory.is(), "is not proper initialized");
- if (!m_pShapeFactory || !m_xTarget.is() || !m_xShapeFactory.is())
+ OSL_PRECOND(m_xTarget.is(), "is not proper initialized");
+ if (!m_xTarget.is())
return;
//create shape
- m_xOuterGroupShape.set( m_pShapeFactory->createGroup3D( m_xTarget, "PlotAreaExcludingAxes" ), uno::UNO_QUERY);
+ rtl::Reference<Svx3DSceneObject> xShapes = ShapeFactory::createGroup3D( m_xTarget, "PlotAreaExcludingAxes" );
+ m_xOuterGroupShape = xShapes;
- uno::Reference< drawing::XShapes > xOuterGroup_Shapes( m_xOuterGroupShape, uno::UNO_QUERY );
+ rtl::Reference<SvxShapeGroupAnyD> xOuterGroup_Shapes = m_xOuterGroupShape;
//create additional group to manipulate the aspect ratio of the whole diagram:
- xOuterGroup_Shapes = m_pShapeFactory->createGroup3D( xOuterGroup_Shapes );
+ xOuterGroup_Shapes = ShapeFactory::createGroup3D( xOuterGroup_Shapes );
- m_xAspectRatio3D.set( xOuterGroup_Shapes, uno::UNO_QUERY );
+ m_xAspectRatio3D = xOuterGroup_Shapes;
- bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram );
+ bool bAddFloorAndWall = m_xDiagram->isSupportingFloorAndWall();
const bool bDoubleSided = false;
@@ -480,13 +452,13 @@ void VDiagram::createShapes_3d()
if( m_xDiagram.is() )
xWallProp.set( m_xDiagram->getWall() );
- 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( !bAddFloorAndWall )
aWallCID.clear();
- uno::Reference< drawing::XShapes > xWallGroup_Shapes( m_pShapeFactory->createGroup3D( xOuterGroup_Shapes, aWallCID ) );
+ rtl::Reference<Svx3DSceneObject> xWallGroup_Shapes = ShapeFactory::createGroup3D( xOuterGroup_Shapes, aWallCID );
- CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
- CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
+ CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( m_xDiagram ) );
+ CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( m_xDiagram ) );
//add left wall
{
@@ -506,8 +478,8 @@ void VDiagram::createShapes_3d()
}
aStripe.InvertNormal(true);
- uno::Reference< drawing::XShape > xShape =
- m_pShapeFactory->createStripe( xWallGroup_Shapes, aStripe
+ rtl::Reference<Svx3DPolygonObject> xShape =
+ ShapeFactory::createStripe( xWallGroup_Shapes, aStripe
, xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture );
if( !bAddFloorAndWall )
{
@@ -534,8 +506,8 @@ void VDiagram::createShapes_3d()
}
aStripe.InvertNormal(true);
- uno::Reference< drawing::XShape > xShape =
- m_pShapeFactory->createStripe(xWallGroup_Shapes, aStripe
+ rtl::Reference<Svx3DPolygonObject> xShape =
+ ShapeFactory::createStripe(xWallGroup_Shapes, aStripe
, xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture );
if( !bAddFloorAndWall )
{
@@ -548,28 +520,25 @@ void VDiagram::createShapes_3d()
try
{
- uno::Reference< beans::XPropertySet > xSourceProp( m_xDiagram, uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xDestProp( m_xOuterGroupShape, uno::UNO_QUERY_THROW );
-
//perspective
{
//ignore distance and focal length from file format and model completely
//use vrp only to indicate the distance of the camera and thus influence the perspective
- xDestProp->setPropertyValue( UNO_NAME_3D_SCENE_DISTANCE, uno::Any(
- static_cast<sal_Int32>(ThreeDHelper::getCameraDistance( xSourceProp ))));
- xDestProp->setPropertyValue( UNO_NAME_3D_SCENE_PERSPECTIVE,
- xSourceProp->getPropertyValue( UNO_NAME_3D_SCENE_PERSPECTIVE));
+ m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_DISTANCE, uno::Any(
+ static_cast<sal_Int32>(m_xDiagram->getCameraDistance())));
+ m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_PERSPECTIVE,
+ m_xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_PERSPECTIVE));
}
//light
{
- xDestProp->setPropertyValue( UNO_NAME_3D_SCENE_SHADE_MODE,
- xSourceProp->getPropertyValue( UNO_NAME_3D_SCENE_SHADE_MODE));
- xDestProp->setPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR,
- xSourceProp->getPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR));
- xDestProp->setPropertyValue( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING,
- xSourceProp->getPropertyValue( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING));
- lcl_setLightSources( xSourceProp, xDestProp );
+ m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_SHADE_MODE,
+ m_xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_SHADE_MODE));
+ m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR,
+ m_xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR));
+ m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING,
+ m_xDiagram->getPropertyValue( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING));
+ lcl_setLightSources( m_xDiagram, m_xOuterGroupShape );
}
//rotation
@@ -589,7 +558,7 @@ void VDiagram::createShapes_3d()
//#i98497# 3D charts are rendered with wrong size
E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
- xDestProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX,
+ m_xOuterGroupShape->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX,
uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aEffectiveTransformation ) ) );
}
}
@@ -609,11 +578,11 @@ void VDiagram::createShapes_3d()
, drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) );
aStripe.InvertNormal(true);
- uno::Reference< drawing::XShape > xShape =
- m_pShapeFactory->createStripe(xOuterGroup_Shapes, aStripe
+ rtl::Reference<Svx3DPolygonObject> xShape =
+ ShapeFactory::createStripe(xOuterGroup_Shapes, aStripe
, xFloorProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided );
- CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
+ CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( m_xDiagram ) );
if( !bAddFloorAndWall || (eBottomPos!=CuboidPlanePosition_Bottom) )
{
//we always need this object as dummy object for correct scene dimensions
@@ -622,38 +591,33 @@ void VDiagram::createShapes_3d()
}
else
{
- OUString aFloorCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, OUString() ) );//@todo read CID from model
+ OUString aFloorCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, u"" ) );//@todo read CID from model
ShapeFactory::setShapeName( xShape, aFloorCID );
}
}
//create an additional scene for the smaller inner coordinate region:
{
- uno::Reference< drawing::XShapes > xShapes = m_pShapeFactory->createGroup3D( xOuterGroup_Shapes,"testonly;CooContainer=XXX_CID" );
- m_xCoordinateRegionShape.set( xShapes, uno::UNO_QUERY );
+ rtl::Reference<Svx3DSceneObject> xShapes2 = ShapeFactory::createGroup3D( xOuterGroup_Shapes,"testonly;CooContainer=XXX_CID" );
+ m_xCoordinateRegionShape = xShapes2;
- uno::Reference< beans::XPropertySet > xShapeProp( m_xCoordinateRegionShape, uno::UNO_QUERY );
- OSL_ENSURE(xShapeProp.is(), "created shape offers no XPropertySet");
- if( xShapeProp.is())
+ try
{
- try
- {
- double fXScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
- double fYScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
- double fZScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
+ double fXScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
+ double fYScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
+ double fZScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
- ::basegfx::B3DHomMatrix aM;
- aM.translate(GRID_TO_WALL_DISTANCE/fXScale, GRID_TO_WALL_DISTANCE/fYScale, GRID_TO_WALL_DISTANCE/fZScale);
- aM.scale( fXScale, fYScale, fZScale );
- E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
+ ::basegfx::B3DHomMatrix aM;
+ aM.translate(GRID_TO_WALL_DISTANCE/fXScale, GRID_TO_WALL_DISTANCE/fYScale, GRID_TO_WALL_DISTANCE/fZScale);
+ aM.scale( fXScale, fYScale, fZScale );
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
- xShapeProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
- , uno::Any(BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aM)) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xShapes2->SvxShape::setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
+ , uno::Any(BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aM)) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
}
@@ -667,7 +631,7 @@ basegfx::B2IRectangle VDiagram::getCurrentRectangle() const
return BaseGFXHelper::makeRectangle(m_aCurrentPosWithoutAxes,m_aCurrentSizeWithoutAxes);
}
-void VDiagram::reduceToMimimumSize()
+void VDiagram::reduceToMinimumSize()
{
if( !m_xOuterGroupShape.is() )
return;
@@ -675,8 +639,8 @@ void VDiagram::reduceToMimimumSize()
awt::Size aMaxSize( m_aAvailableSizeIncludingAxes );
awt::Point aMaxPos( m_aAvailablePosIncludingAxes );
- sal_Int32 nNewWidth = aMaxSize.Width/3;
- sal_Int32 nNewHeight = aMaxSize.Height/3;
+ sal_Int32 nNewWidth = std::round(aMaxSize.Width/2.2);
+ sal_Int32 nNewHeight = std::round(aMaxSize.Height/2.2);
awt::Size aNewSize( nNewWidth, nNewHeight );
awt::Point aNewPos( aMaxPos );
aNewPos.X += nNewWidth;
diff --git a/chart2/source/view/inc/Clipping.hxx b/chart2/source/view/inc/Clipping.hxx
index 4f9a33adb55d..e816e7aa79b1 100644
--- a/chart2/source/view/inc/Clipping.hxx
+++ b/chart2/source/view/inc/Clipping.hxx
@@ -17,12 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_CLIPPING_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_CLIPPING_HXX
+#pragma once
#include <basegfx/range/b2drectangle.hxx>
namespace com::sun::star::drawing { struct PolyPolygonShape3D; }
+namespace com::sun::star::drawing { struct Position3D; }
namespace chart
{
@@ -49,9 +49,13 @@ public:
, const ::basegfx::B2DRectangle& rRectangle
, css::drawing::PolyPolygonShape3D& aResult
, bool bSplitPiecesToDifferentPolygons = true );
+ static void clipPolygonAtRectangle(
+ const std::vector<std::vector<css::drawing::Position3D>>& rPolygon
+ , const ::basegfx::B2DRectangle& rRectangle
+ , std::vector<std::vector<css::drawing::Position3D>>& aResult
+ , bool bSplitPiecesToDifferentPolygons = true );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/ConfigAccess.hxx b/chart2/source/view/inc/ConfigAccess.hxx
deleted file mode 100644
index 556b371f1d81..000000000000
--- a/chart2/source/view/inc/ConfigAccess.hxx
+++ /dev/null
@@ -1,40 +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 INCLUDED_CHART2_SOURCE_VIEW_INC_CONFIGACCESS_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_CONFIGACCESS_HXX
-
-namespace chart
-{
-namespace ConfigAccess
-{
-/** @descr Retrieve the setting for showing errors in charts from the registry
- settings of the Calc application.
-
- If this setting is not found, it is set to false (the default setting).
-
- @return boolean UseErrorRectangle.
- */
-bool getUseErrorRectangle();
-}
-
-} //namespace chart
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/DataTableView.hxx b/chart2/source/view/inc/DataTableView.hxx
new file mode 100644
index 000000000000..0bccaaddde31
--- /dev/null
+++ b/chart2/source/view/inc/DataTableView.hxx
@@ -0,0 +1,88 @@
+/* -*- 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 <svx/unoshape.hxx>
+#include <svx/unodraw/SvxTableShape.hxx>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <DataTable.hxx>
+#include "VLineProperties.hxx"
+
+namespace chart
+{
+class VSeriesPlotter;
+class ChartModel;
+class LegendEntryProvider;
+
+/**
+ * DataTableView is responsible to create the table object, set the cell
+ * properties accordingly to the model and fill it with the chart series
+ * data.
+ */
+class DataTableView final
+{
+private:
+ rtl::Reference<::chart::ChartModel> m_xChartModel;
+ // the target shape
+ rtl::Reference<SvxShapeGroupAnyD> m_xTarget;
+ // the data table shape
+ rtl::Reference<SvxTableShape> m_xTableShape;
+ // the data table model
+ rtl::Reference<DataTable> m_xDataTableModel;
+ css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
+ css::uno::Reference<css::table::XTable> m_xTable;
+ VLineProperties m_aLineProperties;
+ std::vector<VSeriesPlotter*> m_pSeriesPlotterList;
+
+ // data series names
+ std::vector<OUString> m_aDataSeriesNames;
+ // X axis names
+ std::vector<OUString> m_aXValues;
+ // list of data series values
+ std::vector<std::vector<OUString>> m_pDataSeriesValues;
+
+ // if the header vales should be aligned with the x-axis vales
+ bool m_bAlignAxisValuesWithColumns;
+
+ /** Set the char and paragraph properties for the input (value) cell */
+ void
+ setCellCharAndParagraphProperties(css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
+
+ /** Set the common cell properties (for all cells in the data table,
+ * including headers)
+ */
+ void setCellProperties(css::uno::Reference<css::beans::XPropertySet>& xPropertySet, bool bLeft,
+ bool bTop, bool bRight, bool bBottom);
+
+public:
+ DataTableView(rtl::Reference<::chart::ChartModel> const& xChartDoc,
+ rtl::Reference<DataTable> const& rDataTableModel,
+ css::uno::Reference<css::uno::XComponentContext> const& rComponentContext,
+ bool bAlignAxisValuesWithColumns);
+
+ /** Initializes and prepares the target and data table shape */
+ void initializeShapes(const rtl::Reference<SvxShapeGroupAnyD>& xTarget);
+
+ /** Prepares the values of the chart, which will be shown it the data table */
+ void initializeValues(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList);
+
+ /** Creates the data table and fills the values */
+ void createShapes(basegfx::B2DVector const& rStart, basegfx::B2DVector const& rEnd,
+ sal_Int32 nAxisStepWidth);
+
+ /** Repositions the data table shape */
+ void changePosition(sal_Int32 x, sal_Int32 y);
+};
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/DateHelper.hxx b/chart2/source/view/inc/DateHelper.hxx
index bfd549b22142..8c37851b7de3 100644
--- a/chart2/source/view/inc/DateHelper.hxx
+++ b/chart2/source/view/inc/DateHelper.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_DATEHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_DATEHELPER_HXX
+#pragma once
#include <tools/date.hxx>
+#include <tools/long.hxx>
namespace chart
{
@@ -35,10 +35,9 @@ public:
static bool IsLessThanOneMonthAway( const Date& rD1, const Date& rD2 );
static bool IsLessThanOneYearAway( const Date& rD1, const Date& rD2 );
- static double RasterizeDateValue( double fValue, const Date& rNullDate, long TimeResolution );
+ static double RasterizeDateValue( double fValue, const Date& rNullDate, tools::Long TimeResolution );
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/LabelAlignment.hxx b/chart2/source/view/inc/LabelAlignment.hxx
index 7d2eff4a699d..425f5c6c3eaa 100644
--- a/chart2/source/view/inc/LabelAlignment.hxx
+++ b/chart2/source/view/inc/LabelAlignment.hxx
@@ -17,12 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_LABELALIGNMENT_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_LABELALIGNMENT_HXX
+#pragma once
-namespace chart {
-
-enum LabelAlignment {
+namespace chart
+{
+enum LabelAlignment
+{
LABEL_ALIGN_CENTER,
LABEL_ALIGN_LEFT,
LABEL_ALIGN_TOP,
@@ -33,9 +33,6 @@ enum LabelAlignment {
LABEL_ALIGN_RIGHT_TOP,
LABEL_ALIGN_RIGHT_BOTTOM
};
-
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/LabelPositionHelper.hxx b/chart2/source/view/inc/LabelPositionHelper.hxx
index 92b12d8d35f0..4f2f3ba2797a 100644
--- a/chart2/source/view/inc/LabelPositionHelper.hxx
+++ b/chart2/source/view/inc/LabelPositionHelper.hxx
@@ -17,12 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_LABELPOSITIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_LABELPOSITIONHELPER_HXX
+#pragma once
#include "LabelAlignment.hxx"
#include "PropertyMapper.hxx"
#include <com/sun/star/awt/Point.hpp>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
namespace com::sun::star::drawing { struct Position3D; }
namespace com::sun::star::drawing { class XShapes; }
@@ -32,16 +33,13 @@ namespace com::sun::star::drawing { class XShape; }
namespace chart
{
-class ShapeFactory;
-
class LabelPositionHelper
{
public:
LabelPositionHelper() = delete;
LabelPositionHelper(
sal_Int32 nDimensionCount
- , const css::uno::Reference< css::drawing::XShapes >& xLogicTarget
- , ShapeFactory* pShapeFactory );
+ , rtl::Reference<SvxShapeGroupAnyD> xLogicTarget );
virtual ~LabelPositionHelper();
css::awt::Point transformSceneToScreenPosition(
@@ -52,7 +50,7 @@ public:
, const css::uno::Reference< css::beans::XPropertySet >& xAxisModelProps
, const css::awt::Size& rNewReferenceSize );
- static void correctPositionForRotation( const css::uno::Reference< css::drawing::XShape >& xShape2DText
+ static void correctPositionForRotation( const rtl::Reference<SvxShapeText>& xShape2DText
, LabelAlignment eLabelAlignment, const double fRotationAngle, bool bRotateAroundCenter );
protected:
@@ -60,11 +58,9 @@ protected:
private:
//these members are only necessary for transformation from 3D to 2D
- css::uno::Reference< css::drawing::XShapes > m_xLogicTarget;
- ShapeFactory* m_pShapeFactory;
+ rtl::Reference<SvxShapeGroupAnyD> m_xLogicTarget;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx
index 8c7ae00fafab..ce7722b0edfd 100644
--- a/chart2/source/view/inc/LegendEntryProvider.hxx
+++ b/chart2/source/view/inc/LegendEntryProvider.hxx
@@ -16,18 +16,19 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_LEGENDENTRYPROVIDER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_LEGENDENTRYPROVIDER_HXX
+#pragma once
#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/XFormattedString2.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
#include <vector>
namespace chart { class ChartModel; }
namespace com::sun::star::beans { class XPropertySet; }
-namespace com::sun::star::chart2 { class XFormattedString2; }
namespace com::sun::star::drawing { class XShape; }
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
@@ -35,6 +36,7 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class FormattedString;
enum class LegendSymbolStyle
{
@@ -57,12 +59,20 @@ struct ViewLegendEntry
/** The legend symbol that represents a data series or other
information contained in the legend
*/
- css::uno::Reference< css::drawing::XShape > aSymbol;
+ rtl::Reference< SvxShapeGroup > xSymbol;
/** The descriptive text for a legend entry.
*/
- css::uno::Sequence<
- css::uno::Reference< css::chart2::XFormattedString2 > > aLabel;
+ rtl::Reference< ::chart::FormattedString > xLabel;
+};
+
+
+struct ViewLegendSymbol
+{
+ /** The legend symbol that represents a data series or other
+ information contained in the legend
+ */
+ rtl::Reference<SvxShapeGroup> xSymbol;
};
class LegendEntryProvider
@@ -74,8 +84,7 @@ public:
const css::awt::Size& rEntryKeyAspectRatio,
css::chart2::LegendPosition eLegendPosition,
const css::uno::Reference< css::beans::XPropertySet >& xTextProperties,
- const css::uno::Reference< css::drawing::XShapes >& xTarget,
- const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const css::uno::Reference< css::uno::XComponentContext >& xContext,
ChartModel& rModel
) = 0;
@@ -86,7 +95,4 @@ protected:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_VIEW_INC_LEGENDENTRYPROVIDER_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/Linear3DTransformation.hxx b/chart2/source/view/inc/Linear3DTransformation.hxx
index 3572caab7a7c..456f6e4c4b26 100644
--- a/chart2/source/view/inc/Linear3DTransformation.hxx
+++ b/chart2/source/view/inc/Linear3DTransformation.hxx
@@ -16,32 +16,25 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_LINEAR3DTRANSFORMATION_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_LINEAR3DTRANSFORMATION_HXX
+#pragma once
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/chart2/XTransformation.hpp>
+#include "PlottingPositionHelper.hxx"
#include <com/sun/star/drawing/HomogenMatrix.hpp>
namespace chart
{
-class Linear3DTransformation : public ::cppu::WeakImplHelper<
- css::chart2::XTransformation
- >
+class Linear3DTransformation final : public XTransformation2
{
public:
Linear3DTransformation( const css::drawing::HomogenMatrix& rHomMatrix, bool bSwapXAndY );
virtual ~Linear3DTransformation() override;
- // ____ XTransformation ____
- /// @see css::chart2::XTransformation
- virtual css::uno::Sequence< double > SAL_CALL transform(
- const css::uno::Sequence< double >& rSourceValues ) override;
- /// @see css::chart2::XTransformation
- virtual sal_Int32 SAL_CALL getSourceDimension() override;
- /// @see css::chart2::XTransformation
- virtual sal_Int32 SAL_CALL getTargetDimension() override;
+ // ____ XTransformation2 ____
+ virtual css::drawing::Position3D transform(
+ const css::drawing::Position3D& rSourceValues ) const override;
+ virtual css::drawing::Position3D transform(
+ const css::uno::Sequence< double >& rSourceValues ) const override;
private:
css::drawing::HomogenMatrix m_Matrix;
@@ -50,7 +43,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_VIEW_INC_LINEAR3DTRANSFORMATION_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx b/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
index b256f1b919fd..cbb5e55ba74a 100644
--- a/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
+++ b/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
@@ -17,11 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_MINIMUMANDMAXIMUMSUPPLIER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_MINIMUMANDMAXIMUMSUPPLIER_HXX
+#pragma once
#include <sal/types.h>
#include <tools/date.hxx>
+#include <tools/long.hxx>
#include <set>
namespace chart
@@ -48,14 +48,14 @@ public:
virtual bool isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) = 0;
//return a constant out of css::chart::TimeUnit that allows to display the smallest distance between occurring dates
- virtual long calculateTimeResolutionOnXAxis() = 0;
- virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ) = 0;
+ virtual tools::Long calculateTimeResolutionOnXAxis() = 0;
+ virtual void setTimeResolutionOnXAxis( tools::Long nTimeResolution, const Date& rNullDate ) = 0;
protected:
~MinimumAndMaximumSupplier() {}
};
-class MergedMinimumAndMaximumSupplier : public MinimumAndMaximumSupplier
+class MergedMinimumAndMaximumSupplier final : public MinimumAndMaximumSupplier
{
public:
MergedMinimumAndMaximumSupplier();
@@ -79,8 +79,8 @@ public:
virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ) override;
virtual bool isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) override;
- virtual long calculateTimeResolutionOnXAxis() override;
- virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ) override;
+ virtual tools::Long calculateTimeResolutionOnXAxis() override;
+ virtual void setTimeResolutionOnXAxis( tools::Long nTimeResolution, const Date& rNullDate ) override;
private:
typedef std::set< MinimumAndMaximumSupplier* > MinimumAndMaximumSupplierSet;
@@ -88,6 +88,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/PlotterBase.hxx b/chart2/source/view/inc/PlotterBase.hxx
index 7fe205578b21..73695507fd48 100644
--- a/chart2/source/view/inc/PlotterBase.hxx
+++ b/chart2/source/view/inc/PlotterBase.hxx
@@ -16,11 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_PLOTTERBASE_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_PLOTTERBASE_HXX
+#pragma once
-#include <com/sun/star/uno/Reference.h>
#include <rtl/ustring.hxx>
+#include <svx/unoshape.hxx>
#include <vector>
namespace com::sun::star::drawing { struct HomogenMatrix; }
@@ -48,13 +47,12 @@ public:
/// @throws css::uno::RuntimeException
virtual void initPlotter(
- const css::uno::Reference< css::drawing::XShapes >& xLogicTarget
- , const css::uno::Reference< css::drawing::XShapes >& xFinalTarget
- , const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory
+ const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xFinalTarget
, const OUString& rCID
);
- virtual void setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis );
+ virtual void setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis );
virtual void setTransformationSceneToScreen( const css::drawing::HomogenMatrix& rMatrix );
@@ -63,16 +61,13 @@ public:
static bool isValidPosition( const css::drawing::Position3D& rPos );
protected: //methods
- css::uno::Reference< css::drawing::XShapes >
- createGroupShape( const css::uno::Reference<
- css::drawing::XShapes >& xTarget
+ rtl::Reference< SvxShapeGroupAnyD >
+ createGroupShape( const rtl::Reference< SvxShapeGroupAnyD >& xTarget
, const OUString& rName=OUString() );
protected: //member
- css::uno::Reference< css::drawing::XShapes > m_xLogicTarget;
- css::uno::Reference< css::drawing::XShapes > m_xFinalTarget;
- css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory;
- ShapeFactory* m_pShapeFactory;
+ rtl::Reference< SvxShapeGroupAnyD > m_xLogicTarget;
+ rtl::Reference< SvxShapeGroupAnyD > m_xFinalTarget;
OUString m_aCID;
const sal_Int32 m_nDimension;
@@ -80,6 +75,5 @@ protected: //member
PlottingPositionHelper* m_pPosHelper;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx b/chart2/source/view/inc/PlottingPositionHelper.hxx
index 198941330b12..916668dd6c14 100644
--- a/chart2/source/view/inc/PlottingPositionHelper.hxx
+++ b/chart2/source/view/inc/PlottingPositionHelper.hxx
@@ -16,20 +16,24 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_PLOTTINGPOSITIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_PLOTTINGPOSITIONHELPER_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <memory>
#include <chartview/ExplicitScaleValues.hxx>
#include <basegfx/range/b2drectangle.hxx>
-#include <rtl/math.hxx>
+#include <tools/long.hxx>
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/drawing/Position3D.hpp>
#include <basegfx/matrix/b3dhommatrix.hxx>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
-namespace com::sun::star::chart2 { class XTransformation; }
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::drawing { struct HomogenMatrix; }
namespace com::sun::star::drawing { struct PolyPolygonShape3D; }
@@ -39,6 +43,45 @@ namespace chart
class ShapeFactory;
+/** allows the transformation of numeric values from one
+ coordinate-system into another. Values may be transformed using
+ any mapping.
+ This is a non-UNO variant of the css::chart2::XTransformation interface,
+ but using more efficient calling and returning types.
+ */
+class XTransformation2
+{
+public:
+ virtual ~XTransformation2();
+ /** transforms the given input data tuple, given in the source
+ coordinate system, according to the internal transformation
+ rules, into a tuple of transformed coordinates in the
+ destination coordinate system.
+
+ <p>Note that both coordinate systems may have different
+ dimensions, e.g., if a transformation does simply a projection
+ into a lower-dimensional space.</p>
+
+ @param aValues a source tuple of data that is to be
+ transformed. The length of this sequence must be
+ equivalent to the dimension of the source coordinate
+ system.
+
+ @return the transformed data tuple. The length of this
+ sequence is equal to the dimension of the output
+ coordinate system.
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ if the dimension of the input vector is not equal to the
+ dimension given in getSourceDimension().
+ */
+ virtual css::drawing::Position3D transform(
+ const css::drawing::Position3D& rSourceValues ) const = 0;
+ virtual css::drawing::Position3D transform(
+ const css::uno::Sequence< double >& rSourceValues ) const = 0;
+};
+
+
class PlottingPositionHelper
{
public:
@@ -51,7 +94,7 @@ public:
virtual void setTransformationSceneToScreen( const css::drawing::HomogenMatrix& rMatrix);
- virtual void setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis );
+ virtual void setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis );
const std::vector< ExplicitScaleData >& getScales() const { return m_aScales;}
//better performance for big data
@@ -69,7 +112,7 @@ public:
inline void doLogicScaling( css::drawing::Position3D& rPos ) const;
- virtual css::uno::Reference< css::chart2::XTransformation >
+ virtual ::chart::XTransformation2*
getTransformationScaledLogicToScene() const;
virtual css::drawing::Position3D
@@ -79,11 +122,12 @@ public:
transformScaledLogicToScene( double fX, double fY, double fZ, bool bClip ) const;
void transformScaledLogicToScene( css::drawing::PolyPolygonShape3D& rPoly ) const;
+ void transformScaledLogicToScene( std::vector<std::vector<css::drawing::Position3D>>& rPoly ) const;
static css::awt::Point transformSceneToScreenPosition(
const css::drawing::Position3D& rScenePosition3D
- , const css::uno::Reference< css::drawing::XShapes >& xSceneTarget
- , ShapeFactory* pShapeFactory, sal_Int32 nDimensionCount );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xSceneTarget
+ , sal_Int32 nDimensionCount );
inline double getLogicMinX() const;
inline double getLogicMinY() const;
@@ -107,7 +151,7 @@ public:
inline bool maySkipPointsInRegressionCalculation() const;
- void setTimeResolution( long nTimeResolution, const Date& rNullDate );
+ void setTimeResolution( tools::Long nTimeResolution, const Date& rNullDate );
virtual void setScaledCategoryWidth( double fScaledCategoryWidth );
void AllowShiftXAxisPos( bool bAllowShift );
void AllowShiftZAxisPos( bool bAllowShift );
@@ -117,7 +161,7 @@ protected: //member
::basegfx::B3DHomMatrix m_aMatrixScreenToScene;
//this is calculated based on m_aScales and m_aMatrixScreenToScene
- mutable css::uno::Reference< css::chart2::XTransformation > m_xTransformationLogicToScene;
+ mutable std::unique_ptr< ::chart::XTransformation2 > m_xTransformationLogicToScene;
bool m_bSwapXAndY;//e.g. true for bar chart and false for column chart
@@ -128,7 +172,7 @@ protected: //member
bool m_bMaySkipPointsInRegressionCalculation;
bool m_bDateAxis;
- long m_nTimeResolution;
+ tools::Long m_nTimeResolution;
Date m_aNullDate;
double m_fScaledCategoryWidth;
@@ -146,11 +190,11 @@ public:
virtual std::unique_ptr<PlottingPositionHelper> clone() const override;
virtual void setTransformationSceneToScreen( const css::drawing::HomogenMatrix& rMatrix) override;
- virtual void setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis ) override;
+ virtual void setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis ) override;
const ::basegfx::B3DHomMatrix& getUnitCartesianToScene() const { return m_aUnitCartesianToScene;}
- virtual css::uno::Reference< css::chart2::XTransformation >
+ virtual ::chart::XTransformation2*
getTransformationScaledLogicToScene() const override;
//the resulting values provided by the following 3 methods should be used
@@ -278,9 +322,9 @@ bool PlottingPositionHelper::isStrongLowerRequested( sal_Int32 nDimensionIndex )
if( m_aScales.empty() )
return false;
if( 0==nDimensionIndex )
- return m_bAllowShiftXAxisPos && m_aScales[nDimensionIndex].ShiftedCategoryPosition;
+ return m_bAllowShiftXAxisPos && m_aScales[nDimensionIndex].m_bShiftedCategoryPosition;
else if( 2==nDimensionIndex )
- return m_bAllowShiftZAxisPos && m_aScales[nDimensionIndex].ShiftedCategoryPosition;
+ return m_bAllowShiftZAxisPos && m_aScales[nDimensionIndex].m_bShiftedCategoryPosition;
return false;
}
@@ -298,7 +342,7 @@ void PlottingPositionHelper::doLogicScaling( double* pX, double* pY, double* pZ
{
if( m_aScales[0].Scaling.is())
*pX = m_aScales[0].Scaling->doScaling(*pX);
- if( m_bAllowShiftXAxisPos && m_aScales[0].ShiftedCategoryPosition )
+ if( m_bAllowShiftXAxisPos && m_aScales[0].m_bShiftedCategoryPosition )
(*pX) += m_fScaledCategoryWidth/2.0;
}
if(pY && m_aScales[1].Scaling.is())
@@ -307,7 +351,7 @@ void PlottingPositionHelper::doLogicScaling( double* pX, double* pY, double* pZ
{
if( m_aScales[2].Scaling.is())
*pZ = m_aScales[2].Scaling->doScaling(*pZ);
- if( m_bAllowShiftZAxisPos && m_aScales[2].ShiftedCategoryPosition)
+ if( m_bAllowShiftZAxisPos && m_aScales[2].m_bShiftedCategoryPosition)
(*pZ) += 0.5;
}
}
@@ -356,11 +400,7 @@ inline bool PlottingPositionHelper::clipYRange( double& rMin, double& rMax ) con
{
//returns true if something remains
if( rMin > rMax )
- {
- double fHelp = rMin;
- rMin = rMax;
- rMax = fHelp;
- }
+ std::swap( rMin, rMax );
if( rMin > getLogicMaxY() )
return false;
if( rMax < getLogicMinY() )
@@ -419,6 +459,5 @@ inline bool PlottingPositionHelper::maySkipPointsInRegressionCalculation() const
}
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/PolarLabelPositionHelper.hxx b/chart2/source/view/inc/PolarLabelPositionHelper.hxx
index 2c6ed3a93795..84f4ff1dc83c 100644
--- a/chart2/source/view/inc/PolarLabelPositionHelper.hxx
+++ b/chart2/source/view/inc/PolarLabelPositionHelper.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_POLARLABELPOSITIONHELPER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_POLARLABELPOSITIONHELPER_HXX
+#pragma once
#include "LabelPositionHelper.hxx"
#include <com/sun/star/awt/Point.hpp>
@@ -28,14 +27,13 @@ namespace chart
class PolarPlottingPositionHelper;
-class PolarLabelPositionHelper : public LabelPositionHelper
+class PolarLabelPositionHelper final : public LabelPositionHelper
{
public:
PolarLabelPositionHelper(
PolarPlottingPositionHelper* pPosHelper
, sal_Int32 nDimensionCount
- , const css::uno::Reference< css::drawing::XShapes >& xLogicTarget
- , ShapeFactory* pShapeFactory );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget );
virtual ~PolarLabelPositionHelper() override;
css::awt::Point getLabelScreenPositionAndAlignmentForLogicValues(
@@ -68,6 +66,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/PropertyMapper.hxx b/chart2/source/view/inc/PropertyMapper.hxx
index 5da914074e1c..c4d9a1fa2577 100644
--- a/chart2/source/view/inc/PropertyMapper.hxx
+++ b/chart2/source/view/inc/PropertyMapper.hxx
@@ -16,23 +16,23 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_PROPERTYMAPPER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_PROPERTYMAPPER_HXX
+#pragma once
#include <sal/config.h>
-#include <map>
+#include <unordered_map>
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/uno/Reference.h>
namespace com::sun::star::beans { class XPropertySet; }
+class SvxShape;
namespace chart
{
-typedef std::map< OUString, OUString > tPropertyNameMap;
-typedef std::map< OUString, css::uno::Any > tPropertyNameValueMap;
+typedef std::unordered_map<OUString, OUString> tPropertyNameMap;
+typedef std::unordered_map<OUString, css::uno::Any> tPropertyNameValueMap;
typedef css::uno::Sequence< OUString > tNameSequence;
typedef css::uno::Sequence< css::uno::Any > tAnySequence;
@@ -48,8 +48,12 @@ public:
static void setMappedProperties(
const css::uno::Reference< css::beans::XPropertySet >& xTarget
, const css::uno::Reference< css::beans::XPropertySet >& xSource
- , const tPropertyNameMap& rMap
- , tPropertyNameValueMap const * pOverwriteMap=nullptr );
+ , const tPropertyNameMap& rMap );
+
+ static void setMappedProperties(
+ SvxShape& xTarget
+ , const css::uno::Reference< css::beans::XPropertySet >& xSource
+ , const tPropertyNameMap& rMap );
/**
* Fetch property values from the source object and map it to the
@@ -67,13 +71,6 @@ public:
, const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
);
- static void getMultiPropertyLists(
- tNameSequence& rNames
- , tAnySequence& rValues
- , const css::uno::Reference< css::beans::XPropertySet >& xProp
- , const tPropertyNameMap& rMap
- );
-
static void getMultiPropertyListsFromValueMap(
tNameSequence& rNames
, tAnySequence& rValues
@@ -83,7 +80,7 @@ public:
static css::uno::Any*
getValuePointer( tAnySequence& rPropValues
, const tNameSequence& rPropNames
- , const OUString& rPropName );
+ , std::u16string_view rPropName );
static css::uno::Any*
getValuePointerForLimitedSpace( tAnySequence& rPropValues
@@ -93,7 +90,7 @@ public:
static void setMultiProperties(
const tNameSequence& rNames
, const tAnySequence& rValues
- , const css::uno::Reference< css::beans::XPropertySet >& xTarget );
+ , SvxShape& xTarget );
static const tPropertyNameMap& getPropertyNameMapForCharacterProperties();
static const tPropertyNameMap& getPropertyNameMapForParagraphProperties();
@@ -124,6 +121,5 @@ public:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/ScaleAutomatism.hxx b/chart2/source/view/inc/ScaleAutomatism.hxx
index df2e203bc0d6..1141c9e87cd4 100644
--- a/chart2/source/view/inc/ScaleAutomatism.hxx
+++ b/chart2/source/view/inc/ScaleAutomatism.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_SCALEAUTOMATISM_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_SCALEAUTOMATISM_HXX
+#pragma once
#include <com/sun/star/chart2/ScaleData.hpp>
@@ -141,6 +140,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 7a698e4b9d87..b44612e74a4f 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_SHAPEFACTORY_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_SHAPEFACTORY_HXX
+#pragma once
#include "PropertyMapper.hxx"
#include <basegfx/range/b2irectangle.hxx>
@@ -25,12 +24,15 @@
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unodraw/SvxTableShape.hxx>
+#include <svx/unopage.hxx>
namespace chart { struct VLineProperties; }
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::chart2 { class XFormattedString; }
-namespace com::sun::star::drawing { class XDrawPage; }
namespace com::sun::star::drawing { class XShape; }
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::drawing { struct HomogenMatrix; }
@@ -40,7 +42,6 @@ namespace com::sun::star::graphic { class XGraphic; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
namespace com::sun::star::drawing { struct Direction3D; }
-
namespace chart
{
class Stripe;
@@ -68,29 +69,28 @@ enum SymbolEnum { Symbol_Square=0
class ShapeFactory
{
- css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory;
-
- ShapeFactory(css::uno::Reference< css::lang::XMultiServiceFactory> const & xFactory)
- {m_xShapeFactory = xFactory;}
-
public:
enum class StackPosition { Top, Bottom };
- static ShapeFactory* getOrCreateShapeFactory(const css::uno::Reference< css::lang::XMultiServiceFactory>& xFactory);
-
ShapeFactory() = delete;
- css::uno::Reference< css::drawing::XShapes >
+
+ static rtl::Reference< SvxShapeGroup >
createGroup2D(
- const css::uno::Reference< css::drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const OUString& aName = OUString() );
- css::uno::Reference< css::drawing::XShapes >
+ static rtl::Reference< SvxShapeGroup >
+ createGroup2D(
+ const rtl::Reference<SvxDrawPage>& xTarget
+ , const OUString& aName = OUString() );
+
+ static rtl::Reference<Svx3DSceneObject>
createGroup3D(
- const css::uno::Reference< css::drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const OUString& aName = OUString() );
- css::uno::Reference< css::drawing::XShape >
- createCube( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<Svx3DExtrudeObject>
+ createCube( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, sal_Int32 nRotateZAngleHundredthDegree
@@ -98,14 +98,14 @@ public:
, const tPropertyNameMap& rPropertyNameMap
, bool bRounded = false);
- css::uno::Reference< css::drawing::XShape >
- createCylinder( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<Svx3DLatheObject>
+ createCylinder( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, sal_Int32 nRotateZAngleHundredthDegree );
- css::uno::Reference< css::drawing::XShape >
- createPyramid( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<Svx3DSceneObject>
+ createPyramid( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, double fTopHeight
@@ -113,29 +113,29 @@ public:
, const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap);
- css::uno::Reference< css::drawing::XShape >
- createCone( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<Svx3DLatheObject>
+ createCone( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree );
- css::uno::Reference< css::drawing::XShape >
- createPieSegment2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<SvxShapePolyPolygon>
+ createPieSegment2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
, const css::drawing::Direction3D& rOffset
, const css::drawing::HomogenMatrix& rUnitCircleToScene );
- css::uno::Reference< css::drawing::XShape >
- createPieSegment( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<Svx3DExtrudeObject>
+ createPieSegment( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
, const css::drawing::Direction3D& rOffset
, const css::drawing::HomogenMatrix& rUnitCircleToScene
, double fDepth );
- css::uno::Reference< css::drawing::XShape >
- createStripe( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<Svx3DPolygonObject>
+ createStripe( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const Stripe& rStripe
, const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap
@@ -143,143 +143,112 @@ public:
, short nRotatedTexture = 0 //0 to 7 are the different possibilities
, bool bFlatNormals=true );
- css::uno::Reference< css::drawing::XShape >
- createArea3D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::PolyPolygonShape3D& rPolyPolygon
+ static rtl::Reference<Svx3DExtrudeObject>
+ createArea3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon
, double fDepth);
- css::uno::Reference< css::drawing::XShape >
- createArea2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::PolyPolygonShape3D& rPolyPolygon);
+ static rtl::Reference<SvxShapePolyPolygon>
+ createArea2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon);
- css::uno::Reference< css::drawing::XShape >
- createSymbol2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<SvxShapePolyPolygon>
+ createSymbol2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPos
, const css::drawing::Direction3D& rSize
, sal_Int32 nStandardSymbol
, sal_Int32 nBorderColor
, sal_Int32 nFillColor );
- css::uno::Reference< css::drawing::XShape >
- createGraphic2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<SvxGraphicObject>
+ createGraphic2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPos
, const css::drawing::Direction3D& rSize
, const css::uno::Reference< css::graphic::XGraphic >& xGraphic );
- css::uno::Reference< css::drawing::XShape >
- createLine2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<SvxShapePolyPolygon>
+ createLine2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::PointSequenceSequence& rPoints
, const VLineProperties* pLineProperties = nullptr );
+ static rtl::Reference<SvxShapePolyPolygon>
+ createLine2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const std::vector<std::vector<css::drawing::Position3D>>& rPoints
+ , const VLineProperties* pLineProperties = nullptr );
- css::uno::Reference< css::drawing::XShape >
- createLine ( const css::uno::Reference< css::drawing::XShapes >& xTarget,
+ static rtl::Reference<SvxShapePolyPolygon>
+ createLine ( const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const css::awt::Size& rSize, const css::awt::Point& rPosition );
- css::uno::Reference< css::drawing::XShape >
- createLine3D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::PolyPolygonShape3D& rPoints
+ static rtl::Reference<Svx3DPolygonObject>
+ createLine3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const std::vector<std::vector<css::drawing::Position3D>>& rPoints
, const VLineProperties& rLineProperties );
- css::uno::Reference< css::drawing::XShape >
- createCircle2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<SvxShapeCircle>
+ createCircle2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPos
, const css::drawing::Direction3D& rSize );
- css::uno::Reference< css::drawing::XShape >
- createCircle( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<SvxShapeCircle>
+ createCircle( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::awt::Size& rSize
, const css::awt::Point& rPosition );
- css::uno::Reference< css::drawing::XShape >
- createText( const css::uno::Reference< css::drawing::XShapes >& xTarget2D
+ static rtl::Reference<SvxShapeText>
+ createText( const rtl::Reference<SvxShapeGroupAnyD>& xTarget2D
, const OUString& rText
, const tNameSequence& rPropNames
, const tAnySequence& rPropValues
, const css::uno::Any& rATransformation
);
- /** This method creates a text shape made up by a set of paragraphs.
- * For each paragraph the related text style is passed to the method.
- *
- * @param xTarget
- * where to append the new created text shape.
- *
- * @param rTextParagraphs
- * the set of paragraphs which made up the text shape.
- *
- * @param rParaPropNames
- * a collection of lists of text property names:
- * there must be a list of text property names for each paragraph.
- *
- * @param rParaPropValues
- * a collection of lists of text property values:
- * there must be a list of text property values for each paragraph.
- *
- * @param rPropNames
- * a list of text property names to be applied to the whole text shape.
- *
- * @param rPropValues
- * a list of text property values to be applied to the whole text shape.
- *
- * @param rATransformation
- * a transformation to be applied to the text shape as final step.
- *
- */
- css::uno::Reference< css::drawing::XShape >
- createText( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::uno::Sequence< OUString >& rTextParagraphs
- , const css::uno::Sequence< tNameSequence >& rParaPropNames
- , const css::uno::Sequence< tAnySequence >& rParaPropValues
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues
- , const css::uno::Any& rATransformation );
-
- css::uno::Reference< css::drawing::XShape >
- createText(const css::uno::Reference< css::drawing::XShapes >& xTarget
- , css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString
+ static rtl::Reference<SvxShapeText>
+ createText(const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString
, const tNameSequence& rPropNames
, const tAnySequence& rPropValues
, const css::uno::Any& rATransformation);
- css::uno::Reference< css::drawing::XShape >
- createText( const css::uno::Reference< css::drawing::XShapes >& xTarget2D,
+ static rtl::Reference<SvxShapeText>
+ createText( const rtl::Reference<SvxShapeGroupAnyD>& xTarget2D,
const css::awt::Size& rSize,
const css::awt::Point& rPosition,
css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString,
const css::uno::Reference< css::beans::XPropertySet > & xTextProperties,
double nRotation, const OUString& aName, sal_Int32 nTextMaxWidth );
- css::uno::Reference< css::drawing::XShape >
+ static rtl::Reference<SvxTableShape> createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget, OUString const& rName = OUString());
+
+ static rtl::Reference<SvxShapeRect>
createInvisibleRectangle(
- const css::uno::Reference< css::drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::awt::Size& rSize );
- css::uno::Reference< css::drawing::XShape >
+ static rtl::Reference<SvxShapeRect>
createRectangle(
- const css::uno::Reference< css::drawing::XShapes >& xTarget,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const css::awt::Size& rSize,
const css::awt::Point& rPosition,
const tNameSequence& rPropNames,
const tAnySequence& rPropValues,
StackPosition ePos = StackPosition::Top );
- css::uno::Reference< css::drawing::XShape >
+ static rtl::Reference<SvxShapeRect>
createRectangle(
- const css::uno::Reference< css::drawing::XShapes >& xTarget );
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
- css::uno::Reference< css::drawing::XShapes >
- getOrCreateChartRootShape( const css::uno::Reference<
- css::drawing::XDrawPage>& xPage );
+ static rtl::Reference<SvxShapeGroupAnyD>
+ getOrCreateChartRootShape( const rtl::Reference<SvxDrawPage>& xPage );
- static void setPageSize(const css::uno::Reference<css::drawing::XShapes>& xChartShapes,
+ static void setPageSize(const rtl::Reference<SvxShapeGroupAnyD>& xChartShapes,
const css::awt::Size& rSize);
- static css::uno::Reference< css::drawing::XShapes >
- getChartRootShape( const css::uno::Reference< css::drawing::XDrawPage>& xPage );
+ static rtl::Reference<SvxShapeGroupAnyD>
+ getChartRootShape( const rtl::Reference<SvxDrawPage>& xPage );
- static void makeShapeInvisible( const css::uno::Reference< css::drawing::XShape >& xShape );
+ static void makeShapeInvisible( const rtl::Reference< SvxShape >& rShape );
- static void setShapeName( const css::uno::Reference< css::drawing::XShape >& xShape
+ static void setShapeName( const rtl::Reference< SvxShape >& xShape
, const OUString& rName );
static OUString getShapeName( const css::uno::Reference< css::drawing::XShape >& xShape );
@@ -288,9 +257,11 @@ public:
static OUString getStackedString( const OUString& rString, bool bStacked );
- static bool hasPolygonAnyLines( css::drawing::PolyPolygonShape3D& rPoly );
- static bool isPolygonEmptyOrSinglePoint( css::drawing::PolyPolygonShape3D& rPoly );
+ static bool hasPolygonAnyLines( const std::vector<std::vector<css::drawing::Position3D>>& rPoly );
+ static bool isPolygonEmptyOrSinglePoint( const css::drawing::PolyPolygonShape3D& rPoly );
+ static bool isPolygonEmptyOrSinglePoint( const std::vector<std::vector<css::drawing::Position3D>>& rPoly );
static void closePolygon( css::drawing::PolyPolygonShape3D& rPoly );
+ static void closePolygon( std::vector<std::vector<css::drawing::Position3D>>& rPoly );
static css::awt::Size calculateNewSizeRespectingAspectRatio(
const css::awt::Size& rTargetSize
@@ -301,25 +272,24 @@ public:
, const css::awt::Size& rTargetAreaSize
, const css::awt::Size& rObjectSize );
- static ::basegfx::B2IRectangle getRectangleOfShape(
- const css::uno::Reference< css::drawing::XShape >& xShape );
+ static ::basegfx::B2IRectangle getRectangleOfShape( SvxShape& rShape );
static css::awt::Size getSizeAfterRotation(
- const css::uno::Reference< css::drawing::XShape >& xShape, double fRotationAngleDegree );
+ SvxShape& rShape, double fRotationAngleDegree );
- static void removeSubShapes( const css::uno::Reference< css::drawing::XShapes >& xShapes );
+ static void removeSubShapes( const rtl::Reference<SvxShapeGroupAnyD>& xShapes );
static sal_Int32 getSymbolCount() { return Symbol_COUNT; }
private:
- css::uno::Reference< css::drawing::XShape >
- impl_createCube( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<Svx3DExtrudeObject>
+ impl_createCube( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize, sal_Int32 nRotateZAngleHundredthDegree
, bool bRounded );
- css::uno::Reference< css::drawing::XShape >
- impl_createConeOrCylinder( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ static rtl::Reference<Svx3DLatheObject>
+ impl_createConeOrCylinder( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
@@ -327,6 +297,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/Stripe.hxx b/chart2/source/view/inc/Stripe.hxx
index 4c25af12a2ac..0da5e0b5dcc5 100644
--- a/chart2/source/view/inc/Stripe.hxx
+++ b/chart2/source/view/inc/Stripe.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_STRIPE_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_STRIPE_HXX
+#pragma once
#include <com/sun/star/drawing/Position3D.hpp>
#include <com/sun/star/drawing/Direction3D.hpp>
@@ -68,6 +67,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx
index 48f3f4aed0a6..61dda842d02b 100644
--- a/chart2/source/view/inc/VCoordinateSystem.hxx
+++ b/chart2/source/view/inc/VCoordinateSystem.hxx
@@ -16,21 +16,21 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VCOORDINATESYSTEM_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_VCOORDINATESYSTEM_HXX
+#pragma once
#include "MinimumAndMaximumSupplier.hxx"
#include <ThreeDHelper.hxx>
+#include "VSeriesPlotter.hxx"
#include <chartview/ExplicitScaleValues.hxx>
#include <com/sun/star/drawing/HomogenMatrix.hpp>
#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
#include <map>
#include <memory>
#include <vector>
-namespace chart { class ExplicitCategoriesProvider; }
-namespace chart { class ScaleAutomatism; }
namespace com::sun::star::awt { struct Rectangle; }
namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::beans { class XPropertySet; }
@@ -39,11 +39,16 @@ namespace com::sun::star::chart2 { class XChartDocument; }
namespace com::sun::star::chart2 { class XCoordinateSystem; }
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
-
+namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
-
+class ExplicitCategoriesProvider;
+class ScaleAutomatism;
+class ChartModel;
+class Axis;
+class BaseCoordinateSystem;
+class GridProperties;
class VAxisBase;
class VCoordinateSystem
@@ -51,15 +56,14 @@ class VCoordinateSystem
public:
virtual ~VCoordinateSystem();
- static std::unique_ptr<VCoordinateSystem> createCoordinateSystem( const css::uno::Reference<
- css::chart2::XCoordinateSystem >& xCooSysModel );
+ static std::unique_ptr<VCoordinateSystem> createCoordinateSystem( const rtl::Reference<
+ ::chart::BaseCoordinateSystem >& xCooSysModel );
/// @throws css::uno::RuntimeException
void initPlottingTargets(
- const css::uno::Reference< css::drawing::XShapes >& xLogicTarget
- , const css::uno::Reference< css::drawing::XShapes >& xFinalTarget
- , const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory
- , css::uno::Reference< css::drawing::XShapes >& xLogicTargetForSeriesBehindAxis );
+ const rtl::Reference< SvxShapeGroupAnyD >& xLogicTarget
+ , const rtl::Reference< SvxShapeGroupAnyD >& xFinalTarget
+ , rtl::Reference<SvxShapeGroupAnyD>& xLogicTargetForSeriesBehindAxis );
void setParticle( const OUString& rCooSysParticle );
@@ -107,17 +111,19 @@ public:
void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
- const css::uno::Reference< css::chart2::XCoordinateSystem >&
+ const rtl::Reference< ::chart::BaseCoordinateSystem >&
getModel() const { return m_xCooSysModel;}
/**
- * Create "view" axis obejcts 'VAxis' from the coordinate system model.
+ * Create "view" axis objects 'VAxis' from the coordinate system model.
*/
virtual void createVAxisList(
- const css::uno::Reference< css::chart2::XChartDocument> & xChartDoc
- , const css::awt::Size& rFontReferenceSize
- , const css::awt::Rectangle& rMaximumSpaceForLabels
- , bool bLimitSpaceForLabels );
+ const rtl::Reference<::chart::ChartModel> & xChartDoc,
+ const css::awt::Size& rFontReferenceSize,
+ const css::awt::Rectangle& rMaximumSpaceForLabels,
+ bool bLimitSpaceForLabels,
+ std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
+ css::uno::Reference<css::uno::XComponentContext> const& rComponentContext);
virtual void initVAxisInList();
virtual void updateScalesAndIncrementsOnAxes();
@@ -137,39 +143,35 @@ public:
void setSeriesNamesForAxis( const css::uno::Sequence< OUString >& rSeriesNames );
protected: //methods
- VCoordinateSystem( const css::uno::Reference<
- css::chart2::XCoordinateSystem >& xCooSys );
+ VCoordinateSystem( rtl::Reference< ::chart::BaseCoordinateSystem > xCooSys );
- css::uno::Reference< css::chart2::XAxis >
+ rtl::Reference< ::chart::Axis >
getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
- static css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > >
- getGridListFromAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis );
+ static std::vector< rtl::Reference< ::chart::GridProperties > >
+ getGridListFromAxis( const rtl::Reference< ::chart::Axis >& xAxis );
VAxisBase* getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
OUString createCIDForAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
OUString createCIDForGrid( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
- sal_Int32 getNumberFormatKeyForAxis( const css::uno::Reference<
- css::chart2::XAxis >& xAxis
- , const css::uno::Reference<
- css::chart2::XChartDocument>& xChartDoc);
+ sal_Int32 getNumberFormatKeyForAxis( const rtl::Reference< ::chart::Axis >& xAxis
+ , const rtl::Reference<::chart::ChartModel>& xChartDoc);
private: //methods
static void impl_adjustDimension( sal_Int32& rDimensionIndex );
void impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const;
protected: //member
- css::uno::Reference< css::chart2::XCoordinateSystem > m_xCooSysModel;
+ rtl::Reference< ::chart::BaseCoordinateSystem > m_xCooSysModel;
OUString m_aCooSysParticle;
typedef std::pair< sal_Int32, sal_Int32 > tFullAxisIndex; //first index is the dimension, second index is the axis index that indicates whether this is a main or secondary axis
- css::uno::Reference< css::drawing::XShapes > m_xLogicTargetForGrids;
- css::uno::Reference< css::drawing::XShapes > m_xLogicTargetForAxes;
- css::uno::Reference< css::drawing::XShapes > m_xFinalTarget;
- css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory;
+ rtl::Reference<SvxShapeGroupAnyD> m_xLogicTargetForGrids;
+ rtl::Reference<SvxShapeGroupAnyD> m_xLogicTargetForAxes;
+ rtl::Reference<SvxShapeGroupAnyD> m_xFinalTarget;
css::drawing::HomogenMatrix m_aMatrixSceneToScreen;
CuboidPlanePosition m_eLeftWallPos;
@@ -203,6 +205,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx
index 287415c27280..dd5054d26bd8 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -16,15 +16,19 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VDATASERIES_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_VDATASERIES_HXX
+#pragma once
#include "PropertyMapper.hxx"
+#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
-#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
#include <memory>
#include <map>
@@ -33,12 +37,12 @@ namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::chart2 { class XChartType; }
namespace com::sun::star::chart2 { class XDataSeries; }
namespace com::sun::star::chart2::data { class XDataSequence; }
-namespace com::sun::star::chart2 { struct DataPointLabel; }
-namespace com::sun::star::chart2 { struct Symbol; }
namespace com::sun::star::drawing { class XShapes; }
namespace chart
{
+class ChartType;
+class DataSeries;
class VDataSequence
{
@@ -50,22 +54,21 @@ public:
sal_Int32 detectNumberFormatKey( sal_Int32 index ) const;
sal_Int32 getLength() const;
- css::uno::Reference<css::chart2::data::XDataSequence> Model;
-
- mutable css::uno::Sequence<double> Doubles;
+ css::uno::Reference<css::chart2::data::XDataSequence> m_xModel;
+ mutable css::uno::Sequence<double> m_aValues;
};
class VDataSeries final
{
public:
- VDataSeries( const css::uno::Reference<css::chart2::XDataSeries>& xDataSeries );
+ VDataSeries( const rtl::Reference<::chart::DataSeries>& xDataSeries );
~VDataSeries();
VDataSeries(const VDataSeries&) = delete;
const VDataSeries& operator=(const VDataSeries&) = delete;
- const css::uno::Reference<css::chart2::XDataSeries>& getModel() const;
+ const rtl::Reference<::chart::DataSeries>& getModel() const;
void setCategoryXAxis();
void setXValues( const css::uno::Reference<css::chart2::data::XDataSequence>& xValues );
@@ -105,15 +108,16 @@ public:
sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
sal_Int32 getLabelPlacement(
- sal_Int32 nPointIndex, const css::uno::Reference<css::chart2::XChartType>& xChartType,
+ sal_Int32 nPointIndex, const rtl::Reference<::chart::ChartType>& xChartType,
bool bSwapXAndY ) const;
css::awt::Point getLabelPosition( css::awt::Point aTextShapePos, sal_Int32 nPointIndex ) const;
bool isLabelCustomPos( sal_Int32 nPointIndex ) const;
+ css::awt::Size getLabelCustomSize(sal_Int32 nPointIndex) const;
css::uno::Reference<css::beans::XPropertySet> getPropertiesOfPoint( sal_Int32 index ) const;
- css::uno::Reference<css::beans::XPropertySet> getPropertiesOfSeries() const;
+ const css::uno::Reference<css::beans::XPropertySet> & getPropertiesOfSeries() const;
css::chart2::Symbol* getSymbolProperties( sal_Int32 index ) const;
@@ -138,10 +142,10 @@ public:
void setStartingAngle( sal_Int32 nStartingAngle );
sal_Int32 getStartingAngle() const;
- void setRoleOfSequenceForDataLabelNumberFormatDetection( const OUString& rRole );
+ void setRoleOfSequenceForDataLabelNumberFormatDetection( std::u16string_view rRole );
//this is only temporarily here for area chart:
- css::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D;
+ std::vector<std::vector<css::drawing::Position3D>> m_aPolyPolygonShape3D;
sal_Int32 m_nPolygonIndex;
double m_fLogicMinX;
double m_fLogicMaxX;
@@ -181,18 +185,19 @@ private: //methods
VDataSeries();
public: //member
- css::uno::Reference<css::drawing::XShapes> m_xGroupShape;
- css::uno::Reference<css::drawing::XShapes> m_xLabelsGroupShape;
- css::uno::Reference<css::drawing::XShapes> m_xErrorXBarsGroupShape;
- css::uno::Reference<css::drawing::XShapes> m_xErrorYBarsGroupShape;
+ rtl::Reference<SvxShapeGroupAnyD> m_xGroupShape;
+ rtl::Reference<SvxShapeGroup> m_xLabelsGroupShape;
+ rtl::Reference<SvxShapeGroupAnyD> m_xErrorXBarsGroupShape;
+ rtl::Reference<SvxShapeGroupAnyD> m_xErrorYBarsGroupShape;
//the following group shapes will be created as children of m_xGroupShape on demand
//they can be used to assure that some parts of a series shape are always in front of others (e.g. symbols in front of lines)
- css::uno::Reference<css::drawing::XShapes> m_xFrontSubGroupShape;
- css::uno::Reference<css::drawing::XShapes> m_xBackSubGroupShape;
+ rtl::Reference<SvxShapeGroupAnyD> m_xFrontSubGroupShape;
+ rtl::Reference<SvxShapeGroupAnyD> m_xBackSubGroupShape;
private: //member
- css::uno::Reference<css::chart2::XDataSeries> m_xDataSeries;
+ rtl::Reference<::chart::DataSeries> m_xDataSeries;
+ css::uno::Reference<css::beans::XPropertySet> m_xDataSeriesProps; // cached
//all points given by the model data (here are not only the visible points meant)
sal_Int32 m_nPointCount;
@@ -235,20 +240,19 @@ private: //member
sal_Int32 m_nGlobalSeriesIndex;
//some cached values for data labels as they are very expensive
- mutable std::unique_ptr<css::chart2::DataPointLabel>
- m_apLabel_Series;
- mutable std::unique_ptr<tNameSequence> m_apLabelPropNames_Series;
- mutable std::unique_ptr<tAnySequence> m_apLabelPropValues_Series;
- mutable std::unique_ptr<css::chart2::Symbol> m_apSymbolProperties_Series;
-
- mutable std::unique_ptr<css::chart2::DataPointLabel>
- m_apLabel_AttributedPoint;
- mutable std::unique_ptr<tNameSequence> m_apLabelPropNames_AttributedPoint;
- mutable std::unique_ptr<tAnySequence> m_apLabelPropValues_AttributedPoint;
- mutable std::unique_ptr<css::chart2::Symbol> m_apSymbolProperties_AttributedPoint;
- mutable std::unique_ptr<css::chart2::Symbol>
- m_apSymbolProperties_InvisibleSymbolForSelection;
- mutable sal_Int32 m_nCurrentAttributedPoint;
+ mutable std::optional<css::chart2::DataPointLabel>
+ m_oLabel_Series;
+ mutable std::optional<tNameSequence> m_oLabelPropNames_Series;
+ mutable std::optional<tAnySequence> m_oLabelPropValues_Series;
+ mutable std::optional<css::chart2::Symbol> m_oSymbolProperties_Series;
+
+ mutable std::optional<css::chart2::DataPointLabel>
+ m_oLabel_AttributedPoint;
+ mutable std::optional<tNameSequence> m_oLabelPropNames_AttributedPoint;
+ mutable std::optional<tAnySequence> m_oLabelPropValues_AttributedPoint;
+ mutable std::optional<css::chart2::Symbol> m_oSymbolProperties_AttributedPoint;
+ mutable std::optional<css::chart2::Symbol> m_oSymbolProperties_InvisibleSymbolForSelection;
+ mutable sal_Int32 m_nCurrentAttributedPoint;
css::awt::Size m_aReferenceSize;
sal_Int32 m_nMissingValueTreatment;
@@ -260,6 +264,5 @@ private: //member
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/VDiagram.hxx b/chart2/source/view/inc/VDiagram.hxx
index 15ea26434531..ab391f7bc0d3 100644
--- a/chart2/source/view/inc/VDiagram.hxx
+++ b/chart2/source/view/inc/VDiagram.hxx
@@ -16,14 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VDIAGRAM_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_VDIAGRAM_HXX
+#pragma once
-#include <com/sun/star/drawing/XShapes.hpp>
#include <basegfx/range/b2irectangle.hxx>
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/Point.hpp>
+#include <svx/unoshape.hxx>
+#include <rtl/ref.hxx>
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::chart2 { class XDiagram; }
@@ -33,7 +33,7 @@ namespace com::sun::star::drawing { class XShape; }
namespace chart
{
-
+class Diagram;
class ShapeFactory;
/** The VDiagram is responsible to generate the visible parts of the Diagram
@@ -45,27 +45,26 @@ diagram.
class VDiagram final
{
public: //methods
- VDiagram( const css::uno::Reference<css::chart2::XDiagram>& xDiagram,
+ VDiagram( const rtl::Reference<::chart::Diagram>& xDiagram,
const css::drawing::Direction3D& rPreferredAspectRatio,
sal_Int32 nDimension );
~VDiagram();
void init(
- const css::uno::Reference<css::drawing::XShapes>& xTarget,
- const css::uno::Reference<css::lang::XMultiServiceFactory>& xFactory );
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
void createShapes( const css::awt::Point& rPos
, const css::awt::Size& rSize );
- css::uno::Reference< css::drawing::XShapes >
- getCoordinateRegion() const { return css::uno::Reference<css::drawing::XShapes>( m_xCoordinateRegionShape, css::uno::UNO_QUERY );}
+ const rtl::Reference<SvxShapeGroupAnyD> &
+ getCoordinateRegion() const { return m_xCoordinateRegionShape; }
/**
* Get current bounding rectangle for the diagram without axes.
*/
basegfx::B2IRectangle getCurrentRectangle() const;
- void reduceToMimimumSize();
+ void reduceToMinimumSize();
::basegfx::B2IRectangle adjustPosAndSize( const css::awt::Point& rPos
, const css::awt::Size& rAvailableSize );
@@ -86,18 +85,16 @@ private: //methods
private: //members
VDiagram(const VDiagram& rD) = delete;
- css::uno::Reference< css::drawing::XShapes > m_xTarget;
- css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory;
- ShapeFactory* m_pShapeFactory;
+ rtl::Reference<SvxShapeGroupAnyD> m_xTarget;
// this is the surrounding shape which contains floor, wall and coordinate
- css::uno::Reference< css::drawing::XShape > m_xOuterGroupShape;
+ rtl::Reference<SvxShapeGroupAnyD> m_xOuterGroupShape;
// this is an additional inner shape that represents the coordinate region - that is - where to place data points
- css::uno::Reference< css::drawing::XShape > m_xCoordinateRegionShape;
- css::uno::Reference< css::drawing::XShape > m_xWall2D;
+ rtl::Reference<SvxShapeGroupAnyD> m_xCoordinateRegionShape;
+ rtl::Reference<SvxShapeRect> m_xWall2D;
- sal_Int32 m_nDimensionCount;
- css::uno::Reference< css::chart2::XDiagram > m_xDiagram;
+ sal_Int32 m_nDimensionCount;
+ rtl::Reference< ::chart::Diagram > m_xDiagram;
css::drawing::Direction3D m_aPreferredAspectRatio;
css::uno::Reference< css::beans::XPropertySet > m_xAspectRatio3D;
@@ -116,6 +113,5 @@ private: //members
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/VLegendSymbolFactory.hxx b/chart2/source/view/inc/VLegendSymbolFactory.hxx
index 96eb58782ec9..f637a5894912 100644
--- a/chart2/source/view/inc/VLegendSymbolFactory.hxx
+++ b/chart2/source/view/inc/VLegendSymbolFactory.hxx
@@ -16,11 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VLEGENDSYMBOLFACTORY_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_VLEGENDSYMBOLFACTORY_HXX
+#pragma once
#include "LegendEntryProvider.hxx"
#include <com/sun/star/uno/Reference.h>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
namespace com::sun::star::awt { struct Size; }
namespace com::sun::star::beans { class XPropertySet; }
@@ -29,10 +30,7 @@ namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
namespace com::sun::star::uno { class Any; }
-namespace chart
-{
-
-namespace VLegendSymbolFactory
+namespace chart::VLegendSymbolFactory
{
enum class PropertyType
{
@@ -41,20 +39,15 @@ namespace VLegendSymbolFactory
Line,
};
- css::uno::Reference< css::drawing::XShape >
+ rtl::Reference< SvxShapeGroup >
createSymbol(
const css::awt::Size& rEntryKeyAspectRatio,
- const css::uno::Reference< css::drawing::XShapes >& rSymbolContainer,
+ const rtl::Reference<SvxShapeGroupAnyD>& rSymbolContainer,
LegendSymbolStyle eStyle,
- const css::uno::Reference< css::lang::XMultiServiceFactory > & xShapeFactory,
const css::uno::Reference< css::beans::XPropertySet > & xLegendEntryProperties,
PropertyType ePropertyType,
const css::uno::Any& rExplicitSymbol /*should contain a css::chart2::Symbol without automatic symbol if the charttype does support symbols else empty*/);
-}
} // namespace chart
-// INCLUDED_CHART2_SOURCE_VIEW_INC_VLEGENDSYMBOLFACTORY_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/VLineProperties.hxx b/chart2/source/view/inc/VLineProperties.hxx
index a255499fd088..aa1c88ce74f2 100644
--- a/chart2/source/view/inc/VLineProperties.hxx
+++ b/chart2/source/view/inc/VLineProperties.hxx
@@ -17,32 +17,33 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VLINEPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_VLINEPROPERTIES_HXX
+#pragma once
#include <com/sun/star/uno/Any.h>
#include <com/sun/star/uno/Reference.h>
-namespace com::sun::star::beans { class XPropertySet; }
+namespace com::sun::star::beans
+{
+class XPropertySet;
+}
namespace chart
{
-
struct VLineProperties
{
css::uno::Any Color; //type sal_Int32 UNO_NAME_LINECOLOR
css::uno::Any LineStyle; //type drawing::LineStyle for property UNO_NAME_LINESTYLE
- css::uno::Any Transparence;//type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
- css::uno::Any Width;//type sal_Int32 for property UNO_NAME_LINEWIDTH
- css::uno::Any DashName;//type OUString for property "LineDashName"
+ css::uno::Any Transparence; //type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
+ css::uno::Any Width; //type sal_Int32 for property UNO_NAME_LINEWIDTH
+ css::uno::Any DashName; //type OUString for property "LineDashName"
+ css::uno::Any LineCap; //type drawing::LineCap for property UNO_NAME_LINECAP
VLineProperties();
- void initFromPropertySet( const css::uno::Reference< css::beans::XPropertySet >& xProp );
+ void initFromPropertySet(const css::uno::Reference<css::beans::XPropertySet>& xProp);
bool isLineVisible() const;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/VPolarTransformation.hxx b/chart2/source/view/inc/VPolarTransformation.hxx
index af9404ffc1d5..23f3c3b71875 100644
--- a/chart2/source/view/inc/VPolarTransformation.hxx
+++ b/chart2/source/view/inc/VPolarTransformation.hxx
@@ -16,32 +16,24 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VPOLARTRANSFORMATION_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_VPOLARTRANSFORMATION_HXX
+#pragma once
#include "PlottingPositionHelper.hxx"
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/chart2/XTransformation.hpp>
namespace chart
{
-class VPolarTransformation : public ::cppu::WeakImplHelper<
- css::chart2::XTransformation
- >
+class VPolarTransformation final : public XTransformation2
{
public:
VPolarTransformation( const PolarPlottingPositionHelper& rPositionHelper );
virtual ~VPolarTransformation() override;
- // ____ XTransformation ____
- /// @see css::chart2::XTransformation
- virtual css::uno::Sequence< double > SAL_CALL transform(
- const css::uno::Sequence< double >& rSourceValues ) override;
- /// @see css::chart2::XTransformation
- virtual sal_Int32 SAL_CALL getSourceDimension() override;
- /// @see css::chart2::XTransformation
- virtual sal_Int32 SAL_CALL getTargetDimension() override;
+ // ____ XTransformation2 ____
+ virtual css::drawing::Position3D transform(
+ const css::uno::Sequence< double >& rSourceValues ) const override;
+ virtual css::drawing::Position3D transform(
+ const css::drawing::Position3D& rSourceValues ) const override;
private:
PolarPlottingPositionHelper m_aPositionHelper;
@@ -50,7 +42,4 @@ private:
} // namespace chart
-// INCLUDED_CHART2_SOURCE_VIEW_INC_VPOLARTRANSFORMATION_HXX
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
index 17215faae4b5..45676830b538 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VSERIESPLOTTER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_VSERIESPLOTTER_HXX
+#pragma once
#include <memory>
#include "PlotterBase.hxx"
@@ -25,7 +24,10 @@
#include "LabelAlignment.hxx"
#include "MinimumAndMaximumSupplier.hxx"
#include "LegendEntryProvider.hxx"
+#include <basegfx/range/b2irectangle.hxx>
#include <com/sun/star/drawing/Direction3D.hpp>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
namespace com::sun::star::awt { struct Point; }
namespace com::sun::star::chart2 { class XChartType; }
@@ -47,6 +49,7 @@ namespace com::sun::star {
namespace chart {
+class ChartType;
class NumberFormatterWrapper;
class AxesNumberFormats
@@ -83,12 +86,12 @@ public:
sal_Int32 getPointCount() const;
sal_Int32 getAttachedAxisIndexForFirstSeries() const;
- void getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const;
- void getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const;
+ void getMinimumAndMaximumX( double& rfMinimum, double& rfMaximum ) const;
+ void getMinimumAndMaximumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const;
void calculateYMinAndMaxForCategory( sal_Int32 nCategoryIndex
, bool bSeparateStackingForDifferentSigns
- , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex );
+ , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex ) const;
void calculateYMinAndMaxForCategoryRange( sal_Int32 nStartCategoryIndex, sal_Int32 nEndCategoryIndex
, bool bSeparateStackingForDifferentSigns
, double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex );
@@ -171,11 +174,11 @@ public:
virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ) override;
virtual bool isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) override;
- virtual long calculateTimeResolutionOnXAxis() override;
- virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ) override;
+ virtual tools::Long calculateTimeResolutionOnXAxis() override;
+ virtual void setTimeResolutionOnXAxis( tools::Long nTimeResolution, const Date& rNullDate ) override;
- void getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const;
- void getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const;
+ void getMinimumAndMaximumX( double& rfMinimum, double& rfMaximum ) const;
+ void getMinimumAndMaximumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const;
// Methods for handling legends and legend entries.
@@ -184,8 +187,7 @@ public:
const css::awt::Size& rEntryKeyAspectRatio,
css::chart2::LegendPosition eLegendPosition,
const css::uno::Reference< css::beans::XPropertySet >& xTextProperties,
- const css::uno::Reference< css::drawing::XShapes >& xTarget,
- const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const css::uno::Reference< css::uno::XComponentContext >& xContext,
ChartModel& rModel
) override;
@@ -195,32 +197,41 @@ public:
virtual css::uno::Any getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex/*-1 for series symbol*/ );
- css::uno::Reference< css::drawing::XShape > createLegendSymbolForSeries(
+ rtl::Reference<SvxShapeGroup> createLegendSymbolForSeries(
const css::awt::Size& rEntryKeyAspectRatio
, const VDataSeries& rSeries
- , const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
- css::uno::Reference< css::drawing::XShape > createLegendSymbolForPoint(
+ rtl::Reference< SvxShapeGroup > createLegendSymbolForPoint(
const css::awt::Size& rEntryKeyAspectRatio
, const VDataSeries& rSeries
, sal_Int32 nPointIndex
- , const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
std::vector< ViewLegendEntry > createLegendEntriesForSeries(
const css::awt::Size& rEntryKeyAspectRatio,
const VDataSeries& rSeries,
const css::uno::Reference< css::beans::XPropertySet >& xTextProperties,
- const css::uno::Reference< css::drawing::XShapes >& xTarget,
- const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory,
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const css::uno::Reference< css::uno::XComponentContext >& xContext
);
- std::vector< VDataSeries* > getAllSeries();
+ std::vector<ViewLegendSymbol> createSymbols(
+ const css::awt::Size& rEntryKeyAspectRatio
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const css::uno::Reference<css::uno::XComponentContext>& xContext);
+
+ std::vector<ViewLegendSymbol> createSymbolsForSeries(
+ const css::awt::Size& rEntryKeyAspectRatio
+ , const VDataSeries& rSeries
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const css::uno::Reference<css::uno::XComponentContext>& xContext);
+
+ std::vector<VDataSeries*> getAllSeries();
+ std::vector<VDataSeries const*> getAllSeries() const;
// This method creates a series plotter of the requested type; e.g. : return new PieChart...
- static VSeriesPlotter* createSeriesPlotter( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
+ static VSeriesPlotter* createSeriesPlotter( const rtl::Reference< ::chart::ChartType >& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bExcludingPositioning /*for pie and donut charts labels and exploded segments are excluded from the given size*/);
@@ -234,14 +245,20 @@ public:
void setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider );
+ ExplicitCategoriesProvider* getExplicitCategoriesProvider() { return m_pExplicitCategoriesProvider; }
+
//get series names for the z axis labels
- css::uno::Sequence< OUString > getSeriesNames() const;
+ css::uno::Sequence<OUString> getSeriesNames() const;
+
+ //get all series names
+ css::uno::Sequence<OUString> getAllSeriesNames() const;
void setPageReferenceSize( const css::awt::Size & rPageRefSize );
//better performance for big data
void setCoordinateSystemResolution( const css::uno::Sequence< sal_Int32 >& rCoordinateSystemResolution );
bool PointsWereSkipped() const { return m_bPointsWereSkipped;}
void setPieLabelsAllowToMove( bool bIsPieOrDonut ) { m_bPieLabelsAllowToMove = bIsPieOrDonut; };
+ void setAvailableOuterRect( const basegfx::B2IRectangle& aAvailableOuterRect ) { m_aAvailableOuterRect = aAvailableOuterRect; };
//return the depth for a logic 1
double getTransformedDepth() const;
@@ -253,37 +270,44 @@ public:
bool WantToPlotInFrontOfAxisLine();
virtual bool shouldSnapRectToUsedArea();
+ /// This method returns a text string representation of the passed numeric
+ /// value by exploiting a NumberFormatterWrapper object.
+ OUString getLabelTextForValue(VDataSeries const & rDataSeries, sal_Int32 nPointIndex,
+ double fValue, bool bAsPercentage);
+
+ sal_Int32 getRenderOrder() const;
+
protected:
- VSeriesPlotter( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
+ VSeriesPlotter( rtl::Reference< ::chart::ChartType > xChartTypeModel
, sal_Int32 nDimensionCount
, bool bCategoryXAxis=true );
// Methods for group shapes.
- css::uno::Reference< css::drawing::XShapes >
+ rtl::Reference<SvxShapeGroupAnyD>
getSeriesGroupShape( VDataSeries* pDataSeries
- , const css:: uno::Reference< css::drawing::XShapes >& xTarget );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
//the following group shapes will be created as children of SeriesGroupShape on demand
//they can be used to assure that some parts of a series shape are always in front of others (e.g. symbols in front of lines)
//parameter xTarget will be used as parent for the series group shape
- css::uno::Reference< css::drawing::XShapes >
+ rtl::Reference<SvxShapeGroupAnyD>
getSeriesGroupShapeFrontChild( VDataSeries* pDataSeries
- , const css:: uno::Reference< css::drawing::XShapes >& xTarget );
- css::uno::Reference< css::drawing::XShapes >
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
+ rtl::Reference<SvxShapeGroupAnyD>
getSeriesGroupShapeBackChild( VDataSeries* pDataSeries
- , const css:: uno::Reference< css::drawing::XShapes >& xTarget );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
/// This method creates a 2D group shape for containing all text shapes
/// needed for this series; the group is added to the text target;
- css::uno::Reference< css::drawing::XShapes >
+ static rtl::Reference<SvxShapeGroup>
getLabelsGroupShape( VDataSeries& rDataSeries
- , const css:: uno::Reference< css::drawing::XShapes >& xTarget );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
- css::uno::Reference< css::drawing::XShapes >
+ rtl::Reference<SvxShapeGroupAnyD>
getErrorBarsGroupShape( VDataSeries& rDataSeries
- , const css:: uno::Reference< css::drawing::XShapes >& xTarget, bool bYError );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget, bool bYError );
/** This method creates a text shape for a label related to a data point
* and append it to the root text shape group (xTarget).
@@ -310,8 +334,8 @@ protected:
* @return
* a reference to the created text shape.
*/
- css::uno::Reference< css::drawing::XShape >
- createDataLabel( const css::uno::Reference< css::drawing::XShapes >& xTarget
+ rtl::Reference<SvxShapeText>
+ createDataLabel( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, VDataSeries& rDataSeries
, sal_Int32 nPointIndex
, double fValue
@@ -321,13 +345,6 @@ protected:
, sal_Int32 nOffset=0
, sal_Int32 nTextWidth = 0 );
- /// This method returns a text string representation of the passed numeric
- /// value by exploiting a NumberFormatterWrapper object.
- OUString getLabelTextForValue( VDataSeries const & rDataSeries
- , sal_Int32 nPointIndex
- , double fValue
- , bool bAsPercentage );
-
/** creates two T-shaped error bars in both directions (up/down or
left/right depending on the bVertical parameter)
@@ -346,7 +363,7 @@ protected:
for y-error bars this is true, for x-error-bars it is false.
*/
void createErrorBar(
- const css::uno::Reference< css::drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D & rPos
, const css::uno::Reference< css::beans::XPropertySet > & xErrorBarProperties
, const VDataSeries& rVDataSeries
@@ -359,43 +376,37 @@ protected:
const css::drawing::Position3D& rUnscaledLogicPosition
, VDataSeries& rVDataSeries
, sal_Int32 nIndex
- , const css::uno::Reference< css::drawing::XShapes >& rTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& rTarget
, bool bUseXErrorData
, bool bUseYErrorData
);
- void addErrorBorder(
+ static void addErrorBorder(
const css::drawing::Position3D& rPos0
, const css::drawing::Position3D& rPos1
- , const css::uno::Reference< css::drawing::XShapes >& rTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& rTarget
, const css::uno::Reference< css::beans::XPropertySet >& rErrorBorderProp );
void createErrorBar_X( const css::drawing::Position3D& rUnscaledLogicPosition
, VDataSeries& rVDataSeries, sal_Int32 nPointIndex
- , const css::uno::Reference< css::drawing::XShapes >& xTarget );
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget );
void createErrorBar_Y( const css::drawing::Position3D& rUnscaledLogicPosition
, VDataSeries& rVDataSeries, sal_Int32 nPointIndex
- , const css::uno::Reference< css::drawing::XShapes >& xTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, double const * pfScaledLogicX );
void createRegressionCurvesShapes( VDataSeries const & rVDataSeries
- , const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::uno::Reference< css::drawing::XShapes >& xEquationTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xEquationTarget
, bool bMaySkipPointsInRegressionCalculation );
void createRegressionCurveEquationShapes( const OUString & rEquationCID
, const css::uno::Reference< css::beans::XPropertySet > & xEquationProperties
- , const css::uno::Reference< css::drawing::XShapes >& xEquationTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xEquationTarget
, const css::uno::Reference< css::chart2::XRegressionCurveCalculator > & xRegressionCurveCalculator
, css::awt::Point aDefaultPos );
- static void setMappedProperties(
- const css::uno::Reference< css::drawing::XShape >& xTarget
- , const css::uno::Reference< css::beans::XPropertySet >& xSource
- , const tPropertyNameMap& rMap
- , tPropertyNameValueMap const * pOverwriteMap=nullptr );
-
virtual PlottingPositionHelper& getPlottingPositionHelper( sal_Int32 nAxisIndex ) const;//nAxisIndex indicates whether the position belongs to the main axis ( nAxisIndex==0 ) or secondary axis ( nAxisIndex==1 )
VDataSeries* getFirstSeries() const;
@@ -405,13 +416,12 @@ protected:
protected:
PlottingPositionHelper* m_pMainPosHelper;
- css::uno::Reference< css::chart2::XChartType > m_xChartTypeModel;
- css::uno::Reference< css::beans::XPropertySet > m_xChartTypeModelProps;
+ rtl::Reference< ::chart::ChartType > m_xChartTypeModel;
std::vector< std::vector< VDataSeriesGroup > > m_aZSlots;
bool m_bCategoryXAxis;//true->xvalues are indices (this would not be necessary if series for category chart wouldn't have x-values)
- long m_nTimeResolution;
+ tools::Long m_nTimeResolution;
Date m_aNullDate;
std::unique_ptr< NumberFormatterWrapper > m_apNumberFormatterWrapper;
@@ -424,6 +434,8 @@ protected:
css::uno::Sequence< sal_Int32 > m_aCoordinateSystemResolution;
bool m_bPointsWereSkipped;
bool m_bPieLabelsAllowToMove;
+ basegfx::B2IRectangle m_aAvailableOuterRect;
+ css::awt::Size m_aPageReferenceSize;
private:
typedef std::map< sal_Int32 , ExplicitScaleData > tSecondaryValueScales;
@@ -431,10 +443,8 @@ private:
typedef std::map< sal_Int32 , std::unique_ptr<PlottingPositionHelper> > tSecondaryPosHelperMap;
mutable tSecondaryPosHelperMap m_aSecondaryPosHelperMap;
- css::awt::Size m_aPageReferenceSize;
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/ViewDefines.hxx b/chart2/source/view/inc/ViewDefines.hxx
index d191efe484f9..b8b82be956c5 100644
--- a/chart2/source/view/inc/ViewDefines.hxx
+++ b/chart2/source/view/inc/ViewDefines.hxx
@@ -16,23 +16,20 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VIEWDEFINES_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_VIEWDEFINES_HXX
+#pragma once
#include <sal/types.h>
namespace chart
{
-
#define CHART_3DOBJECT_SEGMENTCOUNT (sal_Int32(32))
//There needs to be a little distance between grid lines and walls in 3D, otherwise the lines are partly hidden by the walls
#define GRID_TO_WALL_DISTANCE (1.0)
-const double ZDIRECTION = 1.0;
-const sal_Int32 AXIS2D_TICKLENGTH = 150;//value like in old chart
-const sal_Int32 AXIS2D_TICKLABELSPACING = 100;//value like in old chart
+const double ZDIRECTION = 1.0;
+const sal_Int32 AXIS2D_TICKLENGTH = 150; //value like in old chart
+const sal_Int32 AXIS2D_TICKLABELSPACING = 100; //value like in old chart
-}//end namespace chart
-#endif
+} //end namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/AxisUsage.hxx b/chart2/source/view/main/AxisUsage.hxx
new file mode 100644
index 000000000000..51a32a59b0e1
--- /dev/null
+++ b/chart2/source/view/main/AxisUsage.hxx
@@ -0,0 +1,143 @@
+/* -*- 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 <sal/types.h>
+#include <memory>
+#include <map>
+
+#include <VCoordinateSystem.hxx>
+#include <AxisHelper.hxx>
+#include <ScaleAutomatism.hxx>
+
+namespace chart
+{
+//first index is the dimension, second index is the axis index that indicates whether this is a main or secondary axis
+typedef std::pair<sal_Int32, sal_Int32> tFullAxisIndex;
+typedef std::map<VCoordinateSystem*, tFullAxisIndex> tCoordinateSystemMap;
+
+/** This class handles a collection of coordinate systems and is used for
+ * executing some action on all coordinate systems such as
+ * "prepareAutomaticAxisScaling" and "setExplicitScaleAndIncrement".
+ * Moreover it contains the "aAutoScaling" object that is an instance of
+ * the "ScaleAutomatism" class. The initialization of "aAutoScaling" is
+ * performed in the "SeriesPlotterContainer::initAxisUsageList" method and is
+ * used in the "SeriesPlotterContainer::doAutoScaling" for calculating explicit
+ * scale and increment objects (see "SeriesPlotterContainer::doAutoScaling").
+ */
+class AxisUsage
+{
+public:
+ AxisUsage()
+ : aAutoScaling(AxisHelper::createDefaultScale(), Date(Date::SYSTEM))
+ {
+ }
+
+ void addCoordinateSystem(VCoordinateSystem* pCooSys, sal_Int32 nDimensionIndex,
+ sal_Int32 nAxisIndex)
+ {
+ if (!pCooSys)
+ return;
+
+ tFullAxisIndex aFullAxisIndex(nDimensionIndex, nAxisIndex);
+ tCoordinateSystemMap::const_iterator aFound(aCoordinateSystems.find(pCooSys));
+
+ //use one scale only once for each coordinate system
+ //main axis are preferred over secondary axis
+ //value scales are preferred
+ if (aFound != aCoordinateSystems.end())
+ {
+ sal_Int32 nFoundAxisIndex = aFound->second.second;
+ if (nFoundAxisIndex < nAxisIndex)
+ return;
+ sal_Int32 nFoundDimension = aFound->second.first;
+ if (nFoundDimension == 1)
+ return;
+ if (nFoundDimension < nDimensionIndex)
+ return;
+ }
+ aCoordinateSystems[pCooSys] = std::move(aFullAxisIndex);
+
+ //set maximum scale index
+ auto aIter = aMaxIndexPerDimension.find(nDimensionIndex);
+ if (aIter != aMaxIndexPerDimension.end())
+ {
+ sal_Int32 nCurrentMaxIndex = aIter->second;
+ if (nCurrentMaxIndex < nAxisIndex)
+ aMaxIndexPerDimension[nDimensionIndex] = nAxisIndex;
+ }
+ else
+ aMaxIndexPerDimension[nDimensionIndex] = nAxisIndex;
+ }
+
+ std::vector<VCoordinateSystem*> getCoordinateSystems(sal_Int32 nDimensionIndex,
+ sal_Int32 nAxisIndex)
+ {
+ std::vector<VCoordinateSystem*> aRet;
+
+ for (auto const& coordinateSystem : aCoordinateSystems)
+ {
+ if (coordinateSystem.second.first != nDimensionIndex)
+ continue;
+ if (coordinateSystem.second.second != nAxisIndex)
+ continue;
+ aRet.push_back(coordinateSystem.first);
+ }
+
+ return aRet;
+ }
+
+ sal_Int32 getMaxAxisIndexForDimension(sal_Int32 nDimensionIndex)
+ {
+ sal_Int32 nRet = -1;
+ auto aIter = aMaxIndexPerDimension.find(nDimensionIndex);
+ if (aIter != aMaxIndexPerDimension.end())
+ nRet = aIter->second;
+ return nRet;
+ }
+
+ void prepareAutomaticAxisScaling(ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex,
+ sal_Int32 nAxisIndex)
+ {
+ std::vector<VCoordinateSystem*> aVCooSysList = getCoordinateSystems(nDimIndex, nAxisIndex);
+ for (VCoordinateSystem* pVCoordinateSystem : aVCooSysList)
+ pVCoordinateSystem->prepareAutomaticAxisScaling(rScaleAutomatism, nDimIndex,
+ nAxisIndex);
+ }
+
+ void setExplicitScaleAndIncrement(sal_Int32 nDimIndex, sal_Int32 nAxisIndex,
+ const ExplicitScaleData& rScale,
+ const ExplicitIncrementData& rInc)
+ {
+ std::vector<VCoordinateSystem*> aVCooSysList = getCoordinateSystems(nDimIndex, nAxisIndex);
+ for (VCoordinateSystem* pVCoordinateSystem : aVCooSysList)
+ pVCoordinateSystem->setExplicitScaleAndIncrement(nDimIndex, nAxisIndex, rScale, rInc);
+ }
+
+ ScaleAutomatism aAutoScaling;
+
+private:
+ tCoordinateSystemMap aCoordinateSystems;
+ std::map<sal_Int32, sal_Int32> aMaxIndexPerDimension;
+};
+
+} //end chart2 namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 7e428942f0db..e28bb97f81db 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -19,182 +19,199 @@
#include "ChartItemPool.hxx"
#include <chartview/ChartSfxItemIds.hxx>
+#include <DataSeries.hxx>
+#include <FormattedString.hxx>
+#include <Legend.hxx>
+#include <Axis.hxx>
#include <svx/chrtitem.hxx>
+#include <svx/sdangitm.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svx3ditems.hxx>
#include <svl/intitem.hxx>
+#include <editeng/editeng.hxx>
#include <editeng/brushitem.hxx>
+#include <editeng/eeitem.hxx>
#include <editeng/sizeitem.hxx>
#include <svl/stritem.hxx>
#include <svl/ilstitem.hxx>
+#include <comphelper/processfactory.hxx>
#include <editeng/editids.hrc>
#include <svx/svxids.hrc>
#include <vector>
#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/MovingAverageType.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
namespace chart
{
-ChartItemPool::ChartItemPool():
- SfxItemPool( "ChartItemPool" , SCHATTR_START, SCHATTR_END, nullptr, nullptr ),
- pItemInfos(new SfxItemInfo[SCHATTR_END - SCHATTR_START + 1])
+static ItemInfoPackage& getItemInfoPackageChart()
{
- /**************************************************************************
- * PoolDefaults
- **************************************************************************/
- std::vector<SfxPoolItem*>* ppPoolDefaults = new std::vector<SfxPoolItem*>(SCHATTR_END - SCHATTR_START + 1);
- std::vector<SfxPoolItem*>& rPoolDefaults = *ppPoolDefaults;
- rPoolDefaults[SCHATTR_DATADESCR_SHOW_NUMBER - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_NUMBER);
- rPoolDefaults[SCHATTR_DATADESCR_SHOW_PERCENTAGE- SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_PERCENTAGE);
- rPoolDefaults[SCHATTR_DATADESCR_SHOW_CATEGORY - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_CATEGORY);
- rPoolDefaults[SCHATTR_DATADESCR_SHOW_SYMBOL - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_SYMBOL);
- rPoolDefaults[SCHATTR_DATADESCR_WRAP_TEXT - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_WRAP_TEXT);
- rPoolDefaults[SCHATTR_DATADESCR_SEPARATOR - SCHATTR_START] = new SfxStringItem(SCHATTR_DATADESCR_SEPARATOR," ");
- rPoolDefaults[SCHATTR_DATADESCR_PLACEMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT,0);
- rPoolDefaults[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, std::vector < sal_Int32 >() );
- rPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE);
- rPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_VALUE - SCHATTR_START] = new SfxUInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0);
- rPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_SOURCE - SCHATTR_START] = new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE);
-
- //legend
- rPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SfxInt32Item(SCHATTR_LEGEND_POS, sal_Int32(css::chart2::LegendPosition_LINE_END) );
- rPoolDefaults[SCHATTR_LEGEND_SHOW - SCHATTR_START] = new SfxBoolItem(SCHATTR_LEGEND_SHOW, true);
- rPoolDefaults[SCHATTR_LEGEND_NO_OVERLAY - SCHATTR_START] = new SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, true);
-
- //text
- rPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DEGREES, 0);
- rPoolDefaults[SCHATTR_TEXT_STACKED - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_STACKED,false);
-
- //statistic
- rPoolDefaults[SCHATTR_STAT_AVERAGE - SCHATTR_START] = new SfxBoolItem (SCHATTR_STAT_AVERAGE);
- rPoolDefaults[SCHATTR_STAT_KIND_ERROR - SCHATTR_START] = new SvxChartKindErrorItem (SvxChartKindError::NONE, SCHATTR_STAT_KIND_ERROR);
- rPoolDefaults[SCHATTR_STAT_PERCENT - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_PERCENT);
- rPoolDefaults[SCHATTR_STAT_BIGERROR - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_BIGERROR);
- rPoolDefaults[SCHATTR_STAT_CONSTPLUS - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTPLUS);
- rPoolDefaults[SCHATTR_STAT_CONSTMINUS - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTMINUS);
- rPoolDefaults[SCHATTR_STAT_INDICATE - SCHATTR_START] = new SvxChartIndicateItem (SvxChartIndicate::NONE, SCHATTR_STAT_INDICATE);
- rPoolDefaults[SCHATTR_STAT_RANGE_POS - SCHATTR_START] = new SfxStringItem (SCHATTR_STAT_RANGE_POS, OUString());
- rPoolDefaults[SCHATTR_STAT_RANGE_NEG - SCHATTR_START] = new SfxStringItem (SCHATTR_STAT_RANGE_NEG, OUString());
- rPoolDefaults[SCHATTR_STAT_ERRORBAR_TYPE - SCHATTR_START] = new SfxBoolItem(SCHATTR_STAT_ERRORBAR_TYPE, true);
-
- rPoolDefaults[SCHATTR_STYLE_DEEP - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_DEEP, false);
- rPoolDefaults[SCHATTR_STYLE_3D - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_3D, false);
- rPoolDefaults[SCHATTR_STYLE_VERTICAL - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_VERTICAL, false);
- rPoolDefaults[SCHATTR_STYLE_BASETYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_STYLE_BASETYPE, 0);
- rPoolDefaults[SCHATTR_STYLE_LINES - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_LINES, false);
- rPoolDefaults[SCHATTR_STYLE_PERCENT - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_PERCENT, false);
- rPoolDefaults[SCHATTR_STYLE_STACKED - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_STACKED, false);
- rPoolDefaults[SCHATTR_STYLE_SPLINES - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SPLINES, 0); //Bug: was Bool! test ->Fileformat (touches only 5's)
- rPoolDefaults[SCHATTR_STYLE_SYMBOL - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SYMBOL, 0);
- rPoolDefaults[SCHATTR_STYLE_SHAPE - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SHAPE, 0);
-
- rPoolDefaults[SCHATTR_AXIS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS,2); //2 = Y-Axis!!!
-
- //axis scale
- rPoolDefaults[SCHATTR_AXISTYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXISTYPE, CHART_AXIS_REALNUMBER);
- rPoolDefaults[SCHATTR_AXIS_REVERSE - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_REVERSE,false);
- rPoolDefaults[SCHATTR_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MIN);
- rPoolDefaults[SCHATTR_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MIN);
- rPoolDefaults[SCHATTR_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MAX);
- rPoolDefaults[SCHATTR_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MAX);
- rPoolDefaults[SCHATTR_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN);
- rPoolDefaults[SCHATTR_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN);
- rPoolDefaults[SCHATTR_AXIS_MAIN_TIME_UNIT - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,2);
- rPoolDefaults[SCHATTR_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP);
- rPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_STEP_HELP,0);
- rPoolDefaults[SCHATTR_AXIS_HELP_TIME_UNIT - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,2);
- rPoolDefaults[SCHATTR_AXIS_AUTO_TIME_RESOLUTION - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION);
- rPoolDefaults[SCHATTR_AXIS_TIME_RESOLUTION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,2);
- rPoolDefaults[SCHATTR_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LOGARITHM);
- rPoolDefaults[SCHATTR_AXIS_AUTO_DATEAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS);
- rPoolDefaults[SCHATTR_AXIS_ALLOW_DATEAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_ALLOW_DATEAXIS);
- rPoolDefaults[SCHATTR_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN);
- rPoolDefaults[SCHATTR_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN);
-
- //axis position
- rPoolDefaults[SCHATTR_AXIS_TICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_TICKS,CHAXIS_MARK_OUTER);
- rPoolDefaults[SCHATTR_AXIS_HELPTICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELPTICKS,0);
- rPoolDefaults[SCHATTR_AXIS_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_POSITION,0);
- rPoolDefaults[SCHATTR_AXIS_POSITION_VALUE - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_POSITION_VALUE);
- rPoolDefaults[SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT,0);
- rPoolDefaults[SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION,false);
- rPoolDefaults[SCHATTR_AXIS_LABEL_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_LABEL_POSITION,0);
- rPoolDefaults[SCHATTR_AXIS_MARK_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_MARK_POSITION,0);
-
- //axis label
- rPoolDefaults[SCHATTR_AXIS_SHOWDESCR - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,false);
- rPoolDefaults[SCHATTR_AXIS_LABEL_ORDER - SCHATTR_START] = new SvxChartTextOrderItem(SvxChartTextOrder::SideBySide, SCHATTR_AXIS_LABEL_ORDER);
- rPoolDefaults[SCHATTR_AXIS_LABEL_OVERLAP - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LABEL_OVERLAP,false);
- rPoolDefaults[SCHATTR_AXIS_LABEL_BREAK - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LABEL_BREAK, false );
-
- rPoolDefaults[SCHATTR_SYMBOL_BRUSH - SCHATTR_START] = new SvxBrushItem(SCHATTR_SYMBOL_BRUSH);
- rPoolDefaults[SCHATTR_STOCK_VOLUME - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_VOLUME,false);
- rPoolDefaults[SCHATTR_STOCK_UPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_UPDOWN,false);
- rPoolDefaults[SCHATTR_SYMBOL_SIZE - SCHATTR_START] = new SvxSizeItem(SCHATTR_SYMBOL_SIZE,Size(0,0));
- rPoolDefaults[SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY - SCHATTR_START] = new SfxBoolItem(SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, false);
-
- // new for New Chart
- rPoolDefaults[SCHATTR_BAR_OVERLAP - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_OVERLAP,0);
- rPoolDefaults[SCHATTR_BAR_GAPWIDTH - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_GAPWIDTH,0);
- rPoolDefaults[SCHATTR_BAR_CONNECT - SCHATTR_START] = new SfxBoolItem(SCHATTR_BAR_CONNECT, false);
- rPoolDefaults[SCHATTR_NUM_OF_LINES_FOR_BAR - SCHATTR_START] = new SfxInt32Item( SCHATTR_NUM_OF_LINES_FOR_BAR, 0 );
- rPoolDefaults[SCHATTR_SPLINE_ORDER - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_ORDER, 3 );
- rPoolDefaults[SCHATTR_SPLINE_RESOLUTION - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_RESOLUTION, 20 );
- rPoolDefaults[SCHATTR_GROUP_BARS_PER_AXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, false);
- rPoolDefaults[SCHATTR_STARTING_ANGLE - SCHATTR_START] = new SfxInt32Item( SCHATTR_STARTING_ANGLE, 90 );
- rPoolDefaults[SCHATTR_CLOCKWISE - SCHATTR_START] = new SfxBoolItem( SCHATTR_CLOCKWISE, false );
-
- rPoolDefaults[SCHATTR_MISSING_VALUE_TREATMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT, 0);
- rPoolDefaults[SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, std::vector < sal_Int32 >() );
- rPoolDefaults[SCHATTR_INCLUDE_HIDDEN_CELLS - SCHATTR_START] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, true);
- rPoolDefaults[SCHATTR_HIDE_LEGEND_ENTRY - SCHATTR_START] = new SfxBoolItem(SCHATTR_HIDE_LEGEND_ENTRY, false);
-
- rPoolDefaults[SCHATTR_AXIS_FOR_ALL_SERIES - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_FOR_ALL_SERIES, 0);
-
- rPoolDefaults[SCHATTR_REGRESSION_TYPE - SCHATTR_START] = new SvxChartRegressItem (SvxChartRegress::NONE, SCHATTR_REGRESSION_TYPE);
- rPoolDefaults[SCHATTR_REGRESSION_SHOW_EQUATION - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_EQUATION, false);
- rPoolDefaults[SCHATTR_REGRESSION_SHOW_COEFF - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_COEFF, false);
- rPoolDefaults[SCHATTR_REGRESSION_DEGREE - SCHATTR_START] = new SfxInt32Item(SCHATTR_REGRESSION_DEGREE, 2);
- rPoolDefaults[SCHATTR_REGRESSION_PERIOD - SCHATTR_START] = new SfxInt32Item(SCHATTR_REGRESSION_PERIOD, 2);
- rPoolDefaults[SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD);
- rPoolDefaults[SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD);
- rPoolDefaults[SCHATTR_REGRESSION_SET_INTERCEPT - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SET_INTERCEPT, false);
- rPoolDefaults[SCHATTR_REGRESSION_INTERCEPT_VALUE - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_INTERCEPT_VALUE);
- rPoolDefaults[SCHATTR_REGRESSION_CURVE_NAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_CURVE_NAME, OUString());
- rPoolDefaults[SCHATTR_REGRESSION_XNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_XNAME, "x");
- rPoolDefaults[SCHATTR_REGRESSION_YNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_YNAME, "f(x)");
-
- /**************************************************************************
- * ItemInfos
- **************************************************************************/
- const sal_uInt16 nMax = SCHATTR_END - SCHATTR_START + 1;
- for( sal_uInt16 i = 0; i < nMax; i++ )
+ class ItemInfoPackageChart : public ItemInfoPackage
{
- pItemInfos[i]._nSID = 0;
- pItemInfos[i]._bPoolable = true;
- }
-
- // slot ids differing from which ids
- pItemInfos[SCHATTR_SYMBOL_BRUSH - SCHATTR_START]._nSID = SID_ATTR_BRUSH;
- pItemInfos[SCHATTR_STYLE_SYMBOL - SCHATTR_START]._nSID = SID_ATTR_SYMBOLTYPE;
- pItemInfos[SCHATTR_SYMBOL_SIZE - SCHATTR_START]._nSID = SID_ATTR_SYMBOLSIZE;
+ typedef std::array<ItemInfoStatic, SCHATTR_END - SCHATTR_START + 1> ItemInfoArrayChart;
+ ItemInfoArrayChart maItemInfos {{
+ // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
+ { SCHATTR_DATADESCR_SHOW_NUMBER, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_NUMBER), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_SHOW_PERCENTAGE, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_PERCENTAGE), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_SHOW_CATEGORY, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_CATEGORY), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_SHOW_SYMBOL, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_SYMBOL), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_WRAP_TEXT, new SfxBoolItem(SCHATTR_DATADESCR_WRAP_TEXT), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_SEPARATOR, new SfxStringItem(SCHATTR_DATADESCR_SEPARATOR," "), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_PLACEMENT, new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT,0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, std::vector < sal_Int32 >() ), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_NO_PERCENTVALUE, new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, new SfxBoolItem(SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_PERCENT_NUMBERFORMAT_VALUE, new SfxUInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME), 0, SFX_ITEMINFOFLAG_NONE },
+
+ //legend
+ { SCHATTR_LEGEND_POS, new SfxInt32Item(SCHATTR_LEGEND_POS, sal_Int32(css::chart2::LegendPosition_LINE_END) ), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_LEGEND_SHOW, new SfxBoolItem(SCHATTR_LEGEND_SHOW, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_LEGEND_NO_OVERLAY, new SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, true), 0, SFX_ITEMINFOFLAG_NONE },
+
+ //text
+ { SCHATTR_TEXT_DEGREES, new SdrAngleItem(SCHATTR_TEXT_DEGREES, 0_deg100), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_TEXT_STACKED, new SfxBoolItem(SCHATTR_TEXT_STACKED,false), 0, SFX_ITEMINFOFLAG_NONE },
+
+ //statistic
+ { SCHATTR_STAT_AVERAGE, new SfxBoolItem (SCHATTR_STAT_AVERAGE), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_KIND_ERROR, new SvxChartKindErrorItem (SvxChartKindError::NONE, SCHATTR_STAT_KIND_ERROR), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_PERCENT, new SvxDoubleItem (0.0, SCHATTR_STAT_PERCENT), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_BIGERROR, new SvxDoubleItem (0.0, SCHATTR_STAT_BIGERROR), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_CONSTPLUS, new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTPLUS), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_CONSTMINUS, new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTMINUS), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_INDICATE, new SvxChartIndicateItem (SvxChartIndicate::NONE, SCHATTR_STAT_INDICATE), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_RANGE_POS, new SfxStringItem (SCHATTR_STAT_RANGE_POS, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_RANGE_NEG, new SfxStringItem (SCHATTR_STAT_RANGE_NEG, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STAT_ERRORBAR_TYPE, new SfxBoolItem(SCHATTR_STAT_ERRORBAR_TYPE, true), 0, SFX_ITEMINFOFLAG_NONE },
+
+ { SCHATTR_STYLE_DEEP, new SfxBoolItem (SCHATTR_STYLE_DEEP, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_3D, new SfxBoolItem (SCHATTR_STYLE_3D, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_VERTICAL, new SfxBoolItem (SCHATTR_STYLE_VERTICAL, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_BASETYPE, new SfxInt32Item(SCHATTR_STYLE_BASETYPE, 0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_LINES, new SfxBoolItem (SCHATTR_STYLE_LINES, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_PERCENT, new SfxBoolItem (SCHATTR_STYLE_PERCENT, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_STACKED, new SfxBoolItem (SCHATTR_STYLE_STACKED, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_SPLINES, new SfxInt32Item (SCHATTR_STYLE_SPLINES, 0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_SYMBOL, new SfxInt32Item (SCHATTR_STYLE_SYMBOL, 0), SID_ATTR_SYMBOLTYPE, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STYLE_SHAPE, new SfxInt32Item (SCHATTR_STYLE_SHAPE, 0), 0, SFX_ITEMINFOFLAG_NONE },
+
+ { SCHATTR_AXIS, new SfxInt32Item(SCHATTR_AXIS,2), 0, SFX_ITEMINFOFLAG_NONE },
+
+ //axis scale
+ { SCHATTR_AXISTYPE, new SfxInt32Item(SCHATTR_AXISTYPE, CHART_AXIS_REALNUMBER), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_REVERSE, new SfxBoolItem(SCHATTR_AXIS_REVERSE,false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_AUTO_MIN, new SfxBoolItem(SCHATTR_AXIS_AUTO_MIN), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_MIN, new SvxDoubleItem(0.0, SCHATTR_AXIS_MIN), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_AUTO_MAX, new SfxBoolItem(SCHATTR_AXIS_AUTO_MAX), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_MAX, new SvxDoubleItem(0.0, SCHATTR_AXIS_MAX), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_AUTO_STEP_MAIN, new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_STEP_MAIN, new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_MAIN_TIME_UNIT, new SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,2), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_AUTO_STEP_HELP, new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_STEP_HELP, new SfxInt32Item(SCHATTR_AXIS_STEP_HELP,0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_HELP_TIME_UNIT, new SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,2), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_AUTO_TIME_RESOLUTION, new SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_TIME_RESOLUTION, new SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,2), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_LOGARITHM, new SfxBoolItem(SCHATTR_AXIS_LOGARITHM), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_AUTO_DATEAXIS, new SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_ALLOW_DATEAXIS, new SfxBoolItem(SCHATTR_AXIS_ALLOW_DATEAXIS), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_AUTO_ORIGIN, new SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_ORIGIN, new SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN), 0, SFX_ITEMINFOFLAG_NONE },
+
+ //axis position
+ { SCHATTR_AXIS_TICKS, new SfxInt32Item(SCHATTR_AXIS_TICKS,CHAXIS_MARK_OUTER), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_HELPTICKS, new SfxInt32Item(SCHATTR_AXIS_HELPTICKS,0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_POSITION, new SfxInt32Item(SCHATTR_AXIS_POSITION,0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_POSITION_VALUE, new SvxDoubleItem(0.0, SCHATTR_AXIS_POSITION_VALUE), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, new SfxUInt32Item(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT,0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION, new SfxBoolItem(SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION,false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_LABEL_POSITION, new SfxInt32Item(SCHATTR_AXIS_LABEL_POSITION,0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_MARK_POSITION, new SfxInt32Item(SCHATTR_AXIS_MARK_POSITION,0), 0, SFX_ITEMINFOFLAG_NONE },
+
+ //axis label
+ { SCHATTR_AXIS_SHOWDESCR, new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_LABEL_ORDER, new SvxChartTextOrderItem(SvxChartTextOrder::SideBySide, SCHATTR_AXIS_LABEL_ORDER), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_LABEL_OVERLAP, new SfxBoolItem(SCHATTR_AXIS_LABEL_OVERLAP,false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AXIS_LABEL_BREAK, new SfxBoolItem(SCHATTR_AXIS_LABEL_BREAK, false ), 0, SFX_ITEMINFOFLAG_NONE },
+
+ { SCHATTR_SYMBOL_BRUSH, new SvxBrushItem(SCHATTR_SYMBOL_BRUSH), SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STOCK_VOLUME, new SfxBoolItem(SCHATTR_STOCK_VOLUME,false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STOCK_UPDOWN, new SfxBoolItem(SCHATTR_STOCK_UPDOWN,false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_SYMBOL_SIZE, new SvxSizeItem(SCHATTR_SYMBOL_SIZE,Size(0,0)), SID_ATTR_SYMBOLSIZE, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, new SfxBoolItem(SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, false), 0, SFX_ITEMINFOFLAG_NONE },
+
+ // new for New Chart
+ { SCHATTR_BAR_OVERLAP, new SfxInt32Item(SCHATTR_BAR_OVERLAP,0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_BAR_GAPWIDTH, new SfxInt32Item(SCHATTR_BAR_GAPWIDTH,0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_BAR_CONNECT, new SfxBoolItem(SCHATTR_BAR_CONNECT, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_NUM_OF_LINES_FOR_BAR, new SfxInt32Item( SCHATTR_NUM_OF_LINES_FOR_BAR, 0 ), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_SPLINE_ORDER, new SfxInt32Item( SCHATTR_SPLINE_ORDER, 3 ), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_SPLINE_RESOLUTION, new SfxInt32Item( SCHATTR_SPLINE_RESOLUTION, 20 ), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_GROUP_BARS_PER_AXIS, new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_STARTING_ANGLE, new SdrAngleItem( SCHATTR_STARTING_ANGLE, 9000_deg100 ), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_CLOCKWISE, new SfxBoolItem( SCHATTR_CLOCKWISE, false ), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_MISSING_VALUE_TREATMENT, new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT, 0), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, new SfxIntegerListItem(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, std::vector < sal_Int32 >() ), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_INCLUDE_HIDDEN_CELLS, new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, true), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_HIDE_LEGEND_ENTRY, new SfxBoolItem(SCHATTR_HIDE_LEGEND_ENTRY, false), 0, SFX_ITEMINFOFLAG_NONE },
+
+ { SCHATTR_AXIS_FOR_ALL_SERIES, new SfxInt32Item(SCHATTR_AXIS_FOR_ALL_SERIES, 0), 0, SFX_ITEMINFOFLAG_NONE },
+
+ { SCHATTR_REGRESSION_TYPE, new SvxChartRegressItem (SvxChartRegress::NONE, SCHATTR_REGRESSION_TYPE), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_SHOW_EQUATION, new SfxBoolItem(SCHATTR_REGRESSION_SHOW_EQUATION, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_SHOW_COEFF, new SfxBoolItem(SCHATTR_REGRESSION_SHOW_COEFF, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_DEGREE, new SfxInt32Item(SCHATTR_REGRESSION_DEGREE, 2), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_PERIOD, new SfxInt32Item(SCHATTR_REGRESSION_PERIOD, 2), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD, new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD, new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_SET_INTERCEPT, new SfxBoolItem(SCHATTR_REGRESSION_SET_INTERCEPT, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_INTERCEPT_VALUE, new SvxDoubleItem(0.0, SCHATTR_REGRESSION_INTERCEPT_VALUE), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_CURVE_NAME, new SfxStringItem(SCHATTR_REGRESSION_CURVE_NAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_XNAME, new SfxStringItem(SCHATTR_REGRESSION_XNAME, "x"), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_YNAME, new SfxStringItem(SCHATTR_REGRESSION_YNAME, "f(x)"), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_REGRESSION_MOVING_TYPE, new SfxInt32Item(SCHATTR_REGRESSION_MOVING_TYPE, css::chart2::MovingAverageType::Prior), 0, SFX_ITEMINFOFLAG_NONE },
+
+ { SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, new SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATA_TABLE_VERTICAL_BORDER, new SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATA_TABLE_OUTLINE, new SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, false), 0, SFX_ITEMINFOFLAG_NONE },
+ { SCHATTR_DATA_TABLE_KEYS, new SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, false), 0, SFX_ITEMINFOFLAG_NONE }
+ }};
+
+ virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
+
+ public:
+ virtual size_t size() const override { return maItemInfos.size(); }
+ virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; }
+ };
+
+ static std::unique_ptr<ItemInfoPackageChart> g_aItemInfoPackageChart;
+ if (!g_aItemInfoPackageChart)
+ g_aItemInfoPackageChart.reset(new ItemInfoPackageChart);
+ return *g_aItemInfoPackageChart;
+}
- SetDefaults(ppPoolDefaults);
- SetItemInfos(pItemInfos.get());
+ChartItemPool::ChartItemPool()
+: SfxItemPool("ChartItemPool")
+{
+ registerItemInfoPackage(getItemInfoPackageChart());
}
-ChartItemPool::ChartItemPool(const ChartItemPool& rPool):
- SfxItemPool(rPool)
+ChartItemPool::ChartItemPool(const ChartItemPool& rPool)
+: SfxItemPool(rPool)
{
}
ChartItemPool::~ChartItemPool()
{
- Delete();
- // release and delete static pool default items
- ReleaseDefaults(true);
+ sendShutdownHint();
}
-SfxItemPool* ChartItemPool::Clone() const
+rtl::Reference<SfxItemPool> ChartItemPool::Clone() const
{
return new ChartItemPool(*this);
}
@@ -204,8 +221,21 @@ MapUnit ChartItemPool::GetMetric(sal_uInt16 /* nWhich */) const
return MapUnit::Map100thMM;
}
-SfxItemPool* ChartItemPool::CreateChartItemPool()
+rtl::Reference<SfxItemPool> ChartItemPool::CreateChartItemPool()
{
+ // There are various default values which want to call
+ // OutputDevice::GetDefaultFont. Unfortunately, when processing
+ // UNO methods which may get called from out of process, this
+ // happens on a thread that does not take the SolarMutex, which
+ // causes trouble in ImplFontCache.
+ // Trying to take the SolarMutex when initialising these default
+ // leads to ABBA deadlocks.
+ // So rather just trigger the initialisation of these things here.
+ StaticDataSeriesDefaults();
+ StaticAxisDefaults();
+ StaticLegendDefaults();
+ StaticFormattedStringDefaults();
+
return new ChartItemPool();
}
diff --git a/chart2/source/view/main/ChartItemPool.hxx b/chart2/source/view/main/ChartItemPool.hxx
index b311b3050aa7..558ab3c6e2fc 100644
--- a/chart2/source/view/main/ChartItemPool.hxx
+++ b/chart2/source/view/main/ChartItemPool.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_CHARTITEMPOOL_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_MAIN_CHARTITEMPOOL_HXX
+#pragma once
#include <tools/mapunit.hxx>
#include <svl/itempool.hxx>
@@ -27,26 +26,20 @@ namespace chart
{
class ChartItemPool : public SfxItemPool
{
-private:
- std::unique_ptr<SfxItemInfo[]> pItemInfos;
-
public:
ChartItemPool();
ChartItemPool(const ChartItemPool& rPool);
-protected:
virtual ~ChartItemPool() override;
-public:
- virtual SfxItemPool* Clone() const override;
- MapUnit GetMetric( sal_uInt16 nWhich ) const override;
+ virtual rtl::Reference<SfxItemPool> Clone() const override;
+ MapUnit GetMetric(sal_uInt16 nWhich) const override;
/// creates a pure chart item pool
- static SfxItemPool* CreateChartItemPool();
+ static rtl::Reference<SfxItemPool> CreateChartItemPool();
};
} // namespace chart
-#endif
// INCLUDED_CHART2_SOURCE_VIEW_MAIN_CHARTITEMPOOL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index a70738adb906..dc09a83f810a 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -19,17 +19,24 @@
#include <config_feature_desktop.h>
+#include "SeriesPlotterContainer.hxx"
+
#include <ChartView.hxx>
#include <chartview/DrawModelWrapper.hxx>
+#include <Diagram.hxx>
+#include <ChartType.hxx>
+#include <DataSeries.hxx>
#include <NumberFormatterWrapper.hxx>
#include <VDiagram.hxx>
#include "VTitle.hxx"
#include "VButton.hxx"
#include <ShapeFactory.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <VCoordinateSystem.hxx>
#include <VSeriesPlotter.hxx>
#include <CommonConverters.hxx>
#include <TitleHelper.hxx>
+#include <Legend.hxx>
#include <LegendHelper.hxx>
#include "VLegend.hxx"
#include <PropertyMapper.hxx>
@@ -40,17 +47,22 @@
#include <DiagramHelper.hxx>
#include <RelativePositionHelper.hxx>
#include <servicenames.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
+#include "AxisUsage.hxx"
#include <AxisIndexDefines.hxx>
#include <BaseGFXHelper.hxx>
#include <DataSeriesHelper.hxx>
#include <DateHelper.hxx>
#include <ExplicitCategoriesProvider.hxx>
#include <defines.hxx>
+#include <comphelper/dumpxmltostring.hxx>
#include <unonames.hxx>
#include <editeng/frmdiritem.hxx>
+#include <editeng/eeitem.hxx>
#include <tools/globname.hxx>
#include <comphelper/fileformat.h>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/scopeguard.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -58,29 +70,25 @@
#include <unotools/streamwrap.hxx>
#include <svx/svdpage.hxx>
#include <svx/unopage.hxx>
-#include <svx/unoshape.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#include <svx/unofill.hxx>
#include <drawinglayer/XShapeDumper.hxx>
+#include <sfx2/objsh.hxx>
#include <time.h>
-#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/chart/ChartAxisPosition.hpp>
#include <com/sun/star/chart/TimeUnit.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
#include <com/sun/star/chart2/data/XPivotTableDataProvider.hpp>
#include <com/sun/star/chart2/data/PivotTableFieldEntry.hpp>
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
-#include <com/sun/star/drawing/XShapeGroup.hpp>
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
@@ -92,910 +100,26 @@
#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <svl/itempool.hxx>
-#include <svl/languageoptions.hxx>
+#include <svl/ctloptions.hxx>
#include <comphelper/classids.hxx>
#include <servicenames_charttypes.hxx>
#include <rtl/ustring.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/stream.hxx>
#include <memory>
#include <libxml/xmlwriter.h>
-namespace com::sun::star::chart2 { class XChartDocument; }
namespace chart {
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Any;
-namespace {
-
-class theExplicitValueProviderUnoTunnelId : public rtl::Static<UnoTunnelIdInit, theExplicitValueProviderUnoTunnelId> {};
-
-typedef std::pair< sal_Int32, sal_Int32 > tFullAxisIndex; //first index is the dimension, second index is the axis index that indicates whether this is a main or secondary axis
-typedef std::map< VCoordinateSystem*, tFullAxisIndex > tCoordinateSystemMap;
-
-/** This class handles a collection of coordinate systems and is used for
- * executing some action on all coordinate systems such as
- * `prepareAutomaticAxisScaling` and `setExplicitScaleAndIncrement`.
- * Moreover it contains the `aAutoScaling` object that is an instance of
- * the `ScaleAutomatism` class. The initialization of `aAutoScaling` is
- * performed in the `SeriesPlotterContainer::initAxisUsageList` method and is
- * used in the `SeriesPlotterContainer::doAutoScaling` for calculating explicit
- * scale and increment objects (see `SeriesPlotterContainer::doAutoScaling`).
- */
-struct AxisUsage
-{
- AxisUsage();
- ~AxisUsage();
-
- void addCoordinateSystem( VCoordinateSystem* pCooSys, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
- std::vector< VCoordinateSystem* > getCoordinateSystems( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
- sal_Int32 getMaxAxisIndexForDimension( sal_Int32 nDimensionIndex );
-
- void prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
- void setExplicitScaleAndIncrement( sal_Int32 nDimIndex, sal_Int32 nAxisIndex, const ExplicitScaleData& rScale, const ExplicitIncrementData& rInc );
-
- ScaleAutomatism aAutoScaling;
-
-private:
- tCoordinateSystemMap aCoordinateSystems;
- std::map< sal_Int32, sal_Int32 > aMaxIndexPerDimension;
-};
-
-AxisUsage::AxisUsage()
- : aAutoScaling(AxisHelper::createDefaultScale(), Date(Date::SYSTEM))
-{
-}
-
-AxisUsage::~AxisUsage()
-{
- aCoordinateSystems.clear();
-}
-
-void AxisUsage::addCoordinateSystem( VCoordinateSystem* pCooSys, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
-{
- if(!pCooSys)
- return;
-
- tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
- tCoordinateSystemMap::const_iterator aFound( aCoordinateSystems.find(pCooSys) );
-
- //use one scale only once for each coordinate system
- //main axis are preferred over secondary axis
- //value scales are preferred
- if(aFound!=aCoordinateSystems.end())
- {
- sal_Int32 nFoundAxisIndex = aFound->second.second;
- if( nFoundAxisIndex < nAxisIndex )
- return;
- sal_Int32 nFoundDimension = aFound->second.first;
- if( nFoundDimension ==1 )
- return;
- if( nFoundDimension < nDimensionIndex )
- return;
- }
- aCoordinateSystems[pCooSys] = aFullAxisIndex;
-
- //set maximum scale index
- std::map< sal_Int32, sal_Int32 >::const_iterator aIter = aMaxIndexPerDimension.find(nDimensionIndex);
- if( aIter != aMaxIndexPerDimension.end() )
- {
- sal_Int32 nCurrentMaxIndex = aIter->second;
- if( nCurrentMaxIndex < nAxisIndex )
- aMaxIndexPerDimension[nDimensionIndex]=nAxisIndex;
- }
- else
- aMaxIndexPerDimension[nDimensionIndex]=nAxisIndex;
-}
-
-std::vector< VCoordinateSystem* > AxisUsage::getCoordinateSystems( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
-{
- std::vector< VCoordinateSystem* > aRet;
-
- for (auto const& coordinateSystem : aCoordinateSystems)
- {
- if( coordinateSystem.second.first != nDimensionIndex )
- continue;
- if( coordinateSystem.second.second != nAxisIndex )
- continue;
- aRet.push_back( coordinateSystem.first );
- }
-
- return aRet;
-}
-
-sal_Int32 AxisUsage::getMaxAxisIndexForDimension( sal_Int32 nDimensionIndex )
-{
- sal_Int32 nRet = -1;
- std::map< sal_Int32, sal_Int32 >::const_iterator aIter = aMaxIndexPerDimension.find(nDimensionIndex);
- if( aIter != aMaxIndexPerDimension.end() )
- nRet = aIter->second;
- return nRet;
-}
-
-void AxisUsage::prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
-{
- std::vector<VCoordinateSystem*> aVCooSysList = getCoordinateSystems(nDimIndex, nAxisIndex);
- for (VCoordinateSystem * i : aVCooSysList)
- i->prepareAutomaticAxisScaling(rScaleAutomatism, nDimIndex, nAxisIndex);
-}
-
-void AxisUsage::setExplicitScaleAndIncrement(
- sal_Int32 nDimIndex, sal_Int32 nAxisIndex, const ExplicitScaleData& rScale, const ExplicitIncrementData& rInc )
-{
- std::vector<VCoordinateSystem*> aVCooSysList = getCoordinateSystems(nDimIndex, nAxisIndex);
- for (VCoordinateSystem* i : aVCooSysList)
- i->setExplicitScaleAndIncrement(nDimIndex, nAxisIndex, rScale, rInc);
-}
-
-typedef std::vector<std::unique_ptr<VSeriesPlotter> > SeriesPlottersType;
-
-/** This class is a container of `SeriesPlotter` objects (such as `PieChart`
- * instances). It is used for initializing coordinate systems, axes and scales
- * of all series plotters which belongs to the container.
- */
-class SeriesPlotterContainer
-{
-public:
- explicit SeriesPlotterContainer( std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList );
- ~SeriesPlotterContainer();
-
- /** It is used to set coordinate systems (`m_rVCooSysList`), this method
- * is invoked by `ChartView::createShapes2D` before of
- * `ChartView::impl_createDiagramAndContent`.
- * Coordinate systems are retrieved through the `XCoordinateSystemContainer`
- * interface implemented by a diagram object which is provided by the
- * `ChartModel` object passed to the method (`rChartModel.getFirstDiagram()`).
- *
- * It is used for creating series plotters and appending them
- * to `m_aSeriesPlotterList`. The created series plotters are initialized
- * through data (number formats supplier, color scheme, data series),
- * extracted from the chart model or the diagram objects. An exception is
- * the explicit category provider that is retrieved through the
- * `VCoordinateSystem` object used by the series plotter.
- *
- * It sets the minimum-maximum supplier for a coordinate system:
- * this supplier is the series plotter itself which utilizes the given
- * coordinate system. In fact `VSeriesPlotter` has `MinimumMaximumSupplier`
- * as one of its base classes.
- * Hence, for instance, a `PieChart`, which is a series plotter, is
- * a `MinimumMaximumSupplier`, too.
- */
- void initializeCooSysAndSeriesPlotter( ChartModel& rModel );
-
- /** This method is invoked by `ChartView::impl_createDiagramAndContent`.
- * It iterates on every axis of every coordinate systems, and if the axis
- * is not yet present in `m_aAxisUsageList` it creates a new `AxisUsage`
- * object and initialize its `aAutoScaling` member to the `ScaleData`
- * object of the current axis.
- */
- void initAxisUsageList(const Date& rNullDate);
-
- /**
- * Perform automatic axis scaling and determine the amount and spacing of
- * increments. It assumes that the caller has determined the size of the
- * largest axis label text object prior to calling this method.
- *
- * The new axis scaling data will be stored in the VCoordinateSystem
- * objects. The label alignment direction for each axis will also get
- * determined during this process, and stored in VAxis.
- *
- * This method is invoked by `ChartView::impl_createDiagramAndContent`
- * soon after `initAxisUsageList`.
- * It initializes explicit scale and increment objects for all coordinate
- * systems in `m_rVCooSysList`.
- * This action is achieved by iterating on the `m_aAxisUsageList` container,
- * and performing 3 steps:
- * 1- call `VCoordinateSystem::prepareAutomaticAxisScaling` for setting
- * scaling parameters of the `aAutoScaling` member (a `ScaleAutomatism`
- * object) for the current `AxisUsage` instance
- * (see `VCoordinateSystem::prepareAutomaticAxisScaling`);
- * 2- calculate the explicit scale and increment objects
- * (see ScaleAutomatism::calculateExplicitScaleAndIncrement);
- * 3- set the explicit scale and increment objects for each coordinate
- * system.
- */
- void doAutoScaling( ChartModel& rModel );
-
- /**
- * After auto-scaling is performed, call this method to set the explicit
- * scaling and increment data to all relevant VAxis objects.
- */
- void updateScalesAndIncrementsOnAxes();
-
- /**
- * After auto-scaling is performed, call this method to set the explicit
- * scaling data to all the plotters.
- */
- void setScalesFromCooSysToPlotter();
-
- void setNumberFormatsFromAxes();
- drawing::Direction3D getPreferredAspectRatio();
-
- SeriesPlottersType& getSeriesPlotterList() { return m_aSeriesPlotterList; }
- std::vector< std::unique_ptr<VCoordinateSystem> >& getCooSysList() { return m_rVCooSysList; }
- std::vector< LegendEntryProvider* > getLegendEntryProviderList();
-
- void AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& rModel );
-
- static bool isCategoryPositionShifted(
- const chart2::ScaleData& rSourceScale, bool bHasComplexCategories );
-
-private:
- /** A vector of series plotters.
- */
- SeriesPlottersType m_aSeriesPlotterList;
-
- /** A vector of coordinate systems.
- */
- std::vector< std::unique_ptr<VCoordinateSystem> >& m_rVCooSysList;
-
- /** A map whose key is a `XAxis` interface and the related value is
- * an object of `AxisUsage` type.
- */
- std::map< uno::Reference< XAxis >, AxisUsage > m_aAxisUsageList;
-
- /**
- * Max axis index of all dimensions. Currently this can be either 0 or 1
- * since we only support primary and secondary axes per dimension. The
- * value of 0 means all dimensions have only primary axis, while 1 means
- * at least one dimension has a secondary axis.
- */
- sal_Int32 m_nMaxAxisIndex;
-
- sal_Int32 m_nDefaultDateNumberFormat;
-};
-
-SeriesPlotterContainer::SeriesPlotterContainer( std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList )
- : m_rVCooSysList( rVCooSysList )
- , m_nMaxAxisIndex(0)
- , m_nDefaultDateNumberFormat(0)
-{
-}
-
-SeriesPlotterContainer::~SeriesPlotterContainer()
-{
- // - remove plotter from coordinatesystems
- for(auto & nC : m_rVCooSysList)
- nC->clearMinimumAndMaximumSupplierList();
-}
-
-std::vector< LegendEntryProvider* > SeriesPlotterContainer::getLegendEntryProviderList()
-{
- std::vector< LegendEntryProvider* > aRet( m_aSeriesPlotterList.size() );
- sal_Int32 nN = 0;
- for( const std::unique_ptr<VSeriesPlotter>& aPlotter : m_aSeriesPlotterList)
- aRet[nN++] = aPlotter.get();
- return aRet;
-}
-
-VCoordinateSystem* findInCooSysList( const std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList
- , const uno::Reference< XCoordinateSystem >& xCooSys )
-{
- for(auto & pVCooSys : rVCooSysList)
- {
- if(pVCooSys->getModel()==xCooSys)
- return pVCooSys.get();
- }
- return nullptr;
-}
-
-VCoordinateSystem* lcl_getCooSysForPlotter( const std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList, MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
-{
- if(!pMinimumAndMaximumSupplier)
- return nullptr;
- for(auto & pVCooSys : rVCooSysList)
- {
- if(pVCooSys->hasMinimumAndMaximumSupplier( pMinimumAndMaximumSupplier ))
- return pVCooSys.get();
- }
- return nullptr;
-}
-
-VCoordinateSystem* addCooSysToList( std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList
- , const uno::Reference< XCoordinateSystem >& xCooSys
- , ChartModel& rChartModel )
-{
- VCoordinateSystem* pExistingVCooSys = findInCooSysList( rVCooSysList, xCooSys );
- if( pExistingVCooSys )
- return pExistingVCooSys;
-
- std::unique_ptr<VCoordinateSystem> pVCooSys = VCoordinateSystem::createCoordinateSystem(xCooSys );
- if(!pVCooSys)
- return nullptr;
-
- OUString aCooSysParticle( ObjectIdentifier::createParticleForCoordinateSystem( xCooSys, rChartModel ) );
- pVCooSys->setParticle(aCooSysParticle);
-
- pVCooSys->setExplicitCategoriesProvider( new ExplicitCategoriesProvider(xCooSys, rChartModel) );
- rVCooSysList.push_back( std::move(pVCooSys) );
- return rVCooSysList.back().get();
-}
-
-void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
- ChartModel& rChartModel )
-{
- uno::Reference< XDiagram > xDiagram( rChartModel.getFirstDiagram() );
- if( !xDiagram.is())
- return;
-
- uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( static_cast< ::cppu::OWeakObject* >( &rChartModel ), uno::UNO_QUERY );
- if( rChartModel.hasInternalDataProvider() && DiagramHelper::isSupportingDateAxis( xDiagram ) )
- m_nDefaultDateNumberFormat=DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
-
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
- if(!nDimensionCount)
- {
- //@todo handle mixed dimension
- nDimensionCount = 2;
- }
-
- bool bSortByXValues = false;
- bool bConnectBars = false;
- bool bGroupBarsPerAxis = true;
- bool bIncludeHiddenCells = true;
- bool bSecondaryYaxisVisible = true;
- sal_Int32 nStartingAngle = 90;
- sal_Int32 n3DRelativeHeight = 100;
- try
- {
- uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY_THROW );
- xDiaProp->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= bSortByXValues;
- xDiaProp->getPropertyValue( "ConnectBars" ) >>= bConnectBars;
- xDiaProp->getPropertyValue( "GroupBarsPerAxis" ) >>= bGroupBarsPerAxis;
- xDiaProp->getPropertyValue( "IncludeHiddenCells" ) >>= bIncludeHiddenCells;
- xDiaProp->getPropertyValue( "StartingAngle" ) >>= nStartingAngle;
-
- if (nDimensionCount == 3)
- {
- xDiaProp->getPropertyValue( "3DRelativeHeight" ) >>= n3DRelativeHeight;
- }
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2" );
- }
-
- //prepare for autoscaling and shape creation
- // - create plotter for charttypes (for each first scale group at each plotter, as they are independent)
- // - add series to plotter (thus each charttype can provide minimum and maximum values for autoscaling)
- // - add plotter to coordinate systems
-
- //iterate through all coordinate systems
- uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- OSL_ASSERT( xCooSysContainer.is());
- if( !xCooSysContainer.is())
- return;
- uno::Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
- uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- sal_Int32 nGlobalSeriesIndex = 0;//for automatic symbols
- for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
- {
- uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
- VCoordinateSystem* pVCooSys = addCooSysToList(m_rVCooSysList,xCooSys,rChartModel);
- // Let's check whether the secondary Y axis is visible
- try
- {
- if (xCooSys->getMaximumAxisIndexByDimension(1) > 0)
- {
- Reference< beans::XPropertySet > xAxisProp(xCooSys->getAxisByDimension(1, 1), uno::UNO_QUERY);
- xAxisProp->getPropertyValue("Show") >>= bSecondaryYaxisVisible;
- }
- }
- catch (const lang::IndexOutOfBoundsException&)
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
- //iterate through all chart types in the current coordinate system
- uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
- OSL_ASSERT( xChartTypeContainer.is());
- if( !xChartTypeContainer.is() )
- continue;
- uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
- {
- uno::Reference< XChartType > xChartType( aChartTypeList[nT] );
- if(nDimensionCount == 3 && xChartType->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE))
- {
- uno::Reference< beans::XPropertySet > xPropertySet( xChartType, uno::UNO_QUERY );
- if (xPropertySet.is())
- {
- try
- {
- sal_Int32 n3DRelativeHeightOldValue(100);
- uno::Any aAny = xPropertySet->getPropertyValue( "3DRelativeHeight" );
- aAny >>= n3DRelativeHeightOldValue;
- if (n3DRelativeHeightOldValue != n3DRelativeHeight)
- xPropertySet->setPropertyValue( "3DRelativeHeight", uno::Any(n3DRelativeHeight) );
- }
- catch (const uno::Exception&) { }
- }
- }
-
- bool bExcludingPositioning = DiagramHelper::getDiagramPositioningMode( xDiagram ) == DiagramPositioningMode_EXCLUDING;
- VSeriesPlotter* pPlotter = VSeriesPlotter::createSeriesPlotter( xChartType, nDimensionCount, bExcludingPositioning );
- if( !pPlotter )
- continue;
-
- m_aSeriesPlotterList.push_back( std::unique_ptr<VSeriesPlotter>(pPlotter) );
- pPlotter->setNumberFormatsSupplier( xNumberFormatsSupplier );
- pPlotter->setColorScheme( xColorScheme );
- if(pVCooSys)
- pPlotter->setExplicitCategoriesProvider( pVCooSys->getExplicitCategoriesProvider() );
- sal_Int32 nMissingValueTreatment = DiagramHelper::getCorrectedMissingValueTreatment( xDiagram, xChartType );
-
- if(pVCooSys)
- pVCooSys->addMinimumAndMaximumSupplier(pPlotter);
-
- uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
- OSL_ASSERT( xDataSeriesContainer.is());
- if( !xDataSeriesContainer.is() )
- continue;
-
- sal_Int32 zSlot=-1;
- sal_Int32 xSlot=-1;
- sal_Int32 ySlot=-1;
- uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
- for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
- {
- uno::Reference< XDataSeries > const & xDataSeries = aSeriesList[nS];
- if(!xDataSeries.is())
- continue;
- if( !bIncludeHiddenCells && !DataSeriesHelper::hasUnhiddenData(xDataSeries) )
- continue;
-
- std::unique_ptr<VDataSeries> pSeries(new VDataSeries( xDataSeries ));
-
- pSeries->setGlobalSeriesIndex(nGlobalSeriesIndex);
- nGlobalSeriesIndex++;
-
- if( bSortByXValues )
- pSeries->doSortByXValues();
-
- pSeries->setConnectBars( bConnectBars );
- pSeries->setGroupBarsPerAxis( bGroupBarsPerAxis );
- pSeries->setStartingAngle( nStartingAngle );
-
- pSeries->setMissingValueTreatment( nMissingValueTreatment );
-
- OUString aSeriesParticle( ObjectIdentifier::createParticleForSeries( 0, nCS, nT, nS ) );
- pSeries->setParticle(aSeriesParticle);
-
- OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) );
- pSeries->setRoleOfSequenceForDataLabelNumberFormatDetection(aRole);
-
- //ignore secondary axis for charttypes that do not support them
- if( pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX &&
- ( !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ) ||
- !bSecondaryYaxisVisible ) )
- {
- pSeries->setAttachedAxisIndex(MAIN_AXIS_INDEX);
- }
-
- StackingDirection eDirection = pSeries->getStackingDirection();
- switch(eDirection)
- {
- case StackingDirection_NO_STACKING:
- xSlot++; ySlot=-1;
- if(zSlot<0)
- zSlot=0;
- break;
- case StackingDirection_Y_STACKING:
- ySlot++;
- if(xSlot<0)
- xSlot=0;
- if(zSlot<0)
- zSlot=0;
- break;
- case StackingDirection_Z_STACKING:
- zSlot++; xSlot=-1; ySlot=-1;
- break;
- default:
- // UNO enums have one additional auto-generated case
- break;
- }
- pPlotter->addSeries( std::move(pSeries), zSlot, xSlot, ySlot );
- }
- }
- }
-
- //transport seriesnames to the coordinatesystems if needed
- if( m_aSeriesPlotterList.empty() )
- return;
-
- uno::Sequence< OUString > aSeriesNames;
- bool bSeriesNamesInitialized = false;
- for(auto & pVCooSys : m_rVCooSysList)
- {
- if( pVCooSys->needSeriesNamesForAxis() )
- {
- if(!bSeriesNamesInitialized)
- {
- aSeriesNames = m_aSeriesPlotterList[0]->getSeriesNames();
- bSeriesNamesInitialized = true;
- }
- pVCooSys->setSeriesNamesForAxis( aSeriesNames );
- }
- }
-}
-
-bool SeriesPlotterContainer::isCategoryPositionShifted(
- const chart2::ScaleData& rSourceScale, bool bHasComplexCategories )
-{
- if (rSourceScale.AxisType == AxisType::CATEGORY)
- return bHasComplexCategories || rSourceScale.ShiftedCategoryPosition;
-
- if (rSourceScale.AxisType == AxisType::DATE)
- return rSourceScale.ShiftedCategoryPosition;
-
- return rSourceScale.AxisType == AxisType::SERIES;
-}
-
-void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
-{
- m_aAxisUsageList.clear();
-
- // Loop through coordinate systems in the diagram (though for now
- // there should only be one coordinate system per diagram).
- for (auto & pVCooSys : m_rVCooSysList)
- {
- uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel();
- sal_Int32 nDimCount = xCooSys->getDimension();
- bool bComplexCategoryAllowed = ChartTypeHelper::isSupportingComplexCategory(AxisHelper::getChartTypeByIndex(xCooSys, 0));
-
- for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex)
- {
- bool bDateAxisAllowed = ChartTypeHelper::isSupportingDateAxis(
- AxisHelper::getChartTypeByIndex(xCooSys, 0), nDimIndex);
-
- // Each dimension may have primary and secondary axes.
- const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimIndex);
- for (sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; ++nAxisIndex)
- {
- uno::Reference<XAxis> xAxis = xCooSys->getAxisByDimension(nDimIndex, nAxisIndex);
-
- if (!xAxis.is())
- continue;
-
- if (m_aAxisUsageList.find(xAxis) == m_aAxisUsageList.end())
- {
- // Create axis usage object for this axis.
-
- chart2::ScaleData aSourceScale = xAxis->getScaleData();
- ExplicitCategoriesProvider* pCatProvider = pVCooSys->getExplicitCategoriesProvider();
- if (nDimIndex == 0)
- AxisHelper::checkDateAxis( aSourceScale, pCatProvider, bDateAxisAllowed );
-
- bool bHasComplexCat = pCatProvider && pCatProvider->hasComplexCategories() && bComplexCategoryAllowed;
- aSourceScale.ShiftedCategoryPosition = isCategoryPositionShifted(aSourceScale, bHasComplexCat);
-
- m_aAxisUsageList[xAxis].aAutoScaling = ScaleAutomatism(aSourceScale, rNullDate);
- }
-
- AxisUsage& rAxisUsage = m_aAxisUsageList[xAxis];
- rAxisUsage.addCoordinateSystem(pVCooSys.get(), nDimIndex, nAxisIndex);
- }
- }
- }
-
- // Determine the highest axis index of all dimensions.
- m_nMaxAxisIndex = 0;
- for (const auto & pVCooSys : m_rVCooSysList)
- {
- uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel();
- sal_Int32 nDimCount = xCooSys->getDimension();
-
- for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex)
- {
- for (auto & axisUsage : m_aAxisUsageList)
- {
- sal_Int32 nLocalMax = axisUsage.second.getMaxAxisIndexForDimension(nDimIndex);
- if (m_nMaxAxisIndex < nLocalMax)
- m_nMaxAxisIndex = nLocalMax;
- }
- }
- }
-}
-
-void SeriesPlotterContainer::setScalesFromCooSysToPlotter()
-{
- //set scales to plotter to enable them to provide the preferred scene AspectRatio
- for( const std::unique_ptr<VSeriesPlotter>& aPlotter : m_aSeriesPlotterList )
- {
- VSeriesPlotter* pSeriesPlotter = aPlotter.get();
- VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( m_rVCooSysList, pSeriesPlotter );
- if(pVCooSys)
- {
- pSeriesPlotter->setScales( pVCooSys->getExplicitScales(0,0), pVCooSys->getPropertySwapXAndYAxis() );
- sal_Int32 nMaxAxisIndex = pVCooSys->getMaximumAxisIndexByDimension(1);//only additional value axis are relevant for series plotter
- for( sal_Int32 nI=1; nI<=nMaxAxisIndex; nI++ )
- pSeriesPlotter->addSecondaryValueScale( pVCooSys->getExplicitScale(1,nI), nI );
- }
- }
-}
-
-void SeriesPlotterContainer::setNumberFormatsFromAxes()
-{
- //set numberformats to plotter to enable them to display the data labels in the numberformat of the axis
- for( const std::unique_ptr<VSeriesPlotter>& aPlotter : m_aSeriesPlotterList )
- {
- VSeriesPlotter* pSeriesPlotter = aPlotter.get();
- VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( m_rVCooSysList, pSeriesPlotter );
- if(pVCooSys)
- {
- AxesNumberFormats aAxesNumberFormats;
- const uno::Reference< XCoordinateSystem >& xCooSys = pVCooSys->getModel();
- sal_Int32 nDimensionCount = xCooSys->getDimension();
- for(sal_Int32 nDimensionIndex=0; nDimensionIndex<nDimensionCount; ++nDimensionIndex)
- {
- const sal_Int32 nMaximumAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
- for(sal_Int32 nAxisIndex=0; nAxisIndex<=nMaximumAxisIndex; ++nAxisIndex)
- {
- try
- {
- Reference< beans::XPropertySet > xAxisProp( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ), uno::UNO_QUERY );
- if( xAxisProp.is())
- {
- sal_Int32 nNumberFormatKey(0);
- if( xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey )
- {
- aAxesNumberFormats.setFormat( nNumberFormatKey, nDimensionIndex, nAxisIndex );
- }
- else if( nDimensionIndex==0 )
- {
- //provide a default date format for date axis with own data
- aAxesNumberFormats.setFormat( m_nDefaultDateNumberFormat, nDimensionIndex, nAxisIndex );
- }
- }
- }
- catch( const lang::IndexOutOfBoundsException& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
- }
- }
- }
- }
-}
-
-void SeriesPlotterContainer::updateScalesAndIncrementsOnAxes()
-{
- for(auto & nC : m_rVCooSysList)
- nC->updateScalesAndIncrementsOnAxes();
-}
-
-void SeriesPlotterContainer::doAutoScaling( ChartModel& rChartModel )
-{
- if (m_aSeriesPlotterList.empty() || m_aAxisUsageList.empty())
- // We need these two containers populated to do auto-scaling. Bail out.
- return;
-
- //iterate over the main scales first than secondary axis
- for (sal_Int32 nAxisIndex = 0; nAxisIndex <= m_nMaxAxisIndex; ++nAxisIndex)
- {
- // - first do autoscale for all x and z scales (because they are treated independent)
- for (auto & axisUsage : m_aAxisUsageList)
- {
- AxisUsage& rAxisUsage = axisUsage.second;
-
- rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 0, nAxisIndex);
- rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 2, nAxisIndex);
-
- ExplicitScaleData aExplicitScale;
- ExplicitIncrementData aExplicitIncrement;
- rAxisUsage.aAutoScaling.calculateExplicitScaleAndIncrement( aExplicitScale, aExplicitIncrement );
-
- rAxisUsage.setExplicitScaleAndIncrement(0, nAxisIndex, aExplicitScale, aExplicitIncrement);
- rAxisUsage.setExplicitScaleAndIncrement(2, nAxisIndex, aExplicitScale, aExplicitIncrement);
- }
-
- // - second do autoscale for the dependent y scales (the coordinate systems are prepared with x and z scales already )
- for (auto & axisUsage : m_aAxisUsageList)
- {
- AxisUsage& rAxisUsage = axisUsage.second;
-
- rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 1, nAxisIndex);
-
- ExplicitScaleData aExplicitScale;
- ExplicitIncrementData aExplicitIncrement;
- rAxisUsage.aAutoScaling.calculateExplicitScaleAndIncrement( aExplicitScale, aExplicitIncrement );
-
- rAxisUsage.setExplicitScaleAndIncrement(0, nAxisIndex, aExplicitScale, aExplicitIncrement);
- rAxisUsage.setExplicitScaleAndIncrement(1, nAxisIndex, aExplicitScale, aExplicitIncrement);
- rAxisUsage.setExplicitScaleAndIncrement(2, nAxisIndex, aExplicitScale, aExplicitIncrement);
- }
- }
- AdaptScaleOfYAxisWithoutAttachedSeries( rChartModel );
-}
-
-void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& rModel )
-{
- //issue #i80518#
- for( sal_Int32 nAxisIndex=0; nAxisIndex<=m_nMaxAxisIndex; nAxisIndex++ )
- {
- for (auto & axisUsage : m_aAxisUsageList)
- {
- AxisUsage& rAxisUsage = axisUsage.second;
- std::vector< VCoordinateSystem* > aVCooSysList_Y = rAxisUsage.getCoordinateSystems( 1, nAxisIndex );
- if( aVCooSysList_Y.empty() )
- continue;
-
- uno::Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
- if (!xDiagram.is())
- continue;
-
- bool bSeriesAttachedToThisAxis = false;
- sal_Int32 nAttachedAxisIndex = -1;
- {
- std::vector< Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
- for (auto const& series : aSeriesVector)
- {
- sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex(series);
- if( nAxisIndex == nCurrentIndex )
- {
- bSeriesAttachedToThisAxis = true;
- break;
- }
- else if( nAttachedAxisIndex<0 || nAttachedAxisIndex>nCurrentIndex )
- nAttachedAxisIndex=nCurrentIndex;
- }
- }
-
- if (bSeriesAttachedToThisAxis || nAttachedAxisIndex < 0)
- continue;
-
- for(VCoordinateSystem* nC : aVCooSysList_Y)
- {
- nC->prepareAutomaticAxisScaling( rAxisUsage.aAutoScaling, 1, nAttachedAxisIndex );
-
- ExplicitScaleData aExplicitScaleSource = nC->getExplicitScale( 1,nAttachedAxisIndex );
- ExplicitIncrementData aExplicitIncrementSource = nC->getExplicitIncrement( 1,nAttachedAxisIndex );
-
- ExplicitScaleData aExplicitScaleDest = nC->getExplicitScale( 1,nAxisIndex );
- ExplicitIncrementData aExplicitIncrementDest = nC->getExplicitIncrement( 1,nAxisIndex );
-
- aExplicitScaleDest.Orientation = aExplicitScaleSource.Orientation;
- aExplicitScaleDest.Scaling = aExplicitScaleSource.Scaling;
- aExplicitScaleDest.AxisType = aExplicitScaleSource.AxisType;
-
- aExplicitIncrementDest.BaseValue = aExplicitIncrementSource.BaseValue;
-
- ScaleData aScale( rAxisUsage.aAutoScaling.getScale() );
- if( !aScale.Minimum.hasValue() )
- {
- bool bNewMinOK = true;
- double fMax=0.0;
- if( aScale.Maximum >>= fMax )
- bNewMinOK = (aExplicitScaleSource.Minimum <= fMax);
- if( bNewMinOK )
- aExplicitScaleDest.Minimum = aExplicitScaleSource.Minimum;
- }
- else
- aExplicitIncrementDest.BaseValue = aExplicitScaleDest.Minimum;
-
- if( !aScale.Maximum.hasValue() )
- {
- bool bNewMaxOK = true;
- double fMin=0.0;
- if( aScale.Minimum >>= fMin )
- bNewMaxOK = (fMin <= aExplicitScaleSource.Maximum);
- if( bNewMaxOK )
- aExplicitScaleDest.Maximum = aExplicitScaleSource.Maximum;
- }
- if( !aScale.Origin.hasValue() )
- aExplicitScaleDest.Origin = aExplicitScaleSource.Origin;
-
- if( !aScale.IncrementData.Distance.hasValue() )
- aExplicitIncrementDest.Distance = aExplicitIncrementSource.Distance;
-
- bool bAutoMinorInterval = true;
- if( aScale.IncrementData.SubIncrements.hasElements() )
- bAutoMinorInterval = !( aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() );
- if( bAutoMinorInterval )
- {
- if( !aExplicitIncrementDest.SubIncrements.empty() && !aExplicitIncrementSource.SubIncrements.empty() )
- aExplicitIncrementDest.SubIncrements[0].IntervalCount =
- aExplicitIncrementSource.SubIncrements[0].IntervalCount;
- }
-
- nC->setExplicitScaleAndIncrement( 1, nAxisIndex, aExplicitScaleDest, aExplicitIncrementDest );
- }
- }
- }
-
- if( !AxisHelper::isAxisPositioningEnabled() )
- return;
-
- //correct origin for y main axis (the origin is where the other main axis crosses)
- sal_Int32 nAxisIndex=0;
- sal_Int32 nDimensionIndex=1;
- for (auto & axisUsage : m_aAxisUsageList)
- {
- AxisUsage& rAxisUsage = axisUsage.second;
- std::vector< VCoordinateSystem* > aVCooSysList = rAxisUsage.getCoordinateSystems(nDimensionIndex,nAxisIndex);
- size_t nC;
- for( nC=0; nC < aVCooSysList.size(); nC++)
- {
- ExplicitScaleData aExplicitScale( aVCooSysList[nC]->getExplicitScale( nDimensionIndex, nAxisIndex ) );
- ExplicitIncrementData aExplicitIncrement( aVCooSysList[nC]->getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
-
- Reference< chart2::XCoordinateSystem > xCooSys( aVCooSysList[nC]->getModel() );
- Reference< XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
- Reference< beans::XPropertySet > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ), uno::UNO_QUERY );
-
- css::chart::ChartAxisPosition eCrossingMainAxisPos( css::chart::ChartAxisPosition_ZERO );
- if( xCrossingMainAxis.is() )
- {
- xCrossingMainAxis->getPropertyValue("CrossoverPosition") >>= eCrossingMainAxisPos;
- if( eCrossingMainAxisPos == css::chart::ChartAxisPosition_VALUE )
- {
- double fValue = 0.0;
- xCrossingMainAxis->getPropertyValue("CrossoverValue") >>= fValue;
- aExplicitScale.Origin = fValue;
- }
- else if( eCrossingMainAxisPos == css::chart::ChartAxisPosition_ZERO )
- aExplicitScale.Origin = 0.0;
- else if( eCrossingMainAxisPos == css::chart::ChartAxisPosition_START )
- aExplicitScale.Origin = aExplicitScale.Minimum;
- else if( eCrossingMainAxisPos == css::chart::ChartAxisPosition_END )
- aExplicitScale.Origin = aExplicitScale.Maximum;
- }
-
- aVCooSysList[nC]->setExplicitScaleAndIncrement( nDimensionIndex, nAxisIndex, aExplicitScale, aExplicitIncrement );
- }
- }
-}
-
-drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio()
-{
- drawing::Direction3D aPreferredAspectRatio(1.0,1.0,1.0);
-
- //get a list of all preferred aspect ratios and combine them
- //first with special demands wins (less or equal zero <-> arbitrary)
- double fx, fy, fz;
- fx = fy = fz = -1.0;
- for( const std::unique_ptr<VSeriesPlotter>& aPlotter : m_aSeriesPlotterList )
- {
- drawing::Direction3D aSingleRatio( aPlotter->getPreferredDiagramAspectRatio() );
- if( fx<0 && aSingleRatio.DirectionX>0 )
- fx = aSingleRatio.DirectionX;
-
- if( fy<0 && aSingleRatio.DirectionY>0 )
- {
- if( fx>0 && aSingleRatio.DirectionX>0 )
- fy = fx*aSingleRatio.DirectionY/aSingleRatio.DirectionX;
- else if( fz>0 && aSingleRatio.DirectionZ>0 )
- fy = fz*aSingleRatio.DirectionY/aSingleRatio.DirectionZ;
- else
- fy = aSingleRatio.DirectionY;
- }
-
- if( fz<0 && aSingleRatio.DirectionZ>0 )
- {
- if( fx>0 && aSingleRatio.DirectionX>0 )
- fz = fx*aSingleRatio.DirectionZ/aSingleRatio.DirectionX;
- else if( fy>0 && aSingleRatio.DirectionY>0 )
- fz = fy*aSingleRatio.DirectionZ/aSingleRatio.DirectionY;
- else
- fz = aSingleRatio.DirectionZ;
- }
-
- if( fx>0 && fy>0 && fz>0 )
- break;
- }
- aPreferredAspectRatio = drawing::Direction3D(fx, fy, fz);
- return aPreferredAspectRatio;
-}
-
-}
-
struct CreateShapeParam2D
{
css::awt::Rectangle maRemainingSpace;
@@ -1009,10 +133,10 @@ struct CreateShapeParam2D
std::shared_ptr<VTitle> mpVTitleSecondX;
std::shared_ptr<VTitle> mpVTitleSecondY;
- css::uno::Reference<css::drawing::XShape> mxMarkHandles;
- css::uno::Reference<css::drawing::XShape> mxPlotAreaWithAxes;
+ rtl::Reference<SvxShapeRect> mxMarkHandles;
+ rtl::Reference<SvxShapeRect> mxPlotAreaWithAxes;
- css::uno::Reference<css::drawing::XShapes> mxDiagramWithAxesShapes;
+ rtl::Reference<SvxShapeGroup> mxDiagramWithAxesShapes;
bool mbAutoPosTitleX;
bool mbAutoPosTitleY;
@@ -1032,21 +156,13 @@ struct CreateShapeParam2D
mbUseFixedInnerSize(false) {}
};
-const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId()
-{
- return theExplicitValueProviderUnoTunnelId::get().getSeq();
-}
+
ChartView::ChartView(
- uno::Reference<uno::XComponentContext> const & xContext,
+ uno::Reference<uno::XComponentContext> xContext,
ChartModel& rModel)
- : m_aMutex()
- , m_xCC(xContext)
+ : m_xCC(std::move(xContext))
, mrChartModel(rModel)
- , m_xShapeFactory()
- , m_xDrawPage()
- , m_pDrawModelWrapper()
- , m_aListenerContainer( m_aMutex )
, m_bViewDirty(true)
, m_bInViewUpdate(false)
, m_bViewUpdatePending(false)
@@ -1108,10 +224,10 @@ void ChartView::impl_deleteCoordinateSystems()
// datatransfer::XTransferable
namespace
{
-const OUString lcl_aGDIMetaFileMIMEType(
- "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" );
-const OUString lcl_aGDIMetaFileMIMETypeHighContrast(
- "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" );
+constexpr OUString lcl_aGDIMetaFileMIMEType(
+ u"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\""_ustr );
+constexpr OUString lcl_aGDIMetaFileMIMETypeHighContrast(
+ u"application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\""_ustr );
} // anonymous namespace
void ChartView::getMetaFile( const uno::Reference< io::XOutputStream >& xOutStream
@@ -1123,41 +239,25 @@ void ChartView::getMetaFile( const uno::Reference< io::XOutputStream >& xOutStre
// creating the graphic exporter
uno::Reference< drawing::XGraphicExportFilter > xExporter = drawing::GraphicExportFilter::create( m_xCC );
- uno::Sequence< beans::PropertyValue > aProps(3);
- aProps[0].Name = "FilterName";
- aProps[0].Value <<= OUString("SVM");
-
- aProps[1].Name = "OutputStream";
- aProps[1].Value <<= xOutStream;
-
- uno::Sequence< beans::PropertyValue > aFilterData(8);
- aFilterData[0].Name = "ExportOnlyBackground";
- aFilterData[0].Value <<= false;
- aFilterData[1].Name = "HighContrast";
- aFilterData[1].Value <<= bUseHighContrast;
-
- aFilterData[2].Name = "Version";
- const sal_Int32 nVersion = SOFFICE_FILEFORMAT_50;
- aFilterData[2].Value <<= nVersion;
-
- aFilterData[3].Name = "CurrentPage";
- aFilterData[3].Value <<= uno::Reference< uno::XInterface >( m_xDrawPage, uno::UNO_QUERY );
-
- //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
- aFilterData[4].Name = "ScaleXNumerator";
- aFilterData[4].Value <<= m_nScaleXNumerator;
- aFilterData[5].Name = "ScaleXDenominator";
- aFilterData[5].Value <<= m_nScaleXDenominator;
- aFilterData[6].Name = "ScaleYNumerator";
- aFilterData[6].Value <<= m_nScaleYNumerator;
- aFilterData[7].Name = "ScaleYDenominator";
- aFilterData[7].Value <<= m_nScaleYDenominator;
-
-
- aProps[2].Name = "FilterData";
- aProps[2].Value <<= aFilterData;
-
- xExporter->setSourceDocument( uno::Reference< lang::XComponent >( m_xDrawPage, uno::UNO_QUERY) );
+ uno::Sequence< beans::PropertyValue > aFilterData{
+ comphelper::makePropertyValue("ExportOnlyBackground", false),
+ comphelper::makePropertyValue("HighContrast", bUseHighContrast),
+ comphelper::makePropertyValue("Version", sal_Int32(SOFFICE_FILEFORMAT_50)),
+ comphelper::makePropertyValue("CurrentPage", uno::Reference< uno::XInterface >( static_cast<cppu::OWeakObject*>(m_xDrawPage.get()), uno::UNO_QUERY )),
+ //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
+ comphelper::makePropertyValue("ScaleXNumerator", m_nScaleXNumerator),
+ comphelper::makePropertyValue("ScaleXDenominator", m_nScaleXDenominator),
+ comphelper::makePropertyValue("ScaleYNumerator", m_nScaleYNumerator),
+ comphelper::makePropertyValue("ScaleYDenominator", m_nScaleYDenominator)
+ };
+
+ uno::Sequence< beans::PropertyValue > aProps{
+ comphelper::makePropertyValue("FilterName", OUString("SVM")),
+ comphelper::makePropertyValue("OutputStream", xOutStream),
+ comphelper::makePropertyValue("FilterData", aFilterData)
+ };
+
+ xExporter->setSourceDocument( m_xDrawPage );
if( xExporter->filter( aProps ) )
{
xOutStream->flush();
@@ -1178,41 +278,26 @@ uno::Any SAL_CALL ChartView::getTransferData( const datatransfer::DataFlavor& aF
update();
SvMemoryStream aStream( 1024, 1024 );
- utl::OStreamWrapper* pStreamWrapper = new utl::OStreamWrapper( aStream );
+ rtl::Reference<utl::OStreamWrapper> pStreamWrapper = new utl::OStreamWrapper( aStream );
- uno::Reference< io::XOutputStream > xOutStream( pStreamWrapper );
- uno::Reference< io::XInputStream > xInStream( pStreamWrapper );
- uno::Reference< io::XSeekable > xSeekable( pStreamWrapper );
+ this->getMetaFile( pStreamWrapper, bHighContrastMetaFile );
- if( xOutStream.is() )
- {
- this->getMetaFile( xOutStream, bHighContrastMetaFile );
-
- if( xInStream.is() && xSeekable.is() )
- {
- xSeekable->seek(0);
- sal_Int32 nBytesToRead = xInStream->available();
- uno::Sequence< sal_Int8 > aSeq( nBytesToRead );
- xInStream->readBytes( aSeq, nBytesToRead);
- aRet <<= aSeq;
- xInStream->closeInput();
- }
- }
+ pStreamWrapper->seek(0);
+ sal_Int32 nBytesToRead = pStreamWrapper->available();
+ uno::Sequence< sal_Int8 > aSeq( nBytesToRead );
+ pStreamWrapper->readBytes( aSeq, nBytesToRead);
+ aRet <<= aSeq;
+ pStreamWrapper->closeInput();
return aRet;
}
uno::Sequence< datatransfer::DataFlavor > SAL_CALL ChartView::getTransferDataFlavors()
{
- uno::Sequence< datatransfer::DataFlavor > aRet(2);
-
- aRet[0] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMEType,
- "GDIMetaFile",
- cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );
- aRet[1] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMETypeHighContrast,
- "GDIMetaFile",
- cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );
-
- return aRet;
+ return
+ {
+ { lcl_aGDIMetaFileMIMEType, "GDIMetaFile", cppu::UnoType<uno::Sequence< sal_Int8 >>::get() },
+ { lcl_aGDIMetaFileMIMETypeHighContrast, "GDIMetaFile", cppu::UnoType<uno::Sequence< sal_Int8 >>::get() }
+ };
}
sal_Bool SAL_CALL ChartView::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
{
@@ -1220,17 +305,6 @@ sal_Bool SAL_CALL ChartView::isDataFlavorSupported( const datatransfer::DataFlav
aFlavor.MimeType == lcl_aGDIMetaFileMIMETypeHighContrast );
}
-// ____ XUnoTunnel ___
-::sal_Int64 SAL_CALL ChartView::getSomething( const uno::Sequence< ::sal_Int8 >& aIdentifier )
-{
- if( isUnoTunnelId<ExplicitValueProvider>(aIdentifier) )
- {
- ExplicitValueProvider* pProvider = this;
- return reinterpret_cast<sal_Int64>(pProvider);
- }
- return 0;
-}
-
// lang::XServiceInfo
OUString SAL_CALL ChartView::getImplementationName()
@@ -1262,19 +336,19 @@ static ::basegfx::B3DHomMatrix createTransformationSceneToScreen(
namespace
{
-bool lcl_IsPieOrDonut( const uno::Reference< XDiagram >& xDiagram )
+bool lcl_IsPieOrDonut( const rtl::Reference< Diagram >& xDiagram )
{
//special treatment for pie charts
//the size is checked after complete creation to get the datalabels into the given space
//todo: this is just a workaround at the moment for pie and donut labels
- return DiagramHelper::isPieOrDonutChart( xDiagram );
+ return xDiagram->isPieOrDonutChart();
}
void lcl_setDefaultWritingMode( const std::shared_ptr< DrawModelWrapper >& pDrawModelWrapper, ChartModel& rModel)
{
//get writing mode from parent document:
- if( !SvtLanguageOptions().IsCTLFontEnabled() )
+ if( !SvtCTLOptions::IsCTLFontEnabled() )
return;
try
@@ -1397,7 +471,7 @@ void lcl_setDefaultWritingMode( const std::shared_ptr< DrawModelWrapper >& pDraw
if( nWritingMode != -1 && nWritingMode != text::WritingMode2::PAGE )
{
if( pDrawModelWrapper )
- pDrawModelWrapper->GetItemPool().SetPoolDefaultItem(SvxFrameDirectionItem(static_cast<SvxFrameDirection>(nWritingMode), EE_PARA_WRITINGDIR) );
+ pDrawModelWrapper->GetItemPool().SetUserDefaultItem(SvxFrameDirectionItem(static_cast<SvxFrameDirection>(nWritingMode), EE_PARA_WRITINGDIR) );
}
}
catch( const uno::Exception& )
@@ -1412,7 +486,7 @@ sal_Int16 lcl_getDefaultWritingModeFromPool( const std::shared_ptr<DrawModelWrap
if(!pDrawModelWrapper)
return nWritingMode;
- const SfxPoolItem& rItem = pDrawModelWrapper->GetItemPool().GetDefaultItem(EE_PARA_WRITINGDIR);
+ const SfxPoolItem& rItem = pDrawModelWrapper->GetItemPool().GetUserOrPoolDefaultItem(EE_PARA_WRITINGDIR);
nWritingMode
= static_cast<sal_Int16>(static_cast<const SvxFrameDirectionItem&>(rItem).GetValue());
return nWritingMode;
@@ -1425,11 +499,11 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
//return the used rectangle
awt::Rectangle aUsedOuterRect(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y, 0, 0);
- uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
+ rtl::Reference< Diagram > xDiagram( mrChartModel.getFirstChartDiagram() );
if( !xDiagram.is())
return aUsedOuterRect;
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
if(!nDimensionCount)
{
//@todo handle mixed dimension
@@ -1439,26 +513,23 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
basegfx::B2IRectangle aAvailableOuterRect = BaseGFXHelper::makeRectangle(rParam.maRemainingSpace);
const std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList( rParam.mpSeriesPlotterContainer->getCooSysList() );
- SeriesPlottersType& rSeriesPlotterList = rParam.mpSeriesPlotterContainer->getSeriesPlotterList();
+ auto& rSeriesPlotterList = rParam.mpSeriesPlotterContainer->getSeriesPlotterList();
//create VAxis, so they can give necessary information for automatic scaling
- uno::Reference<chart2::XChartDocument> const xChartDoc(&mrChartModel);
uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier(
mrChartModel.getNumberFormatsSupplier());
- size_t nC = 0;
- for( nC=0; nC < rVCooSysList.size(); nC++)
+
+ for (auto& rpVCooSys : rVCooSysList)
{
- VCoordinateSystem* pVCooSys = rVCooSysList[nC].get();
- if(nDimensionCount==3)
+ if (nDimensionCount == 3)
{
- uno::Reference<beans::XPropertySet> xSceneProperties( xDiagram, uno::UNO_QUERY );
- CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( xSceneProperties ) );
- CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( xSceneProperties ) );
- CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( xSceneProperties ) );
- pVCooSys->set3DWallPositions( eLeftWallPos, eBackWallPos, eBottomPos );
+ CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( xDiagram ) );
+ CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( xDiagram ) );
+ CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( xDiagram ) );
+ rpVCooSys->set3DWallPositions( eLeftWallPos, eBackWallPos, eBottomPos );
}
-
- pVCooSys->createVAxisList(xChartDoc, rPageSize, rParam.maRemainingSpace, rParam.mbUseFixedInnerSize);
+ rpVCooSys->createVAxisList(&mrChartModel, rPageSize, rParam.maRemainingSpace,
+ rParam.mbUseFixedInnerSize, rSeriesPlotterList, getComponentContext());
}
// - prepare list of all axis and how they are used
@@ -1474,11 +545,11 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
drawing::Direction3D aPreferredAspectRatio =
rParam.mpSeriesPlotterContainer->getPreferredAspectRatio();
- uno::Reference< drawing::XShapes > xSeriesTargetInFrontOfAxis;
- uno::Reference< drawing::XShapes > xSeriesTargetBehindAxis;
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesTargetInFrontOfAxis;
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesTargetBehindAxis;
VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount);
{//create diagram
- aVDiagram.init(rParam.mxDiagramWithAxesShapes, m_xShapeFactory);
+ aVDiagram.init(rParam.mxDiagramWithAxesShapes);
aVDiagram.createShapes(
awt::Point(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y),
awt::Size(rParam.maRemainingSpace.Width, rParam.maRemainingSpace.Height));
@@ -1486,29 +557,28 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion();
// It is preferable to use full size than minimum for pie charts
if (!rParam.mbUseFixedInnerSize)
- aVDiagram.reduceToMimimumSize();
+ aVDiagram.reduceToMinimumSize();
}
- uno::Reference< drawing::XShapes > xTextTargetShapes =
- ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)->createGroup2D(rParam.mxDiagramWithAxesShapes);
+ rtl::Reference<SvxShapeGroup> xTextTargetShapes =
+ ShapeFactory::createGroup2D(rParam.mxDiagramWithAxesShapes);
// - create axis and grids for all coordinate systems
//init all coordinate systems
- for( nC=0; nC < rVCooSysList.size(); nC++)
+ for (auto& rpVCooSys : rVCooSysList)
{
- VCoordinateSystem* pVCooSys = rVCooSysList[nC].get();
- pVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis,xTextTargetShapes,m_xShapeFactory,xSeriesTargetBehindAxis);
+ rpVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis, xTextTargetShapes, xSeriesTargetBehindAxis);
- pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
+ rpVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) ));
- pVCooSys->initVAxisInList();
+ rpVCooSys->initVAxisInList();
}
//calculate resulting size respecting axis label layout and fontscaling
- uno::Reference< drawing::XShape > xBoundingShape(rParam.mxDiagramWithAxesShapes, uno::UNO_QUERY);
+ rtl::Reference<SvxShapeGroup> xBoundingShape(rParam.mxDiagramWithAxesShapes);
::basegfx::B2IRectangle aConsumedOuterRect;
//use first coosys only so far; todo: calculate for more than one coosys if we have more in future
@@ -1519,7 +589,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
VCoordinateSystem* pVCooSys = rVCooSysList[0].get();
pVCooSys->createMaximumAxesLabels();
- aConsumedOuterRect = ShapeFactory::getRectangleOfShape(xBoundingShape);
+ aConsumedOuterRect = ShapeFactory::getRectangleOfShape(*xBoundingShape);
::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
if (!rParam.mbUseFixedInnerSize)
aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
@@ -1536,12 +606,14 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
bool bLessSpaceConsumedThanExpected = false;
{
- aConsumedOuterRect = ShapeFactory::getRectangleOfShape(xBoundingShape);
+ aConsumedOuterRect = ShapeFactory::getRectangleOfShape(*xBoundingShape);
if( aConsumedOuterRect.getMinX() > aAvailableOuterRect.getMinX()
|| aConsumedOuterRect.getMaxX() < aAvailableOuterRect.getMaxX()
|| aConsumedOuterRect.getMinY() > aAvailableOuterRect.getMinY()
|| aConsumedOuterRect.getMinY() < aAvailableOuterRect.getMaxY() )
+ {
bLessSpaceConsumedThanExpected = true;
+ }
}
if (bLessSpaceConsumedThanExpected && !rParam.mbUseFixedInnerSize)
@@ -1549,20 +621,28 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
aVDiagram.adjustInnerSize( aConsumedOuterRect );
pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) ));
+
+ // Need to re-adjust again if the labels have changed height because of
+ // text can break. Ideally this shouldn't be needed, but the chart height
+ // isn't readjusted otherwise.
+ pVCooSys->createAxesLabels();
+ aConsumedOuterRect = ShapeFactory::getRectangleOfShape(*xBoundingShape);
+ aVDiagram.adjustInnerSize(aConsumedOuterRect);
+ pVCooSys->setTransformationSceneToScreen(B3DHomMatrixToHomogenMatrix(
+ createTransformationSceneToScreen(aVDiagram.getCurrentRectangle())));
+
}
pVCooSys->updatePositions();//todo: logically this belongs to the condition above, but it seems also to be necessary to give the axes group shapes the right bounding rects for hit test - probably caused by bug i106183 -> check again if fixed
}
//create axes and grids for the final size
- for( nC=0; nC < rVCooSysList.size(); nC++)
+ for (auto& rpVCooSys : rVCooSysList)
{
- VCoordinateSystem* pVCooSys = rVCooSysList[nC].get();
-
- pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
+ rpVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) ));
- pVCooSys->createAxesShapes();
- pVCooSys->createGridShapes();
+ rpVCooSys->createAxesShapes();
+ rpVCooSys->createGridShapes();
}
// - create data series for all charttypes
@@ -1570,7 +650,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
for( const std::unique_ptr<VSeriesPlotter>& aPlotter : rSeriesPlotterList )
{
VSeriesPlotter* pSeriesPlotter = aPlotter.get();
- uno::Reference< drawing::XShapes > xSeriesTarget;
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesTarget;
if( pSeriesPlotter->WantToPlotInFrontOfAxisLine() )
xSeriesTarget = xSeriesTargetInFrontOfAxis;
else
@@ -1578,9 +658,9 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
xSeriesTarget = xSeriesTargetBehindAxis;
OSL_ENSURE( !bIsPieOrDonut, "not implemented yet! - during a complete recreation this shape is destroyed so no series can be created anymore" );
}
- pSeriesPlotter->initPlotter( xSeriesTarget,xTextTargetShapes,m_xShapeFactory,OUString() );
+ pSeriesPlotter->initPlotter( xSeriesTarget,xTextTargetShapes,OUString() );
pSeriesPlotter->setPageReferenceSize( rPageSize );
- VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, pSeriesPlotter );
+ VCoordinateSystem* pVCooSys = SeriesPlotterContainer::getCooSysForPlotter( rVCooSysList, pSeriesPlotter );
if(nDimensionCount==2)
pSeriesPlotter->setTransformationSceneToScreen( pVCooSys->getTransformationSceneToScreen() );
//better performance for big data
@@ -1591,6 +671,11 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
}
// Do not allow to move data labels in case of pie or donut chart, yet!
pSeriesPlotter->setPieLabelsAllowToMove(!bIsPieOrDonut);
+ // use the pagesize as remaining space if we have a fixed inner size
+ if( rParam.mbUseFixedInnerSize )
+ aAvailableOuterRect = BaseGFXHelper::makeRectangle(awt::Rectangle(0, 0, rPageSize.Width, rPageSize.Height));
+ // set the available space for data labels to avoid moving out from chart area
+ pSeriesPlotter->setAvailableOuterRect(aAvailableOuterRect);
pSeriesPlotter->createShapes();
m_bPointsWereSkipped = m_bPointsWereSkipped || pSeriesPlotter->PointsWereSkipped();
}
@@ -1600,7 +685,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
{
m_bPointsWereSkipped = false;
- aConsumedOuterRect = ShapeFactory::getRectangleOfShape(xBoundingShape);
+ aConsumedOuterRect = ShapeFactory::getRectangleOfShape(*xBoundingShape);
::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
if (!rParam.mbUseFixedInnerSize)
aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
@@ -1616,17 +701,16 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
ShapeFactory::removeSubShapes( xTextTargetShapes );
//set new transformation
- for( nC=0; nC < rVCooSysList.size(); nC++)
+ for (auto& rpVCooSys : rVCooSysList)
{
- VCoordinateSystem* pVCooSys = rVCooSysList[nC].get();
- pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
- createTransformationSceneToScreen( aNewInnerRect ) ));
+ auto aMatrix = createTransformationSceneToScreen(aNewInnerRect);
+ rpVCooSys->setTransformationSceneToScreen(B3DHomMatrixToHomogenMatrix(aMatrix));
}
// - create data series for all charttypes
for( std::unique_ptr<VSeriesPlotter>& aPlotter : rSeriesPlotterList )
{
- VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, aPlotter.get() );
+ VCoordinateSystem* pVCooSys = SeriesPlotterContainer::getCooSysForPlotter( rVCooSysList, aPlotter.get() );
if(nDimensionCount==2)
aPlotter->setTransformationSceneToScreen( pVCooSys->getTransformationSceneToScreen() );
// Now we can move data labels in case of pie or donut chart!
@@ -1660,7 +744,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
else
{
::basegfx::B2IRectangle aConsumedInnerRect = aVDiagram.getCurrentRectangle();
- m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( aConsumedInnerRect.getMinX(), aConsumedInnerRect.getMinY(), aConsumedInnerRect.getWidth(), aConsumedInnerRect.getHeight() );
+ m_aResultingDiagramRectangleExcludingAxes = BaseGFXHelper::toAwtRectangle(aConsumedInnerRect);
}
}
else
@@ -1670,7 +754,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
else
{
::basegfx::B2IRectangle aConsumedInnerRect = aVDiagram.getCurrentRectangle();
- m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( aConsumedInnerRect.getMinX(), aConsumedInnerRect.getMinY(), aConsumedInnerRect.getWidth(), aConsumedInnerRect.getHeight() );
+ m_aResultingDiagramRectangleExcludingAxes = BaseGFXHelper::toAwtRectangle(aConsumedInnerRect);
}
}
@@ -1680,8 +764,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
awt::Size aSize(rParam.maRemainingSpace.Width, rParam.maRemainingSpace.Height);
bool bPosSizeExcludeAxesProperty = true;
- uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY_THROW );
- xDiaProps->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxesProperty;
+ xDiagram->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxesProperty;
if (rParam.mbUseFixedInnerSize || bPosSizeExcludeAxesProperty)
{
aPos = awt::Point( m_aResultingDiagramRectangleExcludingAxes.X, m_aResultingDiagramRectangleExcludingAxes.Y );
@@ -1695,7 +778,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
}
bool ChartView::getExplicitValuesForAxis(
- uno::Reference< XAxis > xAxis
+ rtl::Reference< Axis > xAxis
, ExplicitScaleData& rExplicitScale
, ExplicitIncrementData& rExplicitIncrement )
{
@@ -1706,64 +789,66 @@ bool ChartView::getExplicitValuesForAxis(
if(!xAxis.is())
return false;
- uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(xAxis, mrChartModel.getFirstDiagram() ) );
- const VCoordinateSystem* pVCooSys = findInCooSysList(m_aVCooSysList,xCooSys);
+ rtl::Reference< BaseCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemOfAxis(xAxis, mrChartModel.getFirstChartDiagram() );
+ const VCoordinateSystem* pVCooSys = SeriesPlotterContainer::findInCooSysList(m_aVCooSysList, xCooSys);
if(!pVCooSys)
return false;
sal_Int32 nDimensionIndex=-1;
sal_Int32 nAxisIndex=-1;
- if( AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex ) )
+ if( !AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex ) )
+ return false;
+
+ rExplicitScale = pVCooSys->getExplicitScale(nDimensionIndex,nAxisIndex);
+ rExplicitIncrement = pVCooSys->getExplicitIncrement(nDimensionIndex,nAxisIndex);
+ if( !rExplicitScale.m_bShiftedCategoryPosition )
+ return true;
+
+ //remove 'one' from max
+ if( rExplicitScale.AxisType == css::chart2::AxisType::DATE )
{
- rExplicitScale = pVCooSys->getExplicitScale(nDimensionIndex,nAxisIndex);
- rExplicitIncrement = pVCooSys->getExplicitIncrement(nDimensionIndex,nAxisIndex);
- if( rExplicitScale.ShiftedCategoryPosition )
+ Date aMaxDate(rExplicitScale.NullDate); aMaxDate.AddDays(::rtl::math::approxFloor(rExplicitScale.Maximum));
+ //for explicit scales with shifted categories we need one interval more
+ switch( rExplicitScale.TimeResolution )
{
- //remove 'one' from max
- if( rExplicitScale.AxisType == css::chart2::AxisType::DATE )
- {
- Date aMaxDate(rExplicitScale.NullDate); aMaxDate.AddDays(::rtl::math::approxFloor(rExplicitScale.Maximum));
- //for explicit scales with shifted categories we need one interval more
- switch( rExplicitScale.TimeResolution )
- {
- case css::chart::TimeUnit::DAY:
- --aMaxDate;
- break;
- case css::chart::TimeUnit::MONTH:
- aMaxDate = DateHelper::GetDateSomeMonthsAway(aMaxDate,-1);
- break;
- case css::chart::TimeUnit::YEAR:
- aMaxDate = DateHelper::GetDateSomeYearsAway(aMaxDate,-1);
- break;
- }
- rExplicitScale.Maximum = aMaxDate - rExplicitScale.NullDate;
- }
- else if( rExplicitScale.AxisType == css::chart2::AxisType::CATEGORY )
- rExplicitScale.Maximum -= 1.0;
- else if( rExplicitScale.AxisType == css::chart2::AxisType::SERIES )
- rExplicitScale.Maximum -= 1.0;
+ case css::chart::TimeUnit::DAY:
+ --aMaxDate;
+ break;
+ case css::chart::TimeUnit::MONTH:
+ aMaxDate = DateHelper::GetDateSomeMonthsAway(aMaxDate,-1);
+ break;
+ case css::chart::TimeUnit::YEAR:
+ aMaxDate = DateHelper::GetDateSomeYearsAway(aMaxDate,-1);
+ break;
}
- return true;
+ rExplicitScale.Maximum = aMaxDate - rExplicitScale.NullDate;
}
- return false;
+ else if( rExplicitScale.AxisType == css::chart2::AxisType::CATEGORY )
+ rExplicitScale.Maximum -= 1.0;
+ else if( rExplicitScale.AxisType == css::chart2::AxisType::SERIES )
+ rExplicitScale.Maximum -= 1.0;
+ return true;
}
SdrPage* ChartView::getSdrPage()
{
- auto pSvxDrawPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>(m_xDrawPage);
- if(pSvxDrawPage)
- return pSvxDrawPage->GetSdrPage();
+ if(m_xDrawPage)
+ return m_xDrawPage->GetSdrPage();
return nullptr;
}
-uno::Reference< drawing::XShape > ChartView::getShapeForCID( const OUString& rObjectCID )
+rtl::Reference< SvxShape > ChartView::getShapeForCID( const OUString& rObjectCID )
{
SolarMutexGuard aSolarGuard;
SdrObject* pObj = DrawModelWrapper::getNamedSdrObject( rObjectCID, this->getSdrPage() );
- if( pObj )
- return uno::Reference< drawing::XShape >( pObj->getUnoShape(), uno::UNO_QUERY);
- return nullptr;
+ if( !pObj )
+ return nullptr;
+
+ uno::Reference< drawing::XShape > xShape = pObj->getUnoShape();
+ rtl::Reference<SvxShape> xShape2 = dynamic_cast<SvxShape*>(xShape.get());
+ assert(xShape2 || !xShape);
+ return xShape2;
}
awt::Rectangle ChartView::getDiagramRectangleExcludingAxes()
@@ -1777,7 +862,7 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool
impl_updateView();
awt::Rectangle aRet;
- uno::Reference< drawing::XShape > xShape( getShapeForCID(rObjectCID) );
+ rtl::Reference< SvxShape > xShape = getShapeForCID(rObjectCID);
if(xShape.is())
{
//special handling for axis for old api:
@@ -1786,21 +871,20 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool
if( eObjectType == OBJECTTYPE_AXIS || eObjectType == OBJECTTYPE_DIAGRAM )
{
SolarMutexGuard aSolarGuard;
- SvxShape* pRoot = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- if( pRoot )
+ SdrObject* pRootSdrObject = xShape->GetSdrObject();
+ if( pRootSdrObject )
{
- SdrObject* pRootSdrObject = pRoot->GetSdrObject();
- if( pRootSdrObject )
+ SdrObjList* pRootList = pRootSdrObject->GetSubList();
+ if( pRootList )
{
- SdrObjList* pRootList = pRootSdrObject->GetSubList();
- if( pRootList )
+ OUString aShapeName = "MarkHandles";
+ if( eObjectType == OBJECTTYPE_DIAGRAM )
+ aShapeName = "PlotAreaIncludingAxes";
+ SdrObject* pShape = DrawModelWrapper::getNamedSdrObject( aShapeName, pRootList );
+ if( pShape )
{
- OUString aShapeName = "MarkHandles";
- if( eObjectType == OBJECTTYPE_DIAGRAM )
- aShapeName = "PlotAreaIncludingAxes";
- SdrObject* pShape = DrawModelWrapper::getNamedSdrObject( aShapeName, pRootList );
- if( pShape )
- xShape.set( pShape->getUnoShape(), uno::UNO_QUERY);
+ xShape = dynamic_cast<SvxShape*>(pShape->getUnoShape().get());
+ assert(xShape);
}
}
}
@@ -1812,15 +896,11 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool
if( bSnapRect )
{
//for rotated objects the shape size and position differs from the visible rectangle
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- if( pShape )
+ SdrObject* pSdrObject = xShape->GetSdrObject();
+ if( pSdrObject )
{
- SdrObject* pSdrObject = pShape->GetSdrObject();
- if( pSdrObject )
- {
- tools::Rectangle aSnapRect( pSdrObject->GetSnapRect() );
- aRet = awt::Rectangle(aSnapRect.Left(),aSnapRect.Top(),aSnapRect.GetWidth(),aSnapRect.GetHeight());
- }
+ tools::Rectangle aSnapRect( pSdrObject->GetSnapRect() );
+ aRet = awt::Rectangle(aSnapRect.Left(),aSnapRect.Top(),aSnapRect.GetWidth(),aSnapRect.GetHeight());
}
}
}
@@ -1834,170 +914,31 @@ std::shared_ptr< DrawModelWrapper > ChartView::getDrawModelWrapper()
namespace
{
-sal_Int32 lcl_getDiagramTitleSpace()
-{
- return 200; //=0,2 cm spacing
-}
-bool lcl_getPropertySwapXAndYAxis( const uno::Reference< XDiagram >& xDiagram )
-{
- bool bSwapXAndY = false;
-
- uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( xCooSysContainer.is() )
- {
- uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
- if( aCooSysList.hasElements() )
- {
- uno::Reference<beans::XPropertySet> xProp(aCooSysList[0], uno::UNO_QUERY );
- if( xProp.is()) try
- {
- xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
- }
- }
- return bSwapXAndY;
-}
-
-}
-sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
- const Reference< chart2::XAxis >& xAxis
- , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
- , const Reference<chart2::XChartDocument>& xChartDoc)
-{
- return AxisHelper::getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xChartDoc
- , true /*bSearchForParallelAxisIfNothingIsFound*/ );
-}
+constexpr double constPageLayoutDistancePercentage = 0.02;
+constexpr sal_Int32 constPageLayoutFixedDistance = 350;
-sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp )
+bool getAvailablePosAndSizeForDiagram(
+ CreateShapeParam2D& rParam, const awt::Size & rPageSize, rtl::Reference<Diagram> const& xDiagram)
{
- sal_Int32 nFormat=0;
- if( !xSeriesOrPointProp.is() )
- return nFormat;
-
- try
- {
- xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat;
- }
- catch (const beans::UnknownPropertyException&) {}
-
- if(nFormat<0)
- nFormat=0;
- return nFormat;
-}
+ uno::Reference<beans::XPropertySet> const& xProp(xDiagram);
+ rParam.mbUseFixedInnerSize = false;
-sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
- const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp,
- const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
-{
- sal_Int32 nFormat=0;
- if( !xSeriesOrPointProp.is() )
- return nFormat;
- if( !(xSeriesOrPointProp->getPropertyValue("PercentageNumberFormat") >>= nFormat) )
- {
- nFormat = DiagramHelper::getPercentNumberFormat( xNumberFormatsSupplier );
- }
- if(nFormat<0)
- nFormat=0;
- return nFormat;
-}
+ //@todo: we need a size dependent on the axis labels
+ rtl::Reference<ChartType> xChartType;
+ if (xDiagram)
+ xChartType = xDiagram->getChartTypeByIndex(0);
-awt::Rectangle ExplicitValueProvider::AddSubtractAxisTitleSizes(
- ChartModel& rModel
- , const Reference< uno::XInterface >& xChartView
- , const awt::Rectangle& rPositionAndSize, bool bSubtract )
-{
- awt::Rectangle aRet(rPositionAndSize);
+ sal_Int32 nXDistance = sal_Int32(rPageSize.Width * constPageLayoutDistancePercentage);
+ sal_Int32 nYDistance = sal_Int32(rPageSize.Height * constPageLayoutDistancePercentage);
- //add axis title sizes to the diagram size
- uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, rModel ) );
- uno::Reference< chart2::XTitle > xTitle_Width( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, rModel ) );
- uno::Reference< chart2::XTitle > xSecondTitle_Height( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, rModel ) );
- uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, rModel ) );
- if( xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is() || xSecondTitle_Width.is() )
+ // Only pie chart uses fixed size margins
+ if (xChartType.is() && xChartType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_PIE)
{
- ExplicitValueProvider* pExplicitValueProvider = comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(xChartView);
- if( pExplicitValueProvider )
- {
- //detect whether x axis points into x direction or not
- if( lcl_getPropertySwapXAndYAxis( rModel.getFirstDiagram() ) )
- {
- std::swap( xTitle_Height, xTitle_Width );
- std::swap( xSecondTitle_Height, xSecondTitle_Width );
- }
-
- sal_Int32 nTitleSpaceWidth = 0;
- sal_Int32 nTitleSpaceHeight = 0;
- sal_Int32 nSecondTitleSpaceWidth = 0;
- sal_Int32 nSecondTitleSpaceHeight = 0;
-
- if( xTitle_Height.is() )
- {
- OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Height, rModel ) );
- nTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
- if( nTitleSpaceHeight )
- nTitleSpaceHeight+=lcl_getDiagramTitleSpace();
- }
- if( xTitle_Width.is() )
- {
- OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Width, rModel ) );
- nTitleSpaceWidth = pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
- if(nTitleSpaceWidth)
- nTitleSpaceWidth+=lcl_getDiagramTitleSpace();
- }
- if( xSecondTitle_Height.is() )
- {
- OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Height, rModel ) );
- nSecondTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
- if( nSecondTitleSpaceHeight )
- nSecondTitleSpaceHeight+=lcl_getDiagramTitleSpace();
- }
- if( xSecondTitle_Width.is() )
- {
- OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Width, rModel ) );
- nSecondTitleSpaceWidth += pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
- if( nSecondTitleSpaceWidth )
- nSecondTitleSpaceWidth+=lcl_getDiagramTitleSpace();
- }
- if( bSubtract )
- {
- aRet.X += nTitleSpaceWidth;
- aRet.Y += nSecondTitleSpaceHeight;
- aRet.Width -= (nTitleSpaceWidth + nSecondTitleSpaceWidth);
- aRet.Height -= (nTitleSpaceHeight + nSecondTitleSpaceHeight);
- }
- else
- {
-
- aRet.X -= nTitleSpaceWidth;
- aRet.Y -= nSecondTitleSpaceHeight;
- aRet.Width += nTitleSpaceWidth + nSecondTitleSpaceWidth;
- aRet.Height += nTitleSpaceHeight + nSecondTitleSpaceHeight;
- }
- }
+ nXDistance = constPageLayoutFixedDistance;
+ nYDistance = constPageLayoutFixedDistance;
}
- return aRet;
-}
-
-namespace {
-double lcl_getPageLayoutDistancePercentage()
-{
- return 0.02;
-}
-
-bool getAvailablePosAndSizeForDiagram(
- CreateShapeParam2D& rParam, const awt::Size & rPageSize, const uno::Reference< beans::XPropertySet >& xProp)
-{
- rParam.mbUseFixedInnerSize = false;
-
- //@todo: we need a size dependent on the axis labels
- sal_Int32 nYDistance = static_cast<sal_Int32>(rPageSize.Height*lcl_getPageLayoutDistancePercentage());
- sal_Int32 nXDistance = static_cast<sal_Int32>(rPageSize.Width*lcl_getPageLayoutDistancePercentage());
rParam.maRemainingSpace.X += nXDistance;
rParam.maRemainingSpace.Width -= 2*nXDistance;
rParam.maRemainingSpace.Y += nYDistance;
@@ -2050,7 +991,7 @@ bool getAvailablePosAndSizeForDiagram(
return true;
}
-enum TitleAlignment { ALIGN_LEFT, ALIGN_TOP, ALIGN_RIGHT, ALIGN_BOTTOM, ALIGN_Z };
+enum class TitleAlignment { ALIGN_LEFT, ALIGN_TOP, ALIGN_RIGHT, ALIGN_BOTTOM, ALIGN_Z };
void changePositionOfAxisTitle( VTitle* pVTitle, TitleAlignment eAlignment
, awt::Rectangle const & rDiagramPlusAxesRect, const awt::Size & rPageSize )
@@ -2060,32 +1001,30 @@ void changePositionOfAxisTitle( VTitle* pVTitle, TitleAlignment eAlignment
awt::Point aNewPosition(0,0);
awt::Size aTitleSize = pVTitle->getFinalSize();
- sal_Int32 nYDistance = static_cast<sal_Int32>(rPageSize.Height*lcl_getPageLayoutDistancePercentage());
- sal_Int32 nXDistance = static_cast<sal_Int32>(rPageSize.Width*lcl_getPageLayoutDistancePercentage());
- switch( eAlignment )
+ sal_Int32 nYDistance = static_cast<sal_Int32>(rPageSize.Height * constPageLayoutDistancePercentage);
+ sal_Int32 nXDistance = static_cast<sal_Int32>(rPageSize.Width * constPageLayoutDistancePercentage);
+ switch (eAlignment)
{
- case ALIGN_TOP:
+ case TitleAlignment::ALIGN_TOP:
aNewPosition = awt::Point( rDiagramPlusAxesRect.X + rDiagramPlusAxesRect.Width/2
, rDiagramPlusAxesRect.Y - aTitleSize.Height/2 - nYDistance );
break;
- case ALIGN_BOTTOM:
+ case TitleAlignment::ALIGN_BOTTOM:
aNewPosition = awt::Point( rDiagramPlusAxesRect.X + rDiagramPlusAxesRect.Width/2
, rDiagramPlusAxesRect.Y + rDiagramPlusAxesRect.Height + aTitleSize.Height/2 + nYDistance );
break;
- case ALIGN_LEFT:
+ case TitleAlignment::ALIGN_LEFT:
aNewPosition = awt::Point( rDiagramPlusAxesRect.X - aTitleSize.Width/2 - nXDistance
, rDiagramPlusAxesRect.Y + rDiagramPlusAxesRect.Height/2 );
break;
- case ALIGN_RIGHT:
+ case TitleAlignment::ALIGN_RIGHT:
aNewPosition = awt::Point( rDiagramPlusAxesRect.X + rDiagramPlusAxesRect.Width + aTitleSize.Width/2 + nXDistance
, rDiagramPlusAxesRect.Y + rDiagramPlusAxesRect.Height/2 );
break;
- case ALIGN_Z:
+ case TitleAlignment::ALIGN_Z:
aNewPosition = awt::Point( rDiagramPlusAxesRect.X + rDiagramPlusAxesRect.Width + aTitleSize.Width/2 + nXDistance
, rDiagramPlusAxesRect.Y + rDiagramPlusAxesRect.Height - aTitleSize.Height/2 );
break;
- default:
- break;
}
sal_Int32 nMaxY = rPageSize.Height - aTitleSize.Height/2;
@@ -2105,8 +1044,7 @@ void changePositionOfAxisTitle( VTitle* pVTitle, TitleAlignment eAlignment
}
std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
- , const uno::Reference< drawing::XShapes>& xPageShapes
- , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
+ , const rtl::Reference<SvxShapeGroupAnyD>& xPageShapes
, ChartModel& rModel
, awt::Rectangle& rRemainingSpace
, const awt::Size & rPageSize
@@ -2116,7 +1054,7 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
std::shared_ptr<VTitle> apVTitle;
// #i109336# Improve auto positioning in chart
- double fPercentage = lcl_getPageLayoutDistancePercentage();
+ double fPercentage = constPageLayoutDistancePercentage;
sal_Int32 nXDistance = static_cast< sal_Int32 >( rPageSize.Width * fPercentage );
sal_Int32 nYDistance = static_cast< sal_Int32 >( rPageSize.Height * fPercentage );
if ( eType == TitleHelper::MAIN_TITLE )
@@ -2132,9 +1070,9 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
nXDistance = 450; // 1/100 mm
}
- uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, rModel ) );
+ rtl::Reference< Title > xTitle( TitleHelper::getTitle( eType, rModel ) );
OUString aCompleteString = TitleHelper::getCompleteString(xTitle);
- if (aCompleteString.isEmpty())
+ if (aCompleteString.isEmpty() || !VTitle::isVisible(xTitle))
return apVTitle;
//create title
@@ -2159,8 +1097,8 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
bYAxisTitle = true;
}
apVTitle = std::make_shared<VTitle>(xTitle);
- OUString aCID = ObjectIdentifier::createClassifiedIdentifierForObject(xTitle, rModel);
- apVTitle->init(xPageShapes, xShapeFactory, aCID);
+ OUString aCID = ObjectIdentifier::createClassifiedIdentifierForObject(xTitle, &rModel);
+ apVTitle->init(xPageShapes, aCID);
apVTitle->createShapes(awt::Point(0, 0), rPageSize, aTextMaxWidth, bYAxisTitle);
awt::Size aTitleUnrotatedSize = apVTitle->getUnrotatedSize();
awt::Size aTitleSize = apVTitle->getFinalSize();
@@ -2169,8 +1107,7 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
rbAutoPosition = true;
awt::Point aNewPosition(0,0);
chart2::RelativePosition aRelativePosition;
- uno::Reference<beans::XPropertySet> xProp(xTitle, uno::UNO_QUERY);
- if (xProp.is() && (xProp->getPropertyValue("RelativePosition") >>= aRelativePosition))
+ if (xTitle.is() && (xTitle->getPropertyValue("RelativePosition") >>= aRelativePosition))
{
rbAutoPosition = false;
@@ -2187,23 +1124,23 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
{
switch( eAlignment )
{
- case ALIGN_TOP:
+ case TitleAlignment::ALIGN_TOP:
aNewPosition = awt::Point( rRemainingSpace.X + rRemainingSpace.Width/2
, rRemainingSpace.Y + aTitleSize.Height/2 + nYDistance );
break;
- case ALIGN_BOTTOM:
+ case TitleAlignment::ALIGN_BOTTOM:
aNewPosition = awt::Point( rRemainingSpace.X + rRemainingSpace.Width/2
, rRemainingSpace.Y + rRemainingSpace.Height - aTitleSize.Height/2 - nYDistance );
break;
- case ALIGN_LEFT:
+ case TitleAlignment::ALIGN_LEFT:
aNewPosition = awt::Point( rRemainingSpace.X + aTitleSize.Width/2 + nXDistance
, rRemainingSpace.Y + rRemainingSpace.Height/2 );
break;
- case ALIGN_RIGHT:
+ case TitleAlignment::ALIGN_RIGHT:
aNewPosition = awt::Point( rRemainingSpace.X + rRemainingSpace.Width - aTitleSize.Width/2 - nXDistance
, rRemainingSpace.Y + rRemainingSpace.Height/2 );
break;
- default:
+ case TitleAlignment::ALIGN_Z:
break;
}
@@ -2213,47 +1150,46 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
//remaining space
switch( eAlignment )
{
- case ALIGN_TOP:
+ case TitleAlignment::ALIGN_TOP:
// Push the remaining space down from top.
rRemainingSpace.Y += ( aTitleSize.Height + nYDistance );
rRemainingSpace.Height -= ( aTitleSize.Height + nYDistance );
break;
- case ALIGN_BOTTOM:
+ case TitleAlignment::ALIGN_BOTTOM:
// Push the remaining space up from bottom.
rRemainingSpace.Height -= ( aTitleSize.Height + nYDistance );
break;
- case ALIGN_LEFT:
+ case TitleAlignment::ALIGN_LEFT:
// Push the remaining space to the right from left edge.
rRemainingSpace.X += ( aTitleSize.Width + nXDistance );
rRemainingSpace.Width -= ( aTitleSize.Width + nXDistance );
break;
- case ALIGN_RIGHT:
+ case TitleAlignment::ALIGN_RIGHT:
// Push the remaining space to the left from right edge.
rRemainingSpace.Width -= ( aTitleSize.Width + nXDistance );
break;
- default:
+ case TitleAlignment::ALIGN_Z:
break;
}
return apVTitle;
}
-bool lcl_createLegend( const uno::Reference< XLegend > & xLegend
- , const uno::Reference< drawing::XShapes>& xPageShapes
- , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
+bool lcl_createLegend( const rtl::Reference< Legend > & xLegend
+ , const rtl::Reference<SvxShapeGroupAnyD>& xPageShapes
, const uno::Reference< uno::XComponentContext > & xContext
, awt::Rectangle & rRemainingSpace
, const awt::Size & rPageSize
, ChartModel& rModel
- , const std::vector< LegendEntryProvider* >& rLegendEntryProviderList
+ , std::vector< LegendEntryProvider* >&& rLegendEntryProviderList
, sal_Int16 nDefaultWritingMode )
{
if (!VLegend::isVisible(xLegend))
return false;
awt::Size rDefaultLegendSize;
- VLegend aVLegend( xLegend, xContext, rLegendEntryProviderList,
- xPageShapes, xShapeFactory, rModel);
+ VLegend aVLegend( xLegend, xContext, std::move(rLegendEntryProviderList),
+ xPageShapes, rModel);
aVLegend.setDefaultWritingMode( nDefaultWritingMode );
aVLegend.createShapes( awt::Size( rRemainingSpace.Width, rRemainingSpace.Height ),
rPageSize, rDefaultLegendSize );
@@ -2261,8 +1197,7 @@ bool lcl_createLegend( const uno::Reference< XLegend > & xLegend
return true;
}
-void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
- const uno::Reference<lang::XMultiServiceFactory>& xShapeFactory,
+void lcl_createButtons(const rtl::Reference<SvxShapeGroupAnyD>& xPageShapes,
ChartModel& rModel,
awt::Rectangle& rRemainingSpace)
{
@@ -2274,7 +1209,7 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
awt::Size aSize(4000, 700); // size of the button
- long x = 0;
+ tools::Long x = 0;
if (xPivotTableDataProvider->getPageFields().hasElements())
{
@@ -2283,19 +1218,19 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
const css::uno::Sequence<chart2::data::PivotTableFieldEntry> aPivotFieldEntries = xPivotTableDataProvider->getPageFields();
for (css::chart2::data::PivotTableFieldEntry const & rPageFieldEntry : aPivotFieldEntries)
{
- std::unique_ptr<VButton> pButton(new VButton);
- pButton->init(xPageShapes, xShapeFactory);
+ VButton aButton;
+ aButton.init(xPageShapes);
awt::Point aNewPosition(rRemainingSpace.X + x + 100, rRemainingSpace.Y + 100);
sal_Int32 nDimensionIndex = rPageFieldEntry.DimensionIndex;
OUString aFieldOutputDescription = xPivotTableDataProvider->getFieldOutputDescription(nDimensionIndex);
- pButton->setLabel(rPageFieldEntry.Name + " | " + aFieldOutputDescription);
- pButton->setCID("FieldButton.Page." + OUString::number(nDimensionIndex));
- pButton->setPosition(aNewPosition);
- pButton->setSize(aSize);
+ aButton.setLabel(rPageFieldEntry.Name + " | " + aFieldOutputDescription);
+ aButton.setCID("FieldButton.Page." + OUString::number(nDimensionIndex));
+ aButton.setPosition(aNewPosition);
+ aButton.setSize(aSize);
if (rPageFieldEntry.HasHiddenMembers)
- pButton->setArrowColor(Color(0x0000FF));
+ aButton.setArrowColor(Color(0x0000FF));
- pButton->createShapes(xModelPage);
+ aButton.createShapes(xModelPage);
x += aSize.Width + 100;
}
rRemainingSpace.Y += (aSize.Height + 100 + 100);
@@ -2311,23 +1246,22 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
const css::uno::Sequence<chart2::data::PivotTableFieldEntry> aPivotFieldEntries = xPivotTableDataProvider->getRowFields();
for (css::chart2::data::PivotTableFieldEntry const & rRowFieldEntry : aPivotFieldEntries)
{
-
- std::unique_ptr<VButton> pButton(new VButton);
- pButton->init(xPageShapes, xShapeFactory);
+ VButton aButton;
+ aButton.init(xPageShapes);
awt::Point aNewPosition(rRemainingSpace.X + x + 100,
rRemainingSpace.Y + rRemainingSpace.Height - aSize.Height - 100);
- pButton->setLabel(rRowFieldEntry.Name);
- pButton->setCID("FieldButton.Row." + OUString::number(rRowFieldEntry.DimensionIndex));
- pButton->setPosition(aNewPosition);
- pButton->setSize(aSize);
+ aButton.setLabel(rRowFieldEntry.Name);
+ aButton.setCID("FieldButton.Row." + OUString::number(rRowFieldEntry.DimensionIndex));
+ aButton.setPosition(aNewPosition);
+ aButton.setSize(aSize);
if ( rRowFieldEntry.Name == "Data" )
{
- pButton->setBGColor( Color(0x00F6F6F6) );
- pButton->showArrow( false );
+ aButton.setBGColor( Color(0x00F6F6F6) );
+ aButton.showArrow( false );
}
else if (rRowFieldEntry.HasHiddenMembers)
- pButton->setArrowColor(Color(0x0000FF));
- pButton->createShapes(xModelPage);
+ aButton.setArrowColor(Color(0x0000FF));
+ aButton.createShapes(xModelPage);
x += aSize.Width + 100;
}
rRemainingSpace.Height -= (aSize.Height + 100 + 100);
@@ -2336,8 +1270,7 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
void formatPage(
ChartModel& rChartModel
, const awt::Size& rPageSize
- , const uno::Reference< drawing::XShapes >& xTarget
- , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
+ , const rtl::Reference<SvxShapeGroupAnyD>& xTarget
)
{
try
@@ -2346,22 +1279,18 @@ void formatPage(
if( ! xModelPage.is())
return;
- if( !xShapeFactory.is() )
- return;
-
//format page
tPropertyNameValueMap aNameValueMap;
PropertyMapper::getValueMap( aNameValueMap, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xModelPage );
- OUString aCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) );
aNameValueMap.emplace( "Name", uno::Any( aCID ) ); //CID OUString
tNameSequence aNames;
tAnySequence aValues;
PropertyMapper::getMultiPropertyListsFromValueMap( aNames, aValues, aNameValueMap );
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
- pShapeFactory->createRectangle(
+ ShapeFactory::createRectangle(
xTarget, rPageSize, awt::Point(0, 0), aNames, aValues);
}
catch( const uno::Exception & )
@@ -2370,33 +1299,26 @@ void formatPage(
}
}
-void lcl_removeEmptyGroupShapes( const Reference< drawing::XShapes>& xParent )
+void lcl_removeEmptyGroupShapes( const SdrObject& rParent )
{
- if(!xParent.is())
+ SdrObjList* pObjList = rParent.getChildrenOfSdrObject();
+ if (!pObjList || pObjList->GetObjCount() == 0)
return;
- Reference< drawing::XShapeGroup > xParentGroup( xParent, uno::UNO_QUERY );
- if( !xParentGroup.is() )
- {
- Reference< drawing::XDrawPage > xPage( xParent, uno::UNO_QUERY );
- if( !xPage.is() )
- return;
- }
//iterate from back!
- for( sal_Int32 nN = xParent->getCount(); nN--; )
+ for(auto nIdx = static_cast<sal_Int32>(pObjList->GetObjCount() - 1); nIdx >= 0; --nIdx)
{
- uno::Any aAny = xParent->getByIndex( nN );
- Reference< drawing::XShapes> xShapes;
- if( aAny >>= xShapes )
- lcl_removeEmptyGroupShapes( xShapes );
- if( xShapes.is() && xShapes->getCount()==0 )
+ SdrObject* pChildSdrObject = pObjList->GetObj(nIdx);
+ SdrObjList* pChildObjList = pChildSdrObject->getChildrenOfSdrObject();
+ if (!pChildObjList)
+ continue;
+ if (pChildObjList->GetObjCount() == 0)
{
//remove empty group shape
- Reference< drawing::XShapeGroup > xGroup( xShapes, uno::UNO_QUERY );
- Reference< drawing::XShape > xShape( xShapes, uno::UNO_QUERY );
- if( xGroup.is() )
- xParent->remove( xShape );
+ pObjList->NbcRemoveObject(nIdx);
}
+ else
+ lcl_removeEmptyGroupShapes(*pChildSdrObject);
}
}
@@ -2429,13 +1351,11 @@ void ChartView::impl_refreshAddIn()
}
}
-static const char* envChartDummyFactory = getenv("CHART_DUMMY_FACTORY");
-
void ChartView::createShapes()
{
SolarMutexGuard aSolarGuard;
- osl::MutexGuard aTimedGuard(maTimeMutex);
+ std::unique_lock aTimedGuard(maTimeMutex);
if(mrChartModel.isTimeBased())
{
maTimeBased.bTimeBased = true;
@@ -2457,13 +1377,15 @@ void ChartView::createShapes()
awt::Size aPageSize = mrChartModel.getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
if(!mxRootShape.is())
- mxRootShape = pShapeFactory->getOrCreateChartRootShape( m_xDrawPage );
+ mxRootShape = ShapeFactory::getOrCreateChartRootShape( m_xDrawPage );
- SdrPage* pPage = ChartView::getSdrPage();
- if(pPage) //it is necessary to use the implementation here as the uno page does not provide a propertyset
+ SdrPage* pPage = getSdrPage();
+
+ if (pPage) //it is necessary to use the implementation here as the uno page does not provide a propertyset
+ {
pPage->SetSize(Size(aPageSize.Width,aPageSize.Height));
+ }
else
{
OSL_FAIL("could not set page size correctly");
@@ -2489,6 +1411,35 @@ void SAL_CALL ChartView::disposing( const lang::EventObject& /* rSource */ )
{
}
+namespace
+{
+// Disables setting the chart's modified state, as well as its parent's (if exists).
+// Painting a chart must not set these states.
+struct ChartModelDisableSetModified
+{
+ ChartModel& mrChartModel;
+ SfxObjectShell* mpParentShell;
+ bool mbWasUnmodified;
+ ChartModelDisableSetModified(ChartModel& rChartModel)
+ : mrChartModel(rChartModel)
+ , mpParentShell(SfxObjectShell::GetShellFromComponent(rChartModel.getParent()))
+ , mbWasUnmodified(!rChartModel.isModified())
+ {
+ if (mpParentShell && mpParentShell->IsEnableSetModified())
+ mpParentShell->EnableSetModified(false);
+ else
+ mpParentShell = nullptr;
+ }
+ ~ChartModelDisableSetModified()
+ {
+ if (mbWasUnmodified && mrChartModel.isModified())
+ mrChartModel.setModified(false);
+ if (mpParentShell)
+ mpParentShell->EnableSetModified(true);
+ }
+};
+}
+
void ChartView::impl_updateView( bool bCheckLockedCtrler )
{
if( !m_pDrawModelWrapper )
@@ -2503,7 +1454,7 @@ void ChartView::impl_updateView( bool bCheckLockedCtrler )
if (bCheckLockedCtrler && mrChartModel.hasControllersLocked())
return;
- if( !(m_bViewDirty && !m_bInViewUpdate) )
+ if( !m_bViewDirty || m_bInViewUpdate )
return;
m_bInViewUpdate = true;
@@ -2519,6 +1470,9 @@ void ChartView::impl_updateView( bool bCheckLockedCtrler )
m_pDrawModelWrapper->lockControllers();
}
+ // Rendering the chart must not set its (or its parent) modified status
+ ChartModelDisableSetModified dontSetModified(mrChartModel);
+
//create chart view
{
m_bViewDirty = false;
@@ -2635,18 +1589,11 @@ void ChartView::impl_notifyModeChangeListener( const OUString& rNewMode )
{
try
{
- ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer
- .getContainer( cppu::UnoType<util::XModeChangeListener>::get());
- if( pIC )
+ std::unique_lock g(m_aMutex);
+ if( m_aModeChangeListeners.getLength(g) )
{
util::ModeChangeEvent aEvent( static_cast< uno::XWeak* >( this ), rNewMode );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- uno::Reference< util::XModeChangeListener > xListener( aIt.next(), uno::UNO_QUERY );
- if( xListener.is() )
- xListener->modeChanged( aEvent );
- }
+ m_aModeChangeListeners.notifyEach( g, &css::util::XModeChangeListener::modeChanged, aEvent);
}
}
catch( const uno::Exception& )
@@ -2659,13 +1606,13 @@ void ChartView::impl_notifyModeChangeListener( const OUString& rNewMode )
void SAL_CALL ChartView::addModeChangeListener( const uno::Reference< util::XModeChangeListener >& xListener )
{
- m_aListenerContainer.addInterface(
- cppu::UnoType<util::XModeChangeListener>::get(), xListener );
+ std::unique_lock g(m_aMutex);
+ m_aModeChangeListeners.addInterface(g, xListener );
}
void SAL_CALL ChartView::removeModeChangeListener( const uno::Reference< util::XModeChangeListener >& xListener )
{
- m_aListenerContainer.removeInterface(
- cppu::UnoType<util::XModeChangeListener>::get(), xListener );
+ std::unique_lock g(m_aMutex);
+ m_aModeChangeListeners.removeInterface(g, xListener );
}
void SAL_CALL ChartView::addModeChangeApproveListener( const uno::Reference< util::XModeChangeApproveListener >& /* _rxListener */ )
{
@@ -2734,20 +1681,16 @@ void SAL_CALL ChartView::setPropertyValue( const OUString& rPropertyName
if( ! (rValue >>= aZoomFactors) )
throw lang::IllegalArgumentException( "Property 'ZoomFactors' requires value of type Sequence< PropertyValue >", nullptr, 0 );
- sal_Int32 nFilterArgs = aZoomFactors.getLength();
- beans::PropertyValue* pDataValues = aZoomFactors.getArray();
- while( nFilterArgs-- )
+ for (auto& propval : aZoomFactors)
{
- if ( pDataValues->Name == "ScaleXNumerator" )
- pDataValues->Value >>= m_nScaleXNumerator;
- else if ( pDataValues->Name == "ScaleXDenominator" )
- pDataValues->Value >>= m_nScaleXDenominator;
- else if ( pDataValues->Name == "ScaleYNumerator" )
- pDataValues->Value >>= m_nScaleYNumerator;
- else if ( pDataValues->Name == "ScaleYDenominator" )
- pDataValues->Value >>= m_nScaleYDenominator;
-
- pDataValues++;
+ if (propval.Name == "ScaleXNumerator")
+ propval.Value >>= m_nScaleXNumerator;
+ else if (propval.Name == "ScaleXDenominator")
+ propval.Value >>= m_nScaleXDenominator;
+ else if (propval.Name == "ScaleYNumerator")
+ propval.Value >>= m_nScaleYNumerator;
+ else if (propval.Name == "ScaleYDenominator")
+ propval.Value >>= m_nScaleYDenominator;
}
}
else if( rPropertyName == "SdrViewIsInEditMode" )
@@ -2859,38 +1802,40 @@ Reference< uno::XInterface > ChartView::createInstanceWithArguments( const OUStr
uno::Sequence< OUString > ChartView::getAvailableServiceNames()
{
- uno::Sequence< OUString > aServiceNames( 6 );
-
- aServiceNames[0] = "com.sun.star.drawing.DashTable";
- aServiceNames[1] = "com.sun.star.drawing.GradientTable";
- aServiceNames[2] = "com.sun.star.drawing.HatchTable";
- aServiceNames[3] = "com.sun.star.drawing.BitmapTable";
- aServiceNames[4] = "com.sun.star.drawing.TransparencyGradientTable";
- aServiceNames[5] = "com.sun.star.drawing.MarkerTable";
+ uno::Sequence< OUString > aServiceNames{ "com.sun.star.drawing.DashTable",
+ "com.sun.star.drawing.GradientTable",
+ "com.sun.star.drawing.HatchTable",
+ "com.sun.star.drawing.BitmapTable",
+ "com.sun.star.drawing.TransparencyGradientTable",
+ "com.sun.star.drawing.MarkerTable" };
return aServiceNames;
}
-OUString ChartView::dump()
+OUString ChartView::dump(OUString const & kind)
{
+ if (kind.isEmpty()) {
+ return comphelper::dumpXmlToString([this](auto writer) { return dumpAsXml(writer); });
+ }
+
+ // kind == "shapes":
#if HAVE_FEATURE_DESKTOP
// Used for unit tests and in chartcontroller only, no need to drag in this when cross-compiling
// for non-desktop
impl_updateView();
- uno::Reference< drawing::XShapes > xShapes( m_xDrawPage, uno::UNO_QUERY_THROW );
- sal_Int32 n = xShapes->getCount();
+ sal_Int32 n = m_xDrawPage->getCount();
OUStringBuffer aBuffer;
for(sal_Int32 i = 0; i < n; ++i)
{
- uno::Reference< drawing::XShapes > xShape(xShapes->getByIndex(i), uno::UNO_QUERY);
+ uno::Reference< drawing::XShapes > xShape(m_xDrawPage->getByIndex(i), uno::UNO_QUERY);
if(xShape.is())
{
- OUString aString = XShapeDumper::dump(mxRootShape);
+ OUString aString = XShapeDumper::dump(uno::Reference<drawing::XShapes>(mxRootShape));
aBuffer.append(aString);
}
else
{
- uno::Reference< drawing::XShape > xSingleShape(xShapes->getByIndex(i), uno::UNO_QUERY);
+ uno::Reference< drawing::XShape > xSingleShape(m_xDrawPage->getByIndex(i), uno::UNO_QUERY);
if(!xSingleShape.is())
continue;
OUString aString = XShapeDumper::dump(xSingleShape);
@@ -2907,20 +1852,20 @@ OUString ChartView::dump()
void ChartView::dumpAsXml(xmlTextWriterPtr pWriter) const
{
- xmlTextWriterStartElement(pWriter, BAD_CAST("ChartView"));
- xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ChartView"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
if (m_pDrawModelWrapper)
{
m_pDrawModelWrapper->dumpAsXml(pWriter);
}
- xmlTextWriterEndElement(pWriter);
+ (void)xmlTextWriterEndElement(pWriter);
}
void ChartView::setViewDirty()
{
- osl::MutexGuard aGuard(maTimeMutex);
+ std::unique_lock aGuard(maTimeMutex);
m_bViewDirty = true;
}
@@ -2932,11 +1877,9 @@ IMPL_LINK_NOARG(ChartView, UpdateTimeBased, Timer *, void)
void ChartView::createShapes2D( const awt::Size& rPageSize )
{
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
-
// todo: it would be nicer to just pass the page m_xDrawPage and format it,
// but the draw page does not support XPropertySet
- formatPage( mrChartModel, rPageSize, mxRootShape, m_xShapeFactory );
+ formatPage( mrChartModel, rPageSize, mxRootShape );
CreateShapeParam2D aParam;
aParam.maRemainingSpace.X = 0;
@@ -2945,40 +1888,39 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
aParam.maRemainingSpace.Height = rPageSize.Height;
//create the group shape for diagram and axes first to have title and legends on top of it
- uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
- uno::Reference< beans::XPropertySet > xProp(xDiagram, uno::UNO_QUERY);
+ rtl::Reference< Diagram > xDiagram( mrChartModel.getFirstChartDiagram() );
bool bHasRelativeSize = false;
- if( xProp.is() && xProp->getPropertyValue("RelativeSize").hasValue() )
+ if( xDiagram.is() && xDiagram->getPropertyValue("RelativeSize").hasValue() )
bHasRelativeSize = true;
OUString aDiagramCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) ) );//todo: other index if more than one diagram is possible
- uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes(
- pShapeFactory->createGroup2D(mxRootShape,aDiagramCID) );
+ rtl::Reference<SvxShapeGroup> xDiagramPlusAxesPlusMarkHandlesGroup_Shapes =
+ ShapeFactory::createGroup2D(mxRootShape,aDiagramCID);
- aParam.mxMarkHandles = pShapeFactory->createInvisibleRectangle(
+ aParam.mxMarkHandles = ShapeFactory::createInvisibleRectangle(
xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0));
ShapeFactory::setShapeName(aParam.mxMarkHandles, "MarkHandles");
- aParam.mxPlotAreaWithAxes = pShapeFactory->createInvisibleRectangle(
+ aParam.mxPlotAreaWithAxes = ShapeFactory::createInvisibleRectangle(
xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0, 0));
ShapeFactory::setShapeName(aParam.mxPlotAreaWithAxes, "PlotAreaIncludingAxes");
- aParam.mxDiagramWithAxesShapes = pShapeFactory->createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes);
+ aParam.mxDiagramWithAxesShapes = ShapeFactory::createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes);
bool bAutoPositionDummy = true;
// create buttons
- lcl_createButtons(mxRootShape, m_xShapeFactory, mrChartModel, aParam.maRemainingSpace);
+ lcl_createButtons(mxRootShape, mrChartModel, aParam.maRemainingSpace);
lcl_createTitle(
- TitleHelper::MAIN_TITLE, mxRootShape, m_xShapeFactory, mrChartModel,
- aParam.maRemainingSpace, rPageSize, ALIGN_TOP, bAutoPositionDummy);
+ TitleHelper::MAIN_TITLE, mxRootShape, mrChartModel,
+ aParam.maRemainingSpace, rPageSize, TitleAlignment::ALIGN_TOP, bAutoPositionDummy);
if (!bHasRelativeSize && (aParam.maRemainingSpace.Width <= 0 || aParam.maRemainingSpace.Height <= 0))
return;
lcl_createTitle(
- TitleHelper::SUB_TITLE, mxRootShape, m_xShapeFactory, mrChartModel,
- aParam.maRemainingSpace, rPageSize, ALIGN_TOP, bAutoPositionDummy );
+ TitleHelper::SUB_TITLE, mxRootShape, mrChartModel,
+ aParam.maRemainingSpace, rPageSize, TitleAlignment::ALIGN_TOP, bAutoPositionDummy );
if (!bHasRelativeSize && (aParam.maRemainingSpace.Width <= 0 || aParam.maRemainingSpace.Height <= 0))
return;
@@ -2986,7 +1928,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
aParam.mpSeriesPlotterContainer->initializeCooSysAndSeriesPlotter( mrChartModel );
if(maTimeBased.bTimeBased && maTimeBased.nFrame != 0)
{
- SeriesPlottersType& rSeriesPlotter = aParam.mpSeriesPlotterContainer->getSeriesPlotterList();
+ auto& rSeriesPlotter = aParam.mpSeriesPlotterContainer->getSeriesPlotterList();
size_t n = rSeriesPlotter.size();
for(size_t i = 0; i < n; ++i)
{
@@ -3003,7 +1945,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
}
lcl_createLegend(
- LegendHelper::getLegend( mrChartModel ), mxRootShape, m_xShapeFactory, m_xCC,
+ LegendHelper::getLegend( mrChartModel ), mxRootShape, getComponentContext(),
aParam.maRemainingSpace, rPageSize, mrChartModel, aParam.mpSeriesPlotterContainer->getLegendEntryProviderList(),
lcl_getDefaultWritingModeFromPool( m_pDrawModelWrapper ) );
@@ -3014,9 +1956,9 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
return;
bool bDummy = false;
- bool bIsVertical = DiagramHelper::getVertical(xDiagram, bDummy, bDummy);
+ bool bIsVertical = xDiagram && xDiagram->getVertical(bDummy, bDummy);
- if (getAvailablePosAndSizeForDiagram(aParam, rPageSize, xProp))
+ if (getAvailablePosAndSizeForDiagram(aParam, rPageSize, xDiagram))
{
awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent(aParam, rPageSize);
@@ -3029,24 +1971,24 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
//correct axis title position
awt::Rectangle aDiagramPlusAxesRect( aUsedOuterRect );
if (aParam.mbAutoPosTitleX)
- changePositionOfAxisTitle(aParam.mpVTitleX.get(), ALIGN_BOTTOM, aDiagramPlusAxesRect, rPageSize);
+ changePositionOfAxisTitle(aParam.mpVTitleX.get(), TitleAlignment::ALIGN_BOTTOM, aDiagramPlusAxesRect, rPageSize);
if (aParam.mbAutoPosTitleY)
- changePositionOfAxisTitle(aParam.mpVTitleY.get(), ALIGN_LEFT, aDiagramPlusAxesRect, rPageSize);
+ changePositionOfAxisTitle(aParam.mpVTitleY.get(), TitleAlignment::ALIGN_LEFT, aDiagramPlusAxesRect, rPageSize);
if (aParam.mbAutoPosTitleZ)
- changePositionOfAxisTitle(aParam.mpVTitleZ.get(), ALIGN_Z, aDiagramPlusAxesRect, rPageSize);
+ changePositionOfAxisTitle(aParam.mpVTitleZ.get(), TitleAlignment::ALIGN_Z, aDiagramPlusAxesRect, rPageSize);
if (aParam.mbAutoPosSecondTitleX)
- changePositionOfAxisTitle(aParam.mpVTitleSecondX.get(), bIsVertical? ALIGN_RIGHT : ALIGN_TOP, aDiagramPlusAxesRect, rPageSize);
+ changePositionOfAxisTitle(aParam.mpVTitleSecondX.get(), bIsVertical? TitleAlignment::ALIGN_RIGHT : TitleAlignment::ALIGN_TOP, aDiagramPlusAxesRect, rPageSize);
if (aParam.mbAutoPosSecondTitleY)
- changePositionOfAxisTitle(aParam.mpVTitleSecondY.get(), bIsVertical? ALIGN_TOP : ALIGN_RIGHT, aDiagramPlusAxesRect, rPageSize);
+ changePositionOfAxisTitle(aParam.mpVTitleSecondY.get(), bIsVertical? TitleAlignment::ALIGN_TOP : TitleAlignment::ALIGN_RIGHT, aDiagramPlusAxesRect, rPageSize);
}
//cleanup: remove all empty group shapes to avoid grey border lines:
- lcl_removeEmptyGroupShapes( mxRootShape );
+ lcl_removeEmptyGroupShapes( *mxRootShape->GetSdrObject() );
if(maTimeBased.bTimeBased && maTimeBased.nFrame % 60 == 0)
{
// create copy of the data for next frame
- SeriesPlottersType& rSeriesPlotter = aParam.mpSeriesPlotterContainer->getSeriesPlotterList();
+ auto& rSeriesPlotter = aParam.mpSeriesPlotterContainer->getSeriesPlotterList();
size_t n = rSeriesPlotter.size();
maTimeBased.m_aDataSeriesList.clear();
maTimeBased.m_aDataSeriesList.resize(n);
@@ -3075,41 +2017,46 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
bool ChartView::createAxisTitleShapes2D( CreateShapeParam2D& rParam, const css::awt::Size& rPageSize, bool bHasRelativeSize )
{
- uno::Reference<XDiagram> xDiagram = mrChartModel.getFirstDiagram();
+ rtl::Reference<Diagram> xDiagram = mrChartModel.getFirstChartDiagram();
- Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
- sal_Int32 nDimension = DiagramHelper::getDimension( xDiagram );
+ rtl::Reference< ChartType > xChartType;
+ sal_Int32 nDimension = 0;
+ if (xDiagram)
+ {
+ xChartType = xDiagram->getChartTypeByIndex( 0 );
+ nDimension = xDiagram->getDimension();
+ }
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 0 ) )
- rParam.mpVTitleX = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, mxRootShape, m_xShapeFactory, mrChartModel
- , rParam.maRemainingSpace, rPageSize, ALIGN_BOTTOM, rParam.mbAutoPosTitleX );
+ rParam.mpVTitleX = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, mxRootShape, mrChartModel
+ , rParam.maRemainingSpace, rPageSize, TitleAlignment::ALIGN_BOTTOM, rParam.mbAutoPosTitleX );
if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0))
return false;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 1 ) )
- rParam.mpVTitleY = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, mxRootShape, m_xShapeFactory, mrChartModel
- , rParam.maRemainingSpace, rPageSize, ALIGN_LEFT, rParam.mbAutoPosTitleY );
+ rParam.mpVTitleY = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, mxRootShape, mrChartModel
+ , rParam.maRemainingSpace, rPageSize, TitleAlignment::ALIGN_LEFT, rParam.mbAutoPosTitleY );
if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0))
return false;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 2 ) )
- rParam.mpVTitleZ = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, mxRootShape, m_xShapeFactory, mrChartModel
- , rParam.maRemainingSpace, rPageSize, ALIGN_RIGHT, rParam.mbAutoPosTitleZ );
+ rParam.mpVTitleZ = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, mxRootShape, mrChartModel
+ , rParam.maRemainingSpace, rPageSize, TitleAlignment::ALIGN_RIGHT, rParam.mbAutoPosTitleZ );
if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0))
return false;
bool bDummy = false;
- bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy );
+ bool bIsVertical = xDiagram && xDiagram->getVertical( bDummy, bDummy );
if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension ) )
- rParam.mpVTitleSecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, mxRootShape, m_xShapeFactory, mrChartModel
- , rParam.maRemainingSpace, rPageSize, bIsVertical? ALIGN_RIGHT : ALIGN_TOP, rParam.mbAutoPosSecondTitleX );
+ rParam.mpVTitleSecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, mxRootShape, mrChartModel
+ , rParam.maRemainingSpace, rPageSize, bIsVertical? TitleAlignment::ALIGN_RIGHT : TitleAlignment::ALIGN_TOP, rParam.mbAutoPosSecondTitleX );
if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0))
return false;
if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension ) )
- rParam.mpVTitleSecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, mxRootShape, m_xShapeFactory, mrChartModel
- , rParam.maRemainingSpace, rPageSize, bIsVertical? ALIGN_TOP : ALIGN_RIGHT, rParam.mbAutoPosSecondTitleY );
+ rParam.mpVTitleSecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, mxRootShape, mrChartModel
+ , rParam.maRemainingSpace, rPageSize, bIsVertical? TitleAlignment::ALIGN_TOP : TitleAlignment::ALIGN_RIGHT, rParam.mbAutoPosSecondTitleY );
if (!bHasRelativeSize && (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0))
return false;
@@ -3122,7 +2069,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
com_sun_star_comp_chart2_ChartView_get_implementation(css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- ::chart::ChartModel *pChartModel = new ::chart::ChartModel(context);
+ rtl::Reference<::chart::ChartModel> pChartModel = new ::chart::ChartModel(context);
return cppu::acquire(new ::chart::ChartView(context, *pChartModel));
}
diff --git a/chart2/source/view/main/Clipping.cxx b/chart2/source/view/main/Clipping.cxx
index 463b74975a91..713e88c26bd0 100644
--- a/chart2/source/view/main/Clipping.cxx
+++ b/chart2/source/view/main/Clipping.cxx
@@ -21,6 +21,7 @@
#include <CommonConverters.hxx>
#include <BaseGFXHelper.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/drawing/Position3D.hpp>
@@ -204,6 +205,47 @@ void lcl_addPointToPoly( drawing::PolyPolygonShape3D& rPoly
rResultPointCount[nPolygonIndex]=nNewResultPointCount;
}
+void lcl_addPointToPoly( std::vector<std::vector<css::drawing::Position3D>>& rPoly
+ , const drawing::Position3D& rPos
+ , sal_Int32 nPolygonIndex
+ , std::vector< sal_Int32 >& rResultPointCount
+ , sal_Int32 nReservePointCount )
+{
+ if(nPolygonIndex<0)
+ {
+ OSL_FAIL( "The polygon index needs to be > 0");
+ nPolygonIndex=0;
+ }
+
+ //make sure that we have enough polygons
+ if(o3tl::make_unsigned(nPolygonIndex) >= rPoly.size() )
+ {
+ rPoly.resize(nPolygonIndex+1);
+ rResultPointCount.resize(nPolygonIndex+1,0);
+ }
+
+ std::vector<css::drawing::Position3D>* pOuterSequence = &rPoly[nPolygonIndex];
+
+ sal_Int32 nNewResultPointCount = rResultPointCount[nPolygonIndex]+1;
+ sal_Int32 nSeqLength = pOuterSequence->size();
+
+ if( nSeqLength <= nNewResultPointCount )
+ {
+ sal_Int32 nReallocLength = nReservePointCount > SAL_MAX_INT16 ? round_up_nearest_pow2(nNewResultPointCount) * 2 : nReservePointCount;
+ if( nNewResultPointCount > nReallocLength )
+ {
+ nReallocLength = nNewResultPointCount;
+ OSL_FAIL("this should not be the case to avoid performance problems");
+ }
+ pOuterSequence->resize(nReallocLength);
+ }
+
+ css::drawing::Position3D* pInnerSequence = pOuterSequence->data();
+
+ pInnerSequence[nNewResultPointCount-1] = rPos;
+ rResultPointCount[nPolygonIndex]=nNewResultPointCount;
+}
+
}//end anonymous namespace
void Clipping::clipPolygonAtRectangle( const drawing::PolyPolygonShape3D& rPolygon
@@ -295,6 +337,89 @@ void Clipping::clipPolygonAtRectangle( const drawing::PolyPolygonShape3D& rPolyg
}
}
+void Clipping::clipPolygonAtRectangle( const std::vector<std::vector<css::drawing::Position3D>>& rPolygon
+ , const B2DRectangle& rRectangle
+ , std::vector<std::vector<css::drawing::Position3D>>& aResult
+ , bool bSplitPiecesToDifferentPolygons )
+{
+ aResult.clear();
+
+ if(rPolygon.empty())
+ return;
+
+ //need clipping?:
+ {
+ ::basegfx::B3DRange a3DRange( BaseGFXHelper::getBoundVolume( rPolygon ) );
+ ::basegfx::B2DRange a2DRange( a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY() );
+ if( rRectangle.isInside( a2DRange ) )
+ {
+ aResult = rPolygon;
+ return;
+ }
+ else
+ {
+ a2DRange.intersect( rRectangle );
+ if( a2DRange.isEmpty() )
+ return;
+ }
+ }
+
+ std::vector< sal_Int32 > aResultPointCount;//per polygon index
+
+ //apply clipping:
+ drawing::Position3D aFrom;
+ drawing::Position3D aTo;
+
+ sal_Int32 nNewPolyIndex = 0;
+ sal_Int32 nOldPolyCount = rPolygon.size();
+ for(sal_Int32 nOldPolyIndex=0; nOldPolyIndex<nOldPolyCount; nOldPolyIndex++, nNewPolyIndex++ )
+ {
+ sal_Int32 nOldPointCount = rPolygon[nOldPolyIndex].size();
+
+ // set last point to a position outside the rectangle, such that the first
+ // time lcl_clip2d returns true, the comparison to last will always yield false
+ drawing::Position3D aLast(rRectangle.getMinX()-1.0,rRectangle.getMinY()-1.0, 0.0 );
+
+ for(sal_Int32 nOldPoint=1; nOldPoint<nOldPointCount; nOldPoint++)
+ {
+ aFrom = getPointFromPoly(rPolygon,nOldPoint-1,nOldPolyIndex);
+ aTo = getPointFromPoly(rPolygon,nOldPoint,nOldPolyIndex);
+ if( lcl_clip2d_(aFrom, aTo, rRectangle) )
+ {
+ // compose a Polygon of as many consecutive points as possible
+ if(aFrom == aLast)
+ {
+ if( aTo != aFrom )
+ {
+ lcl_addPointToPoly( aResult, aTo, nNewPolyIndex, aResultPointCount, nOldPointCount );
+ }
+ }
+ else
+ {
+ if( bSplitPiecesToDifferentPolygons && nOldPoint!=1 )
+ {
+ if( nNewPolyIndex < static_cast<sal_Int32>(aResult.size())
+ && aResultPointCount[nNewPolyIndex]>0 )
+ nNewPolyIndex++;
+ }
+ lcl_addPointToPoly( aResult, aFrom, nNewPolyIndex, aResultPointCount, nOldPointCount );
+ if( aTo != aFrom )
+ lcl_addPointToPoly( aResult, aTo, nNewPolyIndex, aResultPointCount, nOldPointCount );
+ }
+ aLast = aTo;
+ }
+ }
+ }
+ //free unused space
+ for( sal_Int32 nPolygonIndex = aResultPointCount.size(); nPolygonIndex--; )
+ {
+ std::vector<css::drawing::Position3D>* pOuterSequence = &aResult[nPolygonIndex];
+
+ sal_Int32 nUsedPointCount = aResultPointCount[nPolygonIndex];
+ pOuterSequence->resize(nUsedPointCount);
+ }
+}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/DataPointSymbolSupplier.cxx b/chart2/source/view/main/DataPointSymbolSupplier.cxx
index 7f446139ac22..ff7f8370ac32 100644
--- a/chart2/source/view/main/DataPointSymbolSupplier.cxx
+++ b/chart2/source/view/main/DataPointSymbolSupplier.cxx
@@ -25,19 +25,16 @@ namespace chart
{
using namespace ::com::sun::star;
-uno::Reference< drawing::XShapes > DataPointSymbolSupplier::create2DSymbolList(
- const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
- , const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference< SvxShapeGroup > DataPointSymbolSupplier::create2DSymbolList(
+ const rtl::Reference<SvxDrawPage>& xTarget
, const drawing::Direction3D& rSize )
{
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
- uno::Reference< drawing::XShapes > xGroupShapes =
- pShapeFactory->createGroup2D( xTarget );
+ rtl::Reference< SvxShapeGroup > xGroupShapes = ShapeFactory::createGroup2D( xTarget );
drawing::Position3D aPos(0,0,0);
for(sal_Int32 nS=0;nS<ShapeFactory::getSymbolCount();nS++)
{
- pShapeFactory->createSymbol2D( xGroupShapes, aPos, rSize, nS, 0, 0 );
+ ShapeFactory::createSymbol2D( xGroupShapes, aPos, rSize, nS, 0, 0 );
}
return xGroupShapes;
}
diff --git a/chart2/source/view/main/DataTableView.cxx b/chart2/source/view/main/DataTableView.cxx
new file mode 100644
index 000000000000..eacd91a6a651
--- /dev/null
+++ b/chart2/source/view/main/DataTableView.cxx
@@ -0,0 +1,559 @@
+/* -*- 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 <DataTableView.hxx>
+#include <VSeriesPlotter.hxx>
+#include <ShapeFactory.hxx>
+#include <ExplicitCategoriesProvider.hxx>
+#include <ChartModel.hxx>
+#include <ObjectIdentifier.hxx>
+
+#include <svx/svdotable.hxx>
+
+#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/table/BorderLineStyle.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/util/XBroadcaster.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <o3tl/unit_conversion.hxx>
+
+using namespace css;
+
+namespace chart
+{
+namespace
+{
+void setTopCell(uno::Reference<beans::XPropertySet>& xPropertySet)
+{
+ xPropertySet->setPropertyValue("FillColor", uno::Any(Color(0xFFFFFF)));
+ xPropertySet->setPropertyValue("TextVerticalAdjust", uno::Any(drawing::TextVerticalAdjust_TOP));
+ xPropertySet->setPropertyValue("ParaAdjust", uno::Any(style::ParagraphAdjust_CENTER));
+
+ table::BorderLine2 aBorderLine;
+ aBorderLine.LineWidth = 0;
+ aBorderLine.Color = 0x000000;
+
+ xPropertySet->setPropertyValue("TopBorder", uno::Any(aBorderLine));
+ xPropertySet->setPropertyValue("LeftBorder", uno::Any(aBorderLine));
+}
+
+void copyProperty(uno::Reference<beans::XPropertySet>& xOut,
+ uno::Reference<beans::XPropertySet>& xIn, OUString const& sPropertyName)
+{
+ xOut->setPropertyValue(sPropertyName, xIn->getPropertyValue(sPropertyName));
+}
+
+uno::Reference<text::XTextRange> getFirstParagraph(uno::Reference<text::XText> const& xText)
+{
+ uno::Reference<text::XTextRange> xParagraph;
+ uno::Reference<container::XEnumerationAccess> xEnumAccess(xText, uno::UNO_QUERY);
+ if (!xEnumAccess.is())
+ return xParagraph;
+ uno::Reference<container::XEnumeration> xEnumeration(xEnumAccess->createEnumeration());
+ xParagraph.set(xEnumeration->nextElement(), uno::UNO_QUERY);
+ return xParagraph;
+}
+
+uno::Reference<beans::XPropertySet>
+getFirstParagraphProperties(uno::Reference<text::XText> const& xText)
+{
+ uno::Reference<beans::XPropertySet> xPropertySet;
+ auto xParagraph = getFirstParagraph(xText);
+ if (!xParagraph.is())
+ return xPropertySet;
+ xPropertySet.set(xParagraph, uno::UNO_QUERY);
+ return xPropertySet;
+}
+
+} // end anonymous namespace
+
+DataTableView::DataTableView(
+ rtl::Reference<::chart::ChartModel> const& xChartModel,
+ rtl::Reference<DataTable> const& rDataTableModel,
+ css::uno::Reference<css::uno::XComponentContext> const& rComponentContext,
+ bool bAlignAxisValuesWithColumns)
+ : m_xChartModel(xChartModel)
+ , m_xDataTableModel(rDataTableModel)
+ , m_xComponentContext(rComponentContext)
+ , m_bAlignAxisValuesWithColumns(bAlignAxisValuesWithColumns)
+{
+ uno::Reference<beans::XPropertySet> xPropertySet(m_xDataTableModel);
+ m_aLineProperties.initFromPropertySet(xPropertySet);
+}
+
+void DataTableView::setCellCharAndParagraphProperties(
+ uno::Reference<beans::XPropertySet>& xPropertySet)
+{
+ uno::Reference<beans::XPropertySet> xDataTableProperties(m_xDataTableModel);
+
+ copyProperty(xPropertySet, xDataTableProperties, "CharColor");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontFamily");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontFamilyAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontFamilyComplex");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSet");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSetAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSetComplex");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontName");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontNameAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontNameComplex");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontPitch");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontPitchAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontPitchComplex");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontStyleName");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontStyleNameAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharFontStyleNameComplex");
+
+ copyProperty(xPropertySet, xDataTableProperties, "CharHeight");
+ copyProperty(xPropertySet, xDataTableProperties, "CharHeightAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharHeightComplex");
+ copyProperty(xPropertySet, xDataTableProperties, "CharKerning");
+ copyProperty(xPropertySet, xDataTableProperties, "CharLocale");
+ copyProperty(xPropertySet, xDataTableProperties, "CharLocaleAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharLocaleComplex");
+ copyProperty(xPropertySet, xDataTableProperties, "CharPosture");
+ copyProperty(xPropertySet, xDataTableProperties, "CharPostureAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharPostureComplex");
+ copyProperty(xPropertySet, xDataTableProperties, "CharRelief");
+ copyProperty(xPropertySet, xDataTableProperties, "CharShadowed");
+ copyProperty(xPropertySet, xDataTableProperties, "CharStrikeout");
+ copyProperty(xPropertySet, xDataTableProperties, "CharUnderline");
+ copyProperty(xPropertySet, xDataTableProperties, "CharUnderlineColor");
+ copyProperty(xPropertySet, xDataTableProperties, "CharUnderlineHasColor");
+ copyProperty(xPropertySet, xDataTableProperties, "CharOverline");
+ copyProperty(xPropertySet, xDataTableProperties, "CharOverlineColor");
+ copyProperty(xPropertySet, xDataTableProperties, "CharOverlineHasColor");
+ copyProperty(xPropertySet, xDataTableProperties, "CharWeight");
+ copyProperty(xPropertySet, xDataTableProperties, "CharWeightAsian");
+ copyProperty(xPropertySet, xDataTableProperties, "CharWeightComplex");
+ copyProperty(xPropertySet, xDataTableProperties, "CharWordMode");
+
+ drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
+ xDataTableProperties->getPropertyValue("FillStyle") >>= eFillStyle;
+ if (eFillStyle == drawing::FillStyle_SOLID)
+ {
+ sal_Int32 aColor = 0;
+ if (xDataTableProperties->getPropertyValue("FillColor") >>= aColor)
+ xPropertySet->setPropertyValue("CharBackColor", uno::Any(aColor));
+ }
+
+ xPropertySet->setPropertyValue("ParaAdjust", uno::Any(style::ParagraphAdjust_CENTER));
+}
+
+void DataTableView::setCellProperties(css::uno::Reference<beans::XPropertySet>& xPropertySet,
+ bool bLeft, bool bTop, bool bRight, bool bBottom)
+{
+ xPropertySet->setPropertyValue("FillColor", uno::Any(Color(0xFFFFFF)));
+
+ uno::Reference<beans::XPropertySet> xDataTableProperties(m_xDataTableModel);
+ float fFontHeight = 0.0;
+ xDataTableProperties->getPropertyValue("CharHeight") >>= fFontHeight;
+ fFontHeight = o3tl::convert(fFontHeight, o3tl::Length::pt, o3tl::Length::mm100);
+ sal_Int32 nXDistance = std::round(fFontHeight * 0.18f);
+ sal_Int32 nYDistance = std::round(fFontHeight * 0.30f);
+
+ xPropertySet->setPropertyValue("TextLeftDistance", uno::Any(nXDistance));
+ xPropertySet->setPropertyValue("TextRightDistance", uno::Any(nXDistance));
+ xPropertySet->setPropertyValue("TextUpperDistance", uno::Any(nYDistance));
+ xPropertySet->setPropertyValue("TextLowerDistance", uno::Any(nYDistance));
+
+ xPropertySet->setPropertyValue("TextVerticalAdjust", uno::Any(drawing::TextVerticalAdjust_TOP));
+
+ drawing::LineStyle eStyle = drawing::LineStyle_NONE;
+ m_aLineProperties.LineStyle >>= eStyle;
+
+ if (eStyle != drawing::LineStyle_NONE)
+ {
+ table::BorderLine2 aBorderLine;
+
+ sal_Int32 nWidth = 0;
+ m_aLineProperties.Width >>= nWidth;
+ aBorderLine.LineWidth = o3tl::convert(nWidth, o3tl::Length::mm100, o3tl::Length::twip);
+
+ sal_Int32 nColor = 0;
+ m_aLineProperties.Color >>= nColor;
+ aBorderLine.Color = nColor;
+
+ aBorderLine.LineStyle = table::BorderLineStyle::SOLID;
+
+ if (eStyle == drawing::LineStyle_DASH)
+ {
+ OUString aDashName;
+ m_aLineProperties.DashName >>= aDashName;
+ if (!aDashName.isEmpty() && m_xChartModel.is())
+ {
+ uno::Reference<container::XNameContainer> xDashTable(
+ m_xChartModel->createInstance("com.sun.star.drawing.DashTable"),
+ uno::UNO_QUERY);
+ if (xDashTable.is() && xDashTable->hasByName(aDashName))
+ {
+ drawing::LineDash aLineDash;
+ xDashTable->getByName(aDashName) >>= aLineDash;
+
+ if (aLineDash.Dots == 0 && aLineDash.Dashes == 0)
+ aBorderLine.LineStyle = table::BorderLineStyle::SOLID;
+ else if (aLineDash.Dots == 1 && aLineDash.Dashes == 0)
+ aBorderLine.LineStyle = table::BorderLineStyle::DOTTED;
+ else if (aLineDash.Dots == 0 && aLineDash.Dashes == 1)
+ aBorderLine.LineStyle = table::BorderLineStyle::DASHED;
+ else if (aLineDash.Dots == 1 && aLineDash.Dashes == 1)
+ aBorderLine.LineStyle = table::BorderLineStyle::DASH_DOT;
+ else if (aLineDash.Dots == 2 && aLineDash.Dashes == 1)
+ aBorderLine.LineStyle = table::BorderLineStyle::DASH_DOT_DOT;
+ else
+ aBorderLine.LineStyle = table::BorderLineStyle::DASHED;
+ }
+ }
+ }
+
+ if (bLeft)
+ xPropertySet->setPropertyValue("LeftBorder", uno::Any(aBorderLine));
+ if (bTop)
+ xPropertySet->setPropertyValue("TopBorder", uno::Any(aBorderLine));
+ if (bRight)
+ xPropertySet->setPropertyValue("RightBorder", uno::Any(aBorderLine));
+ if (bBottom)
+ xPropertySet->setPropertyValue("BottomBorder", uno::Any(aBorderLine));
+ }
+}
+
+void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DVector const& rEnd,
+ sal_Int32 nAxisStepWidth)
+{
+ if (!m_xTarget.is())
+ return;
+
+ // Remove shapes first before we add the new ones
+ ShapeFactory::removeSubShapes(m_xTarget);
+ auto sParticle = ObjectIdentifier::createParticleForDataTable(m_xChartModel);
+ auto sCID = ObjectIdentifier::createClassifiedIdentifierForParticle(sParticle);
+ m_xTableShape = ShapeFactory::createTable(m_xTarget, sCID);
+
+ // calculate the table size
+ auto rDelta = rEnd - rStart;
+ sal_Int32 nTableSize = basegfx::fround(rDelta.getX());
+ m_xTableShape->setSize({ nTableSize, 0 });
+
+ try
+ {
+ m_xTableShape->getPropertyValue("Model") >>= m_xTable;
+ }
+ catch (const uno::Exception&)
+ {
+ return;
+ }
+
+ if (!m_xTable.is())
+ return;
+
+ uno::Reference<util::XBroadcaster> xBroadcaster(m_xTable, uno::UNO_QUERY);
+
+ if (!xBroadcaster.is())
+ return;
+
+ xBroadcaster->lockBroadcasts();
+
+ auto* pTableObject = static_cast<sdr::table::SdrTableObj*>(m_xTableShape->GetSdrObject());
+
+ // get the data table properties from the model
+ bool bHBorder = false;
+ bool bVBorder = false;
+ bool bOutline = false;
+ bool bKeys = false;
+
+ std::vector<ViewLegendSymbol> aSymbols;
+
+ m_xDataTableModel->getPropertyValue("HBorder") >>= bHBorder;
+ m_xDataTableModel->getPropertyValue("VBorder") >>= bVBorder;
+ m_xDataTableModel->getPropertyValue("Outline") >>= bOutline;
+ m_xDataTableModel->getPropertyValue("Keys") >>= bKeys;
+
+ // set the data table row and column size
+ sal_Int32 nColumnCount = m_aXValues.size();
+ uno::Reference<table::XTableColumns> xTableColumns = m_xTable->getColumns();
+ xTableColumns->insertByIndex(0, nColumnCount);
+
+ sal_Int32 nRowCount = m_aDataSeriesNames.size();
+ uno::Reference<table::XTableRows> xTableRows = m_xTable->getRows();
+ xTableRows->insertByIndex(0, nRowCount);
+
+ sal_Int32 nColumnWidth = 0.0;
+
+ // If we don't align, we have to calculate the column width ourselves,
+ // otherwise the column width is taken from the x-axis width
+ if (m_bAlignAxisValuesWithColumns)
+ nColumnWidth = nAxisStepWidth;
+ else
+ nColumnWidth = double(nTableSize) / nColumnCount;
+
+ // Setup empty top-left cell
+ {
+ uno::Reference<table::XCell> xCell = m_xTable->getCellByPosition(0, 0);
+ uno::Reference<beans::XPropertySet> xPropertySet(xCell, uno::UNO_QUERY);
+ if (xPropertySet.is())
+ {
+ setTopCell(xPropertySet);
+ }
+ }
+
+ sal_Int32 nColumn;
+ sal_Int32 nRow;
+
+ // COLUMN HEADER
+
+ nColumn = 1;
+ for (auto const& rString : m_aXValues)
+ {
+ uno::Reference<table::XCell> xCell = m_xTable->getCellByPosition(nColumn, 0);
+ uno::Reference<beans::XPropertySet> xPropertySet(xCell, uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCellTextRange(xCell, uno::UNO_QUERY);
+ if (xCellTextRange.is())
+ {
+ auto xText = xCellTextRange->getText();
+ xText->insertString(xText->getStart(), rString, false);
+ auto xTextPropertySet = getFirstParagraphProperties(xText);
+ if (!xTextPropertySet.is())
+ continue;
+
+ bool bLeft
+ = (bOutline && nColumn == 1) || (bVBorder && nColumn > 1 && nColumn < nColumnCount);
+ bool bRight = (bOutline && nColumn == nColumnCount)
+ || (bVBorder && nColumn > 1 && nColumn < nColumnCount);
+ setCellCharAndParagraphProperties(xTextPropertySet);
+ setCellProperties(xPropertySet, bLeft, bOutline, bRight, bOutline);
+ }
+ nColumn++;
+ }
+
+ // ROW HEADER
+ // Prepare keys (symbols)
+ sal_Int32 nMaxSymbolWidth = 0;
+ constexpr const sal_Int32 constSymbolMargin = 100; // 1mm
+ if (bKeys)
+ {
+ uno::Reference<beans::XPropertySet> xDataTableProperties(m_xDataTableModel);
+ float fFontHeight = 0.0;
+ xDataTableProperties->getPropertyValue("CharHeight") >>= fFontHeight;
+ fFontHeight = o3tl::convert(fFontHeight, o3tl::Length::pt, o3tl::Length::mm100);
+
+ sal_Int32 nSymbolHeight = sal_Int32(fFontHeight * 0.6);
+ sal_Int32 nSymbolWidth = nSymbolHeight;
+
+ for (VSeriesPlotter* pSeriesPlotter : m_pSeriesPlotterList)
+ {
+ if (pSeriesPlotter)
+ {
+ awt::Size aCurrentRatio = pSeriesPlotter->getPreferredLegendKeyAspectRatio();
+ sal_Int32 nCurrentWidth = aCurrentRatio.Width;
+ if (aCurrentRatio.Height > 0)
+ nCurrentWidth = nSymbolHeight * aCurrentRatio.Width / aCurrentRatio.Height;
+ nSymbolWidth = std::max(nSymbolWidth, nCurrentWidth);
+ }
+ }
+ nMaxSymbolWidth = nSymbolWidth;
+
+ for (VSeriesPlotter* pSeriesPlotter : m_pSeriesPlotterList)
+ {
+ if (pSeriesPlotter)
+ {
+ awt::Size aSize(nSymbolWidth, nSymbolHeight);
+ std::vector<ViewLegendSymbol> aNewEntries
+ = pSeriesPlotter->createSymbols(aSize, m_xTarget, m_xComponentContext);
+
+ for (auto const& rSymbol : aNewEntries)
+ aSymbols.push_back(rSymbol);
+ }
+ }
+ }
+
+ nRow = 1;
+ for (auto const& rSeriesName : m_aDataSeriesNames)
+ {
+ uno::Reference<table::XCell> xCell = m_xTable->getCellByPosition(0, nRow);
+ uno::Reference<beans::XPropertySet> xCellPropertySet(xCell, uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCellTextRange(xCell, uno::UNO_QUERY);
+ if (xCellTextRange.is())
+ {
+ bool bTop = (bOutline && nRow == 1) || (bHBorder && nRow > 1 && nRow < nRowCount);
+ bool bBottom
+ = (bOutline && nRow == nRowCount) || (bHBorder && nRow > 1 && nRow < nRowCount);
+
+ auto xText = xCellTextRange->getText();
+ xText->insertString(xText->getStart(), rSeriesName, false);
+ auto xTextPropertySet = getFirstParagraphProperties(xText);
+ if (!xTextPropertySet.is())
+ continue;
+ setCellCharAndParagraphProperties(xTextPropertySet);
+ setCellProperties(xCellPropertySet, bOutline, bTop, bOutline, bBottom);
+
+ xCellPropertySet->setPropertyValue("ParaAdjust", uno::Any(style::ParagraphAdjust_LEFT));
+ if (bKeys)
+ {
+ xCellPropertySet->setPropertyValue(
+ "ParaLeftMargin", uno::Any(nMaxSymbolWidth + sal_Int32(2 * constSymbolMargin)));
+ }
+ }
+ nRow++;
+ }
+
+ // TABLE
+ nRow = 1;
+ for (auto const& rSeries : m_pDataSeriesValues)
+ {
+ nColumn = 1;
+ for (auto const& rValue : rSeries)
+ {
+ uno::Reference<table::XCell> xCell = m_xTable->getCellByPosition(nColumn, nRow);
+ uno::Reference<beans::XPropertySet> xCellPropertySet(xCell, uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCellTextRange(xCell, uno::UNO_QUERY);
+ if (xCellTextRange.is())
+ {
+ auto xText = xCellTextRange->getText();
+ xText->insertString(xText->getStart(), rValue, false);
+ auto xTextPropertySet = getFirstParagraphProperties(xText);
+ if (!xTextPropertySet.is())
+ continue;
+
+ bool bLeft = false;
+ bool bTop = false;
+ bool bRight = false;
+ bool bBottom = false;
+
+ if (nColumn > 1 && bVBorder)
+ bLeft = true;
+
+ if (nRow > 1 && bHBorder)
+ bTop = true;
+
+ if (nRow == nRowCount && bOutline)
+ bBottom = true;
+
+ if (nColumn == nColumnCount && bOutline)
+ bRight = true;
+
+ setCellCharAndParagraphProperties(xTextPropertySet);
+ setCellProperties(xCellPropertySet, bLeft, bTop, bRight, bBottom);
+ }
+ nColumn++;
+ }
+ nRow++;
+ }
+
+ // force recalculation of column widths in the table shape
+ xBroadcaster->unlockBroadcasts();
+ pTableObject->DistributeColumns(0, nColumnCount, true, true);
+
+ xBroadcaster->lockBroadcasts();
+
+ // reposition the data table
+ changePosition(basegfx::fround(rStart.getX()), basegfx::fround(rStart.getY()));
+
+ sal_Int32 nTableX = m_xTableShape->getPosition().X;
+ sal_Int32 nTableY = m_xTableShape->getPosition().Y;
+
+ uno::Reference<beans::XPropertySet> xPropertySet(xTableColumns->getByIndex(0), uno::UNO_QUERY);
+
+ for (sal_Int32 i = 1; i < xTableColumns->getCount(); ++i)
+ {
+ xPropertySet.set(xTableColumns->getByIndex(i), uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("Width", uno::Any(nColumnWidth));
+ }
+
+ // force recalculation of row heights in the table shape
+ xBroadcaster->unlockBroadcasts();
+ pTableObject->DistributeRows(0, nRowCount, true, true);
+
+ if (bKeys)
+ {
+ sal_Int32 nTotalHeight = 0;
+ for (sal_Int32 i = 0; i < xTableRows->getCount(); i++)
+ {
+ sal_Int32 nSymbolIndex = i - 1;
+ if (nSymbolIndex < sal_Int32(aSymbols.size()))
+ {
+ xPropertySet.set(xTableRows->getByIndex(i), uno::UNO_QUERY);
+ sal_Int32 nHeight = 0;
+ xPropertySet->getPropertyValue("Height") >>= nHeight;
+ if (i > 0)
+ {
+ auto& rSymbol = aSymbols[nSymbolIndex].xSymbol;
+ sal_Int32 nSymbolHeight = rSymbol->getSize().Height;
+ sal_Int32 nSymbolY
+ = basegfx::fround(double(nHeight) / 2.0 - double(nSymbolHeight) / 2.0);
+ rSymbol->setPosition(
+ { nTableX + constSymbolMargin, nTableY + nTotalHeight + nSymbolY });
+ }
+ nTotalHeight += nHeight;
+ }
+ }
+ }
+}
+
+void DataTableView::changePosition(sal_Int32 x, sal_Int32 y)
+{
+ if (!m_xTable.is())
+ return;
+
+ uno::Reference<table::XTableColumns> xTableColumns = m_xTable->getColumns();
+ uno::Reference<beans::XPropertySet> xPropertySet(xTableColumns->getByIndex(0), uno::UNO_QUERY);
+
+ sal_Int32 nWidth = 0;
+ xPropertySet->getPropertyValue("Width") >>= nWidth;
+
+ m_xTarget->setPosition({ x - nWidth, y });
+}
+
+void DataTableView::initializeShapes(const rtl::Reference<SvxShapeGroupAnyD>& xTarget)
+{
+ m_xTarget = xTarget;
+}
+
+void DataTableView::initializeValues(
+ std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList)
+{
+ for (auto& rSeriesPlotter : rSeriesPlotterList)
+ {
+ m_pSeriesPlotterList.push_back(rSeriesPlotter.get());
+
+ for (auto const& rCategory :
+ rSeriesPlotter->getExplicitCategoriesProvider()->getSimpleCategories())
+ {
+ m_aXValues.push_back(rCategory);
+ }
+
+ for (auto const& rString : rSeriesPlotter->getAllSeriesNames())
+ {
+ m_aDataSeriesNames.push_back(rString);
+ }
+
+ for (VDataSeries* pSeries : rSeriesPlotter->getAllSeries())
+ {
+ auto& rValues = m_pDataSeriesValues.emplace_back();
+ for (int i = 0; i < pSeries->getTotalPointCount(); i++)
+ {
+ double nValue = pSeries->getYValue(i);
+ rValues.push_back(rSeriesPlotter->getLabelTextForValue(*pSeries, i, nValue, false));
+ }
+ }
+ }
+}
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
index 1d9bc2914ce2..71cd8d699cf7 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -23,19 +23,16 @@
#include <ObjectIdentifier.hxx>
#include <svx/unomodel.hxx>
#include <svl/itempool.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/eeitem.hxx>
-#include <svx/svx3ditems.hxx>
#include <svx/objfac3d.hxx>
#include <svx/svdpage.hxx>
+#include <svx/svx3ditems.hxx>
#include <svx/xtable.hxx>
#include <svx/svdoutl.hxx>
#include <editeng/unolingu.hxx>
#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
#include <libxml/xmlwriter.h>
-
-#include <com/sun/star/container/XChild.hpp>
+#include <osl/diagnose.h>
namespace com::sun::star::linguistic2 { class XHyphenator; }
namespace com::sun::star::linguistic2 { class XSpellChecker1; }
@@ -48,31 +45,19 @@ namespace chart
DrawModelWrapper::DrawModelWrapper()
: SdrModel()
- , m_pChartItemPool(nullptr)
{
- m_pChartItemPool = ChartItemPool::CreateChartItemPool();
+ m_xChartItemPool = ChartItemPool::CreateChartItemPool();
- SetScaleUnit(MapUnit::Map100thMM);
- SetScaleFraction(Fraction(1, 1));
SetDefaultFontHeight(423); // 12pt
SfxItemPool* pMasterPool = &GetItemPool();
pMasterPool->SetDefaultMetric(MapUnit::Map100thMM);
- pMasterPool->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, true) );
- pMasterPool->SetPoolDefaultItem(makeSvx3DPercentDiagonalItem (5));
+ pMasterPool->SetUserDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, true) );
+ pMasterPool->SetUserDefaultItem(makeSvx3DPercentDiagonalItem (5));
- SfxItemPool* pPool = pMasterPool;
// append chart pool to end of pool chain
- for (;;)
- {
- SfxItemPool* pSecondary = pPool->GetSecondaryPool();
- if (!pSecondary)
- break;
-
- pPool = pSecondary;
- }
- pPool->SetSecondaryPool(m_pChartItemPool);
- pMasterPool->FreezeIdRanges();
+ pMasterPool->GetLastPoolInChain()->SetSecondaryPool(m_xChartItemPool.get());
+ SetTextDefaults();
//this factory needs to be created before first use of 3D scenes once upon an office runtime
//@todo in future this should be done by drawing engine itself on demand
@@ -115,35 +100,36 @@ DrawModelWrapper::DrawModelWrapper()
DrawModelWrapper::~DrawModelWrapper()
{
+ // normally call from ~SdrModel, but do it here explicitly before we clear m_xChartItemPool
+ implDtorClearModel();
+
//remove m_pChartItemPool from pool chain
- if(m_pChartItemPool)
+ if (m_xChartItemPool)
{
SfxItemPool* pPool = &GetItemPool();
for (;;)
{
SfxItemPool* pSecondary = pPool->GetSecondaryPool();
- if(pSecondary == m_pChartItemPool)
+ if(pSecondary == m_xChartItemPool.get())
{
pPool->SetSecondaryPool (nullptr);
break;
}
pPool = pSecondary;
}
- SfxItemPool::Free(m_pChartItemPool);
+ m_xChartItemPool.clear();
}
m_pRefDevice.disposeAndClear();
}
-uno::Reference< uno::XInterface > DrawModelWrapper::createUnoModel()
+uno::Reference< frame::XModel > DrawModelWrapper::createUnoModel()
{
- uno::Reference< lang::XComponent > xComponent = new SvxUnoDrawingModel( this ); //tell Andreas Schluens if SvxUnoDrawingModel is not needed anymore -> remove export from svx to avoid link problems in writer
- return uno::Reference< uno::XInterface >::query( xComponent );
+ return new SvxUnoDrawingModel( this ); //tell Andreas Schluens if SvxUnoDrawingModel is not needed anymore -> remove export from svx to avoid link problems in writer
}
uno::Reference< frame::XModel > DrawModelWrapper::getUnoModel()
{
- uno::Reference< uno::XInterface > xI = SdrModel::getUnoModel();
- return uno::Reference<frame::XModel>::query( xI );
+ return SdrModel::getUnoModel();
}
SdrModel& DrawModelWrapper::getSdrModel()
@@ -157,7 +143,7 @@ uno::Reference< lang::XMultiServiceFactory > DrawModelWrapper::getShapeFactory()
return xShapeFactory;
}
-uno::Reference< drawing::XDrawPage > const & DrawModelWrapper::getMainDrawPage()
+const rtl::Reference<SvxDrawPage> & DrawModelWrapper::getMainDrawPage()
{
if (m_xMainDrawPage.is())
return m_xMainDrawPage;
@@ -172,12 +158,16 @@ uno::Reference< drawing::XDrawPage > const & DrawModelWrapper::getMainDrawPage()
{
// Take the first page in case of multiple pages.
uno::Any aPage = xDrawPages->getByIndex(0);
- aPage >>= m_xMainDrawPage;
+ uno::Reference<drawing::XDrawPage> xTmp;
+ aPage >>= xTmp;
+ m_xMainDrawPage = dynamic_cast<SvxDrawPage*>(xTmp.get());
+ assert(m_xMainDrawPage);
}
if (!m_xMainDrawPage.is())
{
- m_xMainDrawPage = xDrawPages->insertNewByIndex(0);
+ m_xMainDrawPage = dynamic_cast<SvxDrawPage*>(xDrawPages->insertNewByIndex(0).get());
+ assert(m_xMainDrawPage);
}
//ensure that additional shapes are in front of the chart objects so create the chart root before
@@ -186,7 +176,8 @@ uno::Reference< drawing::XDrawPage > const & DrawModelWrapper::getMainDrawPage()
// ShapeFactory::getOrCreateShapeFactory(getShapeFactory())->getOrCreateChartRootShape( m_xMainDrawPage );
return m_xMainDrawPage;
}
-uno::Reference< drawing::XDrawPage > const & DrawModelWrapper::getHiddenDrawPage()
+
+const rtl::Reference<SvxDrawPage> & DrawModelWrapper::getHiddenDrawPage()
{
if( !m_xHiddenDrawPage.is() )
{
@@ -197,14 +188,21 @@ uno::Reference< drawing::XDrawPage > const & DrawModelWrapper::getHiddenDrawPage
if( xDrawPages->getCount()>1 )
{
uno::Any aPage = xDrawPages->getByIndex( 1 ) ;
- aPage >>= m_xHiddenDrawPage;
+ uno::Reference<drawing::XDrawPage> xTmp;
+ aPage >>= xTmp;
+ m_xHiddenDrawPage = dynamic_cast<SvxDrawPage*>(xTmp.get());
+ assert(m_xHiddenDrawPage);
}
if(!m_xHiddenDrawPage.is())
{
if( xDrawPages->getCount()==0 )
- m_xMainDrawPage = xDrawPages->insertNewByIndex( 0 );
- m_xHiddenDrawPage = xDrawPages->insertNewByIndex( 1 );
+ {
+ m_xMainDrawPage = dynamic_cast<SvxDrawPage*>(xDrawPages->insertNewByIndex( 0 ).get());
+ assert(m_xMainDrawPage);
+ }
+ m_xHiddenDrawPage = dynamic_cast<SvxDrawPage*>(xDrawPages->insertNewByIndex( 1 ).get());
+ assert(m_xHiddenDrawPage);
}
}
}
@@ -213,7 +211,7 @@ uno::Reference< drawing::XDrawPage > const & DrawModelWrapper::getHiddenDrawPage
void DrawModelWrapper::clearMainDrawPage()
{
//uno::Reference<drawing::XShapes> xChartRoot( m_xMainDrawPage, uno::UNO_QUERY );
- uno::Reference<drawing::XShapes> xChartRoot( ShapeFactory::getChartRootShape( m_xMainDrawPage ) );
+ rtl::Reference<SvxShapeGroupAnyD> xChartRoot( ShapeFactory::getChartRootShape( m_xMainDrawPage ) );
if( xChartRoot.is() )
{
sal_Int32 nSubCount = xChartRoot->getCount();
@@ -226,8 +224,7 @@ void DrawModelWrapper::clearMainDrawPage()
}
}
-uno::Reference< drawing::XShapes > DrawModelWrapper::getChartRootShape(
- const uno::Reference< drawing::XDrawPage>& xDrawPage )
+rtl::Reference<SvxShapeGroupAnyD> DrawModelWrapper::getChartRootShape( const rtl::Reference<SvxDrawPage>& xDrawPage )
{
return ShapeFactory::getChartRootShape( xDrawPage );
}
@@ -295,44 +292,36 @@ SdrObject* DrawModelWrapper::getNamedSdrObject( const OUString& rObjectCID, SdrO
{
if(!pSearchList || rObjectCID.isEmpty())
return nullptr;
- const size_t nCount = pSearchList->GetObjCount();
- for( size_t nN=0; nN<nCount; ++nN )
+ for (const rtl::Reference<SdrObject>& pObj : *pSearchList)
{
- SdrObject* pObj = pSearchList->GetObj(nN);
- if(!pObj)
- continue;
if( ObjectIdentifier::areIdenticalObjects( rObjectCID, pObj->GetName() ) )
- return pObj;
- pObj = DrawModelWrapper::getNamedSdrObject( rObjectCID, pObj->GetSubList() );
- if(pObj)
- return pObj;
+ return pObj.get();
+ SdrObject* pNamedObj = DrawModelWrapper::getNamedSdrObject( rObjectCID, pObj->GetSubList() );
+ if(pNamedObj)
+ return pNamedObj;
}
return nullptr;
}
-bool DrawModelWrapper::removeShape( const uno::Reference< drawing::XShape >& xShape )
+bool DrawModelWrapper::removeShape( const rtl::Reference<SvxShape>& xShape )
{
- uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
- if( xChild.is() )
+ uno::Reference<drawing::XShapes> xShapes( xShape->getParent(), uno::UNO_QUERY );
+ if( xShapes.is() )
{
- uno::Reference<drawing::XShapes> xShapes( xChild->getParent(), uno::UNO_QUERY );
- if( xShapes.is() )
- {
- xShapes->remove(xShape);
- return true;
- }
+ xShapes->remove(xShape);
+ return true;
}
return false;
}
void DrawModelWrapper::dumpAsXml(xmlTextWriterPtr pWriter) const
{
- xmlTextWriterStartElement(pWriter, BAD_CAST("DrawModelWrapper"));
- xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("DrawModelWrapper"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
SdrModel::dumpAsXml(pWriter);
- xmlTextWriterEndElement(pWriter);
+ (void)xmlTextWriterEndElement(pWriter);
}
} //namespace chart
diff --git a/chart2/source/view/main/ExplicitValueProvider.cxx b/chart2/source/view/main/ExplicitValueProvider.cxx
new file mode 100644
index 000000000000..52f259d341c9
--- /dev/null
+++ b/chart2/source/view/main/ExplicitValueProvider.cxx
@@ -0,0 +1,203 @@
+/* -*- 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 <chartview/ExplicitValueProvider.hxx>
+#include <AxisHelper.hxx>
+#include <ChartModel.hxx>
+#include <Diagram.hxx>
+#include <DiagramHelper.hxx>
+#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <TitleHelper.hxx>
+#include <ObjectIdentifier.hxx>
+
+#include <comphelper/servicehelper.hxx>
+#include <comphelper/diagnose_ex.hxx>
+
+namespace chart
+{
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+namespace
+{
+constexpr sal_Int32 constDiagramTitleSpace = 200; //=0,2 cm spacing
+
+bool lcl_getPropertySwapXAndYAxis(const rtl::Reference<Diagram>& xDiagram)
+{
+ bool bSwapXAndY = false;
+
+ if (xDiagram.is())
+ {
+ const std::vector<rtl::Reference<BaseCoordinateSystem>>& aCooSysList(
+ xDiagram->getBaseCoordinateSystems());
+ if (!aCooSysList.empty())
+ {
+ try
+ {
+ aCooSysList[0]->getPropertyValue("SwapXAndYAxis") >>= bSwapXAndY;
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ }
+ return bSwapXAndY;
+}
+
+} // end anonymous namespace
+
+sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+ const rtl::Reference<::chart::Axis>& xAxis,
+ const rtl::Reference<::chart::BaseCoordinateSystem>& xCorrespondingCoordinateSystem,
+ const rtl::Reference<::chart::ChartModel>& xChartDoc)
+{
+ return AxisHelper::getExplicitNumberFormatKeyForAxis(
+ xAxis, xCorrespondingCoordinateSystem, xChartDoc,
+ true /*bSearchForParallelAxisIfNothingIsFound*/);
+}
+
+sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ const uno::Reference<beans::XPropertySet>& xSeriesOrPointProp)
+{
+ sal_Int32 nFormat = 0;
+ if (!xSeriesOrPointProp.is())
+ return nFormat;
+
+ try
+ {
+ xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat;
+ }
+ catch (const beans::UnknownPropertyException&)
+ {
+ }
+
+ if (nFormat < 0)
+ nFormat = 0;
+ return nFormat;
+}
+
+sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
+ const uno::Reference<beans::XPropertySet>& xSeriesOrPointProp,
+ const uno::Reference<util::XNumberFormatsSupplier>& xNumberFormatsSupplier)
+{
+ sal_Int32 nFormat = 0;
+ if (!xSeriesOrPointProp.is())
+ return nFormat;
+ if (!(xSeriesOrPointProp->getPropertyValue("PercentageNumberFormat") >>= nFormat))
+ {
+ nFormat = DiagramHelper::getPercentNumberFormat(xNumberFormatsSupplier);
+ }
+ if (nFormat < 0)
+ nFormat = 0;
+ return nFormat;
+}
+
+awt::Rectangle ExplicitValueProvider::AddSubtractAxisTitleSizes(
+ ChartModel& rModel, ExplicitValueProvider* pChartView, const awt::Rectangle& rPositionAndSize,
+ bool bSubtract)
+{
+ awt::Rectangle aRet(rPositionAndSize);
+
+ //add axis title sizes to the diagram size
+ rtl::Reference<::chart::Title> xTitle_Height(
+ TitleHelper::getTitle(TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, rModel));
+ rtl::Reference<::chart::Title> xTitle_Width(
+ TitleHelper::getTitle(TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, rModel));
+ rtl::Reference<::chart::Title> xSecondTitle_Height(
+ TitleHelper::getTitle(TitleHelper::SECONDARY_X_AXIS_TITLE, rModel));
+ rtl::Reference<::chart::Title> xSecondTitle_Width(
+ TitleHelper::getTitle(TitleHelper::SECONDARY_Y_AXIS_TITLE, rModel));
+ if (xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is()
+ || xSecondTitle_Width.is())
+ {
+ ExplicitValueProvider* pExplicitValueProvider = pChartView;
+ if (pExplicitValueProvider)
+ {
+ //detect whether x axis points into x direction or not
+ if (lcl_getPropertySwapXAndYAxis(rModel.getFirstChartDiagram()))
+ {
+ std::swap(xTitle_Height, xTitle_Width);
+ std::swap(xSecondTitle_Height, xSecondTitle_Width);
+ }
+
+ sal_Int32 nTitleSpaceWidth = 0;
+ sal_Int32 nTitleSpaceHeight = 0;
+ sal_Int32 nSecondTitleSpaceWidth = 0;
+ sal_Int32 nSecondTitleSpaceHeight = 0;
+
+ if (xTitle_Height.is())
+ {
+ OUString aCID_X(
+ ObjectIdentifier::createClassifiedIdentifierForObject(xTitle_Height, &rModel));
+ nTitleSpaceHeight
+ = pExplicitValueProvider->getRectangleOfObject(aCID_X, true).Height;
+ if (nTitleSpaceHeight)
+ nTitleSpaceHeight += constDiagramTitleSpace;
+ }
+ if (xTitle_Width.is())
+ {
+ OUString aCID_Y(
+ ObjectIdentifier::createClassifiedIdentifierForObject(xTitle_Width, &rModel));
+ nTitleSpaceWidth = pExplicitValueProvider->getRectangleOfObject(aCID_Y, true).Width;
+ if (nTitleSpaceWidth)
+ nTitleSpaceWidth += constDiagramTitleSpace;
+ }
+ if (xSecondTitle_Height.is())
+ {
+ OUString aCID_X(ObjectIdentifier::createClassifiedIdentifierForObject(
+ xSecondTitle_Height, &rModel));
+ nSecondTitleSpaceHeight
+ = pExplicitValueProvider->getRectangleOfObject(aCID_X, true).Height;
+ if (nSecondTitleSpaceHeight)
+ nSecondTitleSpaceHeight += constDiagramTitleSpace;
+ }
+ if (xSecondTitle_Width.is())
+ {
+ OUString aCID_Y(ObjectIdentifier::createClassifiedIdentifierForObject(
+ xSecondTitle_Width, &rModel));
+ nSecondTitleSpaceWidth
+ += pExplicitValueProvider->getRectangleOfObject(aCID_Y, true).Width;
+ if (nSecondTitleSpaceWidth)
+ nSecondTitleSpaceWidth += constDiagramTitleSpace;
+ }
+ if (bSubtract)
+ {
+ aRet.X += nTitleSpaceWidth;
+ aRet.Y += nSecondTitleSpaceHeight;
+ aRet.Width -= (nTitleSpaceWidth + nSecondTitleSpaceWidth);
+ aRet.Height -= (nTitleSpaceHeight + nSecondTitleSpaceHeight);
+ }
+ else
+ {
+ aRet.X -= nTitleSpaceWidth;
+ aRet.Y -= nSecondTitleSpaceHeight;
+ aRet.Width += nTitleSpaceWidth + nSecondTitleSpaceWidth;
+ aRet.Height += nTitleSpaceHeight + nSecondTitleSpaceHeight;
+ }
+ }
+ }
+ return aRet;
+}
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx
index 811bf7ad148b..3112c591243d 100644
--- a/chart2/source/view/main/LabelPositionHelper.cxx
+++ b/chart2/source/view/main/LabelPositionHelper.cxx
@@ -24,20 +24,19 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
+
+#include <cmath>
+#include <utility>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
LabelPositionHelper::LabelPositionHelper(
sal_Int32 nDimensionCount
- , const uno::Reference< drawing::XShapes >& xLogicTarget
- , ShapeFactory* pShapeFactory )
+ , rtl::Reference<SvxShapeGroupAnyD> xLogicTarget)
: m_nDimensionCount(nDimensionCount)
- , m_xLogicTarget(xLogicTarget)
- , m_pShapeFactory(pShapeFactory)
+ , m_xLogicTarget(std::move(xLogicTarget))
{
}
@@ -48,33 +47,33 @@ LabelPositionHelper::~LabelPositionHelper()
awt::Point LabelPositionHelper::transformSceneToScreenPosition( const drawing::Position3D& rScenePosition3D ) const
{
return PlottingPositionHelper::transformSceneToScreenPosition(
- rScenePosition3D, m_xLogicTarget, m_pShapeFactory, m_nDimensionCount );
+ rScenePosition3D, m_xLogicTarget, m_nDimensionCount );
}
void LabelPositionHelper::changeTextAdjustment( tAnySequence& rPropValues, const tNameSequence& rPropNames, LabelAlignment eAlignment)
{
- //HorizontalAdjustment
+ uno::Any* pHorizontalAdjustAny
+ = PropertyMapper::getValuePointer(rPropValues, rPropNames, u"TextHorizontalAdjust");
+ if (pHorizontalAdjustAny)
{
drawing::TextHorizontalAdjust eHorizontalAdjust = drawing::TextHorizontalAdjust_CENTER;
if( eAlignment==LABEL_ALIGN_RIGHT || eAlignment==LABEL_ALIGN_RIGHT_TOP || eAlignment==LABEL_ALIGN_RIGHT_BOTTOM )
eHorizontalAdjust = drawing::TextHorizontalAdjust_LEFT;
else if( eAlignment==LABEL_ALIGN_LEFT || eAlignment==LABEL_ALIGN_LEFT_TOP || eAlignment==LABEL_ALIGN_LEFT_BOTTOM )
eHorizontalAdjust = drawing::TextHorizontalAdjust_RIGHT;
- uno::Any* pHorizontalAdjustAny = PropertyMapper::getValuePointer(rPropValues,rPropNames,"TextHorizontalAdjust");
- if(pHorizontalAdjustAny)
- *pHorizontalAdjustAny <<= eHorizontalAdjust;
+ *pHorizontalAdjustAny <<= eHorizontalAdjust;
}
- //VerticalAdjustment
+ uno::Any* pVerticalAdjustAny
+ = PropertyMapper::getValuePointer(rPropValues, rPropNames, u"TextVerticalAdjust");
+ if (pVerticalAdjustAny)
{
drawing::TextVerticalAdjust eVerticalAdjust = drawing::TextVerticalAdjust_CENTER;
if( eAlignment==LABEL_ALIGN_TOP || eAlignment==LABEL_ALIGN_RIGHT_TOP || eAlignment==LABEL_ALIGN_LEFT_TOP )
eVerticalAdjust = drawing::TextVerticalAdjust_BOTTOM;
else if( eAlignment==LABEL_ALIGN_BOTTOM || eAlignment==LABEL_ALIGN_RIGHT_BOTTOM || eAlignment==LABEL_ALIGN_LEFT_BOTTOM )
eVerticalAdjust = drawing::TextVerticalAdjust_TOP;
- uno::Any* pVerticalAdjustAny = PropertyMapper::getValuePointer(rPropValues,rPropNames,"TextVerticalAdjust");
- if(pVerticalAdjustAny)
- *pVerticalAdjustAny <<= eVerticalAdjust;
+ *pVerticalAdjustAny <<= eVerticalAdjust;
}
}
@@ -100,11 +99,11 @@ void LabelPositionHelper::doDynamicFontResize( tAnySequence& rPropValues
awt::Size aOldReferenceSize;
if( xAxisModelProps->getPropertyValue( "ReferencePageSize") >>= aOldReferenceSize )
{
- uno::Any* pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, "CharHeight" );
+ uno::Any* pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, u"CharHeight" );
lcl_doDynamicFontResize( pAOldAndNewFontHeightAny, aOldReferenceSize, rNewReferenceSize );
- pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, "CharHeightAsian" );
+ pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, u"CharHeightAsian" );
lcl_doDynamicFontResize( pAOldAndNewFontHeightAny, aOldReferenceSize, rNewReferenceSize );
- pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, "CharHeightComplex" );
+ pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, u"CharHeightComplex" );
lcl_doDynamicFontResize( pAOldAndNewFontHeightAny, aOldReferenceSize, rNewReferenceSize );
}
}
@@ -122,36 +121,36 @@ void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 90.0 )
{
- rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ rfXCorrection = -aSize.Height*std::sin( fAnglePi )/2.0;
if( bRotateAroundCenter )
- rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ rfYCorrection = -aSize.Width*std::sin( fAnglePi )/2.0;
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI2;
- rfXCorrection = -aSize.Width *rtl::math::sin( beta )
- -aSize.Height *rtl::math::cos( beta )/2.0;
+ double beta = fAnglePi-M_PI_2;
+ rfXCorrection = -aSize.Width *std::sin( beta )
+ -aSize.Height *std::cos( beta )/2.0;
if( bRotateAroundCenter )
- rfYCorrection = -aSize.Width *rtl::math::cos( beta )/2.0;
+ rfYCorrection = -aSize.Width *std::cos( beta )/2.0;
else
- rfYCorrection = -aSize.Width *rtl::math::cos( beta );
+ rfYCorrection = -aSize.Width *std::cos( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = fAnglePi - F_PI;
- rfXCorrection = -aSize.Width *rtl::math::cos( beta )
- -aSize.Height*rtl::math::sin( beta )/2.0;
+ double beta = fAnglePi - M_PI;
+ rfXCorrection = -aSize.Width *std::cos( beta )
+ -aSize.Height*std::sin( beta )/2.0;
if( bRotateAroundCenter )
- rfYCorrection = aSize.Width *rtl::math::sin( beta )/2.0;
+ rfYCorrection = aSize.Width *std::sin( beta )/2.0;
else
- rfYCorrection = aSize.Width *rtl::math::sin( beta );
+ rfYCorrection = aSize.Width *std::sin( beta );
}
else
{
- double beta = 2*F_PI - fAnglePi;
- rfXCorrection = -aSize.Height*rtl::math::sin( beta )/2.0;
+ double beta = 2*M_PI - fAnglePi;
+ rfXCorrection = -aSize.Height*std::sin( beta )/2.0;
if( bRotateAroundCenter )
- rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
+ rfYCorrection = aSize.Width*std::sin( beta )/2.0;
}
}
@@ -165,35 +164,35 @@ void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 90.0 )
{
- rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ rfXCorrection = aSize.Height*std::sin( fAnglePi )/2.0;
if( bRotateAroundCenter )
- rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ rfYCorrection = aSize.Width*std::sin( fAnglePi )/2.0;
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = F_PI - fAnglePi;
- rfXCorrection = aSize.Width *rtl::math::cos( beta )
- + aSize.Height*rtl::math::sin( beta )/2.0;
+ double beta = M_PI - fAnglePi;
+ rfXCorrection = aSize.Width *std::cos( beta )
+ + aSize.Height*std::sin( beta )/2.0;
if( bRotateAroundCenter )
- rfYCorrection = aSize.Width *rtl::math::sin( beta )/2.0;
+ rfYCorrection = aSize.Width *std::sin( beta )/2.0;
else
- rfYCorrection = aSize.Width *rtl::math::sin( beta );
+ rfYCorrection = aSize.Width *std::sin( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI2 - fAnglePi;
- rfXCorrection = aSize.Width *rtl::math::sin( beta )
- +aSize.Height*rtl::math::cos( beta )/2.0;
+ double beta = 3*M_PI_2 - fAnglePi;
+ rfXCorrection = aSize.Width *std::sin( beta )
+ +aSize.Height*std::cos( beta )/2.0;
if( bRotateAroundCenter )
- rfYCorrection = -aSize.Width *rtl::math::cos( beta )/2.0;
+ rfYCorrection = -aSize.Width *std::cos( beta )/2.0;
else
- rfYCorrection = -aSize.Width *rtl::math::cos( beta );
+ rfYCorrection = -aSize.Width *std::cos( beta );
}
else
{
- rfXCorrection = aSize.Height*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
+ rfXCorrection = aSize.Height*std::sin( 2*M_PI - fAnglePi )/2.0;
if( bRotateAroundCenter )
- rfYCorrection = -aSize.Width*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
+ rfYCorrection = -aSize.Width*std::sin( 2*M_PI - fAnglePi )/2.0;
}
}
@@ -207,35 +206,35 @@ void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 90.0 )
{
- rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ rfXCorrection = aSize.Height*std::sin( fAnglePi )/2.0;
if( !bRotateAroundCenter )
- rfXCorrection += aSize.Width*rtl::math::cos( fAnglePi )/2.0;
- rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ rfXCorrection += aSize.Width*std::cos( fAnglePi )/2.0;
+ rfYCorrection = -aSize.Width*std::sin( fAnglePi )/2.0;
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi - F_PI2;
- rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
+ double beta = fAnglePi - M_PI_2;
+ rfXCorrection = aSize.Height*std::cos( beta )/2.0;
if( !bRotateAroundCenter )
- rfXCorrection -= aSize.Width*rtl::math::sin( beta )/2.0;
- rfYCorrection = -aSize.Width*rtl::math::cos( beta )/2.0
- - aSize.Height*rtl::math::sin( beta );
+ rfXCorrection -= aSize.Width*std::sin( beta )/2.0;
+ rfYCorrection = -aSize.Width*std::cos( beta )/2.0
+ - aSize.Height*std::sin( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = fAnglePi - F_PI;
- rfXCorrection = -aSize.Height *rtl::math::sin( beta )/2.0;
+ double beta = fAnglePi - M_PI;
+ rfXCorrection = -aSize.Height *std::sin( beta )/2.0;
if( !bRotateAroundCenter )
- rfXCorrection += aSize.Width *rtl::math::cos( beta )/2.0;
- rfYCorrection = -aSize.Width *rtl::math::sin( beta )/2.0
- -aSize.Height *rtl::math::cos( beta );
+ rfXCorrection += aSize.Width *std::cos( beta )/2.0;
+ rfYCorrection = -aSize.Width *std::sin( beta )/2.0
+ -aSize.Height *std::cos( beta );
}
else
{
- rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ rfXCorrection = aSize.Height*std::sin( fAnglePi )/2.0;
if( !bRotateAroundCenter )
- rfXCorrection -= aSize.Width*rtl::math::cos( fAnglePi )/2.0;
- rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ rfXCorrection -= aSize.Width*std::cos( fAnglePi )/2.0;
+ rfYCorrection = aSize.Width*std::sin( fAnglePi )/2.0;
}
}
@@ -249,36 +248,36 @@ void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 90.0 )
{
- rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ rfXCorrection = -aSize.Height*std::sin( fAnglePi )/2.0;
if( !bRotateAroundCenter )
- rfXCorrection -= aSize.Width *rtl::math::cos( fAnglePi )/2.0;
- rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ rfXCorrection -= aSize.Width *std::cos( fAnglePi )/2.0;
+ rfYCorrection = aSize.Width*std::sin( fAnglePi )/2.0;
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI2;
- rfXCorrection = -aSize.Height*rtl::math::cos( beta )/2.0;
+ double beta = fAnglePi-M_PI_2;
+ rfXCorrection = -aSize.Height*std::cos( beta )/2.0;
if( !bRotateAroundCenter )
- rfXCorrection += aSize.Width *rtl::math::sin( beta )/2.0;
- rfYCorrection = aSize.Width *rtl::math::cos( beta )/2.0
- +aSize.Height*rtl::math::sin( beta );
+ rfXCorrection += aSize.Width *std::sin( beta )/2.0;
+ rfYCorrection = aSize.Width *std::cos( beta )/2.0
+ +aSize.Height*std::sin( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI2 - fAnglePi;
- rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
+ double beta = 3*M_PI_2 - fAnglePi;
+ rfXCorrection = aSize.Height*std::cos( beta )/2.0;
if( !bRotateAroundCenter )
- rfXCorrection -= aSize.Width *rtl::math::sin( beta )/2.0;
- rfYCorrection = aSize.Height*rtl::math::sin( beta )
- +aSize.Width*rtl::math::cos( beta )/2.0;
+ rfXCorrection -= aSize.Width *std::sin( beta )/2.0;
+ rfYCorrection = aSize.Height*std::sin( beta )
+ +aSize.Width*std::cos( beta )/2.0;
}
else
{
- double beta = 2*F_PI - fAnglePi;
- rfXCorrection = aSize.Height*rtl::math::sin( beta )/2.0;
+ double beta = 2*M_PI - fAnglePi;
+ rfXCorrection = aSize.Height*std::sin( beta )/2.0;
if( !bRotateAroundCenter )
- rfXCorrection += aSize.Width*rtl::math::cos( beta )/2.0;
- rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
+ rfXCorrection += aSize.Width*std::cos( beta )/2.0;
+ rfYCorrection = aSize.Width*std::sin( beta )/2.0;
}
}
@@ -292,25 +291,25 @@ void lcl_correctRotation_Left_Top( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 90.0 )
{
- rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+ rfYCorrection = -aSize.Width*std::sin( fAnglePi );
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI2;
- rfXCorrection = -aSize.Width*rtl::math::sin( beta );
- rfYCorrection = -aSize.Height*rtl::math::sin( beta )
- -aSize.Width*rtl::math::cos( beta );
+ double beta = fAnglePi-M_PI_2;
+ rfXCorrection = -aSize.Width*std::sin( beta );
+ rfYCorrection = -aSize.Height*std::sin( beta )
+ -aSize.Width*std::cos( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI2 - fAnglePi;
- rfXCorrection = -aSize.Height*rtl::math::cos( beta )
- -aSize.Width*rtl::math::sin( beta );
- rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+ double beta = 3*M_PI_2 - fAnglePi;
+ rfXCorrection = -aSize.Height*std::cos( beta )
+ -aSize.Width*std::sin( beta );
+ rfYCorrection = -aSize.Height*std::sin( beta );
}
else
{
- rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi );
+ rfXCorrection = aSize.Height*std::sin( fAnglePi );
}
}
@@ -324,25 +323,25 @@ void lcl_correctRotation_Left_Bottom( double& rfXCorrection, double& rfYCorrecti
}
else if( fAnglePositiveDegree<= 90.0 )
{
- rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+ rfXCorrection = -aSize.Height*std::sin( fAnglePi );
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI2;
- rfXCorrection = -aSize.Width*rtl::math::sin( beta )
- -aSize.Height*rtl::math::cos( beta );
- rfYCorrection = aSize.Height*rtl::math::sin( beta );
+ double beta = fAnglePi-M_PI_2;
+ rfXCorrection = -aSize.Width*std::sin( beta )
+ -aSize.Height*std::cos( beta );
+ rfYCorrection = aSize.Height*std::sin( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI2 - fAnglePi;
- rfXCorrection = -aSize.Width*rtl::math::sin( beta );
- rfYCorrection = aSize.Width*rtl::math::cos( beta )
- +aSize.Height*rtl::math::sin( beta );
+ double beta = 3*M_PI_2 - fAnglePi;
+ rfXCorrection = -aSize.Width*std::sin( beta );
+ rfYCorrection = aSize.Width*std::cos( beta )
+ +aSize.Height*std::sin( beta );
}
else
{
- rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+ rfYCorrection = -aSize.Width*std::sin( fAnglePi );
}
}
@@ -356,25 +355,25 @@ void lcl_correctRotation_Right_Top( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 90.0 )
{
- rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi );
+ rfXCorrection = aSize.Height*std::sin( fAnglePi );
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI2;
- rfXCorrection = aSize.Width*rtl::math::sin( beta )
- +aSize.Height*rtl::math::cos( beta );
- rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+ double beta = fAnglePi-M_PI_2;
+ rfXCorrection = aSize.Width*std::sin( beta )
+ +aSize.Height*std::cos( beta );
+ rfYCorrection = -aSize.Height*std::sin( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI2 - fAnglePi;
- rfXCorrection = aSize.Width*rtl::math::sin( beta );
- rfYCorrection = -aSize.Width*rtl::math::cos( beta )
- -aSize.Height*rtl::math::sin( beta );
+ double beta = 3*M_PI_2 - fAnglePi;
+ rfXCorrection = aSize.Width*std::sin( beta );
+ rfYCorrection = -aSize.Width*std::cos( beta )
+ -aSize.Height*std::sin( beta );
}
else
{
- rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi );
+ rfYCorrection = aSize.Width*std::sin( fAnglePi );
}
}
@@ -388,31 +387,31 @@ void lcl_correctRotation_Right_Bottom( double& rfXCorrection, double& rfYCorrect
}
else if( fAnglePositiveDegree<= 90.0 )
{
- rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi );
+ rfYCorrection = aSize.Width*std::sin( fAnglePi );
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI2;
- rfXCorrection = aSize.Width*rtl::math::sin( beta );
- rfYCorrection = aSize.Height*rtl::math::sin( beta )
- +aSize.Width*rtl::math::cos( beta );
+ double beta = fAnglePi-M_PI_2;
+ rfXCorrection = aSize.Width*std::sin( beta );
+ rfYCorrection = aSize.Height*std::sin( beta )
+ +aSize.Width*std::cos( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI2 - fAnglePi;
- rfXCorrection = aSize.Height*rtl::math::cos( beta )
- +aSize.Width*rtl::math::sin( beta );
- rfYCorrection = aSize.Height*rtl::math::sin( beta );
+ double beta = 3*M_PI_2 - fAnglePi;
+ rfXCorrection = aSize.Height*std::cos( beta )
+ +aSize.Width*std::sin( beta );
+ rfYCorrection = aSize.Height*std::sin( beta );
}
else
{
- rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+ rfXCorrection = -aSize.Height*std::sin( fAnglePi );
}
}
}//end anonymous namespace
-void LabelPositionHelper::correctPositionForRotation( const uno::Reference< drawing::XShape >& xShape2DText
+void LabelPositionHelper::correctPositionForRotation( const rtl::Reference<SvxShapeText>& xShape2DText
, LabelAlignment eLabelAlignment, const double fRotationAngle, bool bRotateAroundCenter )
{
if( !xShape2DText.is() )
diff --git a/chart2/source/view/main/Linear3DTransformation.cxx b/chart2/source/view/main/Linear3DTransformation.cxx
index c27ffa3168a5..0d723ef3454f 100644
--- a/chart2/source/view/main/Linear3DTransformation.cxx
+++ b/chart2/source/view/main/Linear3DTransformation.cxx
@@ -34,35 +34,35 @@ namespace chart
Linear3DTransformation::~Linear3DTransformation()
{}
-// ____ XTransformation ____
-Sequence< double > SAL_CALL Linear3DTransformation::transform(
- const Sequence< double >& rSourceValues )
+// ____ XTransformation2 ____
+css::drawing::Position3D Linear3DTransformation::transform(
+ const Sequence< double >& rSourceValues ) const
{
double fX = rSourceValues[0];
double fY = rSourceValues[1];
double fZ = rSourceValues[2];
if(m_bSwapXAndY)
std::swap(fX,fY);
- Sequence< double > aNewVec(3);
+ css::drawing::Position3D aNewVec;
double fZwi;
fZwi = m_Matrix.Line1.Column1 * fX
+ m_Matrix.Line1.Column2 * fY
+ m_Matrix.Line1.Column3 * fZ
+ m_Matrix.Line1.Column4;
- aNewVec[0] = fZwi;
+ aNewVec.PositionX = fZwi;
fZwi = m_Matrix.Line2.Column1 * fX
+ m_Matrix.Line2.Column2 * fY
+ m_Matrix.Line2.Column3 * fZ
+ m_Matrix.Line2.Column4;
- aNewVec[1] = fZwi;
+ aNewVec.PositionY = fZwi;
fZwi = m_Matrix.Line3.Column1 * fX
+ m_Matrix.Line3.Column2 * fY
+ m_Matrix.Line3.Column3 * fZ
+ m_Matrix.Line3.Column4;
- aNewVec[2] = fZwi;
+ aNewVec.PositionZ = fZwi;
fZwi = m_Matrix.Line4.Column1 * fX
+ m_Matrix.Line4.Column2 * fY
@@ -70,21 +70,53 @@ Sequence< double > SAL_CALL Linear3DTransformation::transform(
+ m_Matrix.Line4.Column4;
if(fZwi != 1.0 && fZwi != 0.0)
{
- aNewVec[0] /= fZwi;
- aNewVec[1] /= fZwi;
- aNewVec[2] /= fZwi;
+ aNewVec.PositionX /= fZwi;
+ aNewVec.PositionY /= fZwi;
+ aNewVec.PositionZ /= fZwi;
}
return aNewVec;
}
-sal_Int32 SAL_CALL Linear3DTransformation::getSourceDimension()
+css::drawing::Position3D Linear3DTransformation::transform(
+ const css::drawing::Position3D& rSourceValues ) const
{
- return 3;
-}
+ double fX = rSourceValues.PositionX;
+ double fY = rSourceValues.PositionY;
+ double fZ = rSourceValues.PositionZ;
+ if(m_bSwapXAndY)
+ std::swap(fX,fY);
+ css::drawing::Position3D aNewVec;
+ double fZwi;
-sal_Int32 SAL_CALL Linear3DTransformation::getTargetDimension()
-{
- return 3;
+ fZwi = m_Matrix.Line1.Column1 * fX
+ + m_Matrix.Line1.Column2 * fY
+ + m_Matrix.Line1.Column3 * fZ
+ + m_Matrix.Line1.Column4;
+ aNewVec.PositionX = fZwi;
+
+ fZwi = m_Matrix.Line2.Column1 * fX
+ + m_Matrix.Line2.Column2 * fY
+ + m_Matrix.Line2.Column3 * fZ
+ + m_Matrix.Line2.Column4;
+ aNewVec.PositionY = fZwi;
+
+ fZwi = m_Matrix.Line3.Column1 * fX
+ + m_Matrix.Line3.Column2 * fY
+ + m_Matrix.Line3.Column3 * fZ
+ + m_Matrix.Line3.Column4;
+ aNewVec.PositionZ = fZwi;
+
+ fZwi = m_Matrix.Line4.Column1 * fX
+ + m_Matrix.Line4.Column2 * fY
+ + m_Matrix.Line4.Column3 * fZ
+ + m_Matrix.Line4.Column4;
+ if(fZwi != 1.0 && fZwi != 0.0)
+ {
+ aNewVec.PositionX /= fZwi;
+ aNewVec.PositionY /= fZwi;
+ aNewVec.PositionZ /= fZwi;
+ }
+ return aNewVec;
}
} // namespace chart
diff --git a/chart2/source/view/main/PlotterBase.cxx b/chart2/source/view/main/PlotterBase.cxx
index 6479668c67ef..d09bba64aeef 100644
--- a/chart2/source/view/main/PlotterBase.cxx
+++ b/chart2/source/view/main/PlotterBase.cxx
@@ -20,33 +20,26 @@
#include <PlotterBase.hxx>
#include <PlottingPositionHelper.hxx>
#include <ShapeFactory.hxx>
-#include <rtl/math.hxx>
#include <osl/diagnose.h>
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
PlotterBase::PlotterBase( sal_Int32 nDimensionCount )
- : m_pShapeFactory(nullptr)
- , m_aCID()
- , m_nDimension(nDimensionCount)
+ : m_nDimension(nDimensionCount)
, m_pPosHelper(nullptr)
{
}
-void PlotterBase::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget
- , const uno::Reference< drawing::XShapes >& xFinalTarget
- , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
+void PlotterBase::initPlotter( const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget
+ , const rtl::Reference<SvxShapeGroupAnyD>& xFinalTarget
, const OUString& rCID )
{
- OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
+ OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is(),"no proper initialization parameters");
//is only allowed to be called once
m_xLogicTarget = xLogicTarget;
m_xFinalTarget = xFinalTarget;
- m_xShapeFactory = xShapeFactory;
- m_pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
m_aCID = rCID;
}
@@ -54,13 +47,13 @@ PlotterBase::~PlotterBase()
{
}
-void PlotterBase::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
+void PlotterBase::setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis )
{
if (!m_pPosHelper)
return;
OSL_PRECOND(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension of Plotter does not fit two dimension of given scale sequence");
- m_pPosHelper->setScales( rScales, bSwapXAndYAxis );
+ m_pPosHelper->setScales( std::move(rScales), bSwapXAndYAxis );
}
void PlotterBase::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
@@ -74,22 +67,19 @@ void PlotterBase::setTransformationSceneToScreen( const drawing::HomogenMatrix&
m_pPosHelper->setTransformationSceneToScreen( rMatrix );
}
-uno::Reference< drawing::XShapes > PlotterBase::createGroupShape(
- const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<SvxShapeGroupAnyD> PlotterBase::createGroupShape(
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const OUString& rName )
{
- if(!m_xShapeFactory.is())
- return nullptr;
-
if(m_nDimension==2)
{
//create and add to target
- return m_pShapeFactory->createGroup2D( xTarget, rName );
+ return ShapeFactory::createGroup2D( xTarget, rName );
}
else
{
//create and added to target
- return m_pShapeFactory->createGroup3D( xTarget, rName );
+ return ShapeFactory::createGroup3D( xTarget, rName );
}
}
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
index d26e9331ba44..dfbf38bbd90e 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -27,9 +27,7 @@
#include <com/sun/star/chart/TimeUnit.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
-#include <com/sun/star/drawing/DoubleSequence.hpp>
#include <com/sun/star/drawing/Position3D.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <rtl/math.hxx>
@@ -38,10 +36,10 @@ namespace chart
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+XTransformation2::~XTransformation2() {}
+
PlottingPositionHelper::PlottingPositionHelper()
- : m_aScales()
- , m_aMatrixScreenToScene()
- , m_bSwapXAndY( false )
+ : m_bSwapXAndY( false )
, m_nXResolution( 1000 )
, m_nYResolution( 1000 )
, m_nZResolution( 1000 )
@@ -95,14 +93,14 @@ void PlottingPositionHelper::setTransformationSceneToScreen( const drawing::Homo
m_xTransformationLogicToScene = nullptr;
}
-void PlottingPositionHelper::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
+void PlottingPositionHelper::setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis )
{
- m_aScales = rScales;
+ m_aScales = std::move(rScales);
m_bSwapXAndY = bSwapXAndYAxis;
m_xTransformationLogicToScene = nullptr;
}
-uno::Reference< XTransformation > PlottingPositionHelper::getTransformationScaledLogicToScene() const
+::chart::XTransformation2* PlottingPositionHelper::getTransformationScaledLogicToScene() const
{
//this is a standard transformation for a cartesian coordinate system
@@ -110,7 +108,7 @@ uno::Reference< XTransformation > PlottingPositionHelper::getTransformationScale
//we need to apply this transformation to each geometric object because of a bug/problem
//of the old drawing layer (the UNO_NAME_3D_EXTRUDE_DEPTH is an integer value instead of a double )
- if(!m_xTransformationLogicToScene.is())
+ if(!m_xTransformationLogicToScene)
{
::basegfx::B3DHomMatrix aMatrix;
double MinX = getLogicMinX();
@@ -164,9 +162,9 @@ uno::Reference< XTransformation > PlottingPositionHelper::getTransformationScale
aMatrix = m_aMatrixScreenToScene*aMatrix;
- m_xTransformationLogicToScene = new Linear3DTransformation(B3DHomMatrixToHomogenMatrix( aMatrix ),m_bSwapXAndY);
+ m_xTransformationLogicToScene.reset(new Linear3DTransformation(B3DHomMatrixToHomogenMatrix( aMatrix ), m_bSwapXAndY));
}
- return m_xTransformationLogicToScene;
+ return m_xTransformationLogicToScene.get();
}
drawing::Position3D PlottingPositionHelper::transformLogicToScene(
@@ -187,16 +185,13 @@ drawing::Position3D PlottingPositionHelper::transformScaledLogicToScene(
drawing::Position3D aPos( fX, fY, fZ);
- uno::Reference< XTransformation > xTransformation =
+ ::chart::XTransformation2* pTransformation =
getTransformationScaledLogicToScene();
- uno::Sequence< double > aSeq =
- xTransformation->transform( Position3DToSequence(aPos) );
- return SequenceToPosition3D(aSeq);
+ return pTransformation->transform( aPos );
}
awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing::Position3D& rScenePosition3D
- , const uno::Reference< drawing::XShapes >& xSceneTarget
- , ShapeFactory* pShapeFactory
+ , const rtl::Reference<SvxShapeGroupAnyD>& xSceneTarget
, sal_Int32 nDimensionCount )
{
//@todo would like to have a cheaper method to do this transformation
@@ -207,7 +202,7 @@ awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing
{
//create 3D anchor shape
tPropertyNameMap aDummyPropertyNameMap;
- uno::Reference< drawing::XShape > xShape3DAnchor = pShapeFactory->createCube( xSceneTarget
+ rtl::Reference<Svx3DExtrudeObject> xShape3DAnchor = ShapeFactory::createCube( xSceneTarget
, rScenePosition3D,drawing::Direction3D(1,1,1)
, 0, nullptr, aDummyPropertyNameMap);
//get 2D position from xShape3DAnchor
@@ -220,16 +215,38 @@ awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing
void PlottingPositionHelper::transformScaledLogicToScene( drawing::PolyPolygonShape3D& rPolygon ) const
{
drawing::Position3D aScenePosition;
+ auto SequenceXRange = asNonConstRange(rPolygon.SequenceX);
+ auto SequenceYRange = asNonConstRange(rPolygon.SequenceY);
+ auto SequenceZRange = asNonConstRange(rPolygon.SequenceZ);
for( sal_Int32 nS = rPolygon.SequenceX.getLength(); nS--;)
{
- drawing::DoubleSequence& xValues = rPolygon.SequenceX[nS];
- drawing::DoubleSequence& yValues = rPolygon.SequenceY[nS];
- drawing::DoubleSequence& zValues = rPolygon.SequenceZ[nS];
- for( sal_Int32 nP = xValues.getLength(); nP--; )
+ auto xValuesRange = asNonConstRange(SequenceXRange[nS]);
+ auto yValuesRange = asNonConstRange(SequenceYRange[nS]);
+ auto zValuesRange = asNonConstRange(SequenceZRange[nS]);
+ for( sal_Int32 nP = SequenceXRange[nS].getLength(); nP--; )
{
- double& fX = xValues[nP];
- double& fY = yValues[nP];
- double& fZ = zValues[nP];
+ double& fX = xValuesRange[nP];
+ double& fY = yValuesRange[nP];
+ double& fZ = zValuesRange[nP];
+ aScenePosition = transformScaledLogicToScene( fX,fY,fZ,true );
+ fX = aScenePosition.PositionX;
+ fY = aScenePosition.PositionY;
+ fZ = aScenePosition.PositionZ;
+ }
+ }
+}
+
+void PlottingPositionHelper::transformScaledLogicToScene( std::vector<std::vector<css::drawing::Position3D>>& rPolygon ) const
+{
+ drawing::Position3D aScenePosition;
+ for( sal_Int32 nS = static_cast<sal_Int32>(rPolygon.size()); nS--;)
+ {
+ auto valuesRange = rPolygon[nS].data();
+ for( sal_Int32 nP = rPolygon[nS].size(); nP--; )
+ {
+ double& fX = valuesRange[nP].PositionX;
+ double& fY = valuesRange[nP].PositionY;
+ double& fZ = valuesRange[nP].PositionZ;
aScenePosition = transformScaledLogicToScene( fX,fY,fZ,true );
fX = aScenePosition.PositionX;
fY = aScenePosition.PositionY;
@@ -316,7 +333,6 @@ drawing::Direction3D PlottingPositionHelper::getScaledLogicWidth() const
PolarPlottingPositionHelper::PolarPlottingPositionHelper()
: m_fRadiusOffset(0.0)
, m_fAngleDegreeOffset(90.0)
- , m_aUnitCartesianToScene()
{
m_bMaySkipPointsInRegressionCalculation = false;
}
@@ -343,9 +359,9 @@ void PolarPlottingPositionHelper::setTransformationSceneToScreen( const drawing:
PlottingPositionHelper::setTransformationSceneToScreen( rMatrix);
m_aUnitCartesianToScene =impl_calculateMatrixUnitCartesianToScene( m_aMatrixScreenToScene );
}
-void PolarPlottingPositionHelper::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
+void PolarPlottingPositionHelper::setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis )
{
- PlottingPositionHelper::setScales( rScales, bSwapXAndYAxis );
+ PlottingPositionHelper::setScales( std::move(rScales), bSwapXAndYAxis );
m_aUnitCartesianToScene =impl_calculateMatrixUnitCartesianToScene( m_aMatrixScreenToScene );
}
@@ -391,22 +407,18 @@ void PolarPlottingPositionHelper::setScales( const std::vector< ExplicitScaleDat
return aRet;
}
-uno::Reference< XTransformation > PolarPlottingPositionHelper::getTransformationScaledLogicToScene() const
+::chart::XTransformation2* PolarPlottingPositionHelper::getTransformationScaledLogicToScene() const
{
- if( !m_xTransformationLogicToScene.is() )
- m_xTransformationLogicToScene = new VPolarTransformation(*this);
- return m_xTransformationLogicToScene;
+ if( !m_xTransformationLogicToScene )
+ m_xTransformationLogicToScene.reset(new VPolarTransformation(*this));
+ return m_xTransformationLogicToScene.get();
}
double PolarPlottingPositionHelper::getWidthAngleDegree( double& fStartLogicValueOnAngleAxis, double& fEndLogicValueOnAngleAxis ) const
{
const ExplicitScaleData& rAngleScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[0];
if( rAngleScale.Orientation != AxisOrientation_MATHEMATICAL )
- {
- double fHelp = fEndLogicValueOnAngleAxis;
- fEndLogicValueOnAngleAxis = fStartLogicValueOnAngleAxis;
- fStartLogicValueOnAngleAxis = fHelp;
- }
+ std::swap( fStartLogicValueOnAngleAxis, fEndLogicValueOnAngleAxis );
double fStartAngleDegree = transformToAngleDegree( fStartLogicValueOnAngleAxis );
double fEndAngleDegree = transformToAngleDegree( fEndLogicValueOnAngleAxis );
@@ -615,8 +627,8 @@ drawing::Position3D PolarPlottingPositionHelper::transformUnitCircleToScene( dou
{
double fAnglePi = basegfx::deg2rad(fUnitAngleDegree);
- double fX=fUnitRadius*rtl::math::cos(fAnglePi);
- double fY=fUnitRadius*rtl::math::sin(fAnglePi);
+ double fX=fUnitRadius*std::cos(fAnglePi);
+ double fY=fUnitRadius*std::sin(fAnglePi);
double fZ=fLogicZ;
//!! applying matrix to vector does ignore translation, so it is important to use a B3DPoint here instead of B3DVector
@@ -652,7 +664,7 @@ double PlottingPositionHelper::getBaseValueY() const
return m_aScales[1].Origin;
}
-void PlottingPositionHelper::setTimeResolution( long nTimeResolution, const Date& rNullDate )
+void PlottingPositionHelper::setTimeResolution( tools::Long nTimeResolution, const Date& rNullDate )
{
m_nTimeResolution = nTimeResolution;
m_aNullDate = rNullDate;
diff --git a/chart2/source/view/main/PolarLabelPositionHelper.cxx b/chart2/source/view/main/PolarLabelPositionHelper.cxx
index a3e9a7cd9778..44070603c75a 100644
--- a/chart2/source/view/main/PolarLabelPositionHelper.cxx
+++ b/chart2/source/view/main/PolarLabelPositionHelper.cxx
@@ -27,14 +27,12 @@
namespace chart
{
using namespace ::com::sun::star;
-using namespace ::com::sun::star::chart2;
PolarLabelPositionHelper::PolarLabelPositionHelper(
PolarPlottingPositionHelper* pPosHelper
, sal_Int32 nDimensionCount
- , const uno::Reference< drawing::XShapes >& xLogicTarget
- , ShapeFactory* pShapeFactory )
- : LabelPositionHelper( nDimensionCount, xLogicTarget, pShapeFactory )
+ , const rtl::Reference<SvxShapeGroupAnyD>& xLogicTarget )
+ : LabelPositionHelper( nDimensionCount, xLogicTarget )
, m_pPosHelper(pPosHelper)
{
}
@@ -104,19 +102,8 @@ awt::Point PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCi
double fDX = aRet.X-aP0.X;
double fDY = aRet.Y-aP0.Y;
fDY*=-1.0;//drawing layer has inverse y values
- if( fDX != 0.0 )
- {
- fAngleDegree = basegfx::rad2deg(atan(fDY/fDX));
- if(fDX<0.0)
- fAngleDegree+=180.0;
- }
- else
- {
- if(fDY>0.0)
- fAngleDegree = 90.0;
- else
- fAngleDegree = 270.0;
- }
+
+ fAngleDegree = basegfx::rad2deg(atan2(fDY,fDX));
}
//set LabelAlignment
if( !bCenter )
@@ -129,26 +116,22 @@ awt::Point PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCi
bool bOutside = nLabelPlacement == css::chart::DataLabelPlacement::OUTSIDE;
- if(fAngleDegree==0.0)
- rAlignment = LABEL_ALIGN_CENTER;
- else if(fAngleDegree<=22.5)
+ if (fAngleDegree <= 5 || fAngleDegree >= 355)
rAlignment = bOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
- else if(fAngleDegree<67.5)
+ else if (fAngleDegree < 85)
rAlignment = bOutside ? LABEL_ALIGN_RIGHT_TOP : LABEL_ALIGN_LEFT_BOTTOM;
- else if(fAngleDegree<112.5)
+ else if (fAngleDegree <= 95)
rAlignment = bOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
- else if(fAngleDegree<=157.5)
+ else if (fAngleDegree < 175)
rAlignment = bOutside ? LABEL_ALIGN_LEFT_TOP : LABEL_ALIGN_RIGHT_BOTTOM;
- else if(fAngleDegree<=202.5)
+ else if (fAngleDegree <= 185)
rAlignment = bOutside ? LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
- else if(fAngleDegree<247.5)
+ else if (fAngleDegree < 265)
rAlignment = bOutside ? LABEL_ALIGN_LEFT_BOTTOM : LABEL_ALIGN_RIGHT_TOP;
- else if(fAngleDegree<292.5)
+ else if (fAngleDegree <= 275)
rAlignment = bOutside ? LABEL_ALIGN_BOTTOM : LABEL_ALIGN_TOP;
- else if(fAngleDegree<337.5)
- rAlignment = bOutside ? LABEL_ALIGN_RIGHT_BOTTOM : LABEL_ALIGN_LEFT_TOP;
else
- rAlignment = bOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
+ rAlignment = bOutside ? LABEL_ALIGN_RIGHT_BOTTOM : LABEL_ALIGN_LEFT_TOP;
}
else
{
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index 0550cdd5ce11..79206624f436 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -26,48 +26,139 @@
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
-#include <comphelper/sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <svx/unoshape.hxx>
namespace chart
{
using namespace ::com::sun::star;
-namespace
+void PropertyMapper::setMappedProperties(
+ SvxShape& xTarget
+ , const uno::Reference< beans::XPropertySet >& xSource
+ , const tPropertyNameMap& rMap )
{
+ if( !xSource.is() )
+ return;
-void lcl_overwriteOrAppendValues(
- tPropertyNameValueMap &rMap, const tPropertyNameValueMap& rOverwriteMap )
-{
- for (auto const& elem : rOverwriteMap)
- rMap[ elem.first ] = elem.second;
-}
+ sal_Int32 nPropertyCount = rMap.size();
+ tNameSequence aNames(nPropertyCount);
+ tAnySequence aValues(nPropertyCount);
+ auto pNames = aNames.getArray();
+ auto pValues = aValues.getArray();
+ sal_Int32 nN=0;
+
+ for (auto const& elem : rMap)
+ {
+ const OUString & rTarget = elem.first;
+ const OUString & rSource = elem.second;
+ try
+ {
+ uno::Any aAny( xSource->getPropertyValue(rSource) );
+ if( aAny.hasValue() )
+ {
+ //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
+ pNames[nN] = rTarget;
+ pValues[nN] = std::move(aAny);
+ ++nN;
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+ }
+ if (nN == 0)
+ return;
+ //reduce to real property count
+ aNames.realloc(nN);
+ aValues.realloc(nN);
-} // anonymous namespace
+ uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY_THROW );
+ try
+ {
+ xShapeMultiProp->setPropertyValues( aNames, aValues );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" ); //if this occurs more often think of removing the XMultiPropertySet completely for better performance
+ }
+}
void PropertyMapper::setMappedProperties(
const uno::Reference< beans::XPropertySet >& xTarget
, const uno::Reference< beans::XPropertySet >& xSource
- , const tPropertyNameMap& rMap
- , tPropertyNameValueMap const * pOverwriteMap )
+ , const tPropertyNameMap& rMap )
{
if( !xTarget.is() || !xSource.is() )
return;
tNameSequence aNames;
tAnySequence aValues;
- getMultiPropertyLists(aNames, aValues, xSource, rMap );
- if(pOverwriteMap && (aNames.getLength() == aValues.getLength()))
+ sal_Int32 nN=0;
+ sal_Int32 nPropertyCount = rMap.size();
+ aNames.realloc(nPropertyCount);
+ auto pNames = aNames.getArray();
+ aValues.realloc(nPropertyCount);
+ auto pValues = aValues.getArray();
+
+ for (auto const& elem : rMap)
{
- tPropertyNameValueMap aNewMap;
- for( sal_Int32 nI=0; nI<aNames.getLength(); ++nI )
- aNewMap[ aNames[nI] ] = aValues[nI];
- lcl_overwriteOrAppendValues( aNewMap, *pOverwriteMap );
- aNames = comphelper::mapKeysToSequence( aNewMap );
- aValues = comphelper::mapValuesToSequence( aNewMap );
+ const OUString & rTarget = elem.first;
+ const OUString & rSource = elem.second;
+ try
+ {
+ uno::Any aAny( xSource->getPropertyValue(rSource) );
+ if( aAny.hasValue() )
+ {
+ //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
+ pNames[nN] = rTarget;
+ pValues[nN] = aAny;
+ ++nN;
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "exception mapping property from " << rSource << " to " << rTarget);
+ }
}
+ if (nN == 0)
+ return;
+
+ uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY );
+ if (xShapeMultiProp)
+ try
+ {
+ //reduce to real property count
+ aNames.realloc(nN);
+ aValues.realloc(nN);
+ xShapeMultiProp->setPropertyValues( aNames, aValues );
+ return; // successful
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" ); //if this occurs more often think of removing the XMultiPropertySet completely for better performance
+ }
- PropertyMapper::setMultiProperties( aNames, aValues, xTarget );
+ // fall back to one at a time
+ try
+ {
+ for( sal_Int32 i = 0; i < nN; i++ )
+ {
+ try
+ {
+ xTarget->setPropertyValue( aNames[i], aValues[i] );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
}
void PropertyMapper::getValueMap(
@@ -80,12 +171,14 @@ void PropertyMapper::getValueMap(
if((false) && xMultiPropSet.is())
{
uno::Sequence< OUString > aPropSourceNames(rNameMap.size());
+ auto aPropSourceNamesRange = asNonConstRange(aPropSourceNames);
uno::Sequence< OUString > aPropTargetNames(rNameMap.size());
+ auto aPropTargetNamesRange = asNonConstRange(aPropTargetNames);
sal_Int32 i = 0;
for (auto const& elem : rNameMap)
{
- aPropTargetNames[i] = elem.first;
- aPropSourceNames[i] = elem.second;
+ aPropTargetNamesRange[i] = elem.first;
+ aPropSourceNamesRange[i] = elem.second;
++i;
}
@@ -101,13 +194,13 @@ void PropertyMapper::getValueMap(
{
for (auto const& elem : rNameMap)
{
- OUString aTarget = elem.first;
- OUString aSource = elem.second;
+ const OUString & rTarget = elem.first;
+ const OUString & rSource = elem.second;
try
{
- uno::Any aAny( xSourceProp->getPropertyValue(aSource) );
+ uno::Any aAny( xSourceProp->getPropertyValue(rSource) );
if( aAny.hasValue() )
- rValueMap.emplace( aTarget, aAny );
+ rValueMap.emplace( rTarget, aAny );
}
catch( const uno::Exception& )
{
@@ -117,18 +210,6 @@ void PropertyMapper::getValueMap(
}
}
-void PropertyMapper::getMultiPropertyLists(
- tNameSequence& rNames
- , tAnySequence& rValues
- , const uno::Reference< beans::XPropertySet >& xSourceProp
- , const tPropertyNameMap& rNameMap
- )
-{
- tPropertyNameValueMap aValueMap;
- getValueMap( aValueMap, rNameMap, xSourceProp );
- getMultiPropertyListsFromValueMap( rNames, rValues, aValueMap );
-}
-
void PropertyMapper::getMultiPropertyListsFromValueMap(
tNameSequence& rNames
, tAnySequence& rValues
@@ -137,7 +218,9 @@ void PropertyMapper::getMultiPropertyListsFromValueMap(
{
sal_Int32 nPropertyCount = rValueMap.size();
rNames.realloc(nPropertyCount);
+ auto pNames = rNames.getArray();
rValues.realloc(nPropertyCount);
+ auto pValues = rValues.getArray();
//fill sequences
sal_Int32 nN=0;
@@ -147,8 +230,8 @@ void PropertyMapper::getMultiPropertyListsFromValueMap(
if( rAny.hasValue() )
{
//do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
- rNames[nN] = elem.first;
- rValues[nN] = rAny;
+ pNames[nN] = elem.first;
+ pValues[nN] = rAny;
++nN;
}
}
@@ -159,13 +242,13 @@ void PropertyMapper::getMultiPropertyListsFromValueMap(
uno::Any* PropertyMapper::getValuePointer( tAnySequence& rPropValues
, const tNameSequence& rPropNames
- , const OUString& rPropName )
+ , std::u16string_view rPropName )
{
sal_Int32 nCount = rPropNames.getLength();
for( sal_Int32 nN = 0; nN < nCount; nN++ )
{
if(rPropNames[nN] == rPropName)
- return &rPropValues[nN];
+ return &rPropValues.getArray()[nN];
}
return nullptr;
}
@@ -185,7 +268,8 @@ const tPropertyNameMap& PropertyMapper::getPropertyNameMapForCharacterProperties
{"CharColor", "CharColor"},
{"CharContoured", "CharContoured"},
{"CharEmphasis", "CharEmphasis"},//the service style::CharacterProperties describes a property called 'CharEmphasize' which is nowhere implemented
-
+ {"CharEscapement", "CharEscapement"},
+ {"CharEscapementHeight", "CharEscapementHeight"},
{"CharFontFamily", "CharFontFamily"},
{"CharFontFamilyAsian", "CharFontFamilyAsian"},
{"CharFontFamilyComplex", "CharFontFamilyComplex"},
@@ -282,7 +366,8 @@ const tPropertyNameMap& PropertyMapper::getPropertyNameMapForLineProperties()
{"LineJoint", "LineJoint"},
{"LineStyle", "LineStyle"},
{"LineTransparence", "LineTransparence"},
- {"LineWidth", "LineWidth"}};
+ {"LineWidth", "LineWidth"},
+ {"LineCap", "LineCap"}};
return s_aShapePropertyMapForLineProperties;
}
@@ -329,7 +414,8 @@ const tPropertyNameMap& PropertyMapper::getPropertyNameMapForLineSeriesPropertie
{"LineDashName", "LineDashName"},
{"LineStyle", "LineStyle"},
{"LineTransparence", "Transparency"},
- {"LineWidth", "LineWidth"}};
+ {"LineWidth", "LineWidth"},
+ {"LineCap", "LineCap"}};
return s_aShapePropertyMapForLineSeriesProperties;
}
@@ -385,58 +471,24 @@ const tPropertyNameMap& PropertyMapper::getPropertyNameMapForFilledSeriesPropert
{"LineDashName", "BorderDashName"},
{"LineStyle", "BorderStyle"},
{"LineTransparence", "BorderTransparency"},
- {"LineWidth", "BorderWidth"}};
+ {"LineWidth", "BorderWidth"},
+ {"LineCap", "LineCap"}};
return s_aShapePropertyMapForFilledSeriesProperties;
}
void PropertyMapper::setMultiProperties(
const tNameSequence& rNames
, const tAnySequence& rValues
- , const css::uno::Reference<
- css::beans::XPropertySet >& xTarget )
+ , SvxShape& xTarget )
{
- bool bSuccess = false;
try
{
- uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY );
- if( xShapeMultiProp.is() )
- {
- xShapeMultiProp->setPropertyValues( rNames, rValues );
- bSuccess = true;
- }
+ xTarget.setPropertyValues( rNames, rValues );
}
catch( const uno::Exception& )
{
TOOLS_WARN_EXCEPTION("chart2", "" ); //if this occurs more often think of removing the XMultiPropertySet completely for better performance
}
-
- if(bSuccess)
- return;
-
- try
- {
- sal_Int32 nCount = std::max( rNames.getLength(), rValues.getLength() );
- OUString aPropName;
- uno::Any aValue;
- for( sal_Int32 nN = 0; nN < nCount; nN++ )
- {
- aPropName = rNames[nN];
- aValue = rValues[nN];
-
- try
- {
- xTarget->setPropertyValue( aPropName, aValue );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
- }
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
}
void PropertyMapper::getTextLabelMultiPropertyLists(
diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx
new file mode 100644
index 000000000000..afca7efbc463
--- /dev/null
+++ b/chart2/source/view/main/SeriesPlotterContainer.cxx
@@ -0,0 +1,759 @@
+/* -*- 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 <sal/config.h>
+
+#include <cstddef>
+
+#include "SeriesPlotterContainer.hxx"
+
+#include <ChartView.hxx>
+#include <Diagram.hxx>
+#include <ChartType.hxx>
+#include <DataSeries.hxx>
+#include <ChartModel.hxx>
+#include <ChartTypeHelper.hxx>
+#include <ObjectIdentifier.hxx>
+#include <DiagramHelper.hxx>
+#include <Axis.hxx>
+#include <AxisIndexDefines.hxx>
+#include <DataSeriesHelper.hxx>
+#include <ExplicitCategoriesProvider.hxx>
+#include <unonames.hxx>
+
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+#include <comphelper/classids.hxx>
+#include <servicenames_charttypes.hxx>
+#include <comphelper/diagnose_ex.hxx>
+
+namespace chart
+{
+using namespace ::css;
+using namespace ::css::chart2;
+
+using ::css::uno::Reference;
+using ::css::uno::Sequence;
+using ::css::uno::Any;
+
+SeriesPlotterContainer::SeriesPlotterContainer(
+ std::vector<std::unique_ptr<VCoordinateSystem>>& rVCooSysList)
+ : m_rVCooSysList(rVCooSysList)
+ , m_nMaxAxisIndex(0)
+ , m_bChartTypeUsesShiftedCategoryPositionPerDefault(false)
+ , m_nDefaultDateNumberFormat(0)
+{
+}
+
+SeriesPlotterContainer::~SeriesPlotterContainer()
+{
+ // - remove plotter from coordinatesystems
+ for (auto& nC : m_rVCooSysList)
+ nC->clearMinimumAndMaximumSupplierList();
+}
+
+std::vector<LegendEntryProvider*> SeriesPlotterContainer::getLegendEntryProviderList()
+{
+ std::vector<LegendEntryProvider*> aRet(m_aSeriesPlotterList.size());
+ sal_Int32 nN = 0;
+ for (const std::unique_ptr<VSeriesPlotter>& aPlotter : m_aSeriesPlotterList)
+ aRet[nN++] = aPlotter.get();
+ return aRet;
+}
+
+VCoordinateSystem* SeriesPlotterContainer::findInCooSysList(
+ const std::vector<std::unique_ptr<VCoordinateSystem>>& rVCooSysList,
+ const rtl::Reference<BaseCoordinateSystem>& xCooSys)
+{
+ for (auto& pVCooSys : rVCooSysList)
+ {
+ if (pVCooSys->getModel() == xCooSys)
+ return pVCooSys.get();
+ }
+ return nullptr;
+}
+
+VCoordinateSystem* SeriesPlotterContainer::getCooSysForPlotter(
+ const std::vector<std::unique_ptr<VCoordinateSystem>>& rVCooSysList,
+ MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier)
+{
+ if (!pMinimumAndMaximumSupplier)
+ return nullptr;
+ for (auto& pVCooSys : rVCooSysList)
+ {
+ if (pVCooSys->hasMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier))
+ return pVCooSys.get();
+ }
+ return nullptr;
+}
+
+VCoordinateSystem* SeriesPlotterContainer::addCooSysToList(
+ std::vector<std::unique_ptr<VCoordinateSystem>>& rVCooSysList,
+ const rtl::Reference<BaseCoordinateSystem>& xCooSys, ChartModel& rChartModel)
+{
+ VCoordinateSystem* pExistingVCooSys
+ = SeriesPlotterContainer::findInCooSysList(rVCooSysList, xCooSys);
+ if (pExistingVCooSys)
+ return pExistingVCooSys;
+
+ std::unique_ptr<VCoordinateSystem> pVCooSys
+ = VCoordinateSystem::createCoordinateSystem(xCooSys);
+ if (!pVCooSys)
+ return nullptr;
+
+ OUString aCooSysParticle(
+ ObjectIdentifier::createParticleForCoordinateSystem(xCooSys, &rChartModel));
+ pVCooSys->setParticle(aCooSysParticle);
+
+ pVCooSys->setExplicitCategoriesProvider(new ExplicitCategoriesProvider(xCooSys, rChartModel));
+ rVCooSysList.push_back(std::move(pVCooSys));
+ return rVCooSysList.back().get();
+}
+
+void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChartModel)
+{
+ rtl::Reference<Diagram> xDiagram = rChartModel.getFirstChartDiagram();
+ if (!xDiagram.is())
+ return;
+
+ uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(&rChartModel);
+ if (rChartModel.hasInternalDataProvider() && xDiagram->isSupportingDateAxis())
+ m_nDefaultDateNumberFormat = DiagramHelper::getDateNumberFormat(xNumberFormatsSupplier);
+
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
+ if (!nDimensionCount)
+ {
+ //@todo handle mixed dimension
+ nDimensionCount = 2;
+ }
+
+ bool bSortByXValues = false;
+ bool bConnectBars = false;
+ bool bGroupBarsPerAxis = true;
+ bool bIncludeHiddenCells = true;
+ bool bSecondaryYaxisVisible = true;
+ sal_Int32 nStartingAngle = 90;
+ sal_Int32 n3DRelativeHeight = 100;
+ PieChartSubType ePieChartSubType = PieChartSubType_NONE;
+ try
+ {
+ xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= bSortByXValues;
+ xDiagram->getPropertyValue("ConnectBars") >>= bConnectBars;
+ xDiagram->getPropertyValue("GroupBarsPerAxis") >>= bGroupBarsPerAxis;
+ xDiagram->getPropertyValue("IncludeHiddenCells") >>= bIncludeHiddenCells;
+ xDiagram->getPropertyValue("StartingAngle") >>= nStartingAngle;
+
+ if (nDimensionCount == 3)
+ {
+ xDiagram->getPropertyValue("3DRelativeHeight") >>= n3DRelativeHeight;
+ }
+ xDiagram->getPropertyValue("SubPieType") >>= ePieChartSubType;
+ }
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ if (xDiagram->getDataTable().is())
+ m_bTableShiftPosition = true;
+
+ //prepare for autoscaling and shape creation
+ // - create plotter for charttypes (for each first scale group at each plotter, as they are independent)
+ // - add series to plotter (thus each charttype can provide minimum and maximum values for autoscaling)
+ // - add plotter to coordinate systems
+
+ //iterate through all coordinate systems
+ uno::Reference<XColorScheme> xColorScheme(xDiagram->getDefaultColorScheme());
+ auto aCooSysList = xDiagram->getBaseCoordinateSystems();
+ sal_Int32 nGlobalSeriesIndex = 0; //for automatic symbols
+ for (std::size_t nCS = 0; nCS < aCooSysList.size(); ++nCS)
+ {
+ rtl::Reference<BaseCoordinateSystem> xCooSys(aCooSysList[nCS]);
+ VCoordinateSystem* pVCooSys
+ = SeriesPlotterContainer::addCooSysToList(m_rVCooSysList, xCooSys, rChartModel);
+ // Let's check whether the secondary Y axis is visible
+ try
+ {
+ if (xCooSys->getMaximumAxisIndexByDimension(1) > 0)
+ {
+ rtl::Reference<Axis> xAxisProp = xCooSys->getAxisByDimension2(1, 1);
+ xAxisProp->getPropertyValue("Show") >>= bSecondaryYaxisVisible;
+ }
+ }
+ catch (const lang::IndexOutOfBoundsException&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ //iterate through all chart types in the current coordinate system
+ std::vector<rtl::Reference<ChartType>> aChartTypeList(xCooSys->getChartTypes2());
+ for (std::size_t nT = 0; nT < aChartTypeList.size(); ++nT)
+ {
+ rtl::Reference<ChartType> xChartType(aChartTypeList[nT]);
+ if (nDimensionCount == 3
+ && xChartType->getChartType().equalsIgnoreAsciiCase(
+ CHART2_SERVICE_NAME_CHARTTYPE_PIE))
+ {
+ try
+ {
+ sal_Int32 n3DRelativeHeightOldValue(100);
+ uno::Any aAny = xChartType->getFastPropertyValue(
+ PROP_PIECHARTTYPE_3DRELATIVEHEIGHT); // "3DRelativeHeight"
+ aAny >>= n3DRelativeHeightOldValue;
+ if (n3DRelativeHeightOldValue != n3DRelativeHeight)
+ xChartType->setFastPropertyValue(
+ PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, // "3DRelativeHeight"
+ uno::Any(n3DRelativeHeight));
+ }
+ catch (const uno::Exception&)
+ {
+ }
+ }
+
+ if (ePieChartSubType != PieChartSubType_NONE)
+ {
+ xChartType->setFastPropertyValue(PROP_PIECHARTTYPE_SUBTYPE,
+ uno::Any(ePieChartSubType));
+ }
+
+ if (nT == 0)
+ m_bChartTypeUsesShiftedCategoryPositionPerDefault
+ = ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault(xChartType);
+
+ bool bExcludingPositioning
+ = xDiagram->getDiagramPositioningMode() == DiagramPositioningMode::Excluding;
+ VSeriesPlotter* pPlotter = VSeriesPlotter::createSeriesPlotter(
+ xChartType, nDimensionCount, bExcludingPositioning);
+ if (!pPlotter)
+ continue;
+
+ m_aSeriesPlotterList.push_back(std::unique_ptr<VSeriesPlotter>(pPlotter));
+ pPlotter->setNumberFormatsSupplier(xNumberFormatsSupplier);
+ pPlotter->setColorScheme(xColorScheme);
+ if (pVCooSys)
+ pPlotter->setExplicitCategoriesProvider(pVCooSys->getExplicitCategoriesProvider());
+ sal_Int32 nMissingValueTreatment
+ = xDiagram->getCorrectedMissingValueTreatment(xChartType);
+
+ if (pVCooSys)
+ pVCooSys->addMinimumAndMaximumSupplier(pPlotter);
+
+ sal_Int32 zSlot = -1;
+ sal_Int32 xSlot = -1;
+ sal_Int32 ySlot = -1;
+ const std::vector<rtl::Reference<DataSeries>>& aSeriesList
+ = xChartType->getDataSeries2();
+ for (std::size_t nS = 0; nS < aSeriesList.size(); ++nS)
+ {
+ rtl::Reference<DataSeries> const& xDataSeries = aSeriesList[nS];
+ if (!bIncludeHiddenCells && !xDataSeries->hasUnhiddenData())
+ continue;
+
+ std::unique_ptr<VDataSeries> pSeries(new VDataSeries(xDataSeries));
+
+ pSeries->setGlobalSeriesIndex(nGlobalSeriesIndex);
+ nGlobalSeriesIndex++;
+
+ if (bSortByXValues)
+ pSeries->doSortByXValues();
+
+ pSeries->setConnectBars(bConnectBars);
+ pSeries->setGroupBarsPerAxis(bGroupBarsPerAxis);
+ pSeries->setStartingAngle(nStartingAngle);
+
+ pSeries->setMissingValueTreatment(nMissingValueTreatment);
+
+ OUString aSeriesParticle(ObjectIdentifier::createParticleForSeries(0, nCS, nT, nS));
+ pSeries->setParticle(aSeriesParticle);
+
+ OUString aRole(ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection(
+ xChartType));
+ pSeries->setRoleOfSequenceForDataLabelNumberFormatDetection(aRole);
+
+ //ignore secondary axis for charttypes that do not support them
+ if (pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX
+ && (!ChartTypeHelper::isSupportingSecondaryAxis(xChartType, nDimensionCount)
+ || !bSecondaryYaxisVisible))
+ {
+ pSeries->setAttachedAxisIndex(MAIN_AXIS_INDEX);
+ }
+
+ StackingDirection eDirection = pSeries->getStackingDirection();
+ switch (eDirection)
+ {
+ case StackingDirection_NO_STACKING:
+ xSlot++;
+ ySlot = -1;
+ if (zSlot < 0)
+ zSlot = 0;
+ break;
+ case StackingDirection_Y_STACKING:
+ ySlot++;
+ if (xSlot < 0)
+ xSlot = 0;
+ if (zSlot < 0)
+ zSlot = 0;
+ break;
+ case StackingDirection_Z_STACKING:
+ zSlot++;
+ xSlot = -1;
+ ySlot = -1;
+ break;
+ default:
+ // UNO enums have one additional auto-generated case
+ break;
+ }
+ pPlotter->addSeries(std::move(pSeries), zSlot, xSlot, ySlot);
+ }
+ }
+ }
+
+ auto order
+ = [](const std::unique_ptr<VSeriesPlotter>& a, const std::unique_ptr<VSeriesPlotter>& b) {
+ return a->getRenderOrder() < b->getRenderOrder();
+ };
+
+ std::stable_sort(m_aSeriesPlotterList.begin(), m_aSeriesPlotterList.end(), order);
+
+ //transport seriesnames to the coordinatesystems if needed
+ if (m_aSeriesPlotterList.empty())
+ return;
+
+ uno::Sequence<OUString> aSeriesNames;
+ bool bSeriesNamesInitialized = false;
+ for (auto& pVCooSys : m_rVCooSysList)
+ {
+ if (pVCooSys->needSeriesNamesForAxis())
+ {
+ if (!bSeriesNamesInitialized)
+ {
+ aSeriesNames = m_aSeriesPlotterList[0]->getSeriesNames();
+ bSeriesNamesInitialized = true;
+ }
+ pVCooSys->setSeriesNamesForAxis(aSeriesNames);
+ }
+ }
+}
+
+bool SeriesPlotterContainer::isCategoryPositionShifted(const chart2::ScaleData& rSourceScale,
+ bool bHasComplexCategories)
+{
+ if (rSourceScale.AxisType == AxisType::CATEGORY)
+ return bHasComplexCategories || rSourceScale.ShiftedCategoryPosition
+ || m_bTableShiftPosition || m_bChartTypeUsesShiftedCategoryPositionPerDefault;
+
+ if (rSourceScale.AxisType == AxisType::DATE)
+ return rSourceScale.ShiftedCategoryPosition;
+
+ return rSourceScale.AxisType == AxisType::SERIES;
+}
+
+void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
+{
+ m_aAxisUsageList.clear();
+
+ // Loop through coordinate systems in the diagram (though for now
+ // there should only be one coordinate system per diagram).
+ for (auto& pVCooSys : m_rVCooSysList)
+ {
+ rtl::Reference<BaseCoordinateSystem> xCooSys = pVCooSys->getModel();
+ sal_Int32 nDimCount = xCooSys->getDimension();
+ bool bComplexCategoryAllowed = ChartTypeHelper::isSupportingComplexCategory(
+ AxisHelper::getChartTypeByIndex(xCooSys, 0));
+
+ for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex)
+ {
+ bool bDateAxisAllowed = ChartTypeHelper::isSupportingDateAxis(
+ AxisHelper::getChartTypeByIndex(xCooSys, 0), nDimIndex);
+
+ // Each dimension may have primary and secondary axes.
+ const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimIndex);
+ for (sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; ++nAxisIndex)
+ {
+ rtl::Reference<Axis> xAxis = xCooSys->getAxisByDimension2(nDimIndex, nAxisIndex);
+
+ if (!xAxis.is())
+ continue;
+
+ if (m_aAxisUsageList.find(xAxis) == m_aAxisUsageList.end())
+ {
+ // Create axis usage object for this axis.
+
+ chart2::ScaleData aSourceScale = xAxis->getScaleData();
+ ExplicitCategoriesProvider* pCatProvider
+ = pVCooSys->getExplicitCategoriesProvider();
+ if (nDimIndex == 0)
+ AxisHelper::checkDateAxis(aSourceScale, pCatProvider, bDateAxisAllowed);
+
+ bool bHasComplexCat = pCatProvider && pCatProvider->hasComplexCategories()
+ && bComplexCategoryAllowed;
+ aSourceScale.ShiftedCategoryPosition
+ = isCategoryPositionShifted(aSourceScale, bHasComplexCat);
+
+ m_aAxisUsageList[xAxis].aAutoScaling = ScaleAutomatism(aSourceScale, rNullDate);
+ }
+
+ AxisUsage& rAxisUsage = m_aAxisUsageList[xAxis];
+ rAxisUsage.addCoordinateSystem(pVCooSys.get(), nDimIndex, nAxisIndex);
+ }
+ }
+ }
+
+ // Determine the highest axis index of all dimensions.
+ m_nMaxAxisIndex = 0;
+ for (const auto& pVCooSys : m_rVCooSysList)
+ {
+ uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel();
+ sal_Int32 nDimCount = xCooSys->getDimension();
+
+ for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex)
+ {
+ for (auto& axisUsage : m_aAxisUsageList)
+ {
+ sal_Int32 nLocalMax = axisUsage.second.getMaxAxisIndexForDimension(nDimIndex);
+ if (m_nMaxAxisIndex < nLocalMax)
+ m_nMaxAxisIndex = nLocalMax;
+ }
+ }
+ }
+}
+
+void SeriesPlotterContainer::setScalesFromCooSysToPlotter()
+{
+ //set scales to plotter to enable them to provide the preferred scene AspectRatio
+ for (const std::unique_ptr<VSeriesPlotter>& aPlotter : m_aSeriesPlotterList)
+ {
+ VSeriesPlotter* pSeriesPlotter = aPlotter.get();
+ VCoordinateSystem* pVCooSys
+ = SeriesPlotterContainer::getCooSysForPlotter(m_rVCooSysList, pSeriesPlotter);
+ if (pVCooSys)
+ {
+ pSeriesPlotter->setScales(pVCooSys->getExplicitScales(0, 0),
+ pVCooSys->getPropertySwapXAndYAxis());
+ sal_Int32 nMaxAxisIndex = pVCooSys->getMaximumAxisIndexByDimension(
+ 1); //only additional value axis are relevant for series plotter
+ for (sal_Int32 nI = 1; nI <= nMaxAxisIndex; nI++)
+ pSeriesPlotter->addSecondaryValueScale(pVCooSys->getExplicitScale(1, nI), nI);
+ }
+ }
+}
+
+void SeriesPlotterContainer::setNumberFormatsFromAxes()
+{
+ //set numberformats to plotter to enable them to display the data labels in the numberformat of the axis
+ for (const std::unique_ptr<VSeriesPlotter>& aPlotter : m_aSeriesPlotterList)
+ {
+ VSeriesPlotter* pSeriesPlotter = aPlotter.get();
+ VCoordinateSystem* pVCooSys
+ = SeriesPlotterContainer::getCooSysForPlotter(m_rVCooSysList, pSeriesPlotter);
+ if (pVCooSys)
+ {
+ AxesNumberFormats aAxesNumberFormats;
+ const rtl::Reference<BaseCoordinateSystem>& xCooSys = pVCooSys->getModel();
+ sal_Int32 nDimensionCount = xCooSys->getDimension();
+ for (sal_Int32 nDimensionIndex = 0; nDimensionIndex < nDimensionCount;
+ ++nDimensionIndex)
+ {
+ const sal_Int32 nMaximumAxisIndex
+ = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
+ for (sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaximumAxisIndex; ++nAxisIndex)
+ {
+ try
+ {
+ rtl::Reference<Axis> xAxisProp
+ = xCooSys->getAxisByDimension2(nDimensionIndex, nAxisIndex);
+ if (xAxisProp.is())
+ {
+ sal_Int32 nNumberFormatKey(0);
+ if (xAxisProp->getPropertyValue(CHART_UNONAME_NUMFMT)
+ >>= nNumberFormatKey)
+ {
+ aAxesNumberFormats.setFormat(nNumberFormatKey, nDimensionIndex,
+ nAxisIndex);
+ }
+ else if (nDimensionIndex == 0)
+ {
+ //provide a default date format for date axis with own data
+ aAxesNumberFormats.setFormat(m_nDefaultDateNumberFormat,
+ nDimensionIndex, nAxisIndex);
+ }
+ }
+ }
+ catch (const lang::IndexOutOfBoundsException&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ }
+ }
+ }
+}
+
+void SeriesPlotterContainer::updateScalesAndIncrementsOnAxes()
+{
+ for (auto& nC : m_rVCooSysList)
+ nC->updateScalesAndIncrementsOnAxes();
+}
+
+void SeriesPlotterContainer::doAutoScaling(ChartModel& rChartModel)
+{
+ if (m_aSeriesPlotterList.empty() || m_aAxisUsageList.empty())
+ // We need these two containers populated to do auto-scaling. Bail out.
+ return;
+
+ //iterate over the main scales first than secondary axis
+ for (sal_Int32 nAxisIndex = 0; nAxisIndex <= m_nMaxAxisIndex; ++nAxisIndex)
+ {
+ // - first do autoscale for all x and z scales (because they are treated independent)
+ for (auto & [ rAxis, rAxisUsage ] : m_aAxisUsageList)
+ {
+ (void)rAxis;
+ rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 0, nAxisIndex);
+ rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 2, nAxisIndex);
+
+ ExplicitScaleData aExplicitScale;
+ ExplicitIncrementData aExplicitIncrement;
+ rAxisUsage.aAutoScaling.calculateExplicitScaleAndIncrement(aExplicitScale,
+ aExplicitIncrement);
+
+ rAxisUsage.setExplicitScaleAndIncrement(0, nAxisIndex, aExplicitScale,
+ aExplicitIncrement);
+ rAxisUsage.setExplicitScaleAndIncrement(2, nAxisIndex, aExplicitScale,
+ aExplicitIncrement);
+ }
+
+ // - second do autoscale for the dependent y scales (the coordinate systems are prepared with x and z scales already )
+ for (auto & [ rAxis, rAxisUsage ] : m_aAxisUsageList)
+ {
+ (void)rAxis;
+ rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 1, nAxisIndex);
+
+ ExplicitScaleData aExplicitScale;
+ ExplicitIncrementData aExplicitIncrement;
+ rAxisUsage.aAutoScaling.calculateExplicitScaleAndIncrement(aExplicitScale,
+ aExplicitIncrement);
+
+ rAxisUsage.setExplicitScaleAndIncrement(0, nAxisIndex, aExplicitScale,
+ aExplicitIncrement);
+ rAxisUsage.setExplicitScaleAndIncrement(1, nAxisIndex, aExplicitScale,
+ aExplicitIncrement);
+ rAxisUsage.setExplicitScaleAndIncrement(2, nAxisIndex, aExplicitScale,
+ aExplicitIncrement);
+ }
+ }
+ AdaptScaleOfYAxisWithoutAttachedSeries(rChartModel);
+}
+
+void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries(ChartModel& rModel)
+{
+ //issue #i80518#
+ for (sal_Int32 nAxisIndex = 0; nAxisIndex <= m_nMaxAxisIndex; nAxisIndex++)
+ {
+ for (auto & [ rAxis, rAxisUsage ] : m_aAxisUsageList)
+ {
+ (void)rAxis;
+ std::vector<VCoordinateSystem*> aVCooSysList_Y
+ = rAxisUsage.getCoordinateSystems(1, nAxisIndex);
+ if (aVCooSysList_Y.empty())
+ continue;
+
+ rtl::Reference<Diagram> xDiagram(rModel.getFirstChartDiagram());
+ if (!xDiagram.is())
+ continue;
+
+ bool bSeriesAttachedToThisAxis = false;
+ sal_Int32 nAttachedAxisIndex = -1;
+ {
+ std::vector<rtl::Reference<DataSeries>> aSeriesVector = xDiagram->getDataSeries();
+ for (auto const& series : aSeriesVector)
+ {
+ sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex(series);
+ if (nAxisIndex == nCurrentIndex)
+ {
+ bSeriesAttachedToThisAxis = true;
+ break;
+ }
+ else if (nAttachedAxisIndex < 0 || nAttachedAxisIndex > nCurrentIndex)
+ nAttachedAxisIndex = nCurrentIndex;
+ }
+ }
+
+ if (bSeriesAttachedToThisAxis || nAttachedAxisIndex < 0)
+ continue;
+
+ for (VCoordinateSystem* nC : aVCooSysList_Y)
+ {
+ nC->prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 1, nAttachedAxisIndex);
+
+ ExplicitScaleData aExplicitScaleSource
+ = nC->getExplicitScale(1, nAttachedAxisIndex);
+ ExplicitIncrementData aExplicitIncrementSource
+ = nC->getExplicitIncrement(1, nAttachedAxisIndex);
+
+ ExplicitScaleData aExplicitScaleDest = nC->getExplicitScale(1, nAxisIndex);
+ ExplicitIncrementData aExplicitIncrementDest
+ = nC->getExplicitIncrement(1, nAxisIndex);
+
+ aExplicitScaleDest.Orientation = aExplicitScaleSource.Orientation;
+ aExplicitScaleDest.Scaling = aExplicitScaleSource.Scaling;
+ aExplicitScaleDest.AxisType = aExplicitScaleSource.AxisType;
+
+ aExplicitIncrementDest.BaseValue = aExplicitIncrementSource.BaseValue;
+
+ ScaleData aScale(rAxisUsage.aAutoScaling.getScale());
+ if (!aScale.Minimum.hasValue())
+ {
+ bool bNewMinOK = true;
+ double fMax = 0.0;
+ if (aScale.Maximum >>= fMax)
+ bNewMinOK = (aExplicitScaleSource.Minimum <= fMax);
+ if (bNewMinOK)
+ aExplicitScaleDest.Minimum = aExplicitScaleSource.Minimum;
+ }
+ else
+ aExplicitIncrementDest.BaseValue = aExplicitScaleDest.Minimum;
+
+ if (!aScale.Maximum.hasValue())
+ {
+ bool bNewMaxOK = true;
+ double fMin = 0.0;
+ if (aScale.Minimum >>= fMin)
+ bNewMaxOK = (fMin <= aExplicitScaleSource.Maximum);
+ if (bNewMaxOK)
+ aExplicitScaleDest.Maximum = aExplicitScaleSource.Maximum;
+ }
+ if (!aScale.Origin.hasValue())
+ aExplicitScaleDest.Origin = aExplicitScaleSource.Origin;
+
+ if (!aScale.IncrementData.Distance.hasValue())
+ aExplicitIncrementDest.Distance = aExplicitIncrementSource.Distance;
+
+ bool bAutoMinorInterval = true;
+ if (aScale.IncrementData.SubIncrements.hasElements())
+ bAutoMinorInterval
+ = !(aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue());
+ if (bAutoMinorInterval)
+ {
+ if (!aExplicitIncrementDest.SubIncrements.empty()
+ && !aExplicitIncrementSource.SubIncrements.empty())
+ aExplicitIncrementDest.SubIncrements[0].IntervalCount
+ = aExplicitIncrementSource.SubIncrements[0].IntervalCount;
+ }
+
+ nC->setExplicitScaleAndIncrement(1, nAxisIndex, aExplicitScaleDest,
+ aExplicitIncrementDest);
+ }
+ }
+ }
+
+ if (!AxisHelper::isAxisPositioningEnabled())
+ return;
+
+ //correct origin for y main axis (the origin is where the other main axis crosses)
+ sal_Int32 nAxisIndex = 0;
+ sal_Int32 nDimensionIndex = 1;
+ for (auto & [ rAxis, rAxisUsage ] : m_aAxisUsageList)
+ {
+ (void)rAxis;
+ std::vector<VCoordinateSystem*> aVCooSysList
+ = rAxisUsage.getCoordinateSystems(nDimensionIndex, nAxisIndex);
+ size_t nC;
+ for (nC = 0; nC < aVCooSysList.size(); nC++)
+ {
+ ExplicitScaleData aExplicitScale(
+ aVCooSysList[nC]->getExplicitScale(nDimensionIndex, nAxisIndex));
+ ExplicitIncrementData aExplicitIncrement(
+ aVCooSysList[nC]->getExplicitIncrement(nDimensionIndex, nAxisIndex));
+
+ rtl::Reference<BaseCoordinateSystem> xCooSys(aVCooSysList[nC]->getModel());
+ rtl::Reference<Axis> xAxis = xCooSys->getAxisByDimension2(nDimensionIndex, nAxisIndex);
+ rtl::Reference<Axis> xCrossingMainAxis
+ = AxisHelper::getCrossingMainAxis(xAxis, xCooSys);
+
+ if (xCrossingMainAxis.is())
+ {
+ css::chart::ChartAxisPosition eCrossingMainAxisPos(
+ css::chart::ChartAxisPosition_ZERO);
+ xCrossingMainAxis->getPropertyValue("CrossoverPosition") >>= eCrossingMainAxisPos;
+ if (eCrossingMainAxisPos == css::chart::ChartAxisPosition_VALUE)
+ {
+ double fValue = 0.0;
+ xCrossingMainAxis->getPropertyValue("CrossoverValue") >>= fValue;
+ aExplicitScale.Origin = fValue;
+ }
+ else if (eCrossingMainAxisPos == css::chart::ChartAxisPosition_ZERO)
+ aExplicitScale.Origin = 0.0;
+ else if (eCrossingMainAxisPos == css::chart::ChartAxisPosition_START)
+ aExplicitScale.Origin = aExplicitScale.Minimum;
+ else if (eCrossingMainAxisPos == css::chart::ChartAxisPosition_END)
+ aExplicitScale.Origin = aExplicitScale.Maximum;
+ }
+
+ aVCooSysList[nC]->setExplicitScaleAndIncrement(nDimensionIndex, nAxisIndex,
+ aExplicitScale, aExplicitIncrement);
+ }
+ }
+}
+
+drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio()
+{
+ drawing::Direction3D aPreferredAspectRatio(1.0, 1.0, 1.0);
+
+ //get a list of all preferred aspect ratios and combine them
+ //first with special demands wins (less or equal zero <-> arbitrary)
+ double fx, fy, fz;
+ fx = fy = fz = -1.0;
+ for (const std::unique_ptr<VSeriesPlotter>& aPlotter : m_aSeriesPlotterList)
+ {
+ drawing::Direction3D aSingleRatio(aPlotter->getPreferredDiagramAspectRatio());
+ if (fx < 0 && aSingleRatio.DirectionX > 0)
+ fx = aSingleRatio.DirectionX;
+
+ if (fy < 0 && aSingleRatio.DirectionY > 0)
+ {
+ if (fx > 0 && aSingleRatio.DirectionX > 0)
+ fy = fx * aSingleRatio.DirectionY / aSingleRatio.DirectionX;
+ else if (fz > 0 && aSingleRatio.DirectionZ > 0)
+ fy = fz * aSingleRatio.DirectionY / aSingleRatio.DirectionZ;
+ else
+ fy = aSingleRatio.DirectionY;
+ }
+
+ if (fz < 0 && aSingleRatio.DirectionZ > 0)
+ {
+ if (fx > 0 && aSingleRatio.DirectionX > 0)
+ fz = fx * aSingleRatio.DirectionZ / aSingleRatio.DirectionX;
+ else if (fy > 0 && aSingleRatio.DirectionY > 0)
+ fz = fy * aSingleRatio.DirectionZ / aSingleRatio.DirectionY;
+ else
+ fz = aSingleRatio.DirectionZ;
+ }
+
+ if (fx > 0 && fy > 0 && fz > 0)
+ break;
+ }
+ aPreferredAspectRatio = drawing::Direction3D(fx, fy, fz);
+ return aPreferredAspectRatio;
+}
+
+} //end chart2 namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/SeriesPlotterContainer.hxx b/chart2/source/view/main/SeriesPlotterContainer.hxx
new file mode 100644
index 000000000000..38f3c8b909c8
--- /dev/null
+++ b/chart2/source/view/main/SeriesPlotterContainer.hxx
@@ -0,0 +1,160 @@
+/* -*- 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 <config_feature_desktop.h>
+#include <VSeriesPlotter.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include "AxisUsage.hxx"
+
+namespace chart
+{
+/** This class is a container of `SeriesPlotter` objects (such as `PieChart`
+ * instances). It is used for initializing coordinate systems, axes and scales
+ * of all series plotters which belongs to the container.
+ */
+class SeriesPlotterContainer
+{
+public:
+ explicit SeriesPlotterContainer(std::vector<std::unique_ptr<VCoordinateSystem>>& rVCooSysList);
+ ~SeriesPlotterContainer();
+
+ /** It is used to set coordinate systems (`m_rVCooSysList`), this method
+ * is invoked by `ChartView::createShapes2D` before of
+ * `ChartView::impl_createDiagramAndContent`.
+ * Coordinate systems are retrieved through the `XCoordinateSystemContainer`
+ * interface implemented by a diagram object which is provided by the
+ * `ChartModel` object passed to the method (`rChartModel.getFirstDiagram()`).
+ *
+ * It is used for creating series plotters and appending them
+ * to `m_aSeriesPlotterList`. The created series plotters are initialized
+ * through data (number formats supplier, color scheme, data series),
+ * extracted from the chart model or the diagram objects. An exception is
+ * the explicit category provider that is retrieved through the
+ * `VCoordinateSystem` object used by the series plotter.
+ *
+ * It sets the minimum-maximum supplier for a coordinate system:
+ * this supplier is the series plotter itself which utilizes the given
+ * coordinate system. In fact `VSeriesPlotter` has `MinimumMaximumSupplier`
+ * as one of its base classes.
+ * Hence, for instance, a `PieChart`, which is a series plotter, is
+ * a `MinimumMaximumSupplier`, too.
+ */
+ void initializeCooSysAndSeriesPlotter(ChartModel& rModel);
+
+ /** This method is invoked by `ChartView::impl_createDiagramAndContent`.
+ * It iterates on every axis of every coordinate systems, and if the axis
+ * is not yet present in `m_aAxisUsageList` it creates a new `AxisUsage`
+ * object and initialize its `aAutoScaling` member to the `ScaleData`
+ * object of the current axis.
+ */
+ void initAxisUsageList(const Date& rNullDate);
+
+ /**
+ * Perform automatic axis scaling and determine the amount and spacing of
+ * increments. It assumes that the caller has determined the size of the
+ * largest axis label text object prior to calling this method.
+ *
+ * The new axis scaling data will be stored in the VCoordinateSystem
+ * objects. The label alignment direction for each axis will also get
+ * determined during this process, and stored in VAxis.
+ *
+ * This method is invoked by `ChartView::impl_createDiagramAndContent`
+ * soon after `initAxisUsageList`.
+ * It initializes explicit scale and increment objects for all coordinate
+ * systems in `m_rVCooSysList`.
+ * This action is achieved by iterating on the `m_aAxisUsageList` container,
+ * and performing 3 steps:
+ * 1- call `VCoordinateSystem::prepareAutomaticAxisScaling` for setting
+ * scaling parameters of the `aAutoScaling` member (a `ScaleAutomatism`
+ * object) for the current `AxisUsage` instance
+ * (see `VCoordinateSystem::prepareAutomaticAxisScaling`);
+ * 2- calculate the explicit scale and increment objects
+ * (see ScaleAutomatism::calculateExplicitScaleAndIncrement);
+ * 3- set the explicit scale and increment objects for each coordinate
+ * system.
+ */
+ void doAutoScaling(ChartModel& rModel);
+
+ /**
+ * After auto-scaling is performed, call this method to set the explicit
+ * scaling and increment data to all relevant VAxis objects.
+ */
+ void updateScalesAndIncrementsOnAxes();
+
+ /**
+ * After auto-scaling is performed, call this method to set the explicit
+ * scaling data to all the plotters.
+ */
+ void setScalesFromCooSysToPlotter();
+
+ void setNumberFormatsFromAxes();
+ css::drawing::Direction3D getPreferredAspectRatio();
+
+ std::vector<std::unique_ptr<VSeriesPlotter>>& getSeriesPlotterList()
+ {
+ return m_aSeriesPlotterList;
+ }
+ std::vector<std::unique_ptr<VCoordinateSystem>>& getCooSysList() { return m_rVCooSysList; }
+ std::vector<LegendEntryProvider*> getLegendEntryProviderList();
+
+ void AdaptScaleOfYAxisWithoutAttachedSeries(ChartModel& rModel);
+
+ bool isCategoryPositionShifted(const css::chart2::ScaleData& rSourceScale,
+ bool bHasComplexCategories);
+
+ static VCoordinateSystem*
+ getCooSysForPlotter(const std::vector<std::unique_ptr<VCoordinateSystem>>& rVCooSysList,
+ MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier);
+ static VCoordinateSystem*
+ addCooSysToList(std::vector<std::unique_ptr<VCoordinateSystem>>& rVCooSysList,
+ const rtl::Reference<BaseCoordinateSystem>& xCooSys, ChartModel& rChartModel);
+ static VCoordinateSystem*
+ findInCooSysList(const std::vector<std::unique_ptr<VCoordinateSystem>>& rVCooSysList,
+ const rtl::Reference<BaseCoordinateSystem>& xCooSys);
+
+private:
+ /** A vector of series plotters.
+ */
+ std::vector<std::unique_ptr<VSeriesPlotter>> m_aSeriesPlotterList;
+
+ /** A vector of coordinate systems.
+ */
+ std::vector<std::unique_ptr<VCoordinateSystem>>& m_rVCooSysList;
+
+ /** A map whose key is a `XAxis` interface and the related value is
+ * an object of `AxisUsage` type.
+ */
+ std::map<rtl::Reference<Axis>, AxisUsage> m_aAxisUsageList;
+
+ /**
+ * Max axis index of all dimensions. Currently this can be either 0 or 1
+ * since we only support primary and secondary axes per dimension. The
+ * value of 0 means all dimensions have only primary axis, while 1 means
+ * at least one dimension has a secondary axis.
+ */
+ sal_Int32 m_nMaxAxisIndex;
+
+ bool m_bChartTypeUsesShiftedCategoryPositionPerDefault;
+ bool m_bTableShiftPosition = false;
+ sal_Int32 m_nDefaultDateNumberFormat;
+};
+
+} //end chart2 namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index b2e19781c8ef..c681c581a7b3 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -26,7 +26,6 @@
#include <PropertyMapper.hxx>
#include <VLineProperties.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/chart2/XFormattedString.hpp>
#include <com/sun/star/drawing/CircleKind.hpp>
#include <com/sun/star/drawing/DoubleSequence.hpp>
@@ -39,13 +38,10 @@
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/drawing/TextureProjectionMode.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
-#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XShapes2.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
-#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Any.hxx>
@@ -54,11 +50,16 @@
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx>
-#include <tools/diagnose_ex.h>
+#include <svx/svdpage.hxx>
+#include <svx/svdopath.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/helpers.hxx>
+#include <tools/UnitConversion.hxx>
#include <sal/log.hxx>
#include <algorithm>
+#include <cmath>
+#include <cstddef>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -73,36 +74,63 @@ void lcl_addProperty(uno::Sequence<OUString> & rPropertyNames, uno::Sequence<uno
OUString const & rName, uno::Any const & rAny)
{
rPropertyNames.realloc(rPropertyNames.getLength() + 1);
- rPropertyNames[rPropertyNames.getLength() - 1] = rName;
+ rPropertyNames.getArray()[rPropertyNames.getLength() - 1] = rName;
rPropertyValues.realloc(rPropertyValues.getLength() + 1);
- rPropertyValues[rPropertyValues.getLength() - 1] = rAny;
+ rPropertyValues.getArray()[rPropertyValues.getLength() - 1] = rAny;
+}
+
+css::drawing::PolyPolygonShape3D toPolyPolygonShape3D(const std::vector<std::vector<css::drawing::Position3D>>& rPoints)
+{
+ css::drawing::PolyPolygonShape3D aUnoPoly;
+ aUnoPoly.SequenceX.realloc(rPoints.size());
+ aUnoPoly.SequenceY.realloc(rPoints.size());
+ aUnoPoly.SequenceZ.realloc(rPoints.size());
+ for (std::size_t nPolygonIndex=0; nPolygonIndex<rPoints.size(); ++nPolygonIndex)
+ {
+ drawing::DoubleSequence* pOuterSequenceX = &aUnoPoly.SequenceX.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceY = &aUnoPoly.SequenceY.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceZ = &aUnoPoly.SequenceZ.getArray()[nPolygonIndex];
+ pOuterSequenceX->realloc(rPoints[nPolygonIndex].size());
+ pOuterSequenceY->realloc(rPoints[nPolygonIndex].size());
+ pOuterSequenceZ->realloc(rPoints[nPolygonIndex].size());
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+ for (std::size_t nPointIndex=0; nPointIndex<rPoints[nPolygonIndex].size(); ++nPointIndex)
+ {
+ auto& rPos = rPoints[nPolygonIndex][nPointIndex];
+ pInnerSequenceX[nPointIndex] = rPos.PositionX;
+ pInnerSequenceY[nPointIndex] = rPos.PositionY;
+ pInnerSequenceZ[nPointIndex] = rPos.PositionZ;
+ }
+ }
+ return aUnoPoly;
}
} // end anonymous namespace
-uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape(
- const uno::Reference< drawing::XDrawPage>& xDrawPage )
+rtl::Reference<SvxShapeGroupAnyD> ShapeFactory::getOrCreateChartRootShape(
+ const rtl::Reference<SvxDrawPage>& xDrawPage )
{
- uno::Reference<drawing::XShapes> xRet = ShapeFactory::getChartRootShape(xDrawPage);
+ rtl::Reference<SvxShapeGroupAnyD> xRet = ShapeFactory::getChartRootShape(xDrawPage);
if (xRet.is())
return xRet;
// Create a new root shape and set it to the bottom of the page. The root
// shape is identified by having the name com.sun.star.chart2.shapes.
- uno::Reference<drawing::XShape> xShape(
- m_xShapeFactory->createInstance("com.sun.star.drawing.GroupShape"), uno::UNO_QUERY);
- uno::Reference<drawing::XShapes2> xShapes2(xDrawPage, uno::UNO_QUERY_THROW);
- xShapes2->addBottom(xShape);
+ rtl::Reference<SvxShapeGroup> xShapeGroup = new SvxShapeGroup(nullptr, nullptr);
+ xShapeGroup->setShapeKind(SdrObjKind::Group);
+ // cast to resolve ambiguity in converting to XShape
+ xDrawPage->addBottom(static_cast<SvxShape*>(xShapeGroup.get()));
- setShapeName(xShape, "com.sun.star.chart2.shapes");
- xShape->setSize(awt::Size(0,0));
+ setShapeName(xShapeGroup, "com.sun.star.chart2.shapes");
+ xShapeGroup->setSize(awt::Size(0,0));
- xRet.set(xShape, uno::UNO_QUERY);
- return xRet;
+ return xShapeGroup;
}
-void ShapeFactory::setPageSize(const uno::Reference<drawing::XShapes>&, const awt::Size&) {}
+void ShapeFactory::setPageSize(const rtl::Reference<SvxShapeGroupAnyD>&, const awt::Size&) {}
// diverse tools::PolyPolygon create methods
@@ -356,9 +384,9 @@ static uno::Any createPolyPolygon_Cone( double fHeight, double fRadius, double f
// methods for 3D shape creation
-uno::Reference<drawing::XShape>
+rtl::Reference<Svx3DExtrudeObject>
ShapeFactory::createCube(
- const uno::Reference<drawing::XShapes>& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, sal_Int32 nRotateZAngleHundredthDegree
, const uno::Reference< beans::XPropertySet >& xSourceProp
@@ -384,16 +412,15 @@ uno::Reference<drawing::XShape>
TOOLS_WARN_EXCEPTION("chart2", "" );
}
}
- uno::Reference<drawing::XShape> xShape = impl_createCube( xTarget, rPosition, rSize, nRotateZAngleHundredthDegree, bRounded );
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ rtl::Reference<Svx3DExtrudeObject> xShape = impl_createCube( xTarget, rPosition, rSize, nRotateZAngleHundredthDegree, bRounded );
if( xSourceProp.is())
- PropertyMapper::setMappedProperties( xProp, xSourceProp, rPropertyNameMap );
+ PropertyMapper::setMappedProperties( *xShape, xSourceProp, rPropertyNameMap );
return xShape;
}
-uno::Reference<drawing::XShape>
+rtl::Reference<Svx3DExtrudeObject>
ShapeFactory::impl_createCube(
- const uno::Reference<drawing::XShapes>& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, sal_Int32 nRotateZAngleHundredthDegree
, bool bRounded )
@@ -402,60 +429,54 @@ uno::Reference<drawing::XShape>
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<Svx3DExtrudeObject> xShape = new Svx3DExtrudeObject(nullptr);
+ xShape->setShapeKind(SdrObjKind::E3D_Extrusion);
+ xTarget->addShape(*xShape);
//set properties
- uno::Reference<beans::XMultiPropertySet> xMultiPropertySet(xShape, uno::UNO_QUERY);
- OSL_ENSURE(xMultiPropertySet.is(), "created shape offers no XMultiPropertySet");
- if (xMultiPropertySet.is())
+ try
{
- try
- {
- //depth
- double fDepth = rSize.DirectionZ;
- if (fDepth<0)
- fDepth*=-1.0;
-
- //PercentDiagonal
- sal_Int16 nPercentDiagonal = bRounded ? 3 : 0;
-
- //Matrix for position
- basegfx::B3DHomMatrix aHomMatrix;
- if (nRotateZAngleHundredthDegree != 0)
- aHomMatrix.rotate(0.0, 0.0, -nRotateZAngleHundredthDegree / 18000.00 * F_PI);
- aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY,
- rPosition.PositionZ - (fDepth / 2.0));
-
- uno::Sequence<OUString> aPropertyNames {
- UNO_NAME_3D_EXTRUDE_DEPTH,
- UNO_NAME_3D_PERCENT_DIAGONAL,
- UNO_NAME_3D_POLYPOLYGON3D,
- UNO_NAME_3D_TRANSFORM_MATRIX,
- };
-
- uno::Sequence<uno::Any> aPropertyValues {
- uno::Any(sal_Int32(fDepth)), // Depth
- uno::Any(nPercentDiagonal), // PercentDiagonal
- createPolyPolygon_Cube(rSize, double(nPercentDiagonal) / 200.0, bRounded),
- uno::Any(B3DHomMatrixToHomogenMatrix(aHomMatrix))
- };
-
- xMultiPropertySet->setPropertyValues(aPropertyNames, aPropertyValues);
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ //depth
+ double fDepth = rSize.DirectionZ;
+ if (fDepth<0)
+ fDepth*=-1.0;
+
+ //PercentDiagonal
+ sal_Int16 nPercentDiagonal = bRounded ? 3 : 0;
+
+ //Matrix for position
+ basegfx::B3DHomMatrix aHomMatrix;
+ if (nRotateZAngleHundredthDegree != 0)
+ aHomMatrix.rotate(0.0, 0.0, -basegfx::deg2rad<100>(nRotateZAngleHundredthDegree));
+ aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY,
+ rPosition.PositionZ - (fDepth / 2.0));
+
+ uno::Sequence<OUString> aPropertyNames {
+ UNO_NAME_3D_EXTRUDE_DEPTH,
+ UNO_NAME_3D_PERCENT_DIAGONAL,
+ UNO_NAME_3D_POLYPOLYGON3D,
+ UNO_NAME_3D_TRANSFORM_MATRIX,
+ };
+
+ uno::Sequence<uno::Any> aPropertyValues {
+ uno::Any(sal_Int32(fDepth)), // Depth
+ uno::Any(nPercentDiagonal), // PercentDiagonal
+ createPolyPolygon_Cube(rSize, double(nPercentDiagonal) / 200.0, bRounded),
+ uno::Any(B3DHomMatrixToHomogenMatrix(aHomMatrix))
+ };
+
+ xShape->setPropertyValues(aPropertyNames, aPropertyValues);
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference<drawing::XShape>
+rtl::Reference<Svx3DLatheObject>
ShapeFactory::createCylinder(
- const uno::Reference<drawing::XShapes>& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, sal_Int32 nRotateZAngleHundredthDegree )
{
@@ -463,9 +484,9 @@ uno::Reference<drawing::XShape>
xTarget, rPosition, rSize, 0.0, nRotateZAngleHundredthDegree, true );
}
-uno::Reference<drawing::XShape>
+rtl::Reference<Svx3DSceneObject>
ShapeFactory::createPyramid(
- const uno::Reference<drawing::XShapes>& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, double fTopHeight, bool bRotateZ
, const uno::Reference< beans::XPropertySet >& xSourceProp
@@ -474,7 +495,7 @@ uno::Reference<drawing::XShape>
if( !xTarget.is() )
return nullptr;
- Reference< drawing::XShapes > xGroup( ShapeFactory::createGroup3D( xTarget ) );
+ rtl::Reference<Svx3DSceneObject> xGroup( ShapeFactory::createGroup3D( xTarget ) );
bool bDoubleSided = false;
short nRotatedTexture = 0;
@@ -620,21 +641,21 @@ uno::Reference<drawing::XShape>
ShapeFactory::createStripe( xGroup, aStripe4, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
ShapeFactory::createStripe( xGroup, aStripeBottom, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
- return Reference< drawing::XShape >( xGroup, uno::UNO_QUERY );
+ return xGroup;
}
-uno::Reference<drawing::XShape>
+rtl::Reference<Svx3DLatheObject>
ShapeFactory::createCone(
- const uno::Reference<drawing::XShapes>& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree )
{
return impl_createConeOrCylinder( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree, false );
}
-uno::Reference<drawing::XShape>
+rtl::Reference<Svx3DLatheObject>
ShapeFactory::impl_createConeOrCylinder(
- const uno::Reference<drawing::XShapes>& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
, bool bCylinder )
@@ -643,60 +664,54 @@ uno::Reference<drawing::XShape>
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.Shape3DLatheObject" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<Svx3DLatheObject> xShape = new Svx3DLatheObject(nullptr);
+ xShape->setShapeKind(SdrObjKind::E3D_Lathe);
+ xTarget->addShape(*xShape);
double fWidth = rSize.DirectionX/2.0; //The depth will be corrected within Matrix
double fRadius = fWidth; //!!!!!!!! problem in drawing layer: rotation object calculates wrong needed size -> wrong camera (it's a problem with bounding boxes)
double fHeight = rSize.DirectionY;
//set properties
- uno::Reference<beans::XMultiPropertySet> xMultiPropertySet(xShape, uno::UNO_QUERY);
- OSL_ENSURE(xMultiPropertySet.is(), "created shape offers no XMultiPropertySet");
- if (xMultiPropertySet.is())
+ try
{
- try
- {
- //Polygon
- sal_Int32 nVerticalSegmentCount = 0;
- uno::Any aPPolygon = bCylinder
- ? createPolyPolygon_Cylinder(fHeight, fRadius, nVerticalSegmentCount)
- : createPolyPolygon_Cone(fHeight, fRadius, fTopHeight, nVerticalSegmentCount);
-
- //Matrix for position
- basegfx::B3DHomMatrix aHomMatrix;
- if (nRotateZAngleHundredthDegree != 0)
- aHomMatrix.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*F_PI);
- //stretch the symmetric objects to given depth
- aHomMatrix.scale(1.0,1.0,rSize.DirectionZ/rSize.DirectionX);
- aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ);
-
- uno::Sequence<OUString> aPropertyNames{
- UNO_NAME_3D_PERCENT_DIAGONAL,
- UNO_NAME_3D_POLYPOLYGON3D,
- UNO_NAME_3D_TRANSFORM_MATRIX,
- UNO_NAME_3D_HORZ_SEGS,
- UNO_NAME_3D_VERT_SEGS,
- UNO_NAME_3D_REDUCED_LINE_GEOMETRY
- };
-
- uno::Sequence<uno::Any> aPropertyValues {
- uno::Any(sal_Int16(5)), // PercentDiagonal
- aPPolygon, // Polygon
- uno::Any(B3DHomMatrixToHomogenMatrix(aHomMatrix)), // Matrix
- uno::Any(CHART_3DOBJECT_SEGMENTCOUNT), // Horizontal Segments
- uno::Any(nVerticalSegmentCount), // Vertical Segments
- uno::Any(true) // Reduced lines
- };
-
- xMultiPropertySet->setPropertyValues(aPropertyNames, aPropertyValues);
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ //Polygon
+ sal_Int32 nVerticalSegmentCount = 0;
+ uno::Any aPPolygon = bCylinder
+ ? createPolyPolygon_Cylinder(fHeight, fRadius, nVerticalSegmentCount)
+ : createPolyPolygon_Cone(fHeight, fRadius, fTopHeight, nVerticalSegmentCount);
+
+ //Matrix for position
+ basegfx::B3DHomMatrix aHomMatrix;
+ if (nRotateZAngleHundredthDegree != 0)
+ aHomMatrix.rotate(0.0,0.0,-basegfx::deg2rad<100>(nRotateZAngleHundredthDegree));
+ //stretch the symmetric objects to given depth
+ aHomMatrix.scale(1.0,1.0,rSize.DirectionZ/rSize.DirectionX);
+ aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ);
+
+ uno::Sequence<OUString> aPropertyNames{
+ UNO_NAME_3D_PERCENT_DIAGONAL,
+ UNO_NAME_3D_POLYPOLYGON3D,
+ UNO_NAME_3D_TRANSFORM_MATRIX,
+ UNO_NAME_3D_HORZ_SEGS,
+ UNO_NAME_3D_VERT_SEGS,
+ UNO_NAME_3D_REDUCED_LINE_GEOMETRY
+ };
+
+ uno::Sequence<uno::Any> aPropertyValues {
+ uno::Any(sal_Int16(5)), // PercentDiagonal
+ aPPolygon, // Polygon
+ uno::Any(B3DHomMatrixToHomogenMatrix(aHomMatrix)), // Matrix
+ uno::Any(CHART_3DOBJECT_SEGMENTCOUNT), // Horizontal Segments
+ uno::Any(nVerticalSegmentCount), // Vertical Segments
+ uno::Any(true) // Reduced lines
+ };
+
+ xShape->setPropertyValues(aPropertyNames, aPropertyValues);
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
@@ -711,19 +726,23 @@ static void appendAndCloseBezierCoords( drawing::PolyPolygonBezierCoords& rRetur
sal_Int32 nOldCount = rReturn.Coordinates[0].getLength();
- rReturn.Coordinates[0].realloc(nOldCount+nAddCount+1);
- rReturn.Flags[0].realloc(nOldCount+nAddCount+1);
+ auto pCoordinates = rReturn.Coordinates.getArray();
+ pCoordinates[0].realloc(nOldCount + nAddCount + 1);
+ auto pCoordinates0 = pCoordinates[0].getArray();
+ auto pFlags = rReturn.Flags.getArray();
+ pFlags[0].realloc(nOldCount+nAddCount+1);
+ auto pFlags0 = pFlags[0].getArray();
for(sal_Int32 nN=0;nN<nAddCount; nN++ )
{
sal_Int32 nAdd = bAppendInverse ? (nAddCount-1-nN) : nN;
- rReturn.Coordinates[0][nOldCount+nN] = rAdd.Coordinates[0][nAdd];
- rReturn.Flags[0][nOldCount+nN] = rAdd.Flags[0][nAdd];
+ pCoordinates0[nOldCount+nN] = rAdd.Coordinates[0][nAdd];
+ pFlags0[nOldCount+nN] = rAdd.Flags[0][nAdd];
}
//close
- rReturn.Coordinates[0][nOldCount+nAddCount] = rReturn.Coordinates[0][0];
- rReturn.Flags[0][nOldCount+nAddCount] = rReturn.Flags[0][0];
+ pCoordinates0[nOldCount+nAddCount] = rReturn.Coordinates[0][0];
+ pFlags0[nOldCount+nAddCount] = rReturn.Flags[0][0];
}
static drawing::PolyPolygonBezierCoords getCircularArcBezierCoords(
@@ -748,9 +767,9 @@ static drawing::PolyPolygonBezierCoords getCircularArcBezierCoords(
}
else
{
- double fFirstAngleOnSubDevision = (static_cast<sal_Int32>(fStartAngleRadian/fAngleSubdivisionRadian)+1)*fAngleSubdivisionRadian;
- if( !::rtl::math::approxEqual( fStartAngleRadian, fFirstAngleOnSubDevision ) )
- fFirstSegmentAngle = fFirstAngleOnSubDevision-fStartAngleRadian;
+ double fFirstAngleOnSubDivision = (static_cast<sal_Int32>(fStartAngleRadian/fAngleSubdivisionRadian)+1)*fAngleSubdivisionRadian;
+ if( !::rtl::math::approxEqual( fStartAngleRadian, fFirstAngleOnSubDivision ) )
+ fFirstSegmentAngle = fFirstAngleOnSubDivision-fStartAngleRadian;
if(nSegmentCount>1)
{
@@ -767,11 +786,10 @@ static drawing::PolyPolygonBezierCoords getCircularArcBezierCoords(
sal_Int32 nPointCount = 1 + 3*nSegmentCount; //first point of next segment equals last point of former segment
- aReturn.Coordinates = drawing::PointSequenceSequence(1);
- aReturn.Flags = drawing::FlagSequenceSequence(1);
-
drawing::PointSequence aPoints(nPointCount);
+ auto pPoints = aPoints.getArray();
drawing::FlagSequence aFlags(nPointCount);
+ auto pFlags = aFlags.getArray();
//!! applying matrix to vector does ignore translation, so it is important to use a B2DPoint here instead of B2DVector
::basegfx::B2DPoint P0,P1,P2,P3;
@@ -781,7 +799,7 @@ static drawing::PolyPolygonBezierCoords getCircularArcBezierCoords(
for(sal_Int32 nSegment=0; nSegment<nSegmentCount; nSegment++)
{
double fCurrentSegmentAngle = fAngleSubdivisionRadian;
- if(nSegment==0)//first segment gets only a smaller peace until the next subdevision
+ if(nSegment==0)//first segment gets only a smaller peace until the next subdivision
fCurrentSegmentAngle = fFirstSegmentAngle;
else if(nSegment==(nSegmentCount-1)) //the last segment gets the rest angle that does not fit into equal pieces
fCurrentSegmentAngle = fLastSegmentAngle;
@@ -811,28 +829,28 @@ static drawing::PolyPolygonBezierCoords getCircularArcBezierCoords(
P2 = rTransformationFromUnitCircle*(aStart*P2);
P3 = rTransformationFromUnitCircle*(aStart*P3);
- aPoints[nPoint].X = static_cast< sal_Int32 >( P0.getX());
- aPoints[nPoint].Y = static_cast< sal_Int32 >( P0.getY());
- aFlags [nPoint++] = drawing::PolygonFlags_NORMAL;
+ pPoints[nPoint].X = static_cast< sal_Int32 >( P0.getX());
+ pPoints[nPoint].Y = static_cast< sal_Int32 >( P0.getY());
+ pFlags [nPoint++] = drawing::PolygonFlags_NORMAL;
- aPoints[nPoint].X = static_cast< sal_Int32 >( P1.getX());
- aPoints[nPoint].Y = static_cast< sal_Int32 >( P1.getY());
- aFlags[nPoint++] = drawing::PolygonFlags_CONTROL;
+ pPoints[nPoint].X = static_cast< sal_Int32 >( P1.getX());
+ pPoints[nPoint].Y = static_cast< sal_Int32 >( P1.getY());
+ pFlags[nPoint++] = drawing::PolygonFlags_CONTROL;
- aPoints[nPoint].X = static_cast< sal_Int32 >( P2.getX());
- aPoints[nPoint].Y = static_cast< sal_Int32 >( P2.getY());
- aFlags [nPoint++] = drawing::PolygonFlags_CONTROL;
+ pPoints[nPoint].X = static_cast< sal_Int32 >( P2.getX());
+ pPoints[nPoint].Y = static_cast< sal_Int32 >( P2.getY());
+ pFlags [nPoint++] = drawing::PolygonFlags_CONTROL;
if(nSegment==(nSegmentCount-1))
{
- aPoints[nPoint].X = static_cast< sal_Int32 >( P3.getX());
- aPoints[nPoint].Y = static_cast< sal_Int32 >( P3.getY());
- aFlags [nPoint++] = drawing::PolygonFlags_NORMAL;
+ pPoints[nPoint].X = static_cast< sal_Int32 >( P3.getX());
+ pPoints[nPoint].Y = static_cast< sal_Int32 >( P3.getY());
+ pFlags [nPoint++] = drawing::PolygonFlags_NORMAL;
}
}
- aReturn.Coordinates[0] = aPoints;
- aReturn.Flags[0] = aFlags;
+ aReturn.Coordinates = { aPoints };
+ aReturn.Flags = { aFlags };
return aReturn;
}
@@ -846,13 +864,10 @@ static drawing::PolyPolygonBezierCoords getRingBezierCoords(
{
drawing::PolyPolygonBezierCoords aReturn;
- aReturn.Coordinates = drawing::PointSequenceSequence(1);
- aReturn.Flags = drawing::FlagSequenceSequence(1);
-
drawing::PolyPolygonBezierCoords aOuterArc = getCircularArcBezierCoords(
fStartAngleRadian, fWidthAngleRadian, fUnitCircleOuterRadius, aTransformationFromUnitCircle, fAngleSubdivisionRadian );
- aReturn.Coordinates[0] = aOuterArc.Coordinates[0];
- aReturn.Flags[0] = aOuterArc.Flags[0];
+ aReturn.Coordinates = { aOuterArc.Coordinates[0] };
+ aReturn.Flags = { aOuterArc.Flags[0] };
drawing::PolyPolygonBezierCoords aInnerArc = getCircularArcBezierCoords(
fStartAngleRadian, fWidthAngleRadian, fUnitCircleInnerRadius, aTransformationFromUnitCircle, fAngleSubdivisionRadian );
@@ -861,9 +876,9 @@ static drawing::PolyPolygonBezierCoords getRingBezierCoords(
return aReturn;
}
-uno::Reference< drawing::XShape >
+rtl::Reference<SvxShapePolyPolygon>
ShapeFactory::createPieSegment2D(
- const uno::Reference< drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
, const drawing::Direction3D& rOffset
@@ -879,43 +894,43 @@ uno::Reference< drawing::XShape >
fUnitCircleWidthAngleDegree += 360.0;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.ClosedBezierShape" ), uno::UNO_QUERY );
- xTarget->add(xShape); //need to add the shape before setting of properties
+ rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr);
+ xShape->setShapeKind(SdrObjKind::PathFill); // aka ClosedBezierShape
+ xTarget->addShape(*xShape); //need to add the shape before setting of properties
+
+ if (std::isnan(fUnitCircleWidthAngleDegree))
+ {
+ SAL_WARN("chart2", "fUnitCircleWidthAngleDegree isNaN");
+ return xShape;
+ }
//set properties
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
- if( xProp.is())
+ try
{
- try
- {
- ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
- aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
+ ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
+ aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
- const double fAngleSubdivisionRadian = F_PI/10.0;
+ const double fAngleSubdivisionRadian = M_PI/10.0;
- drawing::PolyPolygonBezierCoords aCoords
- = getRingBezierCoords(fUnitCircleInnerRadius, fUnitCircleOuterRadius,
- basegfx::deg2rad(fUnitCircleStartAngleDegree),
- basegfx::deg2rad(fUnitCircleWidthAngleDegree),
- aTransformationFromUnitCircle, fAngleSubdivisionRadian);
+ drawing::PolyPolygonBezierCoords aCoords
+ = getRingBezierCoords(fUnitCircleInnerRadius, fUnitCircleOuterRadius,
+ basegfx::deg2rad(fUnitCircleStartAngleDegree),
+ basegfx::deg2rad(fUnitCircleWidthAngleDegree),
+ aTransformationFromUnitCircle, fAngleSubdivisionRadian);
- xProp->setPropertyValue( "PolyPolygonBezier", uno::Any( aCoords ) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xShape->SvxShape::setPropertyValue( "PolyPolygonBezier", uno::Any( aCoords ) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference< drawing::XShape >
+rtl::Reference<Svx3DExtrudeObject>
ShapeFactory::createPieSegment(
- const uno::Reference< drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
, const drawing::Direction3D& rOffset
@@ -932,71 +947,65 @@ uno::Reference< drawing::XShape >
fUnitCircleWidthAngleDegree += 360.0;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
- xTarget->add(xShape); //need to add the shape before setting of properties
+ rtl::Reference<Svx3DExtrudeObject> xShape = new Svx3DExtrudeObject(nullptr);
+ xShape->setShapeKind(SdrObjKind::E3D_Extrusion);
+ xTarget->addShape(*xShape); //need to add the shape before setting of properties
//set properties
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
- if( xProp.is())
+ try
{
- try
- {
- ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
- aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
-
- const double fAngleSubdivisionRadian = F_PI/32.0;
-
- drawing::PolyPolygonBezierCoords aCoords
- = getRingBezierCoords(fUnitCircleInnerRadius, fUnitCircleOuterRadius,
- basegfx::deg2rad(fUnitCircleStartAngleDegree),
- basegfx::deg2rad(fUnitCircleWidthAngleDegree),
- aTransformationFromUnitCircle, fAngleSubdivisionRadian);
-
- //depth
- xProp->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH
- , uno::Any(static_cast<sal_Int32>(fDepth)) );
-
- //PercentDiagonal
- xProp->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL
- , uno::Any( sal_Int16(0) ) );
-
- //Polygon
- drawing::PolyPolygonShape3D aPoly( BezierToPoly(aCoords) );
- ShapeFactory::closePolygon( aPoly );
- xProp->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
- , uno::Any( aPoly ) );
-
- //DoubleSided
- xProp->setPropertyValue( UNO_NAME_3D_DOUBLE_SIDED
- , uno::Any( true ) );
-
- //Reduced lines
- xProp->setPropertyValue( UNO_NAME_3D_REDUCED_LINE_GEOMETRY
- , uno::Any( true ) );
-
- //TextureProjectionMode
- xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
- , uno::Any( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
-
- //TextureProjectionMode
- xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_X
- , uno::Any( drawing::TextureProjectionMode_PARALLEL ) );
- xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
- , uno::Any( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
+ aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
+
+ const double fAngleSubdivisionRadian = M_PI/32.0;
+
+ drawing::PolyPolygonBezierCoords aCoords
+ = getRingBezierCoords(fUnitCircleInnerRadius, fUnitCircleOuterRadius,
+ basegfx::deg2rad(fUnitCircleStartAngleDegree),
+ basegfx::deg2rad(fUnitCircleWidthAngleDegree),
+ aTransformationFromUnitCircle, fAngleSubdivisionRadian);
+
+ //depth
+ xShape->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH
+ , uno::Any(static_cast<sal_Int32>(fDepth)) );
+
+ //PercentDiagonal
+ xShape->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL
+ , uno::Any( sal_Int16(0) ) );
+
+ //Polygon
+ drawing::PolyPolygonShape3D aPoly( BezierToPoly(aCoords) );
+ ShapeFactory::closePolygon( aPoly );
+ xShape->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
+ , uno::Any( aPoly ) );
+
+ //DoubleSided
+ xShape->setPropertyValue( UNO_NAME_3D_DOUBLE_SIDED
+ , uno::Any( true ) );
+
+ //Reduced lines
+ xShape->setPropertyValue( UNO_NAME_3D_REDUCED_LINE_GEOMETRY
+ , uno::Any( true ) );
+
+ //TextureProjectionMode
+ xShape->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
+ , uno::Any( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
+
+ //TextureProjectionMode
+ xShape->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_X
+ , uno::Any( drawing::TextureProjectionMode_PARALLEL ) );
+ xShape->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
+ , uno::Any( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createStripe( const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<Svx3DPolygonObject>
+ ShapeFactory::createStripe( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const Stripe& rStripe
, const uno::Reference< beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap
@@ -1008,155 +1017,131 @@ uno::Reference< drawing::XShape >
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.Shape3DPolygonObject" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<Svx3DPolygonObject> xShape = new Svx3DPolygonObject(nullptr);
+ xShape->setShapeKind(SdrObjKind::E3D_Polygon);
+ xTarget->addShape(*xShape);
//set properties
- uno::Reference<beans::XMultiPropertySet> xMultiPropertySet(xShape, uno::UNO_QUERY);
- OSL_ENSURE(xMultiPropertySet.is(), "created shape offers no XMultiPropertySet");
- if (xMultiPropertySet.is())
+ try
{
- try
- {
- uno::Sequence<OUString> aPropertyNames{
- UNO_NAME_3D_POLYPOLYGON3D,
- UNO_NAME_3D_TEXTUREPOLYGON3D,
- UNO_NAME_3D_NORMALSPOLYGON3D,
- UNO_NAME_3D_LINEONLY,
- UNO_NAME_3D_DOUBLE_SIDED
- };
-
- uno::Sequence<uno::Any> aPropertyValues {
- rStripe.getPolyPolygonShape3D(), // Polygon
- Stripe::getTexturePolygon(nRotatedTexture), // TexturePolygon
- rStripe.getNormalsPolygon(), // Normals Polygon
- uno::Any(false), // LineOnly
- uno::Any(bDoubleSided) // DoubleSided
- };
-
- //NormalsKind
- if (bFlatNormals)
- lcl_addProperty(aPropertyNames, aPropertyValues,
- UNO_NAME_3D_NORMALS_KIND, uno::Any(drawing::NormalsKind_FLAT));
-
- xMultiPropertySet->setPropertyValues(aPropertyNames, aPropertyValues);
-
- uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
- if (xSourceProp.is() && xPropertySet.is())
- {
- PropertyMapper::setMappedProperties(xPropertySet, xSourceProp, rPropertyNameMap);
- }
- }
- catch( const uno::Exception& )
+ uno::Sequence<OUString> aPropertyNames{
+ UNO_NAME_3D_POLYPOLYGON3D,
+ UNO_NAME_3D_TEXTUREPOLYGON3D,
+ UNO_NAME_3D_NORMALSPOLYGON3D,
+ UNO_NAME_3D_LINEONLY,
+ UNO_NAME_3D_DOUBLE_SIDED
+ };
+
+ uno::Sequence<uno::Any> aPropertyValues {
+ rStripe.getPolyPolygonShape3D(), // Polygon
+ Stripe::getTexturePolygon(nRotatedTexture), // TexturePolygon
+ rStripe.getNormalsPolygon(), // Normals Polygon
+ uno::Any(false), // LineOnly
+ uno::Any(bDoubleSided) // DoubleSided
+ };
+
+ //NormalsKind
+ if (bFlatNormals)
+ lcl_addProperty(aPropertyNames, aPropertyValues,
+ UNO_NAME_3D_NORMALS_KIND, uno::Any(drawing::NormalsKind_FLAT));
+
+ xShape->setPropertyValues(aPropertyNames, aPropertyValues);
+
+ if (xSourceProp)
{
- TOOLS_WARN_EXCEPTION("chart2", "" );
+ PropertyMapper::setMappedProperties(*xShape, xSourceProp, rPropertyNameMap);
}
}
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createArea3D( const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::PolyPolygonShape3D& rPolyPolygon
+rtl::Reference<Svx3DExtrudeObject>
+ ShapeFactory::createArea3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon
, double fDepth )
{
if( !xTarget.is() )
return nullptr;
- if( !rPolyPolygon.SequenceX.hasElements())
+ if( rPolyPolygon.empty() )
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<Svx3DExtrudeObject> xShape = new Svx3DExtrudeObject(nullptr);
+ xShape->setShapeKind(SdrObjKind::E3D_Extrusion);
+ xTarget->addShape(*xShape);
+
+ css::drawing::PolyPolygonShape3D aUnoPolyPolygon = toPolyPolygonShape3D(rPolyPolygon);
//set properties
- uno::Reference<beans::XMultiPropertySet> xMultiPropertySet(xShape, uno::UNO_QUERY);
- OSL_ENSURE(xMultiPropertySet.is(), "created shape offers no XMultiPropertySet");
- if (xMultiPropertySet.is())
+ try
{
- try
- {
- uno::Sequence<OUString> aPropertyNames{
- UNO_NAME_3D_EXTRUDE_DEPTH,
- UNO_NAME_3D_PERCENT_DIAGONAL,
- UNO_NAME_3D_POLYPOLYGON3D,
- UNO_NAME_3D_DOUBLE_SIDED,
- };
-
- uno::Sequence<uno::Any> aPropertyValues {
- uno::Any(sal_Int32(fDepth)), // depth
- uno::Any(sal_Int16(0)), // PercentDiagonal
- uno::Any(rPolyPolygon), // Polygon
- uno::Any(true) // DoubleSided
- };
-
- //the z component of the polygon is now ignored by the drawing layer,
- //so we need to translate the object via transformation matrix
-
- //Matrix for position
- if (rPolyPolygon.SequenceZ.hasElements()&& rPolyPolygon.SequenceZ[0].hasElements())
- {
- basegfx::B3DHomMatrix aM;
- aM.translate(0, 0, rPolyPolygon.SequenceZ[0][0]);
- drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
- lcl_addProperty(aPropertyNames, aPropertyValues, UNO_NAME_3D_TRANSFORM_MATRIX, uno::Any(aHM));
- }
- xMultiPropertySet->setPropertyValues(aPropertyNames, aPropertyValues);
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ uno::Sequence<OUString> aPropertyNames{
+ UNO_NAME_3D_EXTRUDE_DEPTH,
+ UNO_NAME_3D_PERCENT_DIAGONAL,
+ UNO_NAME_3D_POLYPOLYGON3D,
+ UNO_NAME_3D_DOUBLE_SIDED,
+ };
+
+ uno::Sequence<uno::Any> aPropertyValues {
+ uno::Any(sal_Int32(fDepth)), // depth
+ uno::Any(sal_Int16(0)), // PercentDiagonal
+ uno::Any(aUnoPolyPolygon), // Polygon
+ uno::Any(true) // DoubleSided
+ };
+
+ //the z component of the polygon is now ignored by the drawing layer,
+ //so we need to translate the object via transformation matrix
+
+ //Matrix for position
+ if (!rPolyPolygon.empty() && !rPolyPolygon[0].empty())
+ {
+ basegfx::B3DHomMatrix aM;
+ aM.translate(0, 0, rPolyPolygon[0][0].PositionZ);
+ drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
+ lcl_addProperty(aPropertyNames, aPropertyValues, UNO_NAME_3D_TRANSFORM_MATRIX, uno::Any(aHM));
+ }
+ xShape->setPropertyValues(aPropertyNames, aPropertyValues);
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createArea2D( const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::PolyPolygonShape3D& rPolyPolygon )
+rtl::Reference<SvxShapePolyPolygon>
+ ShapeFactory::createArea2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon )
{
if( !xTarget.is() )
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.PolyPolygonShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SdrPathObj> pPath = new SdrPathObj(xTarget->GetSdrObject()->getSdrModelFromSdrObject(), SdrObjKind::Polygon);
+ xTarget->GetSdrObject()->GetSubList()->InsertObject(pPath.get());
//set properties
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
- if( xProp.is())
+ try
{
- try
- {
- //UNO_NAME_POLYGON "Polygon" drawing::PointSequence*
- drawing::PointSequenceSequence aPoints( PolyToPointSequence(rPolyPolygon) );
-
- //Polygon
- xProp->setPropertyValue( UNO_NAME_POLYPOLYGON
- , uno::Any( aPoints ) );
-
- //ZOrder
- //an area should always be behind other shapes
- xProp->setPropertyValue( UNO_NAME_MISC_OBJ_ZORDER
- , uno::Any( sal_Int32(0) ) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ // Polygon
+ basegfx::B2DPolyPolygon aNewPolyPolygon( PolyToB2DPolyPolygon(rPolyPolygon) );
+ // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
+ pPath->ForceMetricToItemPoolMetric(aNewPolyPolygon);
+ pPath->SetPathPoly(aNewPolyPolygon);
}
- return xShape;
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+ return static_cast<SvxShapePolyPolygon*>(pPath->getUnoShape().get());
}
-static drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Position3D& rPos
+static drawing::PointSequenceSequence createPolyPolygon_Symbol( const drawing::Position3D& rPos
, const drawing::Direction3D& rSize
, sal_Int32 nStandardSymbol )
{
@@ -1203,267 +1188,196 @@ static drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Posi
break;
}
- drawing::PolyPolygonShape3D aPP;
-
- aPP.SequenceX.realloc(1);
- aPP.SequenceY.realloc(1);
- aPP.SequenceZ.realloc(1);
+ drawing::PointSequenceSequence aPP;
- drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
- drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
- drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+ aPP.realloc(1);
- pOuterSequenceX->realloc(nPointCount);
- pOuterSequenceY->realloc(nPointCount);
- pOuterSequenceZ->realloc(nPointCount);
+ uno::Sequence<awt::Point>* pOuterSequence = aPP.getArray();
- double* pInnerSequenceX = pOuterSequenceX->getArray();
- double* pInnerSequenceY = pOuterSequenceY->getArray();
- double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+ pOuterSequence->realloc(nPointCount);
- for(sal_Int32 nN = nPointCount; nN--;)
- *pInnerSequenceZ++ = 0.0;
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ auto toPoint = [](double x, double y) -> awt::Point
+ {
+ return { static_cast<sal_Int32>(x), static_cast<sal_Int32>(y) };
+ };
switch(eSymbolType)
{
case Symbol_Square:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
break;
}
case Symbol_UpArrow:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fHeightH );
break;
}
case Symbol_DownArrow:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
break;
}
case Symbol_RightArrow:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
break;
}
case Symbol_LeftArrow:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY );
break;
}
case Symbol_Bowtie:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
break;
}
case Symbol_Sandglass:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fHeightH );
break;
}
case Symbol_Diamond:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY );
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY );
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY );
break;
}
case Symbol_HorizontalBar:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-0.2*fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-0.2*fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+0.2*fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+0.2*fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-0.2*fHeightH );
break;
}
case Symbol_VerticalBar:
{
- *pInnerSequenceX++ = fX-0.2*fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-0.2*fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX+0.2*fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+0.2*fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX+0.2*fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+0.2*fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX-0.2*fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-0.2*fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX-0.2*fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-0.2*fWidthH, fY-fHeightH );
break;
}
case Symbol_Circle:
{
- double fOmega = 1.5707963267948966192 / (nQuarterCount + 1.0);
+ double fOmega = M_PI_2 / (nQuarterCount + 1.0);
// one point in the middle of each edge to get full size bounding rectangle
- *pInnerSequenceX++ = fX + fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX + fWidthH, fY );
// 0 to PI/2
for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
{
- *pInnerSequenceX++ = fX + fWidthH * cos( i * fOmega );
- *pInnerSequenceY++ = fY - fHeightH * sin( i * fOmega );
+ *pInnerSequence++ = toPoint( fX + fWidthH * cos( i * fOmega ), fY - fHeightH * sin( i * fOmega ) );
}
// PI/2 to PI
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY - fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY - fHeightH );
for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
{
- *pInnerSequenceX++ = fX - fWidthH * sin( i * fOmega);
- *pInnerSequenceY++ = fY - fHeightH * cos( i * fOmega);
+ *pInnerSequence++ = toPoint( fX - fWidthH * sin( i * fOmega), fY - fHeightH * cos( i * fOmega) );
}
// PI to 3/2*PI
- *pInnerSequenceX++ = fX - fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX - fWidthH, fY );
for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
{
- *pInnerSequenceX++ = fX - fWidthH * cos( i * fOmega);
- *pInnerSequenceY++ = fY + fHeightH * sin( i * fOmega);
+ *pInnerSequence++ = toPoint( fX - fWidthH * cos( i * fOmega), fY + fHeightH * sin( i * fOmega) );
}
// 3/2*PI to 2*PI
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY + fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY + fHeightH );
for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
{
- *pInnerSequenceX++ = fX + fWidthH * sin(i * fOmega);
- *pInnerSequenceY++ = fY + fHeightH * cos(i * fOmega);
+ *pInnerSequence++ = toPoint( fX + fWidthH * sin(i * fOmega), fY + fHeightH * cos(i * fOmega) );
}
// close polygon
- *pInnerSequenceX++ = fX + fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX + fWidthH, fY );
break;
}
case Symbol_Star:
{
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY-fHeightH );
- *pInnerSequenceX++ = fX+0.2*fWidthH;
- *pInnerSequenceY++ = fY-0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX+0.2*fWidthH, fY-0.2*fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY );
- *pInnerSequenceX++ = fX+0.2*fWidthH;
- *pInnerSequenceY++ = fY+0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX+0.2*fWidthH, fY+0.2*fHeightH );
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY+fHeightH );
- *pInnerSequenceX++ = fX-0.2*fWidthH;
- *pInnerSequenceY++ = fY+0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX-0.2*fWidthH, fY+0.2*fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY );
- *pInnerSequenceX++ = fX-0.2*fWidthH;
- *pInnerSequenceY++ = fY-0.2*fHeightH;
+ *pInnerSequence++ = toPoint( fX-0.2*fWidthH, fY-0.2*fHeightH );
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX, fY-fHeightH );
break;
}
case Symbol_X:
@@ -1473,44 +1387,31 @@ static drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Posi
const double fSmall = sqrt(200.0);
const double fLarge = 128.0 - fSmall;
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY - fScaleY * fSmall;
+ *pInnerSequence++ = toPoint( fX, fY - fScaleY * fSmall );
- *pInnerSequenceX++ = fX - fScaleX * fLarge;
- *pInnerSequenceY++ = fY - fHeightH;
+ *pInnerSequence++ = toPoint( fX - fScaleX * fLarge, fY - fHeightH );
- *pInnerSequenceX++ = fX - fWidthH;
- *pInnerSequenceY++ = fY - fScaleY * fLarge;
+ *pInnerSequence++ = toPoint( fX - fWidthH, fY - fScaleY * fLarge );
- *pInnerSequenceX++ = fX - fScaleX * fSmall;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX - fScaleX * fSmall, fY );
- *pInnerSequenceX++ = fX - fWidthH;
- *pInnerSequenceY++ = fY + fScaleY * fLarge;
+ *pInnerSequence++ = toPoint( fX - fWidthH, fY + fScaleY * fLarge );
- *pInnerSequenceX++ = fX - fScaleX * fLarge;
- *pInnerSequenceY++ = fY + fHeightH;
+ *pInnerSequence++ = toPoint( fX - fScaleX * fLarge, fY + fHeightH );
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY + fScaleY * fSmall;
+ *pInnerSequence++ = toPoint( fX, fY + fScaleY * fSmall );
- *pInnerSequenceX++ = fX + fScaleX * fLarge;
- *pInnerSequenceY++ = fY + fHeightH;
+ *pInnerSequence++ = toPoint( fX + fScaleX * fLarge, fY + fHeightH );
- *pInnerSequenceX++ = fX + fWidthH;
- *pInnerSequenceY++ = fY + fScaleY * fLarge;
+ *pInnerSequence++ = toPoint( fX + fWidthH, fY + fScaleY * fLarge );
- *pInnerSequenceX++ = fX + fScaleX * fSmall;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX + fScaleX * fSmall, fY );
- *pInnerSequenceX++ = fX + fWidthH;
- *pInnerSequenceY++ = fY - fScaleY * fLarge;
+ *pInnerSequence++ = toPoint( fX + fWidthH, fY - fScaleY * fLarge );
- *pInnerSequenceX++ = fX + fScaleX * fLarge;
- *pInnerSequenceY++ = fY - fHeightH;
+ *pInnerSequence++ = toPoint( fX + fScaleX * fLarge, fY - fHeightH );
- *pInnerSequenceX++ = fX;
- *pInnerSequenceY++ = fY - fScaleY * fSmall;
+ *pInnerSequence++ = toPoint( fX, fY - fScaleY * fSmall );
break;
}
@@ -1522,44 +1423,31 @@ static drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Posi
const double fdX = fScaleX * fHalf;
const double fdY = fScaleY * fHalf;
- *pInnerSequenceX++ = fX-fdX;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fdX, fY-fHeightH );
- *pInnerSequenceX++ = fX-fdX;
- *pInnerSequenceY++ = fY-fdY;
+ *pInnerSequence++ = toPoint( fX-fdX, fY-fdY );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fdY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fdY );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fdY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fdY );
- *pInnerSequenceX++ = fX-fdX;
- *pInnerSequenceY++ = fY+fdY;
+ *pInnerSequence++ = toPoint( fX-fdX, fY+fdY );
- *pInnerSequenceX++ = fX-fdX;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fdX, fY+fHeightH );
- *pInnerSequenceX++ = fX+fdX;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+fdX, fY+fHeightH );
- *pInnerSequenceX++ = fX+fdX;
- *pInnerSequenceY++ = fY+fdY;
+ *pInnerSequence++ = toPoint( fX+fdX, fY+fdY );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+fdY;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+fdY );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-fdY;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-fdY );
- *pInnerSequenceX++ = fX+fdX;
- *pInnerSequenceY++ = fY-fdY;
+ *pInnerSequence++ = toPoint( fX+fdX, fY-fdY );
- *pInnerSequenceX++ = fX+fdY;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+fdY, fY-fHeightH );
- *pInnerSequenceX++ = fX-fdX;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fdX, fY-fHeightH );
break;
}
@@ -1576,80 +1464,56 @@ static drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Posi
const double fScaleY = fHeightH / 128.0;
//1
- *pInnerSequenceX++ = fX-fScaleX * fHalf;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fScaleX * fHalf, fY-fHeightH );
//2
- *pInnerSequenceX++ = fX-fScaleX * fHalf;
- *pInnerSequenceY++ = fY-fScaleY * fTwoY;
+ *pInnerSequence++ = toPoint( fX-fScaleX * fHalf, fY-fScaleY * fTwoY );
//3
- *pInnerSequenceX++ = fX-fScaleX * fThreeX;
- *pInnerSequenceY++ = fY-fScaleY * fThreeY;
+ *pInnerSequence++ = toPoint( fX-fScaleX * fThreeX, fY-fScaleY * fThreeY );
//4
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fScaleY * fFourY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fScaleY * fFourY );
//5
- *pInnerSequenceX++ = fX-fScaleX * fFiveX;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX-fScaleX * fFiveX, fY );
//6 as 4
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fScaleY * fFourY;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fScaleY * fFourY );
//7 as 3
- *pInnerSequenceX++ = fX-fScaleX * fThreeX;
- *pInnerSequenceY++ = fY+fScaleY * fThreeY;
+ *pInnerSequence++ = toPoint( fX-fScaleX * fThreeX, fY+fScaleY * fThreeY );
//8 as 2
- *pInnerSequenceX++ = fX-fScaleX * fHalf;
- *pInnerSequenceY++ = fY+fScaleY * fTwoY;
+ *pInnerSequence++ = toPoint( fX-fScaleX * fHalf, fY+fScaleY * fTwoY );
//9 as 1
- *pInnerSequenceX++ = fX-fScaleX * fHalf;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fScaleX * fHalf, fY+fHeightH );
//10 as 1
- *pInnerSequenceX++ = fX+fScaleX * fHalf;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+fScaleX * fHalf, fY+fHeightH );
//11 as 2
- *pInnerSequenceX++ = fX+fScaleX * fHalf;
- *pInnerSequenceY++ = fY+fScaleY * fTwoY;
+ *pInnerSequence++ = toPoint( fX+fScaleX * fHalf, fY+fScaleY * fTwoY );
//12 as 3
- *pInnerSequenceX++ = fX+fScaleX * fThreeX;
- *pInnerSequenceY++ = fY+fScaleY * fThreeY;
+ *pInnerSequence++ = toPoint( fX+fScaleX * fThreeX, fY+fScaleY * fThreeY );
//13 as 4
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+fScaleY * fFourY;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+fScaleY * fFourY );
//14 as 5
- *pInnerSequenceX++ = fX+fScaleX * fFiveX;
- *pInnerSequenceY++ = fY;
+ *pInnerSequence++ = toPoint( fX+fScaleX * fFiveX, fY );
//15 as 4
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-fScaleY * fFourY;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-fScaleY * fFourY );
//16 as 3
- *pInnerSequenceX++ = fX+fScaleX * fThreeX;
- *pInnerSequenceY++ = fY-fScaleY * fThreeY;
+ *pInnerSequence++ = toPoint( fX+fScaleX * fThreeX, fY-fScaleY * fThreeY );
//17 as 2
- *pInnerSequenceX++ = fX+fScaleX * fHalf;
- *pInnerSequenceY++ = fY-fScaleY * fTwoY;
+ *pInnerSequence++ = toPoint( fX+fScaleX * fHalf, fY-fScaleY * fTwoY );
// 18 as 1
- *pInnerSequenceX++ = fX+fScaleX * fHalf;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+fScaleX * fHalf, fY-fHeightH );
// 19 = 1, closing
- *pInnerSequenceX++ = fX-fScaleX * fHalf;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fScaleX * fHalf, fY-fHeightH );
break;
}
default: //case Symbol_Square:
{
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY+fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY+fHeightH );
- *pInnerSequenceX++ = fX+fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX+fWidthH, fY-fHeightH );
- *pInnerSequenceX++ = fX-fWidthH;
- *pInnerSequenceY++ = fY-fHeightH;
+ *pInnerSequence++ = toPoint( fX-fWidthH, fY-fHeightH );
break;
}
}
@@ -1657,9 +1521,9 @@ static drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Posi
return aPP;
}
-uno::Reference< drawing::XShape >
+rtl::Reference<SvxShapePolyPolygon>
ShapeFactory::createSymbol2D(
- const uno::Reference< drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition
, const drawing::Direction3D& rSize
, sal_Int32 nStandardSymbol
@@ -1670,44 +1534,38 @@ uno::Reference< drawing::XShape >
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.PolyPolygonShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr);
+ xShape->setShapeKind(SdrObjKind::Polygon);
+ xTarget->addShape(*xShape);
//set properties
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
- if( xProp.is())
+ try
{
- try
- {
- drawing::PointSequenceSequence aPoints( PolyToPointSequence(
- createPolyPolygon_Symbol( rPosition, rSize, nStandardSymbol ) ));
+ drawing::PointSequenceSequence aPoints =
+ createPolyPolygon_Symbol( rPosition, rSize, nStandardSymbol );
- //Polygon
- xProp->setPropertyValue( UNO_NAME_POLYPOLYGON
- , uno::Any( aPoints ) );
+ //Polygon
+ xShape->SvxShape::setPropertyValue( UNO_NAME_POLYPOLYGON
+ , uno::Any( aPoints ) );
- //LineColor
- xProp->setPropertyValue( UNO_NAME_LINECOLOR
- , uno::Any( nBorderColor ) );
+ //LineColor
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINECOLOR
+ , uno::Any( nBorderColor ) );
- //FillColor
- xProp->setPropertyValue( UNO_NAME_FILLCOLOR
- , uno::Any( nFillColor ) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ //FillColor
+ xShape->SvxShape::setPropertyValue( UNO_NAME_FILLCOLOR
+ , uno::Any( nFillColor ) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference< drawing::XShape >
+rtl::Reference<SvxGraphicObject>
ShapeFactory::createGraphic2D(
- const uno::Reference< drawing::XShapes >& xTarget
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition
, const drawing::Direction3D& rSize
, const uno::Reference< graphic::XGraphic >& xGraphic )
@@ -1719,10 +1577,9 @@ uno::Reference< drawing::XShape >
// performance reasons (ask AW, said CL)
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.GraphicObjectShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxGraphicObject> xShape = new SvxGraphicObject(nullptr);
+ xShape->setShapeKind(SdrObjKind::Graphic);
+ xTarget->addShape(*xShape);
try
{
@@ -1738,24 +1595,19 @@ uno::Reference< drawing::XShape >
{
TOOLS_WARN_EXCEPTION("chart2", "" );
}
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
- if( xProp.is())
+ try
{
- try
- {
- xProp->setPropertyValue( "Graphic", uno::Any( xGraphic ));
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xShape->SvxShape::setPropertyValue( "Graphic", uno::Any( xGraphic ));
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference< drawing::XShapes >
- ShapeFactory::createGroup2D( const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference< SvxShapeGroup >
+ ShapeFactory::createGroup2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const OUString& aName )
{
if( !xTarget.is() )
@@ -1763,23 +1615,21 @@ uno::Reference< drawing::XShapes >
try
{
//create and add to target
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.GroupShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapeGroup> xShapeGroup = new SvxShapeGroup(nullptr, nullptr);
+ xShapeGroup->setShapeKind(SdrObjKind::Group);
+ // cast to resolve ambiguity in converting to XShape
+ xTarget->addShape(*xShapeGroup);
//set name
if(!aName.isEmpty())
- setShapeName( xShape , aName );
+ setShapeName( xShapeGroup, aName );
{//workaround
//need this null size as otherwise empty group shapes where painted with a gray border
- xShape->setSize(awt::Size(0,0));
+ xShapeGroup->setSize(awt::Size(0,0));
}
- //return
- uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
- return xShapes;
+ return xShapeGroup;
}
catch( const uno::Exception& )
{
@@ -1788,41 +1638,64 @@ uno::Reference< drawing::XShapes >
return nullptr;
}
-uno::Reference< drawing::XShapes >
- ShapeFactory::createGroup3D( const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference< SvxShapeGroup >
+ ShapeFactory::createGroup2D( const rtl::Reference<SvxDrawPage>& xTarget
, const OUString& aName )
{
if( !xTarget.is() )
return nullptr;
try
{
- //create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.Shape3DSceneObject" ), uno::UNO_QUERY );
+ //create and add to target
+ rtl::Reference<SvxShapeGroup> xShapeGroup = new SvxShapeGroup(nullptr, nullptr);
+ xShapeGroup->setShapeKind(SdrObjKind::Group);
+ // cast to resolve ambiguity in converting to XShape
+ xTarget->add(static_cast<SvxShape*>(xShapeGroup.get()));
- xTarget->add(xShape);
+ //set name
+ if(!aName.isEmpty())
+ setShapeName( xShapeGroup, aName );
+
+ {//workaround
+ //need this null size as otherwise empty group shapes where painted with a gray border
+ xShapeGroup->setSize(awt::Size(0,0));
+ }
+
+ return xShapeGroup;
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+ return nullptr;
+}
+
+rtl::Reference<Svx3DSceneObject>
+ ShapeFactory::createGroup3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const OUString& aName )
+{
+ if( !xTarget.is() )
+ return nullptr;
+ try
+ {
+ //create shape
+ rtl::Reference<Svx3DSceneObject> xShape = new Svx3DSceneObject(nullptr, nullptr);
+ xShape->setShapeKind(SdrObjKind::E3D_Scene);
+ xTarget->addShape(*xShape);
//it is necessary to set the transform matrix to initialize the scene properly
//otherwise all objects which are placed into this Group will not be visible
//the following should be unnecessary after the bug is fixed
+ //set properties
+ try
{
- //set properties
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
- if( xProp.is())
- {
- try
- {
- ::basegfx::B3DHomMatrix aM;
- xProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
- , uno::Any(B3DHomMatrixToHomogenMatrix(aM)) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
- }
+ ::basegfx::B3DHomMatrix aM;
+ xShape->SvxShape::setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
+ , uno::Any(B3DHomMatrixToHomogenMatrix(aM)) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
//set name
@@ -1830,8 +1703,7 @@ uno::Reference< drawing::XShapes >
setShapeName( xShape , aName );
//return
- uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
- return xShapes;
+ return xShape;
}
catch( const uno::Exception& )
{
@@ -1840,8 +1712,8 @@ uno::Reference< drawing::XShapes >
return nullptr;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createCircle2D( const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<SvxShapeCircle>
+ ShapeFactory::createCircle2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::Position3D& rPosition
, const drawing::Direction3D& rSize )
{
@@ -1849,10 +1721,9 @@ uno::Reference< drawing::XShape >
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.EllipseShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapeCircle> xShape = new SvxShapeCircle(nullptr);
+ xShape->setShapeKind(SdrObjKind::CircleOrEllipse);
+ xTarget->addShape(*xShape);
try
{
@@ -1869,114 +1740,104 @@ uno::Reference< drawing::XShape >
}
//set properties
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
- if( xProp.is())
+ try
{
- try
- {
- xProp->setPropertyValue( UNO_NAME_CIRCKIND, uno::Any( drawing::CircleKind_FULL ) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xShape->SvxShape::setPropertyValue( UNO_NAME_CIRCKIND, uno::Any( drawing::CircleKind_FULL ) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createCircle( const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<SvxShapeCircle>
+ ShapeFactory::createCircle( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const awt::Size& rSize
, const awt::Point& rPosition )
{
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.EllipseShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapeCircle> xShape = new SvxShapeCircle(nullptr);
+ xShape->setShapeKind(SdrObjKind::CircleOrEllipse);
+ xTarget->addShape(*xShape);
xShape->setSize( rSize );
xShape->setPosition( rPosition );
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::PolyPolygonShape3D& rPoints
+rtl::Reference<Svx3DPolygonObject>
+ ShapeFactory::createLine3D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const std::vector<std::vector<css::drawing::Position3D>>& rPoints
, const VLineProperties& rLineProperties )
{
if( !xTarget.is() )
return nullptr;
- if(!rPoints.SequenceX.hasElements())
+ if(rPoints.empty())
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.Shape3DPolygonObject" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<Svx3DPolygonObject> xShape = new Svx3DPolygonObject(nullptr);
+ xShape->setShapeKind(SdrObjKind::E3D_Polygon);
+ xTarget->addShape(*xShape);
+
+ css::drawing::PolyPolygonShape3D aUnoPoly = toPolyPolygonShape3D(rPoints);
//set properties
- uno::Reference<beans::XMultiPropertySet> xMultiPropertySet(xShape, uno::UNO_QUERY);
- OSL_ENSURE(xMultiPropertySet.is(), "created shape offers no XMultiPropertySet");
- if (xMultiPropertySet.is())
+ try
{
- try
- {
- uno::Sequence<OUString> aPropertyNames {
- UNO_NAME_3D_POLYPOLYGON3D,
- UNO_NAME_3D_LINEONLY
- };
+ uno::Sequence<OUString> aPropertyNames {
+ UNO_NAME_3D_POLYPOLYGON3D,
+ UNO_NAME_3D_LINEONLY
+ };
- uno::Sequence<uno::Any> aPropertyValues {
- uno::Any(rPoints), // Polygon
- uno::Any(true) // LineOnly
- };
+ uno::Sequence<uno::Any> aPropertyValues {
+ uno::Any(aUnoPoly), // Polygon
+ uno::Any(true) // LineOnly
+ };
- //Transparency
- if(rLineProperties.Transparence.hasValue())
- {
- lcl_addProperty(aPropertyNames, aPropertyValues,
- UNO_NAME_LINETRANSPARENCE,
- rLineProperties.Transparence);
- }
-
- //LineStyle
- if(rLineProperties.LineStyle.hasValue())
- {
- lcl_addProperty(aPropertyNames, aPropertyValues,
- UNO_NAME_LINESTYLE,
- rLineProperties.LineStyle);
- }
+ //Transparency
+ if(rLineProperties.Transparence.hasValue())
+ {
+ lcl_addProperty(aPropertyNames, aPropertyValues,
+ UNO_NAME_LINETRANSPARENCE,
+ rLineProperties.Transparence);
+ }
- //LineWidth
- if(rLineProperties.Width.hasValue())
- {
- lcl_addProperty(aPropertyNames, aPropertyValues,
- UNO_NAME_LINEWIDTH,
- rLineProperties.Width);
- }
+ //LineStyle
+ if(rLineProperties.LineStyle.hasValue())
+ {
+ lcl_addProperty(aPropertyNames, aPropertyValues,
+ UNO_NAME_LINESTYLE,
+ rLineProperties.LineStyle);
+ }
- //LineColor
- if(rLineProperties.Color.hasValue())
- {
- lcl_addProperty(aPropertyNames, aPropertyValues,
- UNO_NAME_LINECOLOR,
- rLineProperties.Color);
- }
- xMultiPropertySet->setPropertyValues(aPropertyNames, aPropertyValues);
+ //LineWidth
+ if(rLineProperties.Width.hasValue())
+ {
+ lcl_addProperty(aPropertyNames, aPropertyValues,
+ UNO_NAME_LINEWIDTH,
+ rLineProperties.Width);
}
- catch( const uno::Exception& )
+
+ //LineColor
+ if(rLineProperties.Color.hasValue())
{
- TOOLS_WARN_EXCEPTION("chart2", "" );
+ lcl_addProperty(aPropertyNames, aPropertyValues,
+ UNO_NAME_LINECOLOR,
+ rLineProperties.Color);
}
+ xShape->setPropertyValues(aPropertyNames, aPropertyValues);
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createLine2D( const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<SvxShapePolyPolygon>
+ ShapeFactory::createLine2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const drawing::PointSequenceSequence& rPoints
, const VLineProperties* pLineProperties )
{
@@ -1987,75 +1848,138 @@ uno::Reference< drawing::XShape >
return nullptr;
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.PolyLineShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr);
+ xShape->setShapeKind(SdrObjKind::PolyLine);
+ xTarget->addShape(*xShape);
//set properties
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
- if( xProp.is())
+ try
{
- try
+ //Polygon
+ xShape->SvxShape::setPropertyValue( UNO_NAME_POLYPOLYGON
+ , uno::Any( rPoints ) );
+
+ if(pLineProperties)
{
- //Polygon
- xProp->setPropertyValue( UNO_NAME_POLYPOLYGON
- , uno::Any( rPoints ) );
+ //Transparency
+ if(pLineProperties->Transparence.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINETRANSPARENCE
+ , pLineProperties->Transparence );
- if(pLineProperties)
- {
- //Transparency
- if(pLineProperties->Transparence.hasValue())
- xProp->setPropertyValue( UNO_NAME_LINETRANSPARENCE
- , pLineProperties->Transparence );
-
- //LineStyle
- if(pLineProperties->LineStyle.hasValue())
- xProp->setPropertyValue( UNO_NAME_LINESTYLE
- , pLineProperties->LineStyle );
-
- //LineWidth
- if(pLineProperties->Width.hasValue())
- xProp->setPropertyValue( UNO_NAME_LINEWIDTH
- , pLineProperties->Width );
-
- //LineColor
- if(pLineProperties->Color.hasValue())
- xProp->setPropertyValue( UNO_NAME_LINECOLOR
- , pLineProperties->Color );
-
- //LineDashName
- if(pLineProperties->DashName.hasValue())
- xProp->setPropertyValue( "LineDashName"
- , pLineProperties->DashName );
- }
+ //LineStyle
+ if(pLineProperties->LineStyle.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINESTYLE
+ , pLineProperties->LineStyle );
+
+ //LineWidth
+ if(pLineProperties->Width.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINEWIDTH
+ , pLineProperties->Width );
+
+ //LineColor
+ if(pLineProperties->Color.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINECOLOR
+ , pLineProperties->Color );
+
+ //LineDashName
+ if(pLineProperties->DashName.hasValue())
+ xShape->SvxShape::setPropertyValue( "LineDashName"
+ , pLineProperties->DashName );
+
+ //LineCap
+ if(pLineProperties->LineCap.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINECAP
+ , pLineProperties->LineCap );
}
- catch( const uno::Exception& )
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
+ return xShape;
+}
+
+rtl::Reference<SvxShapePolyPolygon>
+ ShapeFactory::createLine2D( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const std::vector<std::vector<css::drawing::Position3D>>& rPoints
+ , const VLineProperties* pLineProperties )
+{
+ if( !xTarget.is() )
+ return nullptr;
+
+ if(rPoints.empty())
+ return nullptr;
+
+ //create shape
+ rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr);
+ xShape->setShapeKind(SdrObjKind::PolyLine);
+ xTarget->addShape(*xShape);
+
+ drawing::PointSequenceSequence aAnyPoints = PolyToPointSequence(rPoints);
+
+ //set properties
+ try
+ {
+ //Polygon
+ xShape->SvxShape::setPropertyValue( UNO_NAME_POLYPOLYGON
+ , uno::Any( aAnyPoints ) );
+
+ if(pLineProperties)
{
- TOOLS_WARN_EXCEPTION("chart2", "" );
+ //Transparency
+ if(pLineProperties->Transparence.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINETRANSPARENCE
+ , pLineProperties->Transparence );
+
+ //LineStyle
+ if(pLineProperties->LineStyle.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINESTYLE
+ , pLineProperties->LineStyle );
+
+ //LineWidth
+ if(pLineProperties->Width.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINEWIDTH
+ , pLineProperties->Width );
+
+ //LineColor
+ if(pLineProperties->Color.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINECOLOR
+ , pLineProperties->Color );
+
+ //LineDashName
+ if(pLineProperties->DashName.hasValue())
+ xShape->SvxShape::setPropertyValue( "LineDashName"
+ , pLineProperties->DashName );
+
+ //LineCap
+ if(pLineProperties->LineCap.hasValue())
+ xShape->SvxShape::setPropertyValue( UNO_NAME_LINECAP
+ , pLineProperties->LineCap );
}
}
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createLine ( const uno::Reference< drawing::XShapes >& xTarget,
+rtl::Reference<SvxShapePolyPolygon>
+ ShapeFactory::createLine ( const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const awt::Size& rSize, const awt::Point& rPosition )
{
//create shape
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.LineShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr);
+ xShape->setShapeKind(SdrObjKind::Line);
+ xTarget->addShape(*xShape);
xShape->setSize( rSize );
xShape->setPosition( rPosition );
return xShape;
}
-uno::Reference< drawing::XShape > ShapeFactory::createInvisibleRectangle(
- const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<SvxShapeRect> ShapeFactory::createInvisibleRectangle(
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const awt::Size& rSize )
{
try
@@ -2063,14 +1987,11 @@ uno::Reference< drawing::XShape > ShapeFactory::createInvisibleRectangle(
if(!xTarget.is())
return nullptr;
- uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
- "com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY );
- if( xShape.is())
- {
- xTarget->add( xShape );
- ShapeFactory::makeShapeInvisible( xShape );
- xShape->setSize( rSize );
- }
+ rtl::Reference<SvxShapeRect> xShape = new SvxShapeRect(nullptr);
+ xShape->setShapeKind(SdrObjKind::Rectangle);
+ xTarget->addShape( *xShape );
+ ShapeFactory::makeShapeInvisible( xShape );
+ xShape->setSize( rSize );
return xShape;
}
catch( const uno::Exception & )
@@ -2080,50 +2001,46 @@ uno::Reference< drawing::XShape > ShapeFactory::createInvisibleRectangle(
return nullptr;
}
-uno::Reference< drawing::XShape > ShapeFactory::createRectangle(
- const uno::Reference< drawing::XShapes >& xTarget,
+rtl::Reference<SvxShapeRect> ShapeFactory::createRectangle(
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const awt::Size& rSize,
const awt::Point& rPosition,
const tNameSequence& rPropNames,
const tAnySequence& rPropValues,
StackPosition ePos )
{
- uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
- "com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY );
- if( xShape.is())
+ rtl::Reference<SvxShapeRect> xShape = new SvxShapeRect(nullptr);
+ xShape->setShapeKind(SdrObjKind::Rectangle);
+ if (ePos == StackPosition::Bottom)
{
- if (ePos == StackPosition::Bottom)
- {
- uno::Reference<drawing::XShapes2> xTarget2(xTarget, uno::UNO_QUERY);
- if (xTarget2.is())
- xTarget2->addBottom(xShape);
- }
- else
- xTarget->add(xShape);
-
- xShape->setPosition( rPosition );
- xShape->setSize( rSize );
- uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY_THROW );
- PropertyMapper::setMultiProperties( rPropNames, rPropValues, xPropSet );
+ uno::Reference<drawing::XShapes2> xTarget2(static_cast<cppu::OWeakObject*>(xTarget.get()), uno::UNO_QUERY);
+ assert(xTarget2);
+ if (xTarget2.is())
+ xTarget2->addBottom(xShape);
}
+ else
+ xTarget->addShape(*xShape);
+
+ xShape->setPosition( rPosition );
+ xShape->setSize( rSize );
+ PropertyMapper::setMultiProperties( rPropNames, rPropValues, *xShape );
return xShape;
}
-uno::Reference< drawing::XShape >
+rtl::Reference<SvxShapeRect>
ShapeFactory::createRectangle(
- const uno::Reference<
- drawing::XShapes >& xTarget )
+ const rtl::Reference<SvxShapeGroupAnyD>& xTarget )
{
- uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
- "com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY );
- xTarget->add( xShape );
+ rtl::Reference<SvxShapeRect> xShape = new SvxShapeRect(nullptr);
+ xShape->setShapeKind(SdrObjKind::Rectangle);
+ xTarget->addShape( *xShape );
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget
+rtl::Reference<SvxShapeText>
+ ShapeFactory::createText( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const OUString& rText
, const tNameSequence& rPropNames
, const tAnySequence& rPropValues
@@ -2136,147 +2053,36 @@ uno::Reference< drawing::XShape >
return nullptr;
//create shape and add to page
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapeText> xShape = new SvxShapeText(nullptr);
+ xShape->setShapeKind(SdrObjKind::Text);
+ xTarget->addShape(*xShape);
//set text
- uno::Reference< text::XTextRange > xTextRange( xShape, uno::UNO_QUERY );
- if( xTextRange.is() )
- xTextRange->setString( rText );
-
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- if( xProp.is() )
- {
- //set properties
- PropertyMapper::setMultiProperties( rPropNames, rPropValues, xProp );
-
- //set position matrix
- //the matrix needs to be set at the end behind autogrow and such position influencing properties
- try
- {
- if (rATransformation.hasValue())
- xProp->setPropertyValue( "Transformation", rATransformation );
- else
- SAL_INFO("chart2", "No rATransformation value is given to ShapeFactory::createText()");
+ xShape->setString( rText );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
- }
- return xShape;
-}
-
-uno::Reference< drawing::XShape >
- ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget
- , const uno::Sequence< OUString >& rTextParagraphs
- , const uno::Sequence< tNameSequence >& rParaPropNames
- , const uno::Sequence< tAnySequence >& rParaPropValues
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues
- , const uno::Any& rATransformation )
-{
- if( !xTarget.is() )
- return nullptr;
-
- if( !rTextParagraphs.hasElements() )
- return nullptr;
-
- sal_Int32 nNumberOfParagraphs = rTextParagraphs.getLength();
-
- if( rParaPropNames.getLength() != nNumberOfParagraphs )
- return nullptr;
-
- if( rParaPropValues.getLength() != nNumberOfParagraphs )
- return nullptr;
+ //set properties
+ PropertyMapper::setMultiProperties( rPropNames, rPropValues, *xShape );
- bool bNotEmpty = false;
- for( sal_Int32 nN = 0; nN < nNumberOfParagraphs; ++nN )
+ //set position matrix
+ //the matrix needs to be set at the end behind autogrow and such position influencing properties
+ try
{
- if( !rTextParagraphs[nN].isEmpty() )
- {
- bNotEmpty = true;
- break;
- }
- }
- if( !bNotEmpty )
- return nullptr;
-
- //create shape and add to page
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ if (rATransformation.hasValue())
+ xShape->SvxShape::setPropertyValue( "Transformation", rATransformation );
+ else
+ SAL_INFO("chart2", "No rATransformation value is given to ShapeFactory::createText()");
- //set paragraph properties
- bNotEmpty = false;
- Reference< text::XText > xText( xShape, uno::UNO_QUERY );
- if( xText.is() )
- {
- // the first cursor is used for appending the next paragraph,
- // after a new string has been inserted the cursor is moved at the end
- // of the inserted string
- // the second cursor is used for selecting the paragraph and apply the
- // passed text properties
- Reference< text::XTextCursor > xInsertCursor = xText->createTextCursor();
- Reference< text::XTextCursor > xSelectionCursor = xText->createTextCursor();
- if( xInsertCursor.is() && xSelectionCursor.is() )
- {
- uno::Reference< beans::XPropertySet > xSelectionProp( xSelectionCursor, uno::UNO_QUERY );
- if( xSelectionProp.is() )
- {
- for( sal_Int32 nN = 0; nN < nNumberOfParagraphs; ++nN )
- {
- if( !rTextParagraphs[nN].isEmpty() )
- {
- xInsertCursor->gotoEnd(false);
- if( bNotEmpty )
- {
- xText->insertString( xInsertCursor, "\n", false );
- }
- xSelectionCursor->gotoEnd(false);
- xText->insertString( xInsertCursor, rTextParagraphs[nN], false );
- bNotEmpty = true;
- xSelectionCursor->gotoEnd(true); // select current paragraph
- PropertyMapper::setMultiProperties( rParaPropNames[nN], rParaPropValues[nN], xSelectionProp );
- }
- }
- }
- }
}
-
- if( !bNotEmpty )
- return nullptr;
-
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- if( xProp.is() )
+ catch( const uno::Exception& )
{
- //set whole text shape properties
- PropertyMapper::setMultiProperties( rPropNames, rPropValues, xProp );
-
- if (rATransformation.hasValue())
- {
- //set position matrix
- //the matrix needs to be set at the end behind autogrow and such position influencing properties
- try
- {
- xProp->setPropertyValue( "Transformation", rATransformation );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
- }
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget
- , uno::Sequence< uno::Reference< chart2::XFormattedString > >& xFormattedString
+rtl::Reference<SvxShapeText>
+ ShapeFactory::createText( const rtl::Reference<SvxShapeGroupAnyD>& xTarget
+ , const uno::Sequence< uno::Reference< chart2::XFormattedString > >& xFormattedString
, const tNameSequence& rPropNames
, const tAnySequence& rPropValues
, const uno::Any& rATransformation )
@@ -2302,41 +2108,36 @@ uno::Reference< drawing::XShape >
return nullptr;
//create shape and add to page
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY );
- xTarget->add(xShape);
+ rtl::Reference<SvxShapeText> xShape = new SvxShapeText(nullptr);
+ xShape->setShapeKind(SdrObjKind::Text);
+ xTarget->addShape(*xShape);
//set paragraph properties
bNotEmpty = false;
- Reference< text::XText > xText( xShape, uno::UNO_QUERY );
- if( xText.is() )
- {
- // the first cursor is used for appending the next paragraph,
- // after a new string has been inserted the cursor is moved at the end
- // of the inserted string
- // the second cursor is used for selecting the paragraph and apply the
- // passed text properties
- Reference< text::XTextCursor > xInsertCursor = xText->createTextCursor();
- Reference< text::XTextCursor > xSelectionCursor = xText->createTextCursor();
- if( xInsertCursor.is() && xSelectionCursor.is() )
+ // the first cursor is used for appending the next paragraph,
+ // after a new string has been inserted the cursor is moved at the end
+ // of the inserted string
+ // the second cursor is used for selecting the paragraph and apply the
+ // passed text properties
+ Reference< text::XTextCursor > xInsertCursor = xShape->createTextCursor();
+ Reference< text::XTextCursor > xSelectionCursor = xShape->createTextCursor();
+ if( xInsertCursor.is() && xSelectionCursor.is() )
+ {
+ uno::Reference< beans::XPropertySet > xSelectionProp( xSelectionCursor, uno::UNO_QUERY );
+ if( xSelectionProp.is() )
{
- uno::Reference< beans::XPropertySet > xSelectionProp( xSelectionCursor, uno::UNO_QUERY );
- if( xSelectionProp.is() )
+ for( sal_Int32 nN = 0; nN < nNumberOfParagraphs; ++nN )
{
- for( sal_Int32 nN = 0; nN < nNumberOfParagraphs; ++nN )
+ if( !xFormattedString[nN]->getString().isEmpty() )
{
- if( !xFormattedString[nN]->getString().isEmpty() )
- {
- xInsertCursor->gotoEnd( false );
- xSelectionCursor->gotoEnd( false );
- xText->insertString( xInsertCursor, xFormattedString[nN]->getString(), false );
- bNotEmpty = true;
- xSelectionCursor->gotoEnd( true ); // select current paragraph
- uno::Reference< beans::XPropertySet > xStringProperties( xFormattedString[nN], uno::UNO_QUERY );
- PropertyMapper::setMappedProperties( xSelectionProp, xStringProperties,
- PropertyMapper::getPropertyNameMapForTextShapeProperties() );
- }
+ xInsertCursor->gotoEnd( false );
+ xSelectionCursor->gotoEnd( false );
+ xShape->insertString( xInsertCursor, xFormattedString[nN]->getString(), false );
+ bNotEmpty = true;
+ xSelectionCursor->gotoEnd( true ); // select current paragraph
+ uno::Reference< beans::XPropertySet > xStringProperties( xFormattedString[nN], uno::UNO_QUERY );
+ PropertyMapper::setMappedProperties( xSelectionProp, xStringProperties,
+ PropertyMapper::getPropertyNameMapForTextShapeProperties() );
}
}
}
@@ -2345,31 +2146,27 @@ uno::Reference< drawing::XShape >
if( !bNotEmpty )
return nullptr;
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- if( xProp.is() )
- {
- //set whole text shape properties
- PropertyMapper::setMultiProperties( rPropNames, rPropValues, xProp );
+ //set whole text shape properties
+ PropertyMapper::setMultiProperties( rPropNames, rPropValues, *xShape );
- if( rATransformation.hasValue() )
+ if( rATransformation.hasValue() )
+ {
+ //set position matrix
+ //the matrix needs to be set at the end behind autogrow and such position influencing properties
+ try
{
- //set position matrix
- //the matrix needs to be set at the end behind autogrow and such position influencing properties
- try
- {
- xProp->setPropertyValue( "Transformation", rATransformation );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xShape->SvxShape::setPropertyValue( "Transformation", rATransformation );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
}
return xShape;
}
-uno::Reference< drawing::XShape >
- ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget,
+rtl::Reference<SvxShapeText>
+ ShapeFactory::createText( const rtl::Reference<SvxShapeGroupAnyD>& xTarget,
const awt::Size& rSize,
const awt::Point& rPos,
uno::Sequence< uno::Reference< chart2::XFormattedString > >& xFormattedString,
@@ -2378,18 +2175,16 @@ uno::Reference< drawing::XShape >
double nRotation, const OUString& aName, sal_Int32 nTextMaxWidth )
{
//create shape and add to page
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance(
- "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY );
+ rtl::Reference<SvxShapeText> xShape = new SvxShapeText(nullptr);
+ xShape->setShapeKind(SdrObjKind::Text);
try
{
- xTarget->add(xShape);
+ xTarget->addShape(*xShape);
//set text and text properties
- uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
- uno::Reference< text::XTextCursor > xTextCursor( xText->createTextCursor() );
- uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
- if( !xText.is() || !xTextCursor.is() || !xShapeProp.is() || !xTextProperties.is() )
+ uno::Reference< text::XTextCursor > xTextCursor( xShape->createTextCursor() );
+ uno::Reference< text::XTextCursor > xSelectionCursor( xShape->createTextCursor() );
+ if( !xTextCursor.is() || !xSelectionCursor.is() )
return xShape;
tPropertyNameValueMap aValueMap;
@@ -2420,7 +2215,7 @@ uno::Reference< drawing::XShape >
tNameSequence aPropNames;
tAnySequence aPropValues;
PropertyMapper::getMultiPropertyListsFromValueMap( aPropNames, aPropValues, aValueMap );
- PropertyMapper::setMultiProperties( aPropNames, aPropValues, xShapeProp );
+ PropertyMapper::setMultiProperties( aPropNames, aPropValues, *xShape );
}
bool bStackCharacters(false);
@@ -2438,65 +2233,88 @@ uno::Reference< drawing::XShape >
//if the characters should be stacked we use only the first character properties for code simplicity
if( xFormattedString.hasElements() )
{
- OUString aLabel;
- for( const auto & i : std::as_const(xFormattedString) )
- aLabel += i->getString();
- aLabel = ShapeFactory::getStackedString( aLabel, bStackCharacters );
-
- xTextCursor->gotoEnd(false);
- xText->insertString( xTextCursor, aLabel, false );
- xTextCursor->gotoEnd(true);
- uno::Reference< beans::XPropertySet > xTargetProps( xShape, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xSourceProps( xFormattedString[0], uno::UNO_QUERY );
-
- PropertyMapper::setMappedProperties( xTargetProps, xSourceProps
- , PropertyMapper::getPropertyNameMapForCharacterProperties() );
+ size_t nLBreaks = xFormattedString.size() - 1;
+ uno::Reference< beans::XPropertySet > xSelectionProp(xSelectionCursor, uno::UNO_QUERY);
+ for (const uno::Reference<chart2::XFormattedString>& rxFS : xFormattedString)
+ {
+ if (!rxFS->getString().isEmpty())
+ {
+ xTextCursor->gotoEnd(false);
+ xSelectionCursor->gotoEnd(false);
+ OUString aLabel = ShapeFactory::getStackedString(rxFS->getString(), bStackCharacters);
+ if (nLBreaks-- > 0)
+ aLabel += OUStringChar('\r');
+ xShape->insertString(xTextCursor, aLabel, false);
+ xSelectionCursor->gotoEnd(true); // select current paragraph
+ uno::Reference< beans::XPropertySet > xSourceProps(rxFS, uno::UNO_QUERY);
+ if (xFormattedString.size() > 1 && xSelectionProp.is())
+ {
+ PropertyMapper::setMappedProperties(xSelectionProp, xSourceProps,
+ PropertyMapper::getPropertyNameMapForTextShapeProperties());
+ }
+ else
+ {
+ PropertyMapper::setMappedProperties(*xShape, xSourceProps,
+ PropertyMapper::getPropertyNameMapForTextShapeProperties());
+ }
+ }
+ }
// adapt font size according to page size
awt::Size aOldRefSize;
if( xTextProperties->getPropertyValue( "ReferencePageSize") >>= aOldRefSize )
{
- RelativeSizeHelper::adaptFontSizes( xTargetProps, aOldRefSize, rSize );
+ RelativeSizeHelper::adaptFontSizes( *xShape, aOldRefSize, rSize );
}
}
}
else
{
- for( const uno::Reference< chart2::XFormattedString >& rxFS : std::as_const(xFormattedString) )
+ uno::Reference< beans::XPropertySet > xSelectionProp(xSelectionCursor, uno::UNO_QUERY);
+ for (const uno::Reference<chart2::XFormattedString>& rxFS : xFormattedString)
{
- xTextCursor->gotoEnd(false);
- xText->insertString( xTextCursor, rxFS->getString(), false );
- xTextCursor->gotoEnd(true);
+ if (!rxFS->getString().isEmpty())
+ {
+ xTextCursor->gotoEnd(false);
+ xSelectionCursor->gotoEnd(false);
+ xShape->insertString(xTextCursor, rxFS->getString(), false);
+ xSelectionCursor->gotoEnd(true); // select current paragraph
+ uno::Reference< beans::XPropertySet > xSourceProps(rxFS, uno::UNO_QUERY);
+ if (xFormattedString.size() > 1 && xSelectionProp.is())
+ {
+ PropertyMapper::setMappedProperties(xSelectionProp, xSourceProps,
+ PropertyMapper::getPropertyNameMapForTextShapeProperties());
+ }
+ else
+ {
+ PropertyMapper::setMappedProperties(*xShape, xSourceProps,
+ PropertyMapper::getPropertyNameMapForTextShapeProperties());
+ }
+ }
}
- awt::Size aOldRefSize;
- bool bHasRefPageSize =
- ( xTextProperties->getPropertyValue( "ReferencePageSize") >>= aOldRefSize );
if( xFormattedString.hasElements() )
{
- uno::Reference< beans::XPropertySet > xTargetProps( xShape, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xSourceProps( xFormattedString[0], uno::UNO_QUERY );
- PropertyMapper::setMappedProperties( xTargetProps, xSourceProps, PropertyMapper::getPropertyNameMapForCharacterProperties() );
-
// adapt font size according to page size
- if( bHasRefPageSize )
+ awt::Size aOldRefSize;
+ if( xTextProperties->getPropertyValue("ReferencePageSize") >>= aOldRefSize )
{
- RelativeSizeHelper::adaptFontSizes( xTargetProps, aOldRefSize, rSize );
+ RelativeSizeHelper::adaptFontSizes( *xShape, aOldRefSize, rSize );
}
}
}
// #i109336# Improve auto positioning in chart
float fFontHeight = 0.0;
- if ( xShapeProp.is() && ( xShapeProp->getPropertyValue( "CharHeight" ) >>= fFontHeight ) )
+ if ( xShape->SvxShape::getPropertyValue( "CharHeight" ) >>= fFontHeight )
{
- fFontHeight *= ( 2540.0f / 72.0f ); // pt -> 1/100 mm
+ fFontHeight = convertPointToMm100(fFontHeight);
sal_Int32 nXDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * 0.18f ) );
sal_Int32 nYDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * 0.30f ) );
- xShapeProp->setPropertyValue( "TextLeftDistance", uno::Any( nXDistance ) );
- xShapeProp->setPropertyValue( "TextRightDistance", uno::Any( nXDistance ) );
- xShapeProp->setPropertyValue( "TextUpperDistance", uno::Any( nYDistance ) );
- xShapeProp->setPropertyValue( "TextLowerDistance", uno::Any( nYDistance ) );
+ xShape->SvxShape::setPropertyValue( "TextLeftDistance", uno::Any( nXDistance ) );
+ xShape->SvxShape::setPropertyValue( "TextRightDistance", uno::Any( nXDistance ) );
+ xShape->SvxShape::setPropertyValue( "TextUpperDistance", uno::Any( nYDistance ) );
+ xShape->SvxShape::setPropertyValue( "TextLowerDistance", uno::Any( nYDistance ) );
}
sal_Int32 nXPos = rPos.X;
sal_Int32 nYPos = rPos.Y;
@@ -2506,9 +2324,9 @@ uno::Reference< drawing::XShape >
::basegfx::B2DHomMatrix aM;
aM.rotate( -basegfx::deg2rad(nRotation) );//#i78696#->#i80521#
aM.translate( nXPos, nYPos );
- xShapeProp->setPropertyValue( "Transformation", uno::Any( B2DHomMatrixToHomogenMatrix3(aM) ) );
+ xShape->SvxShape::setPropertyValue( "Transformation", uno::Any( B2DHomMatrixToHomogenMatrix3(aM) ) );
- xShapeProp->setPropertyValue( "ParaAdjust", uno::Any( style::ParagraphAdjust_CENTER ) );
+ xShape->SvxShape::setPropertyValue( "ParaAdjust", uno::Any( style::ParagraphAdjust_CENTER ) );
}
catch( const uno::Exception& )
{
@@ -2517,16 +2335,10 @@ uno::Reference< drawing::XShape >
return xShape;
}
-ShapeFactory* ShapeFactory::getOrCreateShapeFactory(const uno::Reference< lang::XMultiServiceFactory>& xFactory)
-{
- static ShapeFactory* pShapeFactory = new ShapeFactory(xFactory);
- return pShapeFactory;
-}
-
-uno::Reference< drawing::XShapes > ShapeFactory::getChartRootShape(
- const uno::Reference< drawing::XDrawPage>& xDrawPage )
+rtl::Reference<SvxShapeGroupAnyD> ShapeFactory::getChartRootShape(
+ const rtl::Reference<SvxDrawPage>& xDrawPage )
{
- uno::Reference< drawing::XShapes > xRet;
+ rtl::Reference<SvxShapeGroupAnyD> xRet;
const uno::Reference< drawing::XShapes > xShapes = xDrawPage;
if( xShapes.is() )
{
@@ -2538,7 +2350,8 @@ uno::Reference< drawing::XShapes > ShapeFactory::getChartRootShape(
{
if( ShapeFactory::getShapeName( xShape ) == "com.sun.star.chart2.shapes" )
{
- xRet.set( xShape, uno::UNO_QUERY );
+ xRet = dynamic_cast<SvxShapeGroupAnyD*>(xShape.get());
+ assert(xRet);
break;
}
}
@@ -2547,44 +2360,34 @@ uno::Reference< drawing::XShapes > ShapeFactory::getChartRootShape(
return xRet;
}
-void ShapeFactory::makeShapeInvisible( const uno::Reference< drawing::XShape >& xShape )
+void ShapeFactory::makeShapeInvisible( const rtl::Reference< SvxShape >& xShape )
{
- uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xShapeProp.is(), "created shape offers no XPropertySet");
- if( xShapeProp.is())
+ try
{
- try
- {
- xShapeProp->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ));
- xShapeProp->setPropertyValue( "FillStyle", uno::Any( drawing::FillStyle_NONE ));
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xShape->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ));
+ xShape->setPropertyValue( "FillStyle", uno::Any( drawing::FillStyle_NONE ));
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
}
// set a name/CID at a shape (is used for selection handling)
-void ShapeFactory::setShapeName( const uno::Reference< drawing::XShape >& xShape
+void ShapeFactory::setShapeName( const rtl::Reference< SvxShape >& xShape
, const OUString& rName )
{
if(!xShape.is())
return;
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "shape offers no XPropertySet");
- if( xProp.is())
+ try
{
- try
- {
- xProp->setPropertyValue( UNO_NAME_MISC_OBJ_NAME
- , uno::Any( rName ) );
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ xShape->setPropertyValue( UNO_NAME_MISC_OBJ_NAME
+ , uno::Any( rName ) );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
}
@@ -2640,22 +2443,28 @@ OUString ShapeFactory::getStackedString( const OUString& rString, bool bStacked
return aStackStr.makeStringAndClear();
}
-bool ShapeFactory::hasPolygonAnyLines( drawing::PolyPolygonShape3D& rPoly)
+bool ShapeFactory::hasPolygonAnyLines( const std::vector<std::vector<css::drawing::Position3D>>& rPoly)
{
// #i67757# check all contained polygons, if at least one polygon contains 2 or more points, return true
- for( auto const & i : std::as_const(rPoly.SequenceX) )
- if( i.getLength() > 1 )
+ for( auto const & i : rPoly )
+ if( i.size() > 1 )
return true;
return false;
}
-bool ShapeFactory::isPolygonEmptyOrSinglePoint( drawing::PolyPolygonShape3D& rPoly)
+bool ShapeFactory::isPolygonEmptyOrSinglePoint( const drawing::PolyPolygonShape3D& rPoly)
{
// true, if empty polypolygon or one polygon with one point
return !rPoly.SequenceX.hasElements() ||
((rPoly.SequenceX.getLength() == 1) && (rPoly.SequenceX[0].getLength() <= 1));
}
+bool ShapeFactory::isPolygonEmptyOrSinglePoint( const std::vector<std::vector<css::drawing::Position3D>>& rPoly)
+{
+ // true, if empty polypolygon or one polygon with one point
+ return rPoly.empty() || ((rPoly.size() == 1) && (rPoly[0].size() <= 1));
+}
+
void ShapeFactory::closePolygon( drawing::PolyPolygonShape3D& rPoly)
{
OSL_ENSURE( rPoly.SequenceX.getLength() <= 1, "ShapeFactory::closePolygon - single polygon expected" );
@@ -2666,6 +2475,16 @@ void ShapeFactory::closePolygon( drawing::PolyPolygonShape3D& rPoly)
AddPointToPoly( rPoly, aFirst );
}
+void ShapeFactory::closePolygon( std::vector<std::vector<css::drawing::Position3D>>& rPoly)
+{
+ OSL_ENSURE( rPoly.size() <= 1, "ShapeFactory::closePolygon - single polygon expected" );
+ //add a last point == first point
+ if(isPolygonEmptyOrSinglePoint(rPoly))
+ return;
+ drawing::Position3D aFirst(rPoly[0][0]);
+ AddPointToPoly( rPoly, aFirst );
+}
+
awt::Size ShapeFactory::calculateNewSizeRespectingAspectRatio(
const awt::Size& rTargetSize
, const awt::Size& rSourceSizeWithCorrectAspectRatio )
@@ -2692,55 +2511,48 @@ awt::Point ShapeFactory::calculateTopLeftPositionToCenterObject(
return aNewPosition;
}
-::basegfx::B2IRectangle ShapeFactory::getRectangleOfShape(
- const uno::Reference< drawing::XShape >& xShape )
+::basegfx::B2IRectangle ShapeFactory::getRectangleOfShape( SvxShape& rShape )
{
::basegfx::B2IRectangle aRet;
- if( xShape.is() )
- {
- awt::Point aPos = xShape->getPosition();
- awt::Size aSize = xShape->getSize();
- aRet = BaseGFXHelper::makeRectangle(aPos,aSize);
- }
- return aRet;
+ awt::Point aPos = rShape.getPosition();
+ awt::Size aSize = rShape.getSize();
+ aRet = BaseGFXHelper::makeRectangle(aPos,aSize);
+ return aRet;
}
awt::Size ShapeFactory::getSizeAfterRotation(
- const uno::Reference< drawing::XShape >& xShape, double fRotationAngleDegree )
+ SvxShape& rShape, double fRotationAngleDegree )
{
awt::Size aRet(0,0);
- if(xShape.is())
- {
- const awt::Size aSize( xShape->getSize() );
+ const awt::Size aSize( rShape.getSize() );
- if( fRotationAngleDegree == 0.0 )
- aRet = aSize;
- else
- {
- fRotationAngleDegree = NormAngle360(fRotationAngleDegree);
- if(fRotationAngleDegree>270.0)
- fRotationAngleDegree=360.0-fRotationAngleDegree;
- else if(fRotationAngleDegree>180.0)
- fRotationAngleDegree=fRotationAngleDegree-180.0;
- else if(fRotationAngleDegree>90.0)
- fRotationAngleDegree=180.0-fRotationAngleDegree;
-
- const double fAnglePi = basegfx::deg2rad(fRotationAngleDegree);
-
- aRet.Height = static_cast<sal_Int32>(
- aSize.Width*rtl::math::sin( fAnglePi )
- + aSize.Height*rtl::math::cos( fAnglePi ));
- aRet.Width = static_cast<sal_Int32>(
- aSize.Width*rtl::math::cos( fAnglePi )
- + aSize.Height*rtl::math::sin( fAnglePi ));
- }
+ if( fRotationAngleDegree == 0.0 )
+ aRet = aSize;
+ else
+ {
+ fRotationAngleDegree = NormAngle360(fRotationAngleDegree);
+ if(fRotationAngleDegree>270.0)
+ fRotationAngleDegree=360.0-fRotationAngleDegree;
+ else if(fRotationAngleDegree>180.0)
+ fRotationAngleDegree=fRotationAngleDegree-180.0;
+ else if(fRotationAngleDegree>90.0)
+ fRotationAngleDegree=180.0-fRotationAngleDegree;
+
+ const double fAnglePi = basegfx::deg2rad(fRotationAngleDegree);
+
+ aRet.Height = static_cast<sal_Int32>(
+ aSize.Width*std::sin( fAnglePi )
+ + aSize.Height*std::cos( fAnglePi ));
+ aRet.Width = static_cast<sal_Int32>(
+ aSize.Width*std::cos( fAnglePi )
+ + aSize.Height*std::sin( fAnglePi ));
}
return aRet;
}
-void ShapeFactory::removeSubShapes( const uno::Reference< drawing::XShapes >& xShapes )
+void ShapeFactory::removeSubShapes( const rtl::Reference<SvxShapeGroupAnyD>& xShapes )
{
if( xShapes.is() )
{
@@ -2754,6 +2566,21 @@ void ShapeFactory::removeSubShapes( const uno::Reference< drawing::XShapes >& xS
}
}
+rtl::Reference<SvxTableShape>
+ShapeFactory::createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget, OUString const& rName)
+{
+ if (!xTarget.is())
+ return nullptr;
+
+ //create table shape
+ rtl::Reference<SvxTableShape> xShape = new SvxTableShape(nullptr);
+ xShape->setShapeKind(SdrObjKind::Table);
+ xTarget->addShape(*xShape);
+ if (!rName.isEmpty())
+ setShapeName(xShape, rName);
+ return xShape;
+}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/VButton.cxx b/chart2/source/view/main/VButton.cxx
index 088df5850416..25a770fb04bc 100644
--- a/chart2/source/view/main/VButton.cxx
+++ b/chart2/source/view/main/VButton.cxx
@@ -12,21 +12,15 @@
#include <ShapeFactory.hxx>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <memory>
#include <CommonConverters.hxx>
#include <editeng/unoprnms.hxx>
namespace chart
{
-
using namespace css;
VButton::VButton()
@@ -36,22 +30,15 @@ VButton::VButton()
{
}
-void VButton::init(const uno::Reference<drawing::XShapes>& xTargetPage,
- const uno::Reference<lang::XMultiServiceFactory>& xFactory)
+void VButton::init(const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage)
{
m_xTarget = xTargetPage;
- m_xShapeFactory = xFactory;
}
-uno::Reference<drawing::XShape> VButton::createTriangle(awt::Size aSize)
+rtl::Reference<SvxShapePolyPolygon> VButton::createTriangle(awt::Size aSize)
{
- uno::Reference<drawing::XShape> xShape;
- xShape.set(m_xShapeFactory->createInstance("com.sun.star.drawing.PolyPolygonShape"), uno::UNO_QUERY);
-
- if (!xShape.is())
- return xShape;
-
- uno::Reference<beans::XPropertySet> xProperies(xShape, uno::UNO_QUERY);
+ rtl::Reference<SvxShapePolyPolygon> xShape = new SvxShapePolyPolygon(nullptr);
+ xShape->setShapeKind(SdrObjKind::Polygon);
drawing::PolyPolygonShape3D aPolyPolygon;
aPolyPolygon.SequenceX.realloc(1);
@@ -82,30 +69,27 @@ uno::Reference<drawing::XShape> VButton::createTriangle(awt::Size aSize)
pInnerSequenceY[2] = 0.0;
pInnerSequenceZ[2] = 0.0;
- xProperies->setPropertyValue("Name", uno::makeAny(m_sCID));
- xProperies->setPropertyValue(UNO_NAME_POLYPOLYGON, uno::Any(PolyToPointSequence(aPolyPolygon)));
- xProperies->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE));
- xProperies->setPropertyValue("FillColor", uno::makeAny(m_nArrowColor));
+ xShape->SvxShape::setPropertyValue("Name", uno::Any(m_sCID));
+ xShape->SvxShape::setPropertyValue(UNO_NAME_POLYPOLYGON,
+ uno::Any(PolyToPointSequence(aPolyPolygon)));
+ xShape->SvxShape::setPropertyValue("LineStyle", uno::Any(drawing::LineStyle_NONE));
+ xShape->SvxShape::setPropertyValue("FillColor", uno::Any(m_nArrowColor));
return xShape;
}
void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp)
{
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
+ tNameSequence aPropNames;
+ tAnySequence aPropValues;
- std::unique_ptr<tNameSequence> pPropNames(new tNameSequence);
- std::unique_ptr<tAnySequence> pPropValues(new tAnySequence);
+ PropertyMapper::getTextLabelMultiPropertyLists(xTextProp, aPropNames, aPropValues);
- PropertyMapper::getTextLabelMultiPropertyLists(xTextProp, *pPropNames, *pPropValues);
-
- m_xShape.set(pShapeFactory->createGroup2D(m_xTarget, m_sCID), uno::UNO_QUERY);
+ m_xShape = ShapeFactory::createGroup2D(m_xTarget, m_sCID);
m_xShape->setPosition(m_aPosition);
m_xShape->setSize(m_aSize);
- uno::Reference<drawing::XShapes> xContainer(m_xShape, uno::UNO_QUERY);
- if (!xContainer.is())
- return;
+ rtl::Reference<SvxShapeGroupAnyD> xContainer = m_xShape;
tPropertyNameValueMap aTextValueMap;
aTextValueMap["CharHeight"] <<= 10.0f;
@@ -123,10 +107,10 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp)
aTextValueMap["Name"] <<= m_sCID; //CID OUString
- PropertyMapper::getMultiPropertyListsFromValueMap(*pPropNames, *pPropValues, aTextValueMap);
+ PropertyMapper::getMultiPropertyListsFromValueMap(aPropNames, aPropValues, aTextValueMap);
- uno::Reference<drawing::XShape> xEntry = pShapeFactory->createText(
- xContainer, m_sLabel, *pPropNames, *pPropValues, uno::Any());
+ rtl::Reference<SvxShapeText> xEntry
+ = ShapeFactory::createText(xContainer, m_sLabel, aPropNames, aPropValues, uno::Any());
if (xEntry.is())
{
@@ -137,16 +121,14 @@ void VButton::createShapes(const uno::Reference<beans::XPropertySet>& xTextProp)
if (!m_bShowArrow)
return;
- awt::Size aPolySize {280, 180};
+ awt::Size aPolySize{ 280, 180 };
- uno::Reference<drawing::XShape> xPoly = createTriangle(aPolySize);
- if (xPoly.is())
- {
- xPoly->setSize(aPolySize);
- xPoly->setPosition({ sal_Int32(m_aPosition.X + m_aSize.Width - aPolySize.Width - 100),
- sal_Int32(m_aPosition.Y + (m_aSize.Height / 2.0) - (aPolySize.Height / 2.0)) });
- xContainer->add(xPoly);
- }
+ rtl::Reference<SvxShapePolyPolygon> xPoly = createTriangle(aPolySize);
+ xPoly->setSize(aPolySize);
+ xPoly->setPosition(
+ { sal_Int32(m_aPosition.X + m_aSize.Width - aPolySize.Width - 100),
+ sal_Int32(m_aPosition.Y + (m_aSize.Height / 2.0) - (aPolySize.Height / 2.0)) });
+ xContainer->add(xPoly);
}
} //namespace chart
diff --git a/chart2/source/view/main/VButton.hxx b/chart2/source/view/main/VButton.hxx
index cb420332631a..87017f36901a 100644
--- a/chart2/source/view/main/VButton.hxx
+++ b/chart2/source/view/main/VButton.hxx
@@ -7,13 +7,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_VBUTTON_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_MAIN_VBUTTON_HXX
+#pragma once
#include <tools/color.hxx>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::drawing { class XShape; }
@@ -26,9 +27,8 @@ namespace chart
class VButton final
{
private:
- css::uno::Reference<css::lang::XMultiServiceFactory> m_xShapeFactory;
- css::uno::Reference<css::drawing::XShapes> m_xTarget;
- css::uno::Reference<css::drawing::XShape> m_xShape;
+ rtl::Reference<SvxShapeGroupAnyD> m_xTarget;
+ rtl::Reference<SvxShapeGroup> m_xShape;
OUString m_sLabel;
OUString m_sCID;
css::awt::Point m_aPosition;
@@ -37,14 +37,13 @@ private:
Color m_nArrowColor;
Color m_nBGColor;
- css::uno::Reference<css::drawing::XShape>
+ rtl::Reference<SvxShapePolyPolygon>
createTriangle(css::awt::Size aSize);
public:
VButton();
- void init(const css::uno::Reference<css::drawing::XShapes>& xTargetPage,
- const css::uno::Reference<css::lang::XMultiServiceFactory>& xFactory);
+ void init(const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage);
void createShapes(const css::uno::Reference<css::beans::XPropertySet>& xTextProp);
@@ -83,6 +82,5 @@ public:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index 91388d1c2eda..4527d4368b2f 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -17,63 +17,62 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <limits>
#include <memory>
#include <VDataSeries.hxx>
+#include <DataSeries.hxx>
+#include <DataSeriesProperties.hxx>
#include <ObjectIdentifier.hxx>
#include <CommonConverters.hxx>
#include <LabelPositionHelper.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
+#include <RegressionCurveCalculator.hxx>
#include <RegressionCurveHelper.hxx>
#include <unonames.hxx>
-#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
-#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/XRegressionCurveCalculator.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/RelativeSize.hpp>
-#include <rtl/math.hxx>
+#include <o3tl/compare.hxx>
#include <osl/diagnose.h>
#include <tools/color.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
-#include <com/sun/star/chart2/data/XDataSource.hpp>
namespace chart {
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
+using namespace ::chart::DataSeriesProperties;
void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel )
{
- Model = xModel;
- Doubles = DataSequenceToDoubleSequence( xModel );
+ m_xModel = xModel;
+ m_aValues = DataSequenceToDoubleSequence( xModel );
}
bool VDataSequence::is() const
{
- return Model.is();
+ return m_xModel.is();
}
void VDataSequence::clear()
{
- Model = nullptr;
- Doubles.realloc(0);
+ m_xModel = nullptr;
+ m_aValues.realloc(0);
}
double VDataSequence::getValue( sal_Int32 index ) const
{
- if( 0<=index && index<Doubles.getLength() )
- return Doubles[index];
- else
- {
- double fNan;
- ::rtl::math::setNan( & fNan );
- return fNan;
- }
+ if( 0<=index && index<m_aValues.getLength() )
+ return m_aValues[index];
+ return std::numeric_limits<double>::quiet_NaN();
}
sal_Int32 VDataSequence::detectNumberFormatKey( sal_Int32 index ) const
@@ -81,10 +80,9 @@ sal_Int32 VDataSequence::detectNumberFormatKey( sal_Int32 index ) const
sal_Int32 nNumberFormatKey = -1;
// -1 is allowed and means a key for the whole sequence
- if( -1<=index && index<Doubles.getLength() &&
- Model.is())
+ if( -1<=index && index<m_aValues.getLength() && m_xModel.is())
{
- nNumberFormatKey = Model->getNumberFormatKeyByIndex( index );
+ nNumberFormatKey = m_xModel->getNumberFormatKeyByIndex( index );
}
return nNumberFormatKey;
@@ -92,7 +90,7 @@ sal_Int32 VDataSequence::detectNumberFormatKey( sal_Int32 index ) const
sal_Int32 VDataSequence::getLength() const
{
- return Doubles.getLength();
+ return m_aValues.getLength();
}
namespace
@@ -104,7 +102,7 @@ struct lcl_LessXOfPoint
{
if( !first.empty() && !second.empty() )
{
- return first[0]<second[0];
+ return o3tl::strong_order(first[0], second[0]) < 0;
}
return false;
}
@@ -113,10 +111,10 @@ struct lcl_LessXOfPoint
void lcl_clearIfNoValuesButTextIsContained( VDataSequence& rData, const uno::Reference<data::XDataSequence>& xDataSequence )
{
//#i71686#, #i101968#, #i102428#
- sal_Int32 nCount = rData.Doubles.getLength();
+ sal_Int32 nCount = rData.m_aValues.getLength();
for( sal_Int32 i = 0; i < nCount; ++i )
{
- if( !std::isnan( rData.Doubles[i] ) )
+ if( !std::isnan( rData.m_aValues[i] ) )
return;
}
//no double value is contained
@@ -143,48 +141,35 @@ void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatm
}
-VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
+VDataSeries::VDataSeries( const rtl::Reference< DataSeries >& xDataSeries )
: m_nPolygonIndex(0)
, m_fLogicMinX(0.0)
, m_fLogicMaxX(0.0)
, m_fLogicZPos(0.0)
, m_xDataSeries(xDataSeries)
, m_nPointCount(0)
-
, m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y)
-
- , m_fXMeanValue(1.0)
- , m_fYMeanValue(1.0)
-
- , m_aAttributedDataPointIndexList()
-
+ , m_fXMeanValue(std::numeric_limits<double>::quiet_NaN())
+ , m_fYMeanValue(std::numeric_limits<double>::quiet_NaN())
, m_eStackingDirection(StackingDirection_NO_STACKING)
, m_nAxisIndex(0)
, m_bConnectBars(false)
, m_bGroupBarsPerAxis(true)
, m_nStartingAngle(90)
-
, m_nGlobalSeriesIndex(0)
-
, m_nCurrentAttributedPoint(-1)
, m_nMissingValueTreatment(css::chart::MissingValueTreatment::LEAVE_GAP)
, m_bAllowPercentValueInDataLabel(false)
, mpOldSeries(nullptr)
, mnPercent(0.0)
{
- ::rtl::math::setNan( & m_fXMeanValue );
- ::rtl::math::setNan( & m_fYMeanValue );
+ m_xDataSeriesProps = m_xDataSeries;
- uno::Reference<data::XDataSource> xDataSource( xDataSeries, uno::UNO_QUERY );
+ const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSequences =
+ m_xDataSeries->getDataSequences2();
- uno::Sequence< uno::Reference<
- chart2::data::XLabeledDataSequence > > aDataSequences =
- xDataSource->getDataSequences();
-
- for(sal_Int32 nN = aDataSequences.getLength();nN--;)
+ for(sal_Int32 nN = aDataSequences.size();nN--;)
{
- if(!aDataSequences[nN].is())
- continue;
uno::Reference<data::XDataSequence> xDataSequence( aDataSequences[nN]->getValues());
uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY );
if( xProp.is())
@@ -241,18 +226,17 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
m_nPointCount = m_aValues_Y_Last.getLength();
}
- uno::Reference<beans::XPropertySet> xProp(xDataSeries, uno::UNO_QUERY );
- if( !xProp.is())
+ if( !xDataSeries.is())
return;
try
{
- //get AttributedDataPoints
- xProp->getPropertyValue("AttributedDataPoints") >>= m_aAttributedDataPointIndexList;
+ // "AttributedDataPoints"
+ xDataSeries->getFastPropertyValue(PROP_DATASERIES_ATTRIBUTED_DATA_POINTS) >>= m_aAttributedDataPointIndexList;
- xProp->getPropertyValue("StackingDirection") >>= m_eStackingDirection;
+ xDataSeries->getFastPropertyValue(PROP_DATASERIES_STACKING_DIRECTION) >>= m_eStackingDirection; // "StackingDirection"
- xProp->getPropertyValue("AttachedAxisIndex") >>= m_nAxisIndex;
+ xDataSeries->getFastPropertyValue(PROP_DATASERIES_ATTACHED_AXIS_INDEX) >>= m_nAxisIndex; // "AttachedAxisIndex"
if(m_nAxisIndex<0)
m_nAxisIndex=0;
}
@@ -268,52 +252,53 @@ VDataSeries::~VDataSeries()
void VDataSeries::doSortByXValues()
{
- if( !(m_aValues_X.is() && m_aValues_X.Doubles.hasElements()) )
+ if( !(m_aValues_X.is() && m_aValues_X.m_aValues.hasElements()) )
return;
//prepare a vector for sorting
std::vector< std::vector< double > > aTmp;//outer vector are points, inner vector are the different values of the point
- double fNan;
- ::rtl::math::setNan( & fNan );
sal_Int32 nPointIndex = 0;
for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ )
{
- std::vector< double > aSinglePoint;
- aSinglePoint.push_back( (nPointIndex < m_aValues_X.Doubles.getLength()) ? m_aValues_X.Doubles[nPointIndex] : fNan );
- aSinglePoint.push_back( (nPointIndex < m_aValues_Y.Doubles.getLength()) ? m_aValues_Y.Doubles[nPointIndex] : fNan );
- aTmp.push_back( aSinglePoint );
+ aTmp.push_back(
+ { ((nPointIndex < m_aValues_X.m_aValues.getLength()) ? m_aValues_X.m_aValues[nPointIndex]
+ : std::numeric_limits<double>::quiet_NaN()),
+ ((nPointIndex < m_aValues_Y.m_aValues.getLength()) ? m_aValues_Y.m_aValues[nPointIndex]
+ : std::numeric_limits<double>::quiet_NaN())
+ }
+ );
}
//do sort
std::stable_sort( aTmp.begin(), aTmp.end(), lcl_LessXOfPoint() );
//fill the sorted points back to the members
- m_aValues_X.Doubles.realloc( m_nPointCount );
- m_aValues_Y.Doubles.realloc( m_nPointCount );
+ m_aValues_X.m_aValues.realloc( m_nPointCount );
+ auto pDoublesX = m_aValues_X.m_aValues.getArray();
+ m_aValues_Y.m_aValues.realloc( m_nPointCount );
+ auto pDoublesY = m_aValues_Y.m_aValues.getArray();
for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ )
{
- m_aValues_X.Doubles[nPointIndex]=aTmp[nPointIndex][0];
- m_aValues_Y.Doubles[nPointIndex]=aTmp[nPointIndex][1];
+ pDoublesX[nPointIndex]=aTmp[nPointIndex][0];
+ pDoublesY[nPointIndex]=aTmp[nPointIndex][1];
}
}
void VDataSeries::releaseShapes()
{
- m_xGroupShape.set(nullptr);
- m_xLabelsGroupShape.set(nullptr);
- m_xErrorXBarsGroupShape.set(nullptr);
- m_xErrorYBarsGroupShape.set(nullptr);
- m_xFrontSubGroupShape.set(nullptr);
- m_xBackSubGroupShape.set(nullptr);
+ m_xGroupShape.clear();
+ m_xLabelsGroupShape.clear();
+ m_xErrorXBarsGroupShape.clear();
+ m_xErrorYBarsGroupShape.clear();
+ m_xFrontSubGroupShape.clear();
+ m_xBackSubGroupShape.clear();
- m_aPolyPolygonShape3D.SequenceX.realloc(0);
- m_aPolyPolygonShape3D.SequenceY.realloc(0);
- m_aPolyPolygonShape3D.SequenceZ.realloc(0);
+ m_aPolyPolygonShape3D.clear();
m_nPolygonIndex = 0;
}
-const uno::Reference<css::chart2::XDataSeries>& VDataSeries::getModel() const
+const rtl::Reference<::chart::DataSeries>& VDataSeries::getModel() const
{
return m_xDataSeries;
}
@@ -354,7 +339,7 @@ void VDataSeries::setParticle( const OUString& rSeriesParticle )
m_aPointCID_Stub = ObjectIdentifier::createSeriesSubObjectStub( OBJECTTYPE_DATA_POINT, m_aSeriesParticle );
m_aLabelCID_Stub = ObjectIdentifier::createClassifiedIdentifierWithParent(
- OBJECTTYPE_DATA_LABEL, OUString(), getLabelsCID() );
+ OBJECTTYPE_DATA_LABEL, u"", getLabelsCID() );
}
OUString VDataSeries::getErrorBarsCID(bool bYError) const
{
@@ -435,28 +420,24 @@ void VDataSeries::setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex )
double VDataSeries::getXValue( sal_Int32 index ) const
{
- double fRet = 0.0;
+ double fRet = std::numeric_limits<double>::quiet_NaN();
if(m_aValues_X.is())
{
if( 0<=index && index<m_aValues_X.getLength() )
{
- fRet = m_aValues_X.Doubles[index];
+ fRet = m_aValues_X.m_aValues[index];
if(mpOldSeries && index < mpOldSeries->m_aValues_X.getLength())
{
- double nOldVal = mpOldSeries->m_aValues_X.Doubles[index];
+ double nOldVal = mpOldSeries->m_aValues_X.m_aValues[index];
fRet = nOldVal + (fRet - nOldVal) * mnPercent;
}
}
- else
- ::rtl::math::setNan( &fRet );
}
else
{
// #i70133# always return correct X position - needed for short data series
if( 0<=index /*&& index < m_nPointCount*/ )
fRet = index+1;//first category (index 0) matches with real number 1.0
- else
- ::rtl::math::setNan( &fRet );
}
lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
return fRet;
@@ -464,28 +445,24 @@ double VDataSeries::getXValue( sal_Int32 index ) const
double VDataSeries::getYValue( sal_Int32 index ) const
{
- double fRet = 0.0;
+ double fRet = std::numeric_limits<double>::quiet_NaN();
if(m_aValues_Y.is())
{
if( 0<=index && index<m_aValues_Y.getLength() )
{
- fRet = m_aValues_Y.Doubles[index];
+ fRet = m_aValues_Y.m_aValues[index];
if(mpOldSeries && index < mpOldSeries->m_aValues_Y.getLength())
{
- double nOldVal = mpOldSeries->m_aValues_Y.Doubles[index];
+ double nOldVal = mpOldSeries->m_aValues_Y.m_aValues[index];
fRet = nOldVal + (fRet - nOldVal) * mnPercent;
}
}
- else
- ::rtl::math::setNan( &fRet );
}
else
{
// #i70133# always return correct X position - needed for short data series
if( 0<=index /*&& index < m_nPointCount*/ )
fRet = index+1;//first category (index 0) matches with real number 1.0
- else
- ::rtl::math::setNan( &fRet );
}
lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
return fRet;
@@ -493,8 +470,8 @@ double VDataSeries::getYValue( sal_Int32 index ) const
void VDataSeries::getMinMaxXValue(double& fMin, double& fMax) const
{
- rtl::math::setNan( &fMax );
- rtl::math::setNan( &fMin );
+ fMax = std::numeric_limits<double>::quiet_NaN();
+ fMin = std::numeric_limits<double>::quiet_NaN();
uno::Sequence< double > aValuesX = getAllX();
@@ -550,13 +527,13 @@ double VDataSeries::getBubble_Size( sal_Int32 index ) const
bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const
{
- OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : OUString(CHART_UNONAME_NUMFMT);
+ OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : CHART_UNONAME_NUMFMT;
bool bHasNumberFormat = false;
bool bLinkToSource = true;
uno::Reference< beans::XPropertySet > xPointProp( getPropertiesOfPoint( nPointIndex ));
- sal_Int32 nNumberFormat = -1;
if( xPointProp.is() && (xPointProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource))
{
+ sal_Int32 nNumberFormat = -1;
if( !bLinkToSource && (xPointProp->getPropertyValue(aPropName) >>= nNumberFormat))
bHasNumberFormat = true;
}
@@ -564,28 +541,28 @@ bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPerce
}
sal_Int32 VDataSeries::getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const
{
- OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : OUString(CHART_UNONAME_NUMFMT);
+ OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : CHART_UNONAME_NUMFMT;
sal_Int32 nNumberFormat = -1;
uno::Reference< beans::XPropertySet > xPointProp( getPropertiesOfPoint( nPointIndex ));
if( xPointProp.is() )
xPointProp->getPropertyValue(aPropName) >>= nNumberFormat;
return nNumberFormat;
}
-void VDataSeries::setRoleOfSequenceForDataLabelNumberFormatDetection( const OUString& rRole )
+void VDataSeries::setRoleOfSequenceForDataLabelNumberFormatDetection( std::u16string_view rRole )
{
- if (rRole == "values-y")
+ if (rRole == u"values-y")
m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y;
- else if (rRole == "values-size")
+ else if (rRole == u"values-size")
m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Bubble_Size;
- else if (rRole == "values-min")
+ else if (rRole == u"values-min")
m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Min;
- else if (rRole == "values-max")
+ else if (rRole == u"values-max")
m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Max;
- else if (rRole == "values-first")
+ else if (rRole == u"values-first")
m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_First;
- else if (rRole == "values-last")
+ else if (rRole == u"values-last")
m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Last;
- else if (rRole == "values-x")
+ else if (rRole == u"values-x")
m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_X;
}
sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 index ) const
@@ -596,7 +573,7 @@ sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 index ) const
return nRet;
}
-sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Reference< chart2::XChartType >& xChartType, bool bSwapXAndY ) const
+sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const rtl::Reference< ChartType >& xChartType, bool bSwapXAndY ) const
{
sal_Int32 nLabelPlacement=0;
try
@@ -605,7 +582,7 @@ sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Refe
if( xPointProps.is() )
xPointProps->getPropertyValue("LabelPlacement") >>= nLabelPlacement;
- uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
+ const uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
xChartType, bSwapXAndY, m_xDataSeries ) );
for( sal_Int32 n : aAvailablePlacements )
@@ -653,12 +630,12 @@ awt::Point VDataSeries::getLabelPosition( awt::Point aTextShapePos, sal_Int32 nP
bool VDataSeries::isLabelCustomPos(sal_Int32 nPointIndex) const
{
bool bCustom = false;
- RelativePosition aCustomLabelPosition;
try
{
if( isAttributedDataPoint(nPointIndex) )
{
uno::Reference< beans::XPropertySet > xPointProps(m_xDataSeries->getDataPointByIndex(nPointIndex));
+ RelativePosition aCustomLabelPosition;
if( xPointProps.is() && (xPointProps->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition) )
bCustom = true;
}
@@ -670,10 +647,29 @@ bool VDataSeries::isLabelCustomPos(sal_Int32 nPointIndex) const
return bCustom;
}
+awt::Size VDataSeries::getLabelCustomSize(sal_Int32 nPointIndex) const
+{
+ awt::Size aSize(-1, -1);
+ try
+ {
+ RelativeSize aCustomLabelSize;
+ const uno::Reference<beans::XPropertySet> xPointProps(getPropertiesOfPoint(nPointIndex));
+ if (xPointProps.is() && (xPointProps->getPropertyValue("CustomLabelSize") >>= aCustomLabelSize))
+ {
+ aSize.Width = static_cast<sal_Int32>(aCustomLabelSize.Primary * m_aReferenceSize.Width);
+ aSize.Height = static_cast<sal_Int32>(aCustomLabelSize.Secondary * m_aReferenceSize.Height);
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ return aSize;
+}
+
double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
{
- double fMin=0.0;
- ::rtl::math::setInf(&fMin, false);
+ double fMin = std::numeric_limits<double>::infinity();
if( !m_aValues_Y.is() &&
(m_aValues_Y_Min.is() || m_aValues_Y_Max.is()
@@ -701,15 +697,14 @@ double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
}
if( std::isinf(fMin) )
- ::rtl::math::setNan(&fMin);
+ return std::numeric_limits<double>::quiet_NaN();
return fMin;
}
double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const
{
- double fMax=0.0;
- ::rtl::math::setInf(&fMax, true);
+ double fMax = -std::numeric_limits<double>::infinity();
if( !m_aValues_Y.is() &&
(m_aValues_Y_Min.is() || m_aValues_Y_Max.is()
@@ -737,7 +732,7 @@ double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const
}
if( std::isinf(fMax) )
- ::rtl::math::setNan(&fMax);
+ return std::numeric_limits<double>::quiet_NaN();
return fMax;
}
@@ -748,11 +743,12 @@ uno::Sequence< double > const & VDataSeries::getAllX() const
{
//init x values from category indexes
//first category (index 0) matches with real number 1.0
- m_aValues_X.Doubles.realloc( m_nPointCount );
+ m_aValues_X.m_aValues.realloc( m_nPointCount );
+ auto pDoubles = m_aValues_X.m_aValues.getArray();
for(sal_Int32 nN=m_aValues_X.getLength();nN--;)
- m_aValues_X.Doubles[nN] = nN+1;
+ pDoubles[nN] = nN+1;
}
- return m_aValues_X.Doubles;
+ return m_aValues_X.m_aValues;
}
uno::Sequence< double > const & VDataSeries::getAllY() const
@@ -761,18 +757,19 @@ uno::Sequence< double > const & VDataSeries::getAllY() const
{
//init y values from indexes
//first y-value (index 0) matches with real number 1.0
- m_aValues_Y.Doubles.realloc( m_nPointCount );
+ m_aValues_Y.m_aValues.realloc( m_nPointCount );
+ auto pDoubles = m_aValues_Y.m_aValues.getArray();
for(sal_Int32 nN=m_aValues_Y.getLength();nN--;)
- m_aValues_Y.Doubles[nN] = nN+1;
+ pDoubles[nN] = nN+1;
}
- return m_aValues_Y.Doubles;
+ return m_aValues_Y.m_aValues;
}
double VDataSeries::getXMeanValue() const
{
if( std::isnan( m_fXMeanValue ) )
{
- uno::Reference< XRegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( "com.sun.star.chart2.MeanValueRegressionCurve" ) );
+ rtl::Reference< RegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( u"com.sun.star.chart2.MeanValueRegressionCurve" ) );
uno::Sequence< double > aXValuesDummy;
xCalculator->recalculateRegression( aXValuesDummy, getAllX() );
m_fXMeanValue = xCalculator->getCurveValue( 1.0 );
@@ -784,8 +781,8 @@ double VDataSeries::getYMeanValue() const
{
if( std::isnan( m_fYMeanValue ) )
{
- uno::Reference< XRegressionCurveCalculator > xCalculator(
- RegressionCurveHelper::createRegressionCurveCalculatorByServiceName("com.sun.star.chart2.MeanValueRegressionCurve"));
+ rtl::Reference< RegressionCurveCalculator > xCalculator(
+ RegressionCurveHelper::createRegressionCurveCalculatorByServiceName(u"com.sun.star.chart2.MeanValueRegressionCurve"));
uno::Sequence< double > aXValuesDummy;
xCalculator->recalculateRegression( aXValuesDummy, getAllY() );
m_fYMeanValue = xCalculator->getCurveValue( 1.0 );
@@ -793,26 +790,26 @@ double VDataSeries::getYMeanValue() const
return m_fYMeanValue;
}
-static std::unique_ptr<Symbol> getSymbolPropertiesFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp )
+static std::optional<Symbol> getSymbolPropertiesFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp )
{
- std::unique_ptr< Symbol > apSymbolProps( new Symbol() );
+ Symbol aSymbolProps;
try
{
- if( xProp->getPropertyValue("Symbol") >>= *apSymbolProps )
+ if( xProp->getPropertyValue("Symbol") >>= aSymbolProps )
{
//use main color to fill symbols
- xProp->getPropertyValue("Color") >>= apSymbolProps->FillColor;
+ xProp->getPropertyValue("Color") >>= aSymbolProps.FillColor;
// border of symbols always same as fill color
- apSymbolProps->BorderColor = apSymbolProps->FillColor;
+ aSymbolProps.BorderColor = aSymbolProps.FillColor;
}
else
- apSymbolProps.reset();
+ return std::nullopt;
}
catch(const uno::Exception &)
{
TOOLS_WARN_EXCEPTION("chart2", "" );
}
- return apSymbolProps;
+ return aSymbolProps;
}
Symbol* VDataSeries::getSymbolProperties( sal_Int32 index ) const
@@ -821,38 +818,38 @@ Symbol* VDataSeries::getSymbolProperties( sal_Int32 index ) const
if( isAttributedDataPoint( index ) )
{
adaptPointCache( index );
- if (!m_apSymbolProperties_AttributedPoint)
- m_apSymbolProperties_AttributedPoint
+ if (!m_oSymbolProperties_AttributedPoint)
+ m_oSymbolProperties_AttributedPoint
= getSymbolPropertiesFromPropertySet(getPropertiesOfPoint(index));
- pRet = m_apSymbolProperties_AttributedPoint.get();
+ pRet = &*m_oSymbolProperties_AttributedPoint;
//if a single data point does not have symbols but the dataseries itself has symbols
//we create an invisible symbol shape to enable selection of that point
if( !pRet || pRet->Style == SymbolStyle_NONE )
{
- if (!m_apSymbolProperties_Series)
- m_apSymbolProperties_Series
+ if (!m_oSymbolProperties_Series)
+ m_oSymbolProperties_Series
= getSymbolPropertiesFromPropertySet(getPropertiesOfSeries());
- if( m_apSymbolProperties_Series && m_apSymbolProperties_Series->Style != SymbolStyle_NONE )
+ if( m_oSymbolProperties_Series && m_oSymbolProperties_Series->Style != SymbolStyle_NONE )
{
- if (!m_apSymbolProperties_InvisibleSymbolForSelection)
+ if (!m_oSymbolProperties_InvisibleSymbolForSelection)
{
- m_apSymbolProperties_InvisibleSymbolForSelection.reset(new Symbol);
- m_apSymbolProperties_InvisibleSymbolForSelection->Style = SymbolStyle_STANDARD;
- m_apSymbolProperties_InvisibleSymbolForSelection->StandardSymbol = 0;//square
- m_apSymbolProperties_InvisibleSymbolForSelection->Size = com::sun::star::awt::Size(0, 0);//tdf#126033
- m_apSymbolProperties_InvisibleSymbolForSelection->BorderColor = 0xff000000;//invisible
- m_apSymbolProperties_InvisibleSymbolForSelection->FillColor = 0xff000000;//invisible
+ m_oSymbolProperties_InvisibleSymbolForSelection.emplace();
+ m_oSymbolProperties_InvisibleSymbolForSelection->Style = SymbolStyle_STANDARD;
+ m_oSymbolProperties_InvisibleSymbolForSelection->StandardSymbol = 0;//square
+ m_oSymbolProperties_InvisibleSymbolForSelection->Size = com::sun::star::awt::Size(0, 0);//tdf#126033
+ m_oSymbolProperties_InvisibleSymbolForSelection->BorderColor = 0xff000000;//invisible
+ m_oSymbolProperties_InvisibleSymbolForSelection->FillColor = 0xff000000;//invisible
}
- pRet = m_apSymbolProperties_InvisibleSymbolForSelection.get();
+ pRet = &*m_oSymbolProperties_InvisibleSymbolForSelection;
}
}
}
else
{
- if (!m_apSymbolProperties_Series)
- m_apSymbolProperties_Series
+ if (!m_oSymbolProperties_Series)
+ m_oSymbolProperties_Series
= getSymbolPropertiesFromPropertySet(getPropertiesOfSeries());
- pRet = m_apSymbolProperties_Series.get();
+ pRet = &*m_oSymbolProperties_Series;
}
if( pRet && pRet->Style == SymbolStyle_AUTO )
@@ -921,9 +918,8 @@ bool VDataSeries::isAttributedDataPoint( sal_Int32 index ) const
bool VDataSeries::isVaryColorsByPoint() const
{
bool bVaryColorsByPoint = false;
- Reference< beans::XPropertySet > xSeriesProp( getPropertiesOfSeries() );
- if( xSeriesProp.is() )
- xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint;
+ if( m_xDataSeries )
+ m_xDataSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint; // "VaryColorsByPoint"
return bVaryColorsByPoint;
}
@@ -934,14 +930,14 @@ uno::Reference< beans::XPropertySet > VDataSeries::getPropertiesOfPoint( sal_Int
return getPropertiesOfSeries();
}
-uno::Reference<beans::XPropertySet> VDataSeries::getPropertiesOfSeries() const
+const uno::Reference<beans::XPropertySet> & VDataSeries::getPropertiesOfSeries() const
{
- return uno::Reference<css::beans::XPropertySet>(m_xDataSeries, css::uno::UNO_QUERY);
+ return m_xDataSeriesProps;
}
-static std::unique_ptr<DataPointLabel> getDataPointLabelFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp )
+static std::optional<DataPointLabel> getDataPointLabelFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp )
{
- std::unique_ptr< DataPointLabel > apLabel( new DataPointLabel() );
+ std::optional< DataPointLabel > apLabel( std::in_place );
try
{
if( !(xProp->getPropertyValue(CHART_UNONAME_LABEL) >>= *apLabel) )
@@ -958,10 +954,10 @@ void VDataSeries::adaptPointCache( sal_Int32 nNewPointIndex ) const
{
if( m_nCurrentAttributedPoint != nNewPointIndex )
{
- m_apLabel_AttributedPoint.reset();
- m_apLabelPropNames_AttributedPoint.reset();
- m_apLabelPropValues_AttributedPoint.reset();
- m_apSymbolProperties_AttributedPoint.reset();
+ m_oLabel_AttributedPoint.reset();
+ m_oLabelPropNames_AttributedPoint.reset();
+ m_oLabelPropValues_AttributedPoint.reset();
+ m_oSymbolProperties_AttributedPoint.reset();
m_nCurrentAttributedPoint = nNewPointIndex;
}
}
@@ -972,17 +968,19 @@ DataPointLabel* VDataSeries::getDataPointLabel( sal_Int32 index ) const
if( isAttributedDataPoint( index ) )
{
adaptPointCache( index );
- if (!m_apLabel_AttributedPoint)
- m_apLabel_AttributedPoint
+ if (!m_oLabel_AttributedPoint)
+ m_oLabel_AttributedPoint
= getDataPointLabelFromPropertySet(getPropertiesOfPoint(index));
- pRet = m_apLabel_AttributedPoint.get();
+ if (m_oLabel_AttributedPoint)
+ pRet = &*m_oLabel_AttributedPoint;
}
else
{
- if (!m_apLabel_Series)
- m_apLabel_Series
+ if (!m_oLabel_Series)
+ m_oLabel_Series
= getDataPointLabelFromPropertySet(getPropertiesOfPoint(index));
- pRet = m_apLabel_Series.get();
+ if (m_oLabel_Series)
+ pRet = &*m_oLabel_Series;
}
if( !m_bAllowPercentValueInDataLabel )
{
@@ -996,7 +994,7 @@ DataPointLabel* VDataSeries::getDataPointLabelIfLabel( sal_Int32 index ) const
{
DataPointLabel* pLabel = getDataPointLabel( index );
if( !pLabel || (!pLabel->ShowNumber && !pLabel->ShowNumberInPercent
- && !pLabel->ShowCategoryName ) )
+ && !pLabel->ShowCategoryName && !pLabel->ShowCustomLabel && !pLabel->ShowSeriesName ) )
return nullptr;
return pLabel;
}
@@ -1011,33 +1009,33 @@ bool VDataSeries::getTextLabelMultiPropertyLists( sal_Int32 index
if( isAttributedDataPoint( index ) )
{
adaptPointCache( index );
- if (!m_apLabelPropValues_AttributedPoint)
+ if (!m_oLabelPropValues_AttributedPoint)
{
// Cache these properties for this point.
- m_apLabelPropNames_AttributedPoint.reset(new tNameSequence);
- m_apLabelPropValues_AttributedPoint.reset(new tAnySequence);
+ m_oLabelPropNames_AttributedPoint.emplace();
+ m_oLabelPropValues_AttributedPoint.emplace();
xTextProp.set( getPropertiesOfPoint( index ));
PropertyMapper::getTextLabelMultiPropertyLists(
- xTextProp, *m_apLabelPropNames_AttributedPoint, *m_apLabelPropValues_AttributedPoint);
+ xTextProp, *m_oLabelPropNames_AttributedPoint, *m_oLabelPropValues_AttributedPoint);
bDoDynamicFontResize = true;
}
- pPropNames = m_apLabelPropNames_AttributedPoint.get();
- pPropValues = m_apLabelPropValues_AttributedPoint.get();
+ pPropNames = &*m_oLabelPropNames_AttributedPoint;
+ pPropValues = &*m_oLabelPropValues_AttributedPoint;
}
else
{
- if (!m_apLabelPropValues_Series)
+ if (!m_oLabelPropValues_Series)
{
// Cache these properties for the whole series.
- m_apLabelPropNames_Series.reset(new tNameSequence);
- m_apLabelPropValues_Series.reset(new tAnySequence);
+ m_oLabelPropNames_Series.emplace();
+ m_oLabelPropValues_Series.emplace();
xTextProp.set( getPropertiesOfPoint( index ));
PropertyMapper::getTextLabelMultiPropertyLists(
- xTextProp, *m_apLabelPropNames_Series, *m_apLabelPropValues_Series);
+ xTextProp, *m_oLabelPropNames_Series, *m_oLabelPropValues_Series);
bDoDynamicFontResize = true;
}
- pPropNames = m_apLabelPropNames_Series.get();
- pPropValues = m_apLabelPropValues_Series.get();
+ pPropNames = &*m_oLabelPropNames_Series;
+ pPropValues = &*m_oLabelPropValues_Series;
}
if( bDoDynamicFontResize &&
@@ -1112,11 +1110,7 @@ double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropN
{
auto const itr = m_PropertyMap.find(rPropName);
if (itr == m_PropertyMap.end())
- {
- double fNan;
- ::rtl::math::setNan( &fNan );
- return fNan;
- }
+ return std::numeric_limits<double>::quiet_NaN();
const VDataSequence* pData = &itr->second;
double fValue = pData->getValue(nIndex);
@@ -1126,13 +1120,13 @@ double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropN
if(rPropName.endsWith("Color"))
{
//optimized interpolation for color values
- Color aColor(static_cast<sal_uInt32>(fValue));
- Color aOldColor(static_cast<sal_uInt32>(fOldValue));
+ Color aColor(ColorTransparency, static_cast<sal_uInt32>(fValue));
+ Color aOldColor(ColorTransparency, static_cast<sal_uInt32>(fOldValue));
sal_uInt8 r = aOldColor.GetRed() + (aColor.GetRed() - aOldColor.GetRed()) * mnPercent;
sal_uInt8 g = aOldColor.GetGreen() + (aColor.GetGreen() - aOldColor.GetGreen()) * mnPercent;
sal_uInt8 b = aOldColor.GetBlue() + (aColor.GetBlue() - aOldColor.GetBlue()) * mnPercent;
- sal_uInt8 t = aOldColor.GetTransparency() + (aColor.GetTransparency() - aOldColor.GetTransparency()) * mnPercent;
- Color aRet(t, r, g, b);
+ sal_uInt8 a = aOldColor.GetAlpha() + (aColor.GetAlpha() - aOldColor.GetAlpha()) * mnPercent;
+ Color aRet(ColorAlpha, a, r, g, b);
return sal_uInt32(aRet);
}
return fOldValue + (fValue - fOldValue) * mnPercent;
@@ -1142,7 +1136,7 @@ double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropN
bool VDataSeries::hasPropertyMapping(const OUString& rPropName ) const
{
- return m_PropertyMap.find(rPropName) != m_PropertyMap.end();
+ return m_PropertyMap.contains(rPropName);
}
} //namespace chart
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index d16495e426f3..72c0165a69f5 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -19,9 +19,11 @@
#include "VLegend.hxx"
#include "VButton.hxx"
+#include <Legend.hxx>
#include <PropertyMapper.hxx>
#include <ChartModel.hxx>
#include <ObjectIdentifier.hxx>
+#include <FormattedString.hxx>
#include <RelativePositionHelper.hxx>
#include <ShapeFactory.hxx>
#include <RelativeSizeHelper.hxx>
@@ -31,7 +33,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/chart/ChartLegendExpansion.hpp>
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
@@ -40,9 +41,11 @@
#include <com/sun/star/chart2/data/XPivotTableDataProvider.hpp>
#include <com/sun/star/chart2/data/PivotTableFieldEntry.hpp>
#include <rtl/math.hxx>
-#include <svl/languageoptions.hxx>
-#include <tools/diagnose_ex.h>
+#include <svl/ctloptions.hxx>
+#include <comphelper/diagnose_ex.hxx>
+#include <tools/UnitConversion.hxx>
+#include <utility>
#include <vector>
#include <algorithm>
@@ -66,13 +69,13 @@ double lcl_CalcViewFontSize(
{
double fResult = 10.0;
- awt::Size aPropRefSize;
float fFontHeight( 0.0 );
if( xProp.is() && ( xProp->getPropertyValue( "CharHeight") >>= fFontHeight ))
{
fResult = fFontHeight;
try
{
+ awt::Size aPropRefSize;
if( (xProp->getPropertyValue( "ReferencePageSize") >>= aPropRefSize) &&
(aPropRefSize.Height > 0))
{
@@ -85,8 +88,7 @@ double lcl_CalcViewFontSize(
}
}
- // pt -> 1/100th mm
- return (fResult * (2540.0 / 72.0));
+ return convertPointToMm100(fResult);
}
void lcl_getProperties(
@@ -148,34 +150,35 @@ void lcl_getProperties(
awt::Size lcl_createTextShapes(
const std::vector<ViewLegendEntry> & rEntries,
- const Reference< lang::XMultiServiceFactory > & xShapeFactory,
- const Reference< drawing::XShapes > & xTarget,
- std::vector< Reference< drawing::XShape > > & rOutTextShapes,
+ const rtl::Reference<SvxShapeGroupAnyD> & xTarget,
+ std::vector< rtl::Reference<SvxShapeText> > & rOutTextShapes,
const tPropertyValues & rTextProperties )
{
awt::Size aResult;
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
for (ViewLegendEntry const & rEntry : rEntries)
{
try
{
OUString aLabelString;
- Sequence< Reference< XFormattedString2 > > aLabelSeq = rEntry.aLabel;
- for( sal_Int32 i = 0; i < aLabelSeq.getLength(); ++i )
+ if (rEntry.xLabel)
{
- // todo: support more than one text range
- if( i == 1 )
- break;
+ // tdf#150034 limit legend label text
+ if (rEntry.xLabel->getString().getLength() > 520)
+ {
+ sal_Int32 nIndex = rEntry.xLabel->getString().indexOf(' ', 500);
+ rEntry.xLabel->setString(
+ rEntry.xLabel->getString().copy(0, nIndex > 500 ? nIndex : 500));
+ }
- aLabelString += aLabelSeq[i]->getString();
+ aLabelString += rEntry.xLabel->getString();
// workaround for Issue #i67540#
if( aLabelString.isEmpty())
aLabelString = " ";
}
- Reference< drawing::XShape > xEntry =
- pShapeFactory->createText( xTarget, aLabelString,
+ rtl::Reference<SvxShapeText> xEntry =
+ ShapeFactory::createText( xTarget, aLabelString,
rTextProperties.first, rTextProperties.second, uno::Any() );
// adapt max-extent
@@ -195,7 +198,7 @@ awt::Size lcl_createTextShapes(
}
void lcl_collectColumnWidths( std::vector< sal_Int32 >& rColumnWidths, const sal_Int32 nNumberOfRows, const sal_Int32 nNumberOfColumns,
- const std::vector< Reference< drawing::XShape > >& rTextShapes, sal_Int32 nSymbolPlusDistanceWidth )
+ const std::vector< rtl::Reference<SvxShapeText> >& rTextShapes, sal_Int32 nSymbolPlusDistanceWidth )
{
rColumnWidths.clear();
sal_Int32 nNumberOfEntries = rTextShapes.size();
@@ -218,7 +221,7 @@ void lcl_collectColumnWidths( std::vector< sal_Int32 >& rColumnWidths, const sal
}
void lcl_collectRowHeighs( std::vector< sal_Int32 >& rRowHeights, const sal_Int32 nNumberOfRows, const sal_Int32 nNumberOfColumns,
- const std::vector< Reference< drawing::XShape > >& rTextShapes )
+ const std::vector< rtl::Reference<SvxShapeText> >& rTextShapes )
{
// calculate maximum height for each row
// and collect column widths
@@ -266,8 +269,7 @@ awt::Size lcl_placeLegendEntries(
double fViewFontSize,
const awt::Size& rMaxSymbolExtent,
tPropertyValues & rTextProperties,
- const Reference< drawing::XShapes > & xTarget,
- const Reference< lang::XMultiServiceFactory > & xShapeFactory,
+ const rtl::Reference<SvxShapeGroupAnyD> & xTarget,
const awt::Size& rRemainingSpace,
sal_Int32 nYStartPosition,
const awt::Size& rPageSize,
@@ -291,7 +293,7 @@ awt::Size lcl_placeLegendEntries(
const sal_Int32 nSymbolToTextDistance = static_cast< sal_Int32 >( std::max( 100.0, fViewFontSize * 0.22 ) );//minimum 1mm
const sal_Int32 nSymbolPlusDistanceWidth = rMaxSymbolExtent.Width + nSymbolToTextDistance;
sal_Int32 nMaxTextWidth = rRemainingSpace.Width - nSymbolPlusDistanceWidth;
- uno::Any* pFrameWidthAny = PropertyMapper::getValuePointer( rTextProperties.second, rTextProperties.first, "TextMaximumFrameWidth");
+ uno::Any* pFrameWidthAny = PropertyMapper::getValuePointer( rTextProperties.second, rTextProperties.first, u"TextMaximumFrameWidth");
if(pFrameWidthAny)
{
if( eExpansion == css::chart::ChartLegendExpansion_HIGH )
@@ -303,8 +305,8 @@ awt::Size lcl_placeLegendEntries(
*pFrameWidthAny <<= nMaxTextWidth;
}
- std::vector< Reference< drawing::XShape > > aTextShapes;
- awt::Size aMaxEntryExtent = lcl_createTextShapes( rEntries, xShapeFactory, xTarget, aTextShapes, rTextProperties );
+ std::vector< rtl::Reference<SvxShapeText> > aTextShapes;
+ awt::Size aMaxEntryExtent = lcl_createTextShapes( rEntries, xTarget, aTextShapes, rTextProperties );
OSL_ASSERT( aTextShapes.size() == rEntries.size());
sal_Int32 nMaxEntryWidth = nXOffset + nSymbolPlusDistanceWidth + aMaxEntryExtent.Width;
@@ -328,7 +330,7 @@ awt::Size lcl_placeLegendEntries(
sal_Int32 nMaxColumnCount=-1;
for( sal_Int32 nN=0; nN<static_cast<sal_Int32>(aTextShapes.size()); nN++ )
{
- Reference< drawing::XShape > xShape( aTextShapes[nN] );
+ rtl::Reference<SvxShapeText> xShape( aTextShapes[nN] );
if( !xShape.is() )
continue;
awt::Size aSize( xShape->getSize() );
@@ -348,10 +350,9 @@ awt::Size lcl_placeLegendEntries(
//all good proceed with next entry
continue;
}
- }
- if( nCurrentColumn < nCurrentColumnCount )
+
aColumnWidths[nCurrentColumn] = std::max( nNewWidth, aColumnWidths[nCurrentColumn] );
- else
+ } else
aColumnWidths.push_back(nNewWidth);
//do the columns still fit into the given size?
@@ -410,7 +411,7 @@ awt::Size lcl_placeLegendEntries(
}
if( nEntry < nNumberOfEntries && ( nEntry != 0 || nNumberOfColumns != 1 ) )
{
- DrawModelWrapper::removeShape( rEntries[ nEntry ].aSymbol );
+ DrawModelWrapper::removeShape( rEntries[ nEntry ].xSymbol );
rEntries.pop_back();
nNumberOfEntries--;
}
@@ -419,13 +420,12 @@ awt::Size lcl_placeLegendEntries(
{
try
{
- OUString aLabelString = rEntries[0].aLabel[0]->getString();
- const OUString sDots = "...";
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
- for (sal_Int32 nNewLen = aLabelString.getLength() - sDots.getLength(); nNewLen > 0; nNewLen--)
+ OUString aLabelString = rEntries[0].xLabel->getString();
+ static constexpr OUString sDots = u"..."_ustr;
+ for (sal_Int32 nNewLen = aLabelString.getLength() - sDots.getLength(); nNewLen > 0; )
{
- OUString aNewLabel = aLabelString.copy(0, nNewLen) + sDots;
- Reference<drawing::XShape> xEntry = pShapeFactory->createText(
+ OUString aNewLabel = aLabelString.subView(0, nNewLen) + sDots;
+ rtl::Reference<SvxShapeText> xEntry = ShapeFactory::createText(
xTarget, aNewLabel, rTextProperties.first, rTextProperties.second, uno::Any());
nSumHeight = xEntry->getSize().Height;
nRemainingSpace = rRemainingSpace.Height - nSumHeight;
@@ -435,17 +435,23 @@ awt::Size lcl_placeLegendEntries(
if (rRemainingSpace.Width - nWidth >= 0)
{
aTextShapes.push_back(xEntry);
- rEntries[0].aLabel[0]->setString(aNewLabel);
+ rEntries[0].xLabel->setString(aNewLabel);
aRowHeights[0] = nSumHeight;
aColumnWidths[0] = nWidth;
break;
}
}
DrawModelWrapper::removeShape(xEntry);
+ // The intention here is to make pathological cases with extremely large labels
+ // converge a little faster
+ if (nNewLen > 10 && std::abs(nRemainingSpace) > nSumHeight / 10)
+ nNewLen -= nNewLen / 10;
+ else
+ --nNewLen;
}
- if (aTextShapes.size() == 0)
+ if (aTextShapes.empty())
{
- DrawModelWrapper::removeShape(rEntries[0].aSymbol);
+ DrawModelWrapper::removeShape(rEntries[0].xSymbol);
rEntries.pop_back();
nNumberOfEntries--;
aRowHeights.pop_back();
@@ -580,7 +586,7 @@ awt::Size lcl_placeLegendEntries(
break;
// text shape
- Reference< drawing::XShape > xTextShape( aTextShapes[nEntry] );
+ rtl::Reference<SvxShapeText> xTextShape( aTextShapes[nEntry] );
if( xTextShape.is() )
{
awt::Size aTextSize( xTextShape->getSize() );
@@ -591,7 +597,7 @@ awt::Size lcl_placeLegendEntries(
}
// symbol
- Reference< drawing::XShape > xSymbol( rEntries[ nEntry ].aSymbol );
+ rtl::Reference<SvxShapeGroup> & xSymbol( rEntries[ nEntry ].xSymbol );
if( xSymbol.is() )
{
awt::Size aSymbolSize( rMaxSymbolExtent );
@@ -639,11 +645,11 @@ awt::Size lcl_placeLegendEntries(
awt::Point aPos(0,0);
for( sal_Int32 nEntry=0; nEntry<nNumberOfEntries; nEntry++ )
{
- Reference< drawing::XShape > xSymbol( rEntries[ nEntry ].aSymbol );
+ rtl::Reference<SvxShapeGroup> & xSymbol( rEntries[ nEntry ].xSymbol );
aPos = xSymbol->getPosition();
aPos.X += nLegendWidth;
xSymbol->setPosition( aPos );
- Reference< drawing::XShape > xText( aTextShapes[ nEntry ] );
+ rtl::Reference<SvxShapeText> & xText( aTextShapes[ nEntry ] );
aPos = xText->getPosition();
aPos.X += nLegendWidth;
xText->setPosition( aPos );
@@ -801,7 +807,7 @@ bool lcl_shouldSymbolsBePlacedOnTheLeftSide( const Reference< beans::XPropertySe
bool bSymbolsLeftSide = true;
try
{
- if( SvtLanguageOptions().IsCTLFontEnabled() )
+ if( SvtCTLOptions::IsCTLFontEnabled() )
{
if(xLegendProp.is())
{
@@ -824,9 +830,8 @@ bool lcl_shouldSymbolsBePlacedOnTheLeftSide( const Reference< beans::XPropertySe
}
std::vector<std::shared_ptr<VButton>> lcl_createButtons(
- uno::Reference<drawing::XShapes> const & xLegendContainer,
- uno::Reference<lang::XMultiServiceFactory> const & xShapeFactory,
- ChartModel& rModel, bool bPlaceButtonsVertically, long & nUsedHeight)
+ rtl::Reference<SvxShapeGroupAnyD> const & xLegendContainer,
+ ChartModel& rModel, bool bPlaceButtonsVertically, tools::Long & nUsedHeight)
{
std::vector<std::shared_ptr<VButton>> aButtons;
@@ -846,7 +851,7 @@ std::vector<std::shared_ptr<VButton>> lcl_createButtons(
{
auto pButton = std::make_shared<VButton>();
aButtons.push_back(pButton);
- pButton->init(xLegendContainer, xShapeFactory);
+ pButton->init(xLegendContainer);
awt::Point aNewPosition(x, y);
pButton->setLabel(sColumnFieldEntry.Name);
pButton->setCID("FieldButton.Column." + OUString::number(sColumnFieldEntry.DimensionIndex));
@@ -876,18 +881,16 @@ std::vector<std::shared_ptr<VButton>> lcl_createButtons(
} // anonymous namespace
VLegend::VLegend(
- const Reference< XLegend > & xLegend,
+ rtl::Reference< Legend > xLegend,
const Reference< uno::XComponentContext > & xContext,
- const std::vector< LegendEntryProvider* >& rLegendEntryProviderList,
- const Reference< drawing::XShapes >& xTargetPage,
- const Reference< lang::XMultiServiceFactory >& xFactory,
+ std::vector< LegendEntryProvider* >&& rLegendEntryProviderList,
+ rtl::Reference<SvxShapeGroupAnyD> xTargetPage,
ChartModel& rModel )
- : m_xTarget(xTargetPage)
- , m_xShapeFactory(xFactory)
- , m_xLegend(xLegend)
+ : m_xTarget(std::move(xTargetPage))
+ , m_xLegend(std::move(xLegend))
, mrModel(rModel)
, m_xContext(xContext)
- , m_aLegendEntryProviderList(rLegendEntryProviderList)
+ , m_aLegendEntryProviderList(std::move(rLegendEntryProviderList))
, m_nDefaultWritingMode(text::WritingMode2::LR_TB)
{
}
@@ -897,7 +900,7 @@ void VLegend::setDefaultWritingMode( sal_Int16 nDefaultWritingMode )
m_nDefaultWritingMode = nDefaultWritingMode;
}
-bool VLegend::isVisible( const Reference< XLegend > & xLegend )
+bool VLegend::isVisible( const rtl::Reference< Legend > & xLegend )
{
if( ! xLegend.is())
return false;
@@ -905,8 +908,7 @@ bool VLegend::isVisible( const Reference< XLegend > & xLegend )
bool bShow = false;
try
{
- Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY_THROW );
- xLegendProp->getPropertyValue( "Show") >>= bShow;
+ xLegend->getPropertyValue( "Show") >>= bShow;
}
catch( const uno::Exception & )
{
@@ -921,58 +923,50 @@ void VLegend::createShapes(
const awt::Size & rPageSize,
awt::Size & rDefaultLegendSize )
{
- if(! (m_xLegend.is() &&
- m_xShapeFactory.is() &&
- m_xTarget.is()))
+ if(! (m_xLegend.is() && m_xTarget.is()))
return;
try
{
//create shape and add to page
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
- OUString aLegendParticle( ObjectIdentifier::createParticleForLegend( mrModel ) );
- m_xShape.set( pShapeFactory->createGroup2D( m_xTarget,
- ObjectIdentifier::createClassifiedIdentifierForParticle( aLegendParticle )),
- uno::UNO_QUERY);
+ OUString aLegendParticle( ObjectIdentifier::createParticleForLegend( &mrModel ) );
+ m_xShape = ShapeFactory::createGroup2D( m_xTarget,
+ ObjectIdentifier::createClassifiedIdentifierForParticle( aLegendParticle ) );
// create and insert sub-shapes
- Reference< drawing::XShapes > xLegendContainer( m_xShape, uno::UNO_QUERY );
- if( xLegendContainer.is())
+ rtl::Reference<SvxShapeGroupAnyD> xLegendContainer = m_xShape;
+ if( xLegendContainer.is() )
{
// for quickly setting properties
tPropertyValues aLineFillProperties;
tPropertyValues aTextProperties;
- Reference< beans::XPropertySet > xLegendProp( m_xLegend, uno::UNO_QUERY );
css::chart::ChartLegendExpansion eExpansion = css::chart::ChartLegendExpansion_HIGH;
awt::Size aLegendSize( rAvailableSpace );
bool bCustom = false;
LegendPosition eLegendPosition = LegendPosition_LINE_END;
- if (xLegendProp.is())
+ // get Expansion property
+ m_xLegend->getPropertyValue("Expansion") >>= eExpansion;
+ if( eExpansion == css::chart::ChartLegendExpansion_CUSTOM )
{
- // get Expansion property
- xLegendProp->getPropertyValue("Expansion") >>= eExpansion;
- if( eExpansion == css::chart::ChartLegendExpansion_CUSTOM )
+ RelativeSize aRelativeSize;
+ if (m_xLegend->getPropertyValue("RelativeSize") >>= aRelativeSize)
{
- RelativeSize aRelativeSize;
- if (xLegendProp->getPropertyValue("RelativeSize") >>= aRelativeSize)
- {
- aLegendSize.Width = static_cast<sal_Int32>(::rtl::math::approxCeil( aRelativeSize.Primary * rPageSize.Width ));
- aLegendSize.Height = static_cast<sal_Int32>(::rtl::math::approxCeil( aRelativeSize.Secondary * rPageSize.Height ));
- bCustom = true;
- }
- else
- {
- eExpansion = css::chart::ChartLegendExpansion_HIGH;
- }
+ aLegendSize.Width = static_cast<sal_Int32>(::rtl::math::approxCeil( aRelativeSize.Primary * rPageSize.Width ));
+ aLegendSize.Height = static_cast<sal_Int32>(::rtl::math::approxCeil( aRelativeSize.Secondary * rPageSize.Height ));
+ bCustom = true;
+ }
+ else
+ {
+ eExpansion = css::chart::ChartLegendExpansion_HIGH;
}
- xLegendProp->getPropertyValue("AnchorPosition") >>= eLegendPosition;
- lcl_getProperties( xLegendProp, aLineFillProperties, aTextProperties, rPageSize );
}
+ m_xLegend->getPropertyValue("AnchorPosition") >>= eLegendPosition;
+ lcl_getProperties( m_xLegend, aLineFillProperties, aTextProperties, rPageSize );
// create entries
- double fViewFontSize = lcl_CalcViewFontSize( xLegendProp, rPageSize );//todo
+ double fViewFontSize = lcl_CalcViewFontSize( m_xLegend, rPageSize );//todo
// #i109336# Improve auto positioning in chart
sal_Int32 nSymbolHeight = static_cast< sal_Int32 >( fViewFontSize * 0.6 );
sal_Int32 nSymbolWidth = nSymbolHeight;
@@ -998,15 +992,13 @@ void VLegend::createShapes(
if (pLegendEntryProvider)
{
std::vector<ViewLegendEntry> aNewEntries = pLegendEntryProvider->createLegendEntries(
- aMaxSymbolExtent, eLegendPosition, xLegendProp,
- xLegendContainer, m_xShapeFactory, m_xContext, mrModel);
- if (aNewEntries.size() == 0)
- return;
+ aMaxSymbolExtent, eLegendPosition, m_xLegend,
+ xLegendContainer, m_xContext, mrModel);
aViewEntries.insert( aViewEntries.end(), aNewEntries.begin(), aNewEntries.end() );
}
}
- bool bSymbolsLeftSide = lcl_shouldSymbolsBePlacedOnTheLeftSide( xLegendProp, m_nDefaultWritingMode );
+ bool bSymbolsLeftSide = lcl_shouldSymbolsBePlacedOnTheLeftSide( m_xLegend, m_nDefaultWritingMode );
uno::Reference<chart2::data::XPivotTableDataProvider> xPivotTableDataProvider( mrModel.getDataProvider(), uno::UNO_QUERY );
bool bIsPivotChart = xPivotTableDataProvider.is();
@@ -1014,12 +1006,12 @@ void VLegend::createShapes(
if ( !aViewEntries.empty() || bIsPivotChart )
{
// create buttons
- long nUsedButtonHeight = 0;
+ tools::Long nUsedButtonHeight = 0;
bool bPlaceButtonsVertically = (eLegendPosition != LegendPosition_PAGE_START &&
eLegendPosition != LegendPosition_PAGE_END &&
eExpansion != css::chart::ChartLegendExpansion_WIDE);
- std::vector<std::shared_ptr<VButton>> aButtons = lcl_createButtons(xLegendContainer, m_xShapeFactory, mrModel, bPlaceButtonsVertically, nUsedButtonHeight);
+ std::vector<std::shared_ptr<VButton>> aButtons = lcl_createButtons(xLegendContainer, mrModel, bPlaceButtonsVertically, nUsedButtonHeight);
// A custom size includes the size we used for buttons already, so we need to
// subtract that from the size that is available for the legend
@@ -1029,7 +1021,7 @@ void VLegend::createShapes(
// place the legend entries
aLegendSize = lcl_placeLegendEntries(aViewEntries, eExpansion, bSymbolsLeftSide, fViewFontSize,
aMaxSymbolExtent, aTextProperties, xLegendContainer,
- m_xShapeFactory, aLegendSize, nUsedButtonHeight, rPageSize, bIsPivotChart, rDefaultLegendSize);
+ aLegendSize, nUsedButtonHeight, rPageSize, bIsPivotChart, rDefaultLegendSize);
uno::Reference<beans::XPropertySet> xModelPage(mrModel.getPageBackground());
@@ -1042,17 +1034,14 @@ void VLegend::createShapes(
// create the buttons
pButton->createShapes(xModelPage);
}
- }
- Reference< drawing::XShape > xBorder =
- pShapeFactory->createRectangle( xLegendContainer,
- aLegendSize,
- awt::Point(0,0),
- aLineFillProperties.first,
- aLineFillProperties.second, ShapeFactory::StackPosition::Bottom );
+ rtl::Reference<SvxShapeRect> xBorder = ShapeFactory::createRectangle(
+ xLegendContainer, aLegendSize, awt::Point(0, 0), aLineFillProperties.first,
+ aLineFillProperties.second, ShapeFactory::StackPosition::Bottom);
- //because of this name this border will be used for marking the legend
- ShapeFactory::setShapeName( xBorder, "MarkHandles" );
+ //because of this name this border will be used for marking the legend
+ ShapeFactory::setShapeName(xBorder, "MarkHandles");
+ }
}
}
catch( const uno::Exception & )
@@ -1073,18 +1062,17 @@ void VLegend::changePosition(
{
// determine position and alignment depending on default position
awt::Size aLegendSize = m_xShape->getSize();
- Reference< beans::XPropertySet > xLegendProp( m_xLegend, uno::UNO_QUERY_THROW );
chart2::RelativePosition aRelativePosition;
bool bDefaultLegendSize = rDefaultLegendSize.Width != 0 || rDefaultLegendSize.Height != 0;
bool bAutoPosition =
- ! (xLegendProp->getPropertyValue( "RelativePosition") >>= aRelativePosition);
+ ! (m_xLegend->getPropertyValue( "RelativePosition") >>= aRelativePosition);
LegendPosition ePos = LegendPosition_LINE_END;
- xLegendProp->getPropertyValue( "AnchorPosition") >>= ePos;
+ m_xLegend->getPropertyValue( "AnchorPosition") >>= ePos;
bool bOverlay = false;
- xLegendProp->getPropertyValue("Overlay") >>= bOverlay;
+ m_xLegend->getPropertyValue("Overlay") >>= bOverlay;
//calculate position
if( bAutoPosition )
{
diff --git a/chart2/source/view/main/VLegend.hxx b/chart2/source/view/main/VLegend.hxx
index 297a99129d4d..b6b6a0074e49 100644
--- a/chart2/source/view/main/VLegend.hxx
+++ b/chart2/source/view/main/VLegend.hxx
@@ -16,11 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_VLEGEND_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_MAIN_VLEGEND_HXX
+#pragma once
-#include <com/sun/star/uno/Reference.hxx>
+#include <Legend.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
+#include <svx/unoshape.hxx>
#include <vector>
namespace chart { class ChartModel; }
@@ -35,16 +37,16 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace chart
{
+class Legend;
class LegendEntryProvider;
class VLegend
{
public:
- VLegend( const css::uno::Reference< css::chart2::XLegend > & xLegend,
+ VLegend( rtl::Reference< ::chart::Legend > xLegend,
const css::uno::Reference< css::uno::XComponentContext > & xContext,
- const std::vector< LegendEntryProvider* >& rLegendEntryProviderList,
- const css::uno::Reference< css::drawing::XShapes >& xTargetPage,
- const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
+ std::vector< LegendEntryProvider* >&& rLegendEntryProviderList,
+ rtl::Reference<SvxShapeGroupAnyD> xTargetPage,
ChartModel& rModel );
void setDefaultWritingMode( sal_Int16 nDefaultWritingMode );
@@ -68,13 +70,12 @@ public:
const css::awt::Size & rDefaultLegendSize );
static bool isVisible(
- const css::uno::Reference< css::chart2::XLegend > & xLegend );
+ const rtl::Reference< ::chart::Legend > & xLegend );
private:
- css::uno::Reference< css::drawing::XShapes > m_xTarget;
- css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory;
- css::uno::Reference< css::chart2::XLegend > m_xLegend;
- css::uno::Reference< css::drawing::XShape > m_xShape;
+ rtl::Reference<SvxShapeGroupAnyD> m_xTarget;
+ rtl::Reference<::chart::Legend> m_xLegend;
+ rtl::Reference< SvxShapeGroup > m_xShape;
ChartModel& mrModel;
@@ -86,6 +87,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx
index 1ccc0de34324..0b230ed07f34 100644
--- a/chart2/source/view/main/VLegendSymbolFactory.cxx
+++ b/chart2/source/view/main/VLegendSymbolFactory.cxx
@@ -22,10 +22,8 @@
#include <ShapeFactory.hxx>
#include <com/sun/star/drawing/Position3D.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/drawing/Direction3D.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
using namespace ::com::sun::star;
@@ -60,7 +58,7 @@ void getPropNamesAndValues( const Reference< beans::XPropertySet >& xProp,
::chart::PropertyMapper::getMultiPropertyListsFromValueMap( rNames, rValues, aValueMap );
- uno::Any* pLineWidthAny = ::chart::PropertyMapper::getValuePointer(rValues,rNames,"LineWidth");
+ uno::Any* pLineWidthAny = ::chart::PropertyMapper::getValuePointer(rValues,rNames,u"LineWidth");
sal_Int32 nLineWidth = 0;
if( pLineWidthAny && (*pLineWidthAny>>=nLineWidth) )
{
@@ -73,7 +71,7 @@ void getPropNamesAndValues( const Reference< beans::XPropertySet >& xProp,
void lcl_setPropertiesToShape(
const Reference< beans::XPropertySet > & xProp,
- const Reference< drawing::XShape > & xShape,
+ const rtl::Reference< SvxShape > & xShape,
::chart::VLegendSymbolFactory::PropertyType ePropertyType,
const awt::Size& aMaxSymbolExtent)
{
@@ -82,8 +80,7 @@ void lcl_setPropertiesToShape(
getPropNamesAndValues( xProp, aPropNames, aPropValues,
ePropertyType, aMaxSymbolExtent );
- Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
- ::chart::PropertyMapper::setMultiProperties( aPropNames, aPropValues, xShapeProp );
+ ::chart::PropertyMapper::setMultiProperties( aPropNames, aPropValues, *xShape );
}
} // anonymous namespace
@@ -91,50 +88,43 @@ void lcl_setPropertiesToShape(
namespace chart
{
-Reference< drawing::XShape > VLegendSymbolFactory::createSymbol(
+rtl::Reference< SvxShapeGroup > VLegendSymbolFactory::createSymbol(
const awt::Size& rEntryKeyAspectRatio,
- const Reference< drawing::XShapes >& rSymbolContainer,
+ const rtl::Reference<SvxShapeGroupAnyD>& rSymbolContainer,
LegendSymbolStyle eStyle,
- const Reference< lang::XMultiServiceFactory > & xShapeFactory,
const Reference< beans::XPropertySet > & xLegendEntryProperties,
PropertyType ePropertyType, const uno::Any& rExplicitSymbol )
{
- Reference< drawing::XShape > xResult;
+ rtl::Reference< SvxShapeGroup > xResult;
- if( ! (rSymbolContainer.is() && xShapeFactory.is()))
+ if( !rSymbolContainer)
return xResult;
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
- xResult.set( pShapeFactory->createGroup2D( rSymbolContainer ), uno::UNO_QUERY );
-
- Reference< drawing::XShapes > xResultGroup( xResult, uno::UNO_QUERY );
- if( ! xResultGroup.is())
+ xResult = ShapeFactory::createGroup2D( rSymbolContainer );
+ if( ! xResult)
return xResult;
+ rtl::Reference<SvxShapeGroupAnyD> xResultGroup = xResult;
+
// add an invisible square box to maintain aspect ratio
- pShapeFactory->createInvisibleRectangle( xResultGroup, rEntryKeyAspectRatio );
+ ShapeFactory::createInvisibleRectangle( xResultGroup, rEntryKeyAspectRatio );
// create symbol
try
{
if( eStyle == LegendSymbolStyle::Line )
{
- Reference< drawing::XShape > xLine =
- pShapeFactory->createLine( xResultGroup, awt::Size( rEntryKeyAspectRatio.Width, 0 ),
+ rtl::Reference<SvxShapePolyPolygon> xLine =
+ ShapeFactory::createLine( xResultGroup, awt::Size( rEntryKeyAspectRatio.Width, 0 ),
awt::Point( 0, rEntryKeyAspectRatio.Height/2 ));
- if( xLine.is())
- {
- lcl_setPropertiesToShape( xLegendEntryProperties, xLine, ePropertyType, rEntryKeyAspectRatio );
- }
+ lcl_setPropertiesToShape( xLegendEntryProperties, xLine, ePropertyType, rEntryKeyAspectRatio );
- Reference< drawing::XShape > xSymbol;
const sal_Int32 nSize = std::min(rEntryKeyAspectRatio.Width,rEntryKeyAspectRatio.Height);
chart2::Symbol aSymbol;
if( rExplicitSymbol >>= aSymbol )
{
drawing::Direction3D aSymbolSize( nSize, nSize, 0 );
drawing::Position3D aPos( rEntryKeyAspectRatio.Width/2.0, rEntryKeyAspectRatio.Height/2.0, 0 );
- ShapeFactory* pFactory = ShapeFactory::getOrCreateShapeFactory( xShapeFactory );
if( aSymbol.Style == chart2::SymbolStyle_STANDARD )
{
// take series color as fill color
@@ -142,21 +132,21 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol(
// border of symbols always same as fill color
aSymbol.BorderColor = aSymbol.FillColor;
- xSymbol.set( pFactory->createSymbol2D(
+ ShapeFactory::createSymbol2D(
xResultGroup,
aPos,
aSymbolSize,
aSymbol.StandardSymbol,
aSymbol.BorderColor,
- aSymbol.FillColor ));
+ aSymbol.FillColor );
}
else if( aSymbol.Style == chart2::SymbolStyle_GRAPHIC )
{
- xSymbol.set( pFactory->createGraphic2D(
+ ShapeFactory::createGraphic2D(
xResultGroup,
aPos,
aSymbolSize,
- aSymbol.Graphic ));
+ aSymbol.Graphic );
}
else if( aSymbol.Style == chart2::SymbolStyle_AUTO )
{
@@ -167,13 +157,10 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol(
else if( eStyle == LegendSymbolStyle::Circle )
{
sal_Int32 nSize = std::min( rEntryKeyAspectRatio.Width, rEntryKeyAspectRatio.Height );
- Reference< drawing::XShape > xShape =
- pShapeFactory->createCircle( xResultGroup, awt::Size( nSize, nSize ),
+ rtl::Reference<SvxShapeCircle> xShape =
+ ShapeFactory::createCircle( xResultGroup, awt::Size( nSize, nSize ),
awt::Point( rEntryKeyAspectRatio.Width/2-nSize/2, rEntryKeyAspectRatio.Height/2-nSize/2 ));
- if( xShape.is() )
- {
- lcl_setPropertiesToShape( xLegendEntryProperties, xShape, ePropertyType, awt::Size(0,0) ); // PropertyType::FilledSeries );
- }
+ lcl_setPropertiesToShape( xLegendEntryProperties, xShape, ePropertyType, awt::Size(0,0) ); // PropertyType::FilledSeries );
}
else // eStyle == LegendSymbolStyle::Box
{
@@ -183,7 +170,7 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol(
getPropNamesAndValues( xLegendEntryProperties, aPropNames, aPropValues,
ePropertyType, awt::Size(0,0) );// PropertyType::FilledSeries
- pShapeFactory->createRectangle( xResultGroup,
+ ShapeFactory::createRectangle( xResultGroup,
rEntryKeyAspectRatio, awt::Point( 0, 0 ),
aPropNames, aPropValues );
}
diff --git a/chart2/source/view/main/VLineProperties.cxx b/chart2/source/view/main/VLineProperties.cxx
index f1ca35e71730..81685337f704 100644
--- a/chart2/source/view/main/VLineProperties.cxx
+++ b/chart2/source/view/main/VLineProperties.cxx
@@ -19,8 +19,9 @@
#include <VLineProperties.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
@@ -31,26 +32,29 @@ using namespace ::com::sun::star;
VLineProperties::VLineProperties()
{
Color <<= sal_Int32(0x000000); //type sal_Int32 UNO_NAME_LINECOLOR
- LineStyle <<= drawing::LineStyle_SOLID; //type drawing::LineStyle for property UNO_NAME_LINESTYLE
- Transparence <<= sal_Int16(0);//type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
- Width <<= sal_Int32(0);//type sal_Int32 for property UNO_NAME_LINEWIDTH
+ LineStyle
+ <<= drawing::LineStyle_SOLID; //type drawing::LineStyle for property UNO_NAME_LINESTYLE
+ Transparence <<= sal_Int16(0); //type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
+ Width <<= sal_Int32(0); //type sal_Int32 for property UNO_NAME_LINEWIDTH
+ LineCap <<= drawing::LineCap_BUTT; //type drawing::LineCap for property UNO_NAME_LINECAP
}
-void VLineProperties::initFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp )
+void VLineProperties::initFromPropertySet(const uno::Reference<beans::XPropertySet>& xProp)
{
- if(xProp.is())
+ if (xProp.is())
{
try
{
- Color = xProp->getPropertyValue( "LineColor" );
- LineStyle = xProp->getPropertyValue( "LineStyle" );
- Transparence = xProp->getPropertyValue( "LineTransparence" );
- Width = xProp->getPropertyValue( "LineWidth" );
- DashName = xProp->getPropertyValue( "LineDashName" );
+ Color = xProp->getPropertyValue("LineColor");
+ LineStyle = xProp->getPropertyValue("LineStyle");
+ Transparence = xProp->getPropertyValue("LineTransparence");
+ Width = xProp->getPropertyValue("LineWidth");
+ DashName = xProp->getPropertyValue("LineDashName");
+ LineCap = xProp->getPropertyValue("LineCap");
}
- catch( const uno::Exception& )
+ catch (const uno::Exception&)
{
- TOOLS_WARN_EXCEPTION("chart2", "" );
+ TOOLS_WARN_EXCEPTION("chart2", "");
}
}
else
@@ -63,11 +67,11 @@ bool VLineProperties::isLineVisible() const
drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID);
LineStyle >>= aLineStyle;
- if( aLineStyle != drawing::LineStyle_NONE )
+ if (aLineStyle != drawing::LineStyle_NONE)
{
- sal_Int16 nLineTransparence=0;
+ sal_Int16 nLineTransparence = 0;
Transparence >>= nLineTransparence;
- if(nLineTransparence!=100)
+ if (nLineTransparence != 100)
{
bRet = true;
}
diff --git a/chart2/source/view/main/VPolarTransformation.cxx b/chart2/source/view/main/VPolarTransformation.cxx
index 6d3ba587fc9c..9ec2eea3fc58 100644
--- a/chart2/source/view/main/VPolarTransformation.cxx
+++ b/chart2/source/view/main/VPolarTransformation.cxx
@@ -18,7 +18,6 @@
*/
#include <VPolarTransformation.hxx>
-#include <CommonConverters.hxx>
using namespace ::com::sun::star;
@@ -37,9 +36,9 @@ VPolarTransformation::~VPolarTransformation()
{
}
-// ____ XTransformation ____
-Sequence< double > SAL_CALL VPolarTransformation::transform(
- const Sequence< double >& rSourceValues )
+// ____ XTransformation2 ____
+css::drawing::Position3D VPolarTransformation::transform(
+ const Sequence< double >& rSourceValues ) const
{
double fScaledLogicAngle = rSourceValues[0];
double fScaledLogicRadius = rSourceValues[1];
@@ -58,17 +57,30 @@ Sequence< double > SAL_CALL VPolarTransformation::transform(
//!! applying matrix to vector does ignore translation, so it is important to use a B3DPoint here instead of B3DVector
::basegfx::B3DPoint aPoint(fX,fY,fZ);
::basegfx::B3DPoint aRet = m_aUnitCartesianToScene * aPoint;
- return B3DPointToSequence(aRet);
+ return css::drawing::Position3D(aRet.getX(), aRet.getY(), aRet.getZ());
}
-sal_Int32 SAL_CALL VPolarTransformation::getSourceDimension()
+css::drawing::Position3D VPolarTransformation::transform(
+ const css::drawing::Position3D& rSourceValues ) const
{
- return 3;
-}
+ double fScaledLogicAngle = rSourceValues.PositionX;
+ double fScaledLogicRadius = rSourceValues.PositionY;
-sal_Int32 SAL_CALL VPolarTransformation::getTargetDimension()
-{
- return 3;
+ if( m_aPositionHelper.isSwapXAndY() )
+ std::swap(fScaledLogicAngle,fScaledLogicRadius);
+
+ double fAngleDegree = m_aPositionHelper.transformToAngleDegree( fScaledLogicAngle, false );
+ double fAnglePi = basegfx::deg2rad(fAngleDegree);
+ double fRadius = m_aPositionHelper.transformToRadius( fScaledLogicRadius, false);
+
+ double fX=fRadius*cos(fAnglePi);
+ double fY=fRadius*sin(fAnglePi);
+ double fZ=rSourceValues.PositionZ;
+
+ //!! applying matrix to vector does ignore translation, so it is important to use a B3DPoint here instead of B3DVector
+ ::basegfx::B3DPoint aPoint(fX,fY,fZ);
+ ::basegfx::B3DPoint aRet = m_aUnitCartesianToScene * aPoint;
+ return css::drawing::Position3D(aRet.getX(), aRet.getY(), aRet.getZ());
}
} // namespace chart
diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx
index f0befe954659..e251fe95971c 100644
--- a/chart2/source/view/main/VTitle.cxx
+++ b/chart2/source/view/main/VTitle.cxx
@@ -20,19 +20,19 @@
#include "VTitle.hxx"
#include <CommonConverters.hxx>
#include <ShapeFactory.hxx>
+#include <Title.hxx>
#include <com/sun/star/chart2/XTitle.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
namespace chart
{
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-VTitle::VTitle( const uno::Reference< XTitle > & xTitle )
- : m_xTitle(xTitle)
- , m_aCID()
+VTitle::VTitle( uno::Reference< XTitle > xTitle )
+ : m_xTitle(std::move(xTitle))
, m_fRotationAngleDegree(0.0)
, m_nXPos(0)
, m_nYPos(0)
@@ -44,12 +44,10 @@ VTitle::~VTitle()
}
void VTitle::init(
- const uno::Reference< drawing::XShapes >& xTargetPage
- , const uno::Reference< lang::XMultiServiceFactory >& xFactory
+ const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage
, const OUString& rCID )
{
m_xTarget = xTargetPage;
- m_xShapeFactory = xFactory;
m_aCID = rCID;
}
@@ -69,16 +67,13 @@ awt::Size VTitle::getUnrotatedSize() const //size before rotation
awt::Size VTitle::getFinalSize() const //size after rotation
{
return ShapeFactory::getSizeAfterRotation(
- m_xShape, m_fRotationAngleDegree );
+ *m_xShape, m_fRotationAngleDegree );
}
void VTitle::changePosition( const awt::Point& rPos )
{
if(!m_xShape.is())
return;
- uno::Reference< beans::XPropertySet > xShapeProp( m_xShape, uno::UNO_QUERY );
- if(!xShapeProp.is())
- return;
try
{
m_nXPos = rPos.X;
@@ -87,9 +82,9 @@ void VTitle::changePosition( const awt::Point& rPos )
//set position matrix
//the matrix needs to be set at the end behind autogrow and such position influencing properties
::basegfx::B2DHomMatrix aM;
- aM.rotate( -m_fRotationAngleDegree*F_PI/180.0 );//#i78696#->#i80521#
+ aM.rotate( basegfx::deg2rad(-m_fRotationAngleDegree) );//#i78696#->#i80521#
aM.translate( m_nXPos, m_nYPos);
- xShapeProp->setPropertyValue( "Transformation", uno::Any( B2DHomMatrixToHomogenMatrix3(aM) ) );
+ m_xShape->SvxShape::setPropertyValue( "Transformation", uno::Any( B2DHomMatrixToHomogenMatrix3(aM) ) );
}
catch( const uno::Exception& )
{
@@ -97,6 +92,20 @@ void VTitle::changePosition( const awt::Point& rPos )
}
}
+bool VTitle::isVisible(const rtl::Reference< Title >& xTitle) {
+ if (!xTitle.is()) {
+ return false;
+ }
+ bool bShow = true;
+ try {
+ xTitle->getPropertyValue("Visible") >>= bShow;
+ } catch (const uno::Exception &) {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ return bShow;
+}
+
+
void VTitle::createShapes(
const awt::Point& rPos
, const awt::Size& rReferenceSize
@@ -141,8 +150,7 @@ void VTitle::createShapes(
else
nTextMaxWidth = rTextMaxWidth.Height;
- ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
- m_xShape =pShapeFactory->createText( m_xTarget, rReferenceSize, rPos, aStringList, xTitleProperties,
+ m_xShape = ShapeFactory::createText( m_xTarget, rReferenceSize, rPos, aStringList, xTitleProperties,
m_fRotationAngleDegree, m_aCID, nTextMaxWidth );
}
diff --git a/chart2/source/view/main/VTitle.hxx b/chart2/source/view/main/VTitle.hxx
index 9fb0e905fa8a..792d7f6a0a5c 100644
--- a/chart2/source/view/main/VTitle.hxx
+++ b/chart2/source/view/main/VTitle.hxx
@@ -16,31 +16,33 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_VTITLE_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_MAIN_VTITLE_HXX
+#pragma once
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/uno/Reference.h>
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
#include <sal/types.h>
+#include <svx/unoshape.hxx>
namespace com::sun::star::awt { struct Point; }
namespace com::sun::star::chart2 { class XTitle; }
namespace com::sun::star::drawing { class XShape; }
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::lang { class XMultiServiceFactory; }
+class SvxShapeText;
namespace chart
{
+class Title;
class VTitle final
{
public:
- explicit VTitle( const css::uno::Reference< css::chart2::XTitle > & xTitle );
+ explicit VTitle( css::uno::Reference< css::chart2::XTitle > xTitle );
~VTitle();
- void init( const css::uno::Reference< css::drawing::XShapes >& xTargetPage
- , const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory
+ void init( const rtl::Reference<SvxShapeGroupAnyD>& xTargetPage
, const OUString& rCID );
void createShapes( const css::awt::Point& rPos
@@ -52,12 +54,13 @@ public:
css::awt::Size getUnrotatedSize() const;
css::awt::Size getFinalSize() const;
void changePosition( const css::awt::Point& rPos );
+ static bool isVisible(
+ const rtl::Reference< ::chart::Title > & xTitle);
private:
- css::uno::Reference< css::drawing::XShapes > m_xTarget;
- css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory;
+ rtl::Reference<SvxShapeGroupAnyD> m_xTarget;
css::uno::Reference< css::chart2::XTitle > m_xTitle;
- css::uno::Reference< css::drawing::XShape > m_xShape;
+ rtl::Reference<SvxShapeText> m_xShape;
OUString m_aCID;
double m_fRotationAngleDegree;
@@ -66,6 +69,5 @@ private:
};
} //namespace chart
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */